/**********************************REUSABLE FUNCTIONS STARTS*******************************************/

/***********HELP : STARTS**************
FUNCTION NAME : Trim -> To trim the values entered in text box(it will call the LTrim and RTrim functions inside automatically.
FUNCTION NAME : CharAndSpace -> This function will allow only character and space not digits(use for city, relation textbox).
FUNCTION NAME : DigitsAndDot -> This function will allow only Digits and Dot not characters(use for price textbox).
FUNCTION NAME : DigitsOnly -> This function will allow only Digits and not characters even dot also.
FUNCTION NAME : telephoneno -> This function will allow only Digits, +, and -(for eg. telephone no: IN +91  2221113456  Call ).
FUNCTION NAME : GetMonthDays -> This function will will return number of days in the current month.
FUNCTION NAME : GetDays -> This function will will returns the diff betn two dates for month 1=jan,12=Dec
FUNCTION NAME : isNumeric,isInteger -> This function will Checks the number is integer or not.
FUNCTION NAME : daysInFebruary -> This function will checks the posted date is valid or not.
FUNCTION NAME : isDate -> This function will Checks the febraury month.
FUNCTION NAME : closewindow -> This function will Close the window.
FUNCTION NAME : checkimage -> This function will checks the entered image is in .jpg,.gif,.jpeg,.png formot or not.
FUNCTION NAME : backToMain -> This function will redirect to specifie file.
FUNCTION NAME : ageValidate -> This function will to checks age the user's age.
FUNCTION NAME : ValidateDateAfter -> This function will to checks the date after some days.
FUNCTION NAME : SameOrAfterDate -> This function will to checks the date or after some days.
FUNCTION NAME : NotFutureDate -> This function will to checks whether the date is future date or not.
FUNCTION NAME : checkEmail -> This function will to checks for valid email-id.
FUNCTION NAME : selectall -> This function will check and uncheck the checkbox.
FUNCTION NAME : atleastone -> This function will Ask conformation before doing ant task like make active, inactive,delete operations.

/***********HELP : ENDS**************/
//General funtion to prevent the JS error...

function xerr()
{
     return(true);
}
onerror=xerr;

//  Trim functions...
function Trim(TRIM_VALUE){
	if(TRIM_VALUE.length < 1){
		return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE==""){
		return "";
	}
	else{
		return TRIM_VALUE;
	}
} //End Function

function RTrim(VALUE){
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0){
		return"";
	}
	var iTemp = v_length -1;

	while(iTemp > -1){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;

	} //End While
	return strTemp;

} //End Function

function LTrim(VALUE){
	var w_space = String.fromCharCode(32);
	if(v_length < 1){
		return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";

	var iTemp = 0;

	while(iTemp < v_length){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
		iTemp = iTemp + 1;
	} //End While

	return strTemp;
} //End Function

//Function for field name that only allowed Character and Space not Digits...
function CharAndSpace(FieldName)
{
	if(FieldName.value != "")
	{
		var ValidChar = "0123456789~`!@#$%^&*()_+|\\=-][{}:';?><,./'";
		var ValidChars = ValidChar+'"';
		for (j = 0; j < FieldName.value.length; j++)
		{
			var Char = FieldName.value.charAt(j);
			if (ValidChars.indexOf(Char) != -1)
			{
				return  false;
			}
		}
		return true;
	}
}

//Function for field name that only allowed Digits and Dot...
function DigitsAndDot(FieldName)
{
	if(FieldName.value != "")
	{
		var ValidChars = "0123456789.";
		for (j = 0; j < FieldName.value.length; j++)
		{
			var Char = FieldName.value.charAt(j);
			if (ValidChars.indexOf(Char) == -1)
			{
				return  false;
			}
		}
		return true;
	}
}

//Function for field name that only allowed Digits...
function DigitsOnly(FieldName)
{
	if(FieldName.value != '')
	{
		var ValidChars = "0123456789";
		for (j = 0; j < FieldName.value.length; j++)
		{
			var Char = FieldName.value.charAt(j);
			if (ValidChars.indexOf(Char) == -1)
			{
				return  false;
			}
		}
	}
}

//Function for field name that only allowed Digits, +, and -(for eg. telephone no: IN +91  2221113456  Call )...
function telephoneno(FieldName)
{
	if(FieldName.value != "")
	{
		var ValidChars = "0123456789-+  ";
		for (j = 0; j < FieldName.value.length; j++)
		{
			var Char = FieldName.value.charAt(j);
			if (ValidChars.indexOf(Char) == -1)
			{
				return  false;
			}
		}
		return true;
	}
}

/* the function GetMonthDays will return number of days in the current month. */
function GetMonthDays()
{
	DateObj = new Date();
	var CurYear=DateObj.getMonth();
	var FebDays=28;

	if(CurYear%4==1)
	{
		FebDays=29;
	}

	days= new Array(31,FebDays,31,30,31,30,31,31,30,31,30,31);
	return days;
}

//returns the diff betn two dates for month 1=jan,12=Dec
function GetDays(toyear, tomonth, today, fromyear, frommonth, fromday)
{
	DDate= new Date(toyear,tomonth-1,today);
	NDate=	new Date(fromyear,frommonth-1,fromday);

	var Days = new String((NDate-DDate)/86400000);

	return Math.floor(Days);
}

//Check the number is integer or not...
function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++)
   {
      Char = sText.charAt(i);
      if(ValidChars.indexOf(Char) == -1)
      {
         IsNumber = false;
      }
   }
   return IsNumber;
}

//Close the window
function closewindow()
{
	window.close();
}

//Function to check the entered image is in .jpg,.gif,.jpeg,.png formot or not...
function checkimage(formname,fieldname)
{
	if(eval("document."+formname+"."+fieldname+".value") != '')
	{
		imagename=eval("document."+formname+"."+fieldname+".value");
		splitimagename	= imagename.split(".");
		imagenamelen   	= splitimagename.length;
		imageextention	= splitimagename[imagenamelen-1];

                if((imageextention != 'jpg') & (imageextention != 'JPG') & (imageextention != 'gif') & (imageextention != 'jpeg') & (imageextention != 'png'))
		{
			alert("-Please Upload Proper Image.\nAccept image format:\n.gif\n.jpeg\n.jpg\n.png.");
			return false;
		}
	}
	return true;
}

function checkcacdocs(formname,fieldname)
{
	if(eval("document."+formname+"."+fieldname+".value") != '')
	{
		imagename=eval("document."+formname+"."+fieldname+".value");
		splitimagename	= imagename.split(".");
		imagenamelen   	= splitimagename.length;
		imageextention	= splitimagename[imagenamelen-1];

                if((imageextention != 'doc') & (imageextention != 'pdf') & (imageextention != 'xls') & (imageextention != 'docx') & (imageextention != 'ppt'))
		{
			alert("-Please Upload Proper file.\nAccept file format:\n.doc\n.pdf\n.xls\n.docx\n.ppt.");
			return false;
		}
	}
	return false;
}

function checkdocs(formname,fieldname)
{
	if(eval("document."+formname+"."+fieldname+".value") != '')
	{
		imagename=eval("document."+formname+"."+fieldname+".value");
		splitimagename	= imagename.split(".");
		imagenamelen   	= splitimagename.length;
		imageextention	= splitimagename[imagenamelen-1];

                if((imageextention != 'doc') & (imageextention != 'pdf') & (imageextention != 'xls') & (imageextention != 'docx') & (imageextention != 'ppt') & (imageextention != 'txt'))
		{
			alert("-Please Upload Proper file.\nAccept file format:\n.doc\n.pdf\n.xls\n.docx\n.ppt\n.txt.");
			return false;
		}
	}
	return false;
} 

//Function to check the entered image is in .jpg,.gif,.jpeg,.png formot or not...
function checkfile(formname,fieldname)
{
	if(eval("document."+formname+"."+fieldname+".value") != '')
	{
		imagename=eval("document."+formname+"."+fieldname+".value");
		splitimagename	= imagename.split(".");
		imagenamelen   	= splitimagename.length;
		imageextention	= splitimagename[imagenamelen-1];

                if((imageextention != 'jpg') & (imageextention != 'JPG') & (imageextention != 'gif') & (imageextention != 'jpeg') & (imageextention != 'png') & (imageextention != 'pdf') & (imageextention != 'doc') & (imageextention != 'txt') & (imageextention != 'mp3'))
		{
			alert("-Please Upload Proper Image.\nAccept image format:\n.gif\n.jpeg\n.jpg\n.png\n.pdf\n.doc\n.txt\.mp3.");
			return false;
		}
	}
	return true;
}


function checkvideo(formname,fieldname)
{
	if(eval("document."+formname+"."+fieldname+".value") != '')
	{
		imagename=eval("document."+formname+"."+fieldname+".value");
		splitimagename	= imagename.split(".");
		imagenamelen   	= splitimagename.length;
		imageextention	= splitimagename[imagenamelen-1];

      if((imageextention != 'flv') & (imageextention != 'FLV'))
		{
			alert("-Please Upload Proper Video.\nAccept video format:\n flv.");
			return false;
		}
	}
	return true;
}

//Common function to redirect....
function backToMain(frm)
{
	with(frm)
	{
		document.location	=	module_name.value;
	}
}

//check email validation
function checkEmail(email)
{
	if(email != ""){
		if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
		{
			return true;
		}
		alert("-Invalid contact E-Mail address! please re-enter.")
		return false;
	}else{
		alert("-Please enter your contact E-Mail address.")
		return false;
	}
}

//Function to open popup...
function openpopup(url,popup_name,height,width,other_properties)
{
	var left		= parseInt((screen.width-350)/2);
	var top			= parseInt((screen.height-300)/2)
	var win_options = 'height='+height+',width='+width+',resizable=no,'
	+ 'scrollbars=1,left=' + left + ',top=' + top;
	window.open(url,popup_name,win_options);
}

//Function to check and uncheck the checkbox...
function selectall(ids,frmname)
{
	var id=ids
	var fname= frmname
	var f1=document.fname.check;
	if(id==1)
	{
			for(i=0;i<=f1.length;i++)
			{
			   f1[i].checked=true;
			}
	}else
	{
			for(i=0;i<=f1.length;i++)
			{
				f1[i].checked=false;
			}

	}
}

function selectallfrmrep(ids)
{
	var id=ids
	//var fname= frmname
	var f1=document.frmres.check;
	if(id==1)
	{
			for(i=0;i<=f1.length;i++)
			{
			   f1[i].checked=true;
			}
	}else
	{
			for(i=0;i<=f1.length;i++)
			{
				f1[i].checked=false;
			}

	}
}
//Ask conformation before doing ant task like make active, inactive,delete operations...
function atleastone(frm)
{
	with(frm)
	{
		var count = check.length;
		var i;
		for(i=0; i<count; i++)
		{
			if(check[i].checked)
			{
				var confirmation = confirm("-Do you want to do this operation.");
				if(confirmation) { return true; } else { return false; }
			}
		}
		alert('-Please select atleast one.');
		return false;
	}
}

//AJAX General Function...Check the browser compactibility...
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

//check email ids to your friends
function checkEmailsent(email)
{
	if(email != ""){
		if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
		{
			return true;
		}
		alert("-Invalid E-Mail address! Please re-enter.")
		return false;
	}else{
		alert("-Please enter your friend E-Mail address.")
		return false;
	}
}

//check email ids to of admin...
function checkEmailadmin(email)
{
	if(email != ""){
		if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
		{
			return true;
		}
		alert("-Invalid E-Mail address! Please re-enter.");
		return false;
	}else{
		alert("-Please enter E-Mail address.");
		return false;
	}
}

/**********************************REUSABLE FUNCTIONS ENDS*************************************/
//This is test file...for AJAX...
function ajaxFunction(str)
{
	//alert(str);
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
 	{
  		alert ("-Your browser does not support AJAX!");
  		return;
   }
	var url="test.php";
	url=url+"?id="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

//Validate admin change password...
function chpassadminValidate(frm)
{
	with(frm)
	{
		if(Trim(opwd.value) == '')
		{
			alert("-Please enter your old password.");
			opwd.focus();
			return false;
		}
		if(Trim(npwd.value) == '')
		{
			alert("-Please enter your new password.");
			npwd.focus();
			return false;
		}
		if(Trim(rpwd.value) == '')
		{
			alert("-Please re-enter your new password.");
			rpwd.focus();
			return false;
		}
		if(Trim(npwd.value) != Trim(rpwd.value))
		{
			alert("-Incorrect new password.");
			rpwd.value='';
			rpwd.focus();
			return false;
		}
	}
	return true;
}

//By clicking on Active, Inactive, Delete button...
function anyone(frm,message)
{
	with(frm)
	{
		var count = check.length;
		var i;
		for(i=0; i < count; i++)
		{
			if(check[i].checked)
			{
				var confirmation = confirm("-Do you want to do this operation.");
				if(confirmation) { return true; } else { return false; }
			}
		}
		alert("-Please select atleast one "+message+".");
		return false;
	}
}


//To select all colums in users management...
function SelectAllInUsers(ids)
{
	var id=ids;
	var f1=document.frmusers.check;
	if(id==1)
	{
			for(i=0;i<=f1.length;i++)
			{
			   f1[i].checked=true;
			}
	}
	else
	{
			for(i=0;i<=f1.length;i++)
			{
				f1[i].checked=false;
			}
	}
}


//Email Validation
function checkemail(emailstr)
{
	//var str=document.frm.emailid.value;
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

	if (filter.test(emailstr))
	{
		return true;
	} else {
	alert("Please input a valid email address!");
		return false;
	}
}

function validateaddevents(frm){
	with(frm)
	{
		if(Trim(eventtitle.value) == '')
		{
			alert("-Please enter event title.");
			eventtitle.focus();
			return false;
		}
		if(category.value == '0')
		{
			alert("-Please select Meeting Review Category.");
			category.focus();
			return false;
		}
		if(calendarevents.value == '0')
		{
			alert("-Please select Calendar Category.");
			calendarevents.focus();
			return false;
		}
		if(Trim(eventdescription.value) == '')
		{
			alert("-Please enter event description.");
			eventdescription.focus();
			return false;
		}
		if(getcatname(category.value)=="Summits" || getcatname(category.value)=="summits") {
			if(Trim(venue_address1.value) == '')
			{
				alert("-Please enter Venue Address1.");
				venue_address1.focus();
				return false;
			}
			if(Trim(venue_city.value) == '')
			{
				alert("-Please enter Venue City.");
				venue_city.focus();
				return false;
			}
			if(Trim(venue_state.value) == '')
			{
				alert("-Please enter Venue State.");
				venue_state.focus();
				return false;
			}
			if(Trim(venue_country.value) == '')
			{
				alert("-Please enter Venue Country.");
				venue_country.focus();
				return false;
			}
			if(Trim(venue_zip.value) == '')
			{
				alert("-Please enter Venue Zipcode.");
				venue_zip.focus();
				return false;
			}
			if(Trim(fromDate.value) == '') {
				alert("-Please enter event from Date.");
				Date.focus();
				return false;
			}
			if(Trim(toDate.value) == '') {
				alert("-Please enter event to Date.");
				Date.focus();
				return false;
			}
		}
		if(getcatname(category.value)=="Webinar" || getcatname(category.value)=="webinar") {
			if(Trim(conference_dial.value) == '')
			{
				alert("-Please enter Conference dial-in details.");
				conference_dial.focus();
				return false;
			}
			if(Trim(Date.value) == '') {
				alert("-Please enter event Date.");
				Date.focus();
				return false;
			}
		}
	}
	return true;
}
function converttodouble(val) {
	val=val+"";
	var reta="";
	if(val.length==1)
		reta = "0"+val;
	else
		reta = val;
	return reta;
}
function add_options(divname) {
	//alert('divname');
	strbooth = "";
	strbooth += "<div id='"+divname+incvalue+"' style='padding:10px 0px;'><table border='0' align='center' cellpadding='3' cellspacing='0' width='100%' style='border:1px solid #000' class='tdrow'>";
	strbooth +='<tr>';
		strbooth +='<td valign="top" width="20%"><input type="hidden" name="hid_agent'+incvalue+'" id="hid_agent'+incvalue+'" value="1" /><input type="hidden" name="hid_incagenda'+incvalue+'" id="hid_incagenda'+incvalue+'">Agenda Title</td>';
		strbooth +='<td valign="top" width="3%">:</td>';
		strbooth +='<td valign="top" width="50%"><input type="text" size="50" name="agenda'+incvalue+'"></td>';
		strbooth +='<td><a href="#" onclick="javascript:return cancel_options(\''+divname+incvalue+'\',\''+incvalue+'\');">Cancel Agenda</a></td>';
	strbooth +='</tr>';
	strbooth +='<tr>';
    strbooth +='<td valign="top">Description</td>';
    strbooth +='<td valign="top">:</td>';
    strbooth +='<td valign="top"><textarea name="agenda_desc'+incvalue+'" cols="38" rows="4"></textarea> </td>';
    strbooth +='<td>&nbsp;</td>';
    strbooth +='</tr>';
	strbooth +='<tr>';
		strbooth +='<td>Start Time (hh:mm) </td>';
		strbooth +='<td>:</td>';
		strbooth +='<td>';
			strbooth +='<select name="starttimehr'+incvalue+'">';
				strbooth +='<option value="--">--</option>';
				for(i=0;i<=11;i++) {
					strbooth +='<option value="'+converttodouble(i)+'">'+converttodouble(i)+'</option>';
				}
			strbooth +='</select>'
			strbooth +='&nbsp;<b>:</b>&nbsp;';
			strbooth +='<select name="starttimemin'+incvalue+'">';
				strbooth +='<option value="--">--</option>';
				for(j=0;j<=55;j=j+5) {
					strbooth +='<option value="'+converttodouble(j)+'">'+converttodouble(j)+'</option>';
				}
			strbooth +='</select>&nbsp';
            strbooth +='<select name="sel_starttimeopt'+incvalue+'">';
            strbooth +='<option value="--">--</option>';
            strbooth +='<option value="AM">AM</option>';
            strbooth +='<option value="PM">PM</option>';
            strbooth +='</select>';
		strbooth +='</td>';
    strbooth +='</tr>';
    strbooth +='<tr>';
		strbooth +='<td>End Time (hh:mm) </td>';
		strbooth +='<td>:</td>';
		strbooth +='<td>';
			strbooth +='<select name="endtimehr'+incvalue+'">';
				strbooth +='<option value="--">--</option>';
				for(k=0;k<=11;k++) {
					strbooth +='<option value="'+converttodouble(k)+'">'+converttodouble(k)+'</option>';
				}
			strbooth +='</select>';
			strbooth +='&nbsp;<b>:</b>&nbsp;';
			strbooth +='<select name="endtimemin'+incvalue+'">';
				strbooth +='<option value="--">--</option>';
				for(l=0;l<=55;l=l+5) {
					strbooth +='<option value="'+converttodouble(l)+'">'+converttodouble(l)+'</option>';
				}
			strbooth +='</select>&nbsp;';
			strbooth +='<select name="sel_endtimeopt'+incvalue+'">';
            strbooth +='<option value="--">--</option>';
            strbooth +='<option value="AM">AM</option>';
            strbooth +='<option value="PM">PM</option>';
            strbooth +='</select>';
		strbooth +='</td>';
		strbooth +='<td><a href="#" onClick="javascript:return add_speaker(\'div_speaker'+incvalue+'\',\'hid_agent'+incvalue+'\',\''+incvalue+'\',\'hid_incagenda'+incvalue+'\')" class="link02">Add Speaker</A></td>';
    strbooth +='</tr>';
	strbooth += '<tr>';
   		strbooth += '<td colspan="4"><div id="div_speaker'+incvalue+'"></div></td>';
    strbooth += '</tr>';
	strbooth += '</table></div>';
	var pushval=document.getElementById('hid_totagenda').value;
	var finalpushval=pushval+","+incvalue;
	document.getElementById('hid_totagenda').value=finalpushval;
	document.getElementById(divname).innerHTML = document.getElementById(divname).innerHTML + strbooth;
	incvalue++;
	return false;
}
function cancel_options(id,delid) {
	var pushval=document.getElementById('hid_totagenda').value;
	var pusharr=new Array();
	var pushnewarr=new Array();
	pusharr=pushval.split(",");
	for(i=0;i<pusharr.length;i++) {
		if(delid!=pusharr[i]) {
			pushnewarr[i]=pusharr[i];
		}
	}
	pushnewvalue=pushnewarr.join(',');
	document.getElementById('hid_totagenda').value=pushnewvalue;
	document.getElementById(id).innerHTML="";
	document.getElementById(id).style.display="none";
	return false;
}
function cancel_options_edit(id,delid,delagenda) {
	var pushval=document.getElementById('hid_totagenda').value;
	var pusharr=new Array();
	var pushnewarr=new Array();
	pusharr=pushval.split(",");
	for(i=0;i<pusharr.length;i++) {
		if(delid!=pusharr[i]) {
			pushnewarr[i]=pusharr[i];
		}
	}
	pushnewvalue=pushnewarr.join(',');
	document.getElementById('hid_totagenda').value=pushnewvalue;
	var totdelval=document.getElementById('del_agendas').value;
	var finaldelval=totdelval+","+delagenda;
	document.getElementById('del_agendas').value=finaldelval;
	document.getElementById(id).innerHTML="";
	document.getElementById(id).style.display="none";
	return false;
}
function add_speaker(divname,topincval,valinc,getinctot) {
	var fnincvalue=document.getElementById(topincval).value;
	strbooth = "";
	strbooth += "<div id='"+divname+fnincvalue+"'><table border='0' align='center' cellpadding='0' cellspacing='0' width='100%' class='tdrow'>";
	strbooth += '<tr>';
		strbooth += '<td valign="top" width="20%">Speaker Name</td>';
		strbooth +=' <td valign="top" width="3%">:</td>';
		strbooth += '<td valign="top" width="50%"><input type="text" size="50" name="speaker_name'+valinc+'_'+fnincvalue+'"></td>';
		strbooth +='<td><a href="#" onclick="javascript:return cancel_optionsspeaker(\''+divname+fnincvalue+'\',\''+getinctot+'\',\''+fnincvalue+'\');">Cancel Speaker</a></td>';
	strbooth +='</tr>';
	strbooth += '<tr>';
		strbooth += '<td valign="top" width="20%">Speaker Photo</td>';
		strbooth +=' <td valign="top" width="3%">:</td>';
		strbooth += '<td valign="top" colspan="2"><input type="file" size="37" name="s_photo'+valinc+'_'+fnincvalue+'"></td>';
	strbooth +='</tr>';
	strbooth += '<tr>';
		strbooth += '<td valign="top" width="20%">Speaker Bio</td>';
		strbooth +=' <td valign="top" width="3%">:</td>';
		strbooth += '<td valign="top" colspan="2"><textarea name="s_bio'+valinc+'_'+fnincvalue+'" cols="38" rows="4"></textarea></td>';
	strbooth += '</tr>';
	strbooth += '</table></div>';
	document.getElementById(divname).innerHTML = document.getElementById(divname).innerHTML + strbooth;
	var pushval=document.getElementById(getinctot).value;
	var finalpushval=pushval+","+fnincvalue;
	document.getElementById(getinctot).value=finalpushval;
	fnincvalue++;
	document.getElementById(topincval).value=fnincvalue;
	return false;
}
function cancel_optionsspeaker(id,hidid,inid) {
	var pushval=document.getElementById(hidid).value;
	var pusharr=new Array();
	var pushnewarr=new Array();
	pusharr=pushval.split(",");
	for(i=0;i<pusharr.length;i++) {
		if(inid!=pusharr[i]) {
			pushnewarr[i]=pusharr[i];
		}
	}
	pushnewvalue=pushnewarr.join(',');
	document.getElementById(hidid).value=pushnewvalue;
	document.getElementById(id).innerHTML="";
	document.getElementById(id).style.display="none";
	return false;
}

function cancel_optionsspeaker_edit(id,hidid,inid,delid) {
	var pushval=document.getElementById(hidid).value;
	var pusharr=new Array();
	var pushnewarr=new Array();
	pusharr=pushval.split(",");
	for(i=0;i<pusharr.length;i++) {
		if(inid!=pusharr[i]) {
			pushnewarr[i]=pusharr[i];
		}
	}
	pushnewvalue=pushnewarr.join(',');
	document.getElementById(hidid).value=pushnewvalue;
	var totdelval=document.getElementById('del_speakers').value;
	var finaldelval=totdelval+","+delid;
	document.getElementById('del_speakers').value=finaldelval;
	document.getElementById(id).innerHTML="";
	document.getElementById(id).style.display="none";
	return false;
}

function getcatname(catval) {
	var catname="";
	for(i=0;i<catarray.length;i++) {
		if(catarray[i]['cat_id']==catval) {
			catname=catarray[i]['cat_name'];
			break;
		}
	}
	return catname;
}
function chk_Category() {
	var objval=document.frm_addevents.category.value;
	if(objval!="0" && objval!="") {
		if(getcatname(objval)=="Summits" || getcatname(objval)=="summits") {
			document.getElementById('div_summit').style.display="block";
			document.getElementById('div_webinar').style.display="none";
			document.getElementById('div_datewebinar').style.display="none";
		document.getElementById('div_datesumbit').style.display="block";
		}
		if(getcatname(objval)=="Webinar" || getcatname(objval)=="webinar") {
			document.getElementById('div_summit').style.display="none";
			document.getElementById('div_webinar').style.display="block";
			document.getElementById('div_datewebinar').style.display="block";
		document.getElementById('div_datesumbit').style.display="none";
		}
	} else {
		document.getElementById('div_datewebinar').style.display="none";
		document.getElementById('div_datesumbit').style.display="none";
		document.getElementById('div_summit').style.display="none";
		document.getElementById('div_webinar').style.display="none";
	}
}
function getAgendacount(agenid,option) {
	if(speakearray.length>0) {
		var incval=1;
		var presentval="";
		for(i=0;i<speakearray.length;i++) {
			if(speakearray[i]['agenda_id']==agenid) {
				if(speakearray[i]['speaker_name']!="") {
					 if(presentval!="") {
						 presentval = presentval+","+incval;
					 } else {
						 presentval =incval;
					 }
					 incval++;
				}
			}
		}
		if(option=="count") {
			return incval;
		} else if(option=="present") {
			return presentval;
		}
	}
}
function Change_delDiv(delid,disid,option) {
	if(option=="delete") {
		document.getElementById(delid).style.display='none';
		document.getElementById(disid).style.display='block';
	}
	if(option=="change") {
		document.getElementById(delid).style.display='block';
		document.getElementById(disid).style.display='none';
	}
}
function getSpeakerDetails(agid,valinc) {
	var strbooth = "";
	var fnincvalue=1;
	var divname="div_speaker"+valinc;
	var getinctot="hid_incagenda"+valinc;
	for(spil=0;spil<speakearray.length;spil++) {
		if(speakearray[spil]['agenda_id']==agid) {
			if(speakearray[spil]['speaker_name']!="") {
				strbooth += "<div id='"+divname+fnincvalue+"'><table border='0' align='center' cellpadding='2' cellspacing='0' width='100%' class='tdrow'>";
				strbooth += '<tr>';
					strbooth += '<td valign="top" width="20%"><input type="hidden" name="hidspeak_'+valinc+'_'+fnincvalue+'" id="hidspeak_'+valinc+'_'+fnincvalue+'" value="'+speakearray[spil]['sp_id']+'" >Speaker Name</td>';
					strbooth +=' <td valign="top" width="3%">:</td>';
					strbooth += '<td valign="top" width="50%"><input type="text" size="50" name="speaker_name'+valinc+'_'+fnincvalue+'" value="'+speakearray[spil]['speaker_name']+'"></td>';
					strbooth +='<td><a href="#" onclick="javascript:return cancel_optionsspeaker_edit(\''+divname+fnincvalue+'\',\''+getinctot+'\',\''+fnincvalue+'\',\''+speakearray[spil]['sp_id']+'\');">Cancel Speaker</a></td>';
				strbooth +='</tr>';
				strbooth += '<tr>';
					strbooth += '<td valign="top" width="20%">Speaker Photo</td>';
					strbooth +=' <td valign="top" width="3%">:</td>';
					strbooth += '<td valign="top" colspan="2">';
					strbooth += '<div id="divdel_'+speakearray[spil]['sp_id']+'"';
					if(speakearray[spil]['photo_name']=="") {
						strbooth += ' style="display:none"';
					}
					strbooth += '><a href="#" onclick="javascript:window.open(\'../speaker_img.php?sid='+speakearray[spil]['sp_id']+'\',\'\',\'width=500,height=500,resizable=no,scrollbars=yes,menubar=no,toolbar=no\'); return false;">'+speakearray[spil]['speaker_name']+'</a>&nbsp;[ <a href="#" onclick="javascript:Change_delDiv(\'divdel_'+speakearray[spil]['sp_id']+'\',\'divdisp_'+speakearray[spil]['sp_id']+'\',\'delete\'); return false;">CHANGE PHOTO</a> ]</div>';
					strbooth += '<div id="divdisp_'+speakearray[spil]['sp_id']+'"';
					if(speakearray[spil]['photo_name']!="") {
						strbooth += ' style="display:none"';
					}
					strbooth += '><input type="file" size="37" name="s_photo'+valinc+'_'+fnincvalue+'">';
					if(speakearray[spil]['photo_name']!="") {
					strbooth += ' [ <a href="#" onclick="javascript:Change_delDiv(\'divdel_'+speakearray[spil]['sp_id']+'\',\'divdisp_'+speakearray[spil]['sp_id']+'\',\'change\'); return false;">UNDO</a> ] ';
					}
					strbooth += '</div></td>';
				strbooth +='</tr>';
				strbooth += '<tr>';
					strbooth += '<td valign="top" width="20%">Speaker Bio</td>';
					strbooth +=' <td valign="top" width="3%">:</td>';
					strbooth += '<td valign="top" colspan="2"><textarea name="s_bio'+valinc+'_'+fnincvalue+'" cols="38" rows="4">'+speakearray[spil]['speaker_bio']+'</textarea></td>';
				strbooth += '</tr>';
				strbooth += '</table></div>';
				fnincvalue++;
			}
		}
	}
	return strbooth;
}
function Edit_Events() {
	if(speakearray.length>0) {
		var strbooth = "";
		var incvalue=1;
		var finalpushval="";
		var divname="div_agendas";
		agid="";
		for(spi=0;spi<speakearray.length;spi++) {
			if(agid!=speakearray[spi]['agenda_id']) {
			strbooth += "<div id='"+divname+incvalue+"' style='padding:10px 0px;'><table border='0' align='center' cellpadding='3' cellspacing='0' width='100%' style='border:1px solid #000' class='tdrow'>";
			strbooth +='<tr>';
				strbooth +='<td valign="top" width="20%">';
				strbooth +='<input type="hidden" name="hid_agent'+incvalue+'" id="hid_agent'+incvalue+'" value="';
				strbooth +=getAgendacount(speakearray[spi]['agenda_id'],"count");
				strbooth +='" /><input type="hidden" name="hid_incagenda'+incvalue+'" id="hid_incagenda'+incvalue+'" value="'+getAgendacount(speakearray[spi]['agenda_id'],'present')+'" /><input type="hidden" name="hidag_'+incvalue+'" id="hidag_'+incvalue+'" value="'+speakearray[spi]['agenda_id']+'" >Agenda Title</td>';
				strbooth +='<td valign="top" width="3%">:</td>';
				strbooth +='<td valign="top" width="50%"><input type="text" size="50" name="agenda'+incvalue+'" value="'+speakearray[spi]['agenda']+'"></td>';
				if(spi==0) {
					strbooth +='<td><a href="#" onClick="javascript:return add_options(\'div_agendas\')" class="link02">Add Agenda</A></td>';
				} else {
					strbooth +='<td><a href="#" onclick="javascript:return cancel_options_edit(\''+divname+incvalue+'\',\''+incvalue+'\',\''+speakearray[spi]['agenda_id']+'\');">Cancel Agenda</a></td>';
				}
			strbooth +='</tr>';
			strbooth +='<tr>';
		    strbooth +='<td valign="top">Description</td>';
		    strbooth +='<td valign="top">:</td>';
		    strbooth +='<td valign="top"><textarea name="agenda_desc'+incvalue+'" cols="38" rows="4">'+speakearray[spi]['agenda_desc']+'</textarea> </td>';
		    strbooth +='<td>&nbsp;</td>';
		    strbooth +='</tr>';
			strbooth +='<tr>';
				strbooth +='<td>Start Time (hh:mm) </td>';
				strbooth +='<td>:</td>';
				strbooth +='<td>';
					strbooth +='<select name="starttimehr'+incvalue+'">';
						strbooth +='<option value="--">--</option>';
						for(i=0;i<=11;i++) {
							strbooth +='<option value="'+converttodouble(i)+'"';
							if(speakearray[spi]['start_timehr']==converttodouble(i)) {
								strbooth +=' selected="selected"';
							}
							strbooth +='>'+converttodouble(i)+'</option>';
						}
					strbooth +='</select>';
					strbooth +='&nbsp;<b>:</b>&nbsp;';
					strbooth +='<select name="starttimemin'+incvalue+'">';
						strbooth +='<option value="--">--</option>';
						for(j=0;j<=55;j=j+5) {
							strbooth +='<option value="'+converttodouble(j)+'"';
							if(speakearray[spi]['start_timemin']==converttodouble(j)) {
								strbooth +=' selected="selected"';
							}
							strbooth +='>'+converttodouble(j)+'</option>';
						}
					strbooth +='</select>&nbsp;';
					strbooth +='<select name="sel_starttimeopt'+incvalue+'">';
					strbooth +='<option value="--">--</option>';
					strbooth +='<option value="AM"';
					if(speakearray[spi]['starttime_opt']=="AM") {
						strbooth +=' selected="selected"';
					}
					strbooth +='>AM</option>';
					strbooth +='<option value="PM"';
					if(speakearray[spi]['starttime_opt']=="PM") {
						strbooth +=' selected="selected"';
					}
					strbooth +='>PM</option>';
					strbooth +='</select>';
				strbooth +='</td><td>&nbsp;</td>';
			strbooth +='</tr>';
			strbooth +='<tr>';
				strbooth +='<td>End Time (hh:mm) </td>';
				strbooth +='<td>:</td>';
				strbooth +='<td>';
					strbooth +='<select name="endtimehr'+incvalue+'">';
						strbooth +='<option value="--">--</option>';
						for(k=0;k<=11;k++) {
							strbooth +='<option value="'+converttodouble(k)+'"';
							if(speakearray[spi]['end_timehr']==converttodouble(k)) {
								strbooth +=' selected="selected"';
							}
							strbooth +='>'+converttodouble(k)+'</option>';
						}
					strbooth +='</select>';
					strbooth +='&nbsp;<b>:</b>&nbsp;';
					strbooth +='<select name="endtimemin'+incvalue+'">';
						strbooth +='<option value="--">--</option>';
						for(l=0;l<=55;l=l+5) {
							strbooth +='<option value="'+converttodouble(l)+'"';
							if(speakearray[spi]['end_timemin']==converttodouble(l)) {
								strbooth +=' selected="selected"';
							}
							strbooth +='>'+converttodouble(l)+'</option>';
						}
					strbooth +='</select>&nbsp;';
					strbooth +='<select name="sel_endtimeopt'+incvalue+'">';
					strbooth +='<option value="--">--</option>';
					strbooth +='<option value="AM"';
					if(speakearray[spi]['endtime_opt']=="AM") {
						strbooth +=' selected="selected"';
					}
					strbooth +='>AM</option>';
					strbooth +='<option value="PM"';
					if(speakearray[spi]['endtime_opt']=="PM") {
						strbooth +=' selected="selected"';
					}
					strbooth +='>PM</option>';
					strbooth +='</select>';
				strbooth +='</td>';
				strbooth +='<td><a href="#" onClick="javascript:return add_speaker(\'div_speaker'+incvalue+'\',\'hid_agent'+incvalue+'\',\''+incvalue+'\',\'hid_incagenda'+incvalue+'\')" class="link02">Add Speaker</A></td>';
			strbooth +='</tr>';
			strbooth += '<tr>';
				strbooth += '<td colspan="4"><div id="div_speaker'+incvalue+'">';
				strbooth +=getSpeakerDetails(speakearray[spi]['agenda_id'],incvalue);
				strbooth += '</div></td>';
			strbooth += '</tr>';
			strbooth += '</table></div>';
			var finalpushval=finalpushval+","+incvalue;
			incvalue++;
			}
			agid=speakearray[spi]['agenda_id'];
		}
		document.getElementById('hid_totagenda').value=finalpushval;
		document.getElementById(divname).innerHTML = strbooth;
	}
}
function validatefeedback(frm)
{
	with(frm)
	{
		//alert("tamil");
		if(Trim(fname.value) == "")
		{
			alert("-Please enter Firstname.");
			fname.focus();
			return false;
		}

		if(Trim(lname.value) == "")
		{
			alert("-Please enter Lastname.");
			lname.focus();
			return false;
		}
		if (email.value == "")
	   {
		   alert("Please enter a Contact Email-ID.");
		   email.focus();
		   return false;
	   }
		if(!checkEmail(email.value))
		{
			email.focus();
			return false;
		}

		if(!IsNumeric(phone.value))
		{
			alert("-Phone field should be numeric digits and must 10 characters.");
			phone.focus();
			return false;
		}
		if(phone.value.length <=9)
		{
			alert("-Phone field should be numeric digits and must 10 characters.");
			phone.focus();
			return false;
		}
		if(Trim(subject.value) == "")
		{
			alert("-Please enter the subject.");
			subject.focus();
			return false;
		}
		if(Trim(message.value) == "")
		{
			alert("-Please enter the Message.");
			message.focus();
			return false;
		}

	  }
	  return true;

}

function validateeventregister(frm)
{

	with(frm)
	{

		if(Trim(fname.value) == "")
		{
			alert("-Please enter Firstname.");
			fname.focus();
			return false;
		}

		if(Trim(lname.value) == "")
		{
			alert("-Please enter Lastname.");
			lname.focus();
			return false;
		}
		if(Trim(company.value) == "")
		{
			//alert("dsds");
			alert("-Please enter company.");
			company.focus();
			return false;
		}

		if (email.value == "")
	   {
		   alert("Please enter a Contact Email-ID.");
		   email.focus();
		   return false;
	   }
		if(!checkEmail(email.value))
		{
			email.focus();
			return false;
		}

		if(!IsNumeric(phone.value))
		{
			alert("-Phone field should be numeric digits and must 10 characters.");
			phone.focus();
			return false;
		}
		if(phone.value.length <=9)
		{
			alert("-Phone field should be numeric digits and must 10 characters.");
			phone.focus();
			return false;
		}
		if(Trim(comments.value) == "")
		{
			alert("-Please enter the comments.");
			comments.focus();
			return false;
		}

	  }
	  return true;

}
function SelectAllInUsers(ids)
{
	var id=ids;
	var f1=document.frmviewinitiatives.check;
	if(id==1)
	{
			for(i=0;i<=f1.length;i++)
			{
			   f1[i].checked=true;
			}
	}
	else
	{
			for(i=0;i<=f1.length;i++)
			{
				f1[i].checked=false;
			}
	}
}

//validate adminaddinitiatives

function validateaddinitiatives(frm)
{
	//alert("ccccc");
	with(frm)
	{
		if(Trim(name.value) == "")
		{
			alert("-Please enter the Name.");
			name.focus();
			return false;
		}
		if(Trim(owner.value) == "")
		{
			alert("-Please enter the Owner.");
			owner.focus();
			return false;
		}
		if(Trim(des.value) == "")
		{
			alert("-Please enter the Description.");
			des.focus();
			return false;
		}

	 }
	return true;
}
function chk_Deletefile(delid,frm) {
	if(confirm("Do you want to delete this document?")) {
		frm.delids.value=delid;
		return true;
	} else {
		return false;
	}
}

function SelectAllInUser(ids) {
	var id=ids;
	var f1=document.frmusers.check;
	if(id==1)
	{
			for(i=0;i<=f1.length;i++)
			{
			   f1[i].checked=true;
			}
	}
	else
	{
			for(i=0;i<=f1.length;i++)
			{
				f1[i].checked=false;
			}
	}
}
function validateaddeditmember(frm)
{
	//alert("ccccc");
	with(frm)
	{
		if(Trim(username.value) == "")
		{
			alert("-Please enter the Username.");
			username.focus();
			return false;
		}
		if(Trim(password.value) == "")
		{
			alert("-Please enter the Password.");
			password.focus();
			return false;
		}
		if(member.value == "0")
		{
			alert("-Please select the member.");
			member.focus();
			return false;
		}
		if(initiative.value == "0")
		{
			alert("-Please select the initiative.");
			initiative.focus();
			return false;
		}
		if(Trim(firstname.value) == "")
		{
			alert("-Please enter the Firstname.");
			firstname.focus();
			return false;
		}
		if(Trim(lastname.value) == "")
		{
			alert("-Please enter the Lastname.");
			lastname.focus();
			return false;
		}
		if(Trim(designation.value) == "")
		{
			alert("-Please enter the Designation.");
			designation.focus();
			return false;
		}
		if(Trim(company.value) == "")
		{
			alert("-Please enter the Company.");
			company.focus();
			return false;
		}
		if(photo.value != '')
		{
			if(!checkimage('frmadduser','photo'))
			{
			return false;
			}
		}
	 }
	return true();
}


function SelectAllInUsers(ids)
{
	var id=ids;
	var f1=document.frmviewexemembers.check;
	if(id==1)
	{
			for(i=0;i<=f1.length;i++)
			{
			   f1[i].checked=true;
			}
	}
	else
	{
			for(i=0;i<=f1.length;i++)
			{
				f1[i].checked=false;
			}
	}
}
function validateexcutivemember(frm)
{
	//alert("ccccc");
	with(frm)
	{
		if (username.value == "")
	   {
		   alert("Please enter a Username/Email-ID.");
		   username.focus();
		   return false;
	   }
		if(!checkEmail(username.value))
		{

			username.focus();
			return false;
		}
		if(Trim(password.value) == "")
		{
			alert("-Please enter the Password.");
			password.focus();
			return false;
		}
		if(Trim(firstname.value) == "")
		{
			alert("-Please enter the Firstname.");
			firstname.focus();
			return false;
		}
		if(Trim(lastname.value) == "")
		{
			alert("-Please enter the Lastname.");
			lastname.focus();
			return false;
		}
		if(Trim(designation.value) == "")
		{
			alert("-Please enter the Designation.");
			designation.focus();
			return false;
		}
		if(Trim(company.value) == "")
		{
			alert("-Please enter the Company.");
			company.focus();
			return false;
		}
		if(photo.value != '')
		{
			if(!checkimage('frmaddexeuser','photo'))
			{
			return false;
			}
		}

	 }
	return true();
}

function validateadmincompany(frm)
{
	with(frm)
	{
		if(photo.value != '')
		{
			if(!checkimage('frm','photo'))
			{
			return false;
			}
		}

	 }
	return true;
}

function selectallfrmcom(ids)
{
	var id=ids;
	var f1=document.frmcom.check;
	if(id==1)
	{
			for(i=0;i<=f1.length;i++)
			{
			   f1[i].checked=true;
			}
	}
	else
	{
			for(i=0;i<=f1.length;i++)
			{
				f1[i].checked=false;
			}
	}
}
function SelectAllInUserss(ids)
{
	var id=ids;
	var f1=document.frmviewiniexemembers.check;
	if(id==1)
	{
			for(i=0;i<=f1.length;i++)
			{
			   f1[i].checked=true;
			}
	}
	else
	{
			for(i=0;i<=f1.length;i++)
			{
				f1[i].checked=false;
			}
	}
}
function validateviewinitmem(frm)
{
	//alert("ccccc");
	with(frm)
	{
		if (username.value == "")
	   {
		   alert("Please enter a Username/Email-ID.");
		   username.focus();
		   return false;
	   }
		if(!checkEmail(username.value))
		{

			username.focus();
			return false;
		}
		if(Trim(password.value) == "")
		{
			alert("-Please enter the Password.");
			password.focus();
			return false;
		}
		if(Trim(firstname.value) == "")
		{
			alert("-Please enter the Firstname.");
			firstname.focus();
			return false;
		}
		if(Trim(lastname.value) == "")
		{
			alert("-Please enter the Lastname.");
			lastname.focus();
			return false;
		}
		if(Trim(designation.value) == "")
		{
			alert("-Please enter the Designation.");
			designation.focus();
			return false;
		}
		if(Trim(company.value) == "")
		{
			alert("-Please enter the Company.");
			company.focus();
			return false;
		}
		if(photo.value != '')
		{
			if(!checkimage('frmaddexeuser','photo'))
			{
			return false;
			}
		}

	 }
	return true();
}

/*function memberprofile(urlfull) {
	//alert(urlfull);
	var urls = urlfull;
	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=650px,height=500px,center=1,resize=0,scrolling=1')
}*/

/*function changepassword() {
	var urls = "changepassword.php";
	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=550px,height=300px,center=1,resize=0,scrolling=1')
}*/

function uploadphoto(id) {
	var urls = "uploadphoto.php?id="+id;
	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=650px,height=500px,center=1,resize=0,scrolling=1')
}

function uploaddocs(id) {
	var urls = "uploaddoc.php?id="+id;
	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=650px,height=500px,center=1,resize=0,scrolling=1')
}
/*function openphotos(id) {
	var urls = "view_ec.php?id="+id + "&only=photos";
	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=700px,height=600px,center=1,resize=0,scrolling=0')
}

function opendocs(id) {
	var urls = "view_ec.php?id="+id + "&only=docs";
	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=700px,height=400px,center=1,resize=0,scrolling=0')
}*/
function showvideo(urlfull) {
	var urls = "showvideo.php?vname="+urlfull;
	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=410px,height=315px,center=1,resize=0,scrolling=1')
}
function showconvert(urlvid) {
	var urls = "showvideoconv.php?vid="+urlvid;
	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=410px,height=315px,center=1,resize=0,scrolling=1')
}


function putvalue(txtval,obj) {
	if(obj.value=='') {
		obj.value=txtval;
	}
}
function getvalue(txtval,obj) {

	if(obj.value==txtval) {
		obj.value='';
	}
}
function validatewriteonwall()
{
	if(document.getElementById("txt_commentstitle").value=="")
	{
		alert('Please enter the title.');
		return false;
	}else if(document.getElementById("txt_commentstitle").value=="Title here")
	{
		alert('Please enter the title.');
		return false;
	}	
	else if(document.getElementById("txt_commentswall").value=="")
	{

		alert('Please enter the brief.');
		return false;
	}else if(document.getElementById("txt_commentswall").value=="Brief here")
	{
		alert('Please enter the brief.');
		return false;
	}
	else{
			checkvalidate();
		}
}
function validatecommentswriteonwall(valid)
{

	if(document.getElementById('txt_usercommentsonwall_'+valid).value=="")
	{
		alert('Please enter the comments.');
		document.getElementById('txt_usercommentsonwall_'+valid).focus();
		return false;
	}
	else if(document.getElementById('txt_usercommentsonwall_'+valid).value=="Add comments...")
	{
		return false;
	}
	else
	{
			//alert(document.getElementById('txt_usercommentsonwall').value);alert(document.getElementById('dividvalue').value);
			commentswriteonwall(document.getElementById('txt_usercommentsonwall_'+valid).value,document.getElementById('dividvalue_'+valid).value);
			return true;
	}
}
function delbuttonfn(wallid, userid){

	var r=confirm("Are you sure you want to delete this wall?");
	if (r==true)  {
		delfunforwall(wallid, userid)
	}
}
function delcommentsforwall(wallid, commentid){
	//alert(wallid);
	//alert(commentid);
	var r=confirm("Are you sure you want to delete this Comments?");
	if (r==true)  {
		delfunforCommentsofWall(wallid, commentid)
	}
	}

function jqueryfor_post_hclcaccomm(divid){

	if(document.getElementById("txt_hclcaccomments_"+divid).value=="")
	{

		alert('Please enter the comments.');
		return false;
	}
	else{
			checkvalidatehclcac(divid);

		}
	}
function delbuttonfnhclcaccomm(wallid, userid, docid){

	var r=confirm("Are you sure you want to delete this Comments?");
	if (r==true)  {
		delfunforwall_hclcaccomm(wallid, userid, docid)
	}
}

function jqueryfor_post_otherdocscomm(divid){

	if(document.getElementById("txt_otherdocscomments_"+divid).value=="")
	{

		alert('Please enter the comments.');
		return false;
	}
	else{
			checkvalidateotherdocscomm(divid);
			//alert(divid);

		}
	}

function jqueryfor_post_hclcacdocscomm(divid){

	if(document.getElementById("txt_othernewdocscomments_"+divid).value=="")
	{

		alert('Please enter the comments.');
		return false;
	}
	else{
			checkvalidatehclcacdocscomm(divid);


		}
	}
function delbuttonfnotherdocscomm(wallid, userid, docid){

	var r=confirm("Are you sure you want to delete this Comments?");
	if (r==true)  {

		delfunforwall_otherdocscomm(wallid, userid, docid)
	}
}

function delbuttonfnhclcacdocscomm(wallid, userid, docid){

	var r=confirm("Are you sure you want to delete this Comments?");
	if (r==true)  {
		delfunforwall_hclcacdocscomm(wallid, userid, docid)
	}
}
function jqueryfor_uploadcac(){

	if(document.getElementById("txt_cacdocs").value=="")
	{

		alert('Please enter the title of the document.');
		document.getElementById("txt_cacdocs").focus();
		return false;
	}
	else if(document.getElementById("file_cacdocs").value=="")
	{

		alert('Please choose the document to upload.');
		return false;
	}

	else{
			checkvalidateuploadcac();

		}
	}

function delbuttonfncacdocs(wallid, userid){

	var r=confirm("Are you sure you want to delete this Comments?");
	if (r==true)  {
		//alert(wallid);alert(userid);
		delfunforwall_cacdocs(wallid, userid)
	}
}


function changehclcategory(selval){

		if(selval.value=='HCL Reports'){
			document.getElementById("showhclcat").style.display='block';
		}else{
			document.getElementById("showhclcat").style.display='none';
			}
	}


function validatevideos(frm){
	with(frm){
		if(Trim(up_title.value)==''){
			alert('Please enter the video title.');
			up_title.focus();
			return false;
		}
		if(up_video.value != '')
		{
			if(!checkvideo('frmvideos','up_video'))
			{
				return false;
			}
		}

	}
	return true;
}

function validateChangePassword(frm){
	with(frm){
		if(Trim(currentPassword.value)==''){
			alert('Please enter the current password.');
			currentPassword.focus();
			return false;
		}
		if(Trim(newPassword.value)==''){
			alert('Please enter the new password.');
			newPassword.focus();
			return false;
		}
		if(Trim(confirmPassword.value)==''){
			alert('Please enter the confirm password.');
			confirmPassword.focus();
			return false;
		}
		if(Trim(confirmPassword.value)!=Trim(newPassword.value)){
			alert('New password and confirm password doesn\'t match.');
			confirmPassword.focus();
			return false;
		}

	}
	return true;
}

//To validate the upload photos..

function validateuploadphotos(frm){
	with(frm){
		if(Trim(imgtitle1.value)=='') {
			alert('Please enter the title1.');
			imgtitle1.focus();
			return false;
		}
		if(Trim(imgtitle1.value)!='') {
			if(image1.value=='') {
				alert('Please upload the photo1.');
				image1.focus();
				return false;
			}
		}
		if(image1.value != '')
		{
			if(!checkimage('frmphotoupload','image1'))
			{
			return false;
			}
		}
		if(Trim(imgtitle2.value)=='') {
			alert('Please enter the title2.');
			imgtitle2.focus();
			return false;
		}
		if(Trim(imgtitle2.value)!=''){
			if(image2.value=='') {
				alert('Please upload the photo2');
				image2.focus();
				return false;
			}
		}
		if(image2.value != '')
		{
			if(!checkimage('frmphotoupload','image2'))
			{
			return false;
			}
		}
		if(Trim(imgtitle3.value)=='') {
			alert('Please enter the title3.');
			imgtitle3.focus();
			return false;
		}
		if(Trim(imgtitle3.value)!='') {
			if(image3.value==''){
				alert('Please upload the photo3');
				image3.focus();
				return false;
			}
		}
		if(image3.value != '')
		{
			if(!checkimage('frmphotoupload','image3'))
			{
			return false;
			}
		}
	} return true;
}

function validatedocupload(frm) {
	with(frm) {
		if(Trim(imgtitle1.value)=='') {
			alert('Please enter the title1.');
			imgtitle1.focus();
			return false;
		}
		if(Trim(imgtitle1.value)!='') {
			if(image1.value=='') {
				alert('Please upload the doc1.');
				image1.focus();
				return false;
			}
		}
		if(image1.value != '')
		{
			if(!checkdocs('frmphotoupload','image1'))
			{
			return false;
			}
		}
		if(Trim(imgtitle2.value)=='') {
			alert('Please enter the title2.');
			imgtitle2.focus();
			return false;
		}
		if(Trim(imgtitle2.value)!=''){
			if(image2.value=='') {
				alert('Please upload the doc2');
				image2.focus();
				return false;
			}
		}
		if(image2.value != '')
		{
			if(!checkdocs('frmphotoupload','image2'))
			{
			return false;
			}
		}
		if(Trim(imgtitle3.value)=='') {
			alert('Please enter the title3.');
			imgtitle3.focus();
			return false;
		}
		if(Trim(imgtitle3.value)!='') {
			if(image3.value==''){
				alert('Please upload the doc3');
				image3.focus();
				return false;
			}
		}
		if(image3.value != '')
		{
			if(!checkdocs('frmphotoupload','image3'))
			{
			return false;
			}
		}
	} return true;
}

function showChatpopup(){
	document.getElementById("chatpopUp").style.display="block";
	}
function hideChatpopup(){
	document.getElementById("chatpopUp").style.display="none";
	}	
