// JavaScript Document
//function to chk for valid URL
function isValidURL(element, msg, required)
{
	if(element.value == "")
	{
		var rval = trim(required);
		if (rval.toLowerCase() == "yes" || rval == 1)
		{
			document.getElementById("errormsg").innerHTML ="Please Enter  "+msg;
			element.className = "chcolor";
			return false;
		}
	}
	if(element.value != "")
	{
		// if (!(/^[www]\w+([\.-]?\w+)*(\.\w{2,3}.*/i.test(element.value)))))
		var oRegExp = /[^:]+[^:\/]+(:[0-9]+)?\/?.*/;
		if (!oRegExp.test(element.value))
		{
			document.getElementById("errormsg").innerHTML ='\r\n The URL you have entered is invalid.\n Please check it for accuracy.';
			element.className = "chcolor";
			//element.select();
			return false;
		}
	}
	return true;
}
/************* Function for the Search Companies Page in the Client Side *********/
function fnNavigatePage(path,id)
{
	document.getElementById('light1').style.display = 'block';
	document.getElementById('AddLink').href = path+'signup.html?keyword=company&id='+id;
}
function fnFeedComment()
{
	document.getElementById('CommentRow').style.display = '';
	document.getElementById('YesBtn').disabled = true;
	document.getElementById('NoBtn').disabled = true;
}
function PostFeedBack()
{
	var feedback= document.getElementById('comment').value;
	if(feedback != '' && feedback != 'Leave your Comment Here.')
	{
		xhReq.open("GET", "ajax_functions?feedback="+feedback, true);
		xhReq.onreadystatechange = onSumResponseFeedBack;
		xhReq.send(null);
	}
}
function onSumResponseFeedBack()
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	document.getElementById('CommentTD').innerHTML = serverResponse;
}
function isValidAlphabet(element, msg, required)
{
	var i=0;
	var ValidData="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._- ";
	var Data = element.value;
	if(element.value == "")
	{
		var rval = trim(required);
		if (rval.toLowerCase() == "yes" || rval == 1)
		{
			document.getElementById("errormsg").innerHTML ="Please Enter  "+msg;
			element.className = "chcolor";
			return false;
		}
	}
	if(element.value != "")
	{
		for(i=0;i<Data.length;i++)
		{
			if(ValidData.indexOf(Data.charAt(i))==-1)
			{
				document.getElementById("errormsg").innerHTML ="Invalid Characters in your "+msg+". Please try again.";
				element.className = "chcolor";
				return false;
			}
		}
	}
    return true;
}
/***** Code to validate user registration ********/
function isValidNumber(element, msg, required)
{  
	var VarNumber = element.value;
	if(VarNumber == "")
	{
		var rval = trim(required);
		if (rval.toLowerCase() == "yes" || rval == 1)
		{
			document.getElementById("errormsg").innerHTML = "Please enter "+msg;
			element.className = "chcolor";
			return false;
		}
	}
	if (VarNumber != "")
	{
		var Num;
		Num=VarNumber;
		var valid = "0123456789";
		var hyphencount = 0;
		for (var i=0; i < Num.length; i++) 
		{
			temp = "" + Num.substring(i, i+1);
			if (valid.indexOf(temp) == "-1")
			{
			  document.getElementById("errormsg").innerHTML = "Invalid characters in your "+msg+".  Please try again.";
			  element.className = "chcolor";
			  return false;
			}
	   } // end for loop
	   
		if(VarNumber < 1)
		{
			document.getElementById("errormsg").innerHTML = msg+" is not a valid number";
			element.className = "chcolor";
			return false;
		}
    }   // end if
    return true; 
}  // end function
function isValidEmail(element, required)
{
	var VarEmail = element.value;
	if(VarEmail == "")
	{
		var rval = trim(required);
		if (rval.toLowerCase() == "yes" || rval == 1)
		{
			document.getElementById("errormsg").innerHTML = "Please enter Email Address";
			element.className = "chcolor";
			return false;
		}
	}	
	if(VarEmail != "")
	{
		var emailStr = VarEmail;
		 
		var emailPat=/^(.+)@(.+)$/
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
		var validChars="\[^\\s" + specialChars + "\]"
		var firstChars=validChars
		var quotedUser="(\"[^\"]*\")"
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom="(" + firstChars + validChars + "*" + ")"
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
		var matchArray=emailStr.match(emailPat)
		if (matchArray==null) 
		{
			 document.getElementById("errormsg").innerHTML = "Email address seems to be incorrect (check @ and .'s)";
			 element.className = "chcolor";
			 return false;
		}
		var user=matchArray[1]
		var domain=matchArray[2]
		if (user.match(userPat)==null) 
		{
			document.getElementById("errormsg").innerHTML = "The Email doesn't seem to be valid.";
			element.className = "chcolor";
			return false;
		}
		var IPArray=domain.match(ipDomainPat)
	
		if (IPArray!=null) 
		{
			for (var i=1;i<=4;i++) 
			{
				if (IPArray[i]>255) 
				{
					 document.getElementById("errormsg").innerHTML = "Destination IP address is invalid!";
					 element.className = "chcolor";
					 return false;
				}
			}
		}
		var domainArray=domain.match(domainPat)
		if (domainArray==null) 
		{
			document.getElementById("errormsg").innerHTML = "The domain name doesn't seem to be valid.";
			element.className = "chcolor";
			return false;
		}
		var atomPat=new RegExp(atom,"g");
		var domArr=domain.match(atomPat);
		if (!isNaN(domArr[1]))
		{
			document.getElementById("errormsg").innerHTML = "The domain name doesn't seem to be valid.";
			element.className = "chcolor";
			return false;
		}
		
		var len=domArr.length;
		if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) 
		{
		   var errStr = "The address must end in a three-letter domain, or two letter country.";
		   document.getElementById("errormsg").innerHTML = errStr;
		   element.className = "chcolor";
		   return false;
		}
		if (domArr[domArr.length-1].length==2 && len<2) 
		{
			var errStr = "This address ends in two characters, which is a country";
			errStr    += " code.  Country codes must be preceded by ";
			errStr	  += "a hostname and category (like com, co, pub, pu, etc.)";
			document.getElementById("errormsg").innerHTML = errStr;
			element.className = "chcolor";
			return false;
		}
		if (domArr[domArr.length-1].length==3 && len<2) 
		{
			 var errStr="This address is missing a hostname!";
			 document.getElementById("errormsg").innerHTML = errStr;
			 element.className = "chcolor";
			 return false;
		}
	}
	return true;
}
function isValidEmailAlert(element, required)
{
	var VarEmail = element.value;
	if(VarEmail == "")
	{
		var rval = trim(required);
		if (rval.toLowerCase() == "yes" || rval == 1)
		{
			alert("Please Enter E-mail address");
			return false;
		}
	}	
	if(VarEmail != "")
	{
		var emailStr = VarEmail;
		 
		var emailPat=/^(.+)@(.+)$/
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
		var validChars="\[^\\s" + specialChars + "\]"
		var firstChars=validChars
		var quotedUser="(\"[^\"]*\")"
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom="(" + firstChars + validChars + "*" + ")"
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
		var matchArray=emailStr.match(emailPat)
		if (matchArray==null) 
		{
			 alert("Email address seems to be incorrect (check @ and .'s)");
			 return false;
		}
		var user=matchArray[1]
		var domain=matchArray[2]
		if (user.match(userPat)==null) 
		{
			alert("The Email doesn't seem to be valid.");
			return false;
		}
		var IPArray=domain.match(ipDomainPat)
	
		if (IPArray!=null) 
		{
			for (var i=1;i<=4;i++) 
			{
				if (IPArray[i]>255) 
				{
					 alert("Destination IP address is invalid!");
					 return false;
				}
			}
		}
		var domainArray=domain.match(domainPat)
		if (domainArray==null) 
		{
			alert("The domain name doesn't seem to be valid.");
			return false;
		}
		var atomPat=new RegExp(atom,"g");
		var domArr=domain.match(atomPat);
		if (!isNaN(domArr[1]))
		{
			alert("The domain name doesn't seem to be valid.");
			return false;
		}
		
		var len=domArr.length;
		if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) 
		{
		   var errStr = "The address must end in a three-letter domain, or two letter country.";
		   alert(errStr);
		   return false;
		}
		if (domArr[domArr.length-1].length==2 && len<3) 
		{
			var errStr = "This address ends in two characters, which is a country";
			errStr    += " code.  Country codes must be preceded by ";
			errStr	  += "a hostname and category (like com, co, pub, pu, etc.)";
			alert(errStr);
			return false;
		}
		if (domArr[domArr.length-1].length==3 && len<2) 
		{
			 var errStr="This address is missing a hostname!";
			 alert(errStr);
			 return false;
		}
	}
	return true;
}
function chcol(frm)
{
	var reqarr = new Array();
	reqarr = document.getElementById("tot_hid").value.split(",");
	var reqlen = reqarr.length;
	var flag = 0;
	for(var i=0;i<reqlen;i++)
	{
		if(document.getElementById(reqarr[i]).value == "")
		{
			document.getElementById(reqarr[i]).className = "chcolor";
			flag++;
		}
		else
		{
			document.getElementById(reqarr[i]).className = "normaltextfield1";
			if(document.getElementById(reqarr[i]).id == 'userid')
			{
				if(!isValidEmail(frm.elements['userid'],"Email"))
					return false;
			}
		}
	}
	if(flag > 0)
	{
		document.getElementById("errormsg").innerHTML = "Please fill the Required information.";
		return false;
	}
	else 
		return true;
}
//lost password
function lostpassfun(frm)
{
	var reqarr = new Array();
	reqarr = document.getElementById("tot_hid").value.split(",");
	var reqlen = reqarr.length;
	var flag = 0;
	for(var i=0;i<reqlen;i++)
	{
		if(document.getElementById(reqarr[i]).value == "")
		{
			document.getElementById(reqarr[i]).className = "chcolor";
			flag++;
		}
		else
		{
			document.getElementById(reqarr[i]).className = "normaltextfield1";
			if(document.getElementById(reqarr[i]).id == 'memid')
			{
				if(!isValidEmail(frm.memid,"Email"))
					return;
			}
		}
	}
	if(flag > 0)
	{
		document.getElementById("errormsg").innerHTML = "Please fill the Required information.";
		return;
	}
	else 
		frm.submit();
}
//for signup
function showsignup(val)
{
	var frm=document.signup;
	frm.keyword.value=val;
	frm.action=secfilepath+"signup.html";
	frm.submit();
}
//function foe registration
function regfun(frm,val)
{
	/****************** If the User Type is Customer ****************/
	if(frm.elements['item[type]'].value  == "customer")
	{
		var reqarr 	= new Array();
		reqarr 		= document.getElementById("customer_hid").value.split(",");
		var reqlen 	= reqarr.length;
		var flag 	= 0;
		for(var i=0;i<reqlen;i++)
		{
			if(document.getElementById(reqarr[i]).value == "")
			{
				document.getElementById(reqarr[i]).className = "chcolor";
				flag++;
			}
			else
			{
				document.getElementById(reqarr[i]).className = "normaltextfield1";
				if(document.getElementById(reqarr[i]).id == 'custfname')
				{
					if(!isValidAlphabet(frm.elements['customer[first_name]'],"First name",''))
						return false;
				}
				if(document.getElementById(reqarr[i]).id == 'custlname')
				{
					if(!isValidAlphabet(frm.elements['customer[last_name]'],"Last name",''))
						return false;
				}
				if(document.getElementById(reqarr[i]).id == 'custemail')
				{
					if(!isValidEmail(frm.elements['customer[email]'],"Email",''))
						return false;
				}
				if(frm.elements['customer[phone]'].value!='')
				{
					if(!isValidNumber(frm.elements['customer[phone]'],"Phone number",''))
						return false;
				}
			}
		}
		if(flag > 0)
		{
			document.getElementById("errormsg").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'> Please fill the information in the fields that are highlighted";
			return false;
		}
		else 
		{
			if(frm.elements['custterms'].checked==false)
			{
				document.getElementById("errormsg").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'> Plese check  the terms and conditions";
				return false;
			}
		}
		document.getElementById('hid_key').value = "PostVal";
		frm.submit();
	}
	/*********** If the User Type is Company *******************/
	if(frm.elements['item[type]'].value == "company")
	{
		var reqarr = new Array();
		reqarr = document.getElementById("company_hid").value.split(",");
		var reqlen = reqarr.length;
		var flag = 0;
		for(var i=0;i<reqlen;i++)
		{
			if(document.getElementById(reqarr[i]).value == "")
			{
					document.getElementById(reqarr[i]).className = "chcolor";
					flag++;
			}
			else
			{	
				if(document.getElementById(reqarr[i]).type != 'checkbox')
				document.getElementById(reqarr[i]).className = "normaltextfield1";
				if(document.getElementById(reqarr[i]).id == 'cemail')
				{
					if(!isValidEmail(frm.elements['company[email]'],"Email"))
						return false;
				}
				if(frm.elements['company[home_url]'].value!='')
				{
					if(!isValidURL(frm.elements['company[home_url]'],"Website url"))
							return false;
				}
				if(frm.elements['company[blog_url]'].value!='')
				{
					if(!isValidURL(frm.elements['company[blog_url]'],"Blog url"))
							return false;
				}
				if(frm.elements['company[phone]'].value!='')
				{
					if(!isValidNumber(frm.elements['company[phone]'],"Phone Number",''))
						return false;
				}
			}
		}
		if(flag > 0)
		{
			document.getElementById("errormsg").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'> Please fill the information in the fields that are highlighted";
			return false;
		}
		else 
		{
			
			if(document.getElementById('photo_val').value=='')
			{
				document.getElementById("errormsg").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'> Please Upload the Logo";
				return false;
			}
			if(frm.elements['companyterms'].checked==false)
			{
				document.getElementById("errormsg").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'> Plese accept the terms and conditions";
				return false;
			}
			if(document.getElementById('com_url').value == '')
			{
				document.getElementById("errormsg").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'> Plese try for valid CompaniesInfo URL by Editing the Company Name.";
				return false;
			}
		}
		var country		= document.getElementById('cccountry').value;
		var compname	= document.getElementById('companyname').value;
		var compurl 	= document.getElementById('com_url').value;
		var compper		= document.getElementById('cperson').value;
		var compdes 	= document.getElementById('cpdesignation').value;
		var compsize	= document.getElementById('typecomp').value;
		var compind 	= document.getElementById('ccindustry').value;
		var compcat 	= document.getElementById('ccategory').value;
		var comptype 	= document.getElementById('cctype').value;
		var compweburl 	= document.getElementById('chomepage').value;
		var compblogurl = document.getElementById('cblog').value;
		var compphone 	= document.getElementById('cphone').value;
		var compemail 	= document.getElementById('cemail').value;
		var compaddr 	= document.getElementById('caddress1').value;
		var compstate 	= document.getElementById('cstate').value;
		var compcity 	= document.getElementById('ccity').value;
		var compzip		= document.getElementById('czipcode').value;
		var compabout	= document.getElementById('coverview').value;
		var comptags	= document.getElementById('ctags').value;
		var compref		= document.getElementById('company_referedby').value;
		var refdesc		= document.getElementById('company_referdesc').value;
		var parameters	= "utype=company&country="+country+"&compname="+compname+"&compurl="+compurl+"&compper="+compper+"&compdes="+compdes+"&compsize="+compsize+"&compind="+compind+"&compcat="+compcat+"&comptype="+comptype+"&compweburl="+compweburl+"&compblogurl="+compblogurl+"&compphone="+compphone+"&compemail="+compemail+"&compaddr="+compaddr+"&compstate="+compstate+"&compcity="+compcity+"&compzip="+compzip+"&comptags="+comptags+"&compref="+compref+"&refdesc="+refdesc+"&compabout="+compabout;
		document.getElementById('RegistrationBox').innerHTML = '<br><br>Please wait while your information is being saved.<br> Do not press \'refresh\' or \'back button\' during the process<br><br>';
		hajax(filepath+"signup_ajax",onSumResponseSignUp,parameters,'');
		return false;
	}
	/*************** If the Usertype is Professional ***********/
	if(frm.elements['item[type]'].value  == "people")
	{
		var reqarr 	= new Array();
		reqarr 		= document.getElementById("people_hid").value.split(",");
		var reqlen 	= reqarr.length;
		var flag 	= 0;
		for(var i=0;i<reqlen;i++)
		{
			if(document.getElementById(reqarr[i]).value == "")
			{
				document.getElementById(reqarr[i]).className = "chcolor";
				flag++;
			}
			else
			{
				if(document.getElementById(reqarr[i]).type != 'checkbox')
					document.getElementById(reqarr[i]).className = "normaltextfield1";
				if(document.getElementById(reqarr[i]).id == 'pfirstname')
				{
					if(!isValidAlphabet(frm.elements['people[firstname]'],"First name",''))
						return false;
				}
				if(document.getElementById(reqarr[i]).id == 'lastname')
				{
					if(!isValidAlphabet(frm.elements['people[lastname]'],"Last name",''))
						return false;
				}
				if(document.getElementById(reqarr[i]).id == 'pemail')
				{
					if(!isValidEmail(frm.elements['people[email]'],"Email",''))
						return false;
				}
			}
		}
		if(flag > 0)
		{
			document.getElementById("errormsg").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'> Please fill the information in the fields that are highlighted";
			return false;
		}
		else 
		{
			if(frm.elements['people[home_page_url]'].value!='')
			{
				if(!isValidURL(frm.elements['people[home_page_url]'],"Website url"))
						return false;
			}
			if(frm.elements['people[blog_url]'].value!='')
			{
				if(!isValidURL(frm.elements['people[blog_url]'],"Blog url"))
						return false;
			}
			if(frm.elements['people[phone]'].value!='')
			{
				if(!isValidNumber(frm.elements['people[phone]'],"Phone number",''))
					return false;
			}
			if(document.getElementById('photo_val').value=='')
			{
				document.getElementById("errormsg").innerHTML = "Please Upload the Logo";
				return false;
			}
			if(frm.elements['peopleterms'].checked==false)
			{
				document.getElementById("errormsg").innerHTML = "Plese check  the terms and conditions";
				return false;
			}
		}
		var pepcat 		= document.getElementById('pepcat').value;
		var psername	= document.getElementById('psername').value;
		var peoindustry	= document.getElementById('peoindustry').value;
		var peocategory = document.getElementById('peocategory').value;
		var pfirstname	= document.getElementById('pfirstname').value;
		var lastname	= document.getElementById('lastname').value;
		var phomepage 	= document.getElementById('phomepage').value;
		var pblog 		= document.getElementById('pblog').value;
		var pphone 		= document.getElementById('pphone').value;
		var pemail 		= document.getElementById('pemail').value;
		var pcntry		= document.getElementById('pcntry').value;
		var pepstate 	= document.getElementById('pepstate').value;
		var pepcity 	= document.getElementById('pepcity').value;
		var pepzipcode	= document.getElementById('pepzipcode').value;
		var pepimgline	= document.getElementById('image_line').value;
		var poverview 	= document.getElementById('poverview').value;
		var ptags 		= document.getElementById('ptags').value;
		var compref		= document.getElementById('people_referedby').value;
		var refdesc		= document.getElementById('people_referdesc').value;
		var parameters	= "utype=people&pepcat="+pepcat+"&psername="+psername+"&peoindustry="+peoindustry+"&peocategory="+peocategory+"&pfirstname="+pfirstname+"&lastname="+lastname+"&phomepage="+phomepage+"&pblog="+pblog+"&pphone="+pphone+"&pemail="+pemail+"&pcntry="+pcntry+"&pepstate="+pepstate+"&pepcity="+pepcity+"&pepzipcode="+pepzipcode+"&ptags="+ptags+"&compref="+compref+"&refdesc="+refdesc+"&pepimgline="+pepimgline+"&poverview="+poverview;
		document.getElementById('RegistrationBox').innerHTML = '<br><br>Please wait while your information is being saved.<br> Do not press \'refresh\' or \'back button\' during the proces<br><br>';
		hajax(filepath+"signup_ajax",onSumResponseSignUp,parameters,'');
		return false;
	}
}
function onSumResponseSignUp(serverResponse,passedArgs) 
{
	document.getElementById('RegistrationBox').innerHTML = serverResponse;
}
function regfun2(frm,val)
{
	var cnt = 0;
	var av	= 0;
	var bx	= 0;
	for(i=0;i<frm.subscription.length;i++)
	{
		if(frm.subscription[i].checked == true)
		{
			frm.subtype.value = frm.subscription[i].id;
			frm.duration.value = frm.subscription[i].value;
			av++;
		}
	}
	for(i=0;i<frm.payoption.length;i++)
	{
		if(frm.payoption[i].checked == true)
		{
			frm.paymenttype.value = frm.payoption[i].value;
			bx++;
		}
	}
	if(av == 0)
	{
		document.getElementById("errormsg2").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'>&nbsp;Please Select the Subscription";
		return false;
	}
	if(frm.subtype.value != 'basic' && bx == 0)
	{
		document.getElementById("errormsg2").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'>&nbsp;Please Select the Payment Option";
		return false;
	}
	if(frm.subtype.value != 'basic' && frm.paymenttype.value == 'Credit Card')
	{
		if(frm.creditcard_type.value == '')
		{
			document.getElementById("errormsg2").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'>&nbsp;Please Select Credit Card Type";
			return false;
		}
		if(frm.firstname.value == '')
		{
			document.getElementById("errormsg2").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'>&nbsp;Please Enter First name on Card";
			return false;
		}
		if(frm.clastname.value == '')
		{
			document.getElementById("errormsg2").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'>&nbsp;Please Enter Last name on Card";
			return false;
		}
		if(frm.creditcard_no.value == '')
		{
			document.getElementById("errormsg2").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'>&nbsp;Please Enter Card Number";
			return false;
		}
		if(frm.cvv_num.value == '')
		{
			document.getElementById("errormsg2").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'>&nbsp;Please Enter CVV Number";
			return false;
		}
		if(frm.month.value == '')
		{
			document.getElementById("errormsg2").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'>&nbsp;Please Select Card Expiry Month";
			return false;
		}
		if(frm.year.value == '')
		{
			document.getElementById("errormsg2").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'>&nbsp;Please Select Card Expiry Year";
			return false;
		}
	}
	document.getElementById('hid_key').value = 'PostVal';
	return true;
}
//function for adding office for a company
function checkoffice(frm)
{
	if(document.forms['office1'].elements['office[phone]'].value == "")
	{
		document.getElementById("ophone").className = "chcolor";
		document.getElementById("ophonediv").innerHTML = "Please enter Phone Number";
		document.forms['office1'].elements['office[phone]'].focus();
		return;
	}
	else
	{
		document.getElementById("ophone").className = "chcolor1";
		document.getElementById("ophonediv").innerHTML = "";
	}
	if(document.forms['office1'].elements['office[email]'].value == "")
	{
		document.getElementById("oemail").className = "chcolor";
		document.getElementById("oemaildiv").innerHTML = "Please enter Email Address";
		document.forms['office1'].elements['office[email]'].focus();
		return;
	}
	else
	{
		document.getElementById("oemail").className = "chcolor1";
		document.getElementById("oemaildiv").innerHTML = "";
	}
	if(document.forms['office1'].elements['office[address1]'].value == "")
	{
		document.getElementById("oaddress1").className = "chcolor";
		document.getElementById("oaddress1div").innerHTML = "Please enter Address1";
		document.forms['office1'].elements['office[address1]'].focus();
		return;
	}
	else
	{
		document.getElementById("oaddress1").className = "chcolor1";
		document.getElementById("oaddress1div").innerHTML = "";
	}
	if(document.forms['office1'].elements['office[address2]'].value == "")
	{
		document.getElementById("oaddress2").className = "chcolor";
		document.getElementById("oaddress2div").innerHTML = "Please enter Address2";
		document.forms['office1'].elements['office[address2]'].focus();
		return;
	}
	else
	{
		document.getElementById("oaddress2").className = "chcolor1";
		document.getElementById("oaddress2div").innerHTML = "";
	}
	if(document.forms['office1'].elements['office[city]'].value == "")
	{
		document.getElementById("ocity").className = "chcolor";
		document.getElementById("ocitydiv").innerHTML = "Please enter City";
		document.forms['office1'].elements['office[city]'].focus();
		return;
	}
	else
	{
		document.getElementById("ocity").className = "chcolor1";
		document.getElementById("ocitydiv").innerHTML = "";
	}
	if(document.forms['office1'].elements['office[state]'].value == "")
	{
		document.getElementById("ostate").className = "chcolor";
		document.getElementById("ostatediv").innerHTML = "Please enter State";
		document.forms['office1'].elements['office[state]'].focus();
		return;
	}
	else
	{
		document.getElementById("ostate").className = "chcolor1";
		document.getElementById("ostatediv").innerHTML = "";
	}
	if(document.forms['office1'].elements['office[zipcode]'].value == "")
	{
		document.getElementById("ozipcode").className = "chcolor";
		document.getElementById("ozipcodediv").innerHTML = "Please enter Zipcode";
		document.forms['office1'].elements['office[zipcode]'].focus();
		return;
	}
	else
	{
		document.getElementById("ozipcode").className = "chcolor1";
		document.getElementById("ozipcodediv").innerHTML = "";
	}
	if(document.forms['office1'].elements['office[country]'].value == "")
	{
		document.getElementById("ocountry").className = "chcolor";
		document.getElementById("ofcountrydiv").innerHTML = "Please Select country";
		document.forms['office1'].elements['office[country]'].focus();
		return;
	}
	else
	{
		document.getElementById("ocountry").className = "chcolor1";
		document.getElementById("ofcountrydiv").innerHTML = "";
	}
	frm.editoffice.value="set";
	frm.submit();
}
//function for change password
function chpassfun(frm)
{
	if(frm.cpassword.value == "")
	{
		document.getElementById("cpassword").className = "chcolor";
		document.getElementById("cpdiv").innerHTML = "Please enter New Password";
		document.cpassword.focus();
		return;
	}
	else
	{
		document.getElementById("cpassword").className = "chcolor1";
		document.getElementById("cpdiv").innerHTML = "";
	}
	if(frm.ccpassword.value == "")
	{
		document.getElementById("ccpassword").className = "chcolor";
		document.getElementById("ccpdiv").innerHTML = "Please enter Confirm Password";
		document.cpassword.focus();
		return;
	}
	else
	{
		document.getElementById("ccpassword").className = "chcolor1";
		document.getElementById("ccpdiv").innerHTML = "";
	}
	if(frm.cpassword.value != frm.ccpassword.value)
	{
		document.getElementById("cpassword").className = "chcolor";
		document.getElementById("ccpassword").className = "chcolor";
		document.getElementById("ccpdiv").innerHTML = "Password Mismatch";
		document.ccpassword.focus();
		return;
	}
	else
	{
		document.getElementById("cpassword").className = "chcolor1";
		document.getElementById("ccpassword").className = "chcolor1";
		document.getElementById("ccpdiv").innerHTML = "";
	}	
	
	frm.chpasshid.value = "set";
	frm.submit();
}
//function for news post for a company
function newsfun(frm)
{
	if(document.forms['news'].elements['item[news_title]'].value == "")
	{
		document.getElementById("newstitle").className = "chcolor";
		document.getElementById("ntitlediv").innerHTML = "Please Enter NewsTitle";
		document.forms['news'].elements['item[news_title]'].focus();
		return;
	}
	else
	{
		document.getElementById("newstitle").className = "chcolor1";
		document.getElementById("ntitlediv").innerHTML = "";
	}
	if(document.forms['news'].elements['item[news_article]'].value == "")
	{
		document.getElementById("newsdescription").className = "chcolor";
		document.getElementById("ndescdiv").innerHTML = "Please Enter News Content";
		document.forms['news'].elements['item[news_article]'].focus();
		return;
	}
	else
	{
		document.getElementById("newsdescription").className = "chcolor1";
		document.getElementById("ndescdiv").innerHTML = "";
	}
	frm.submit();
}
//function for blogs post for a company
function blogfun(frm)
{
	if(document.forms['blogs'].elements['item[blog_title]'].value == "")
	{
		document.getElementById("blogtitle").className = "chcolor";
		document.getElementById("btitlediv").innerHTML = "Please Enter Blog Title";
		document.forms['blogs'].elements['item[blog_title]'].focus();
		return;
	}
	else
	{
		document.getElementById("blogtitle").className = "chcolor1";
		document.getElementById("btitlediv").innerHTML = "";
	}
	if(document.forms['blogs'].elements['item[blog_article]'].value == "")
	{
		document.getElementById("blogdescription").className = "chcolor";
		document.getElementById("bdescdiv").innerHTML = "Please Enter Blog Content";
		document.forms['blogs'].elements['item[blog_article]'].focus();
		return;
	}
	else
	{
		document.getElementById("blogdescription").className = "chcolor1";
		document.getElementById("bdescdiv").innerHTML = "";
	}
	frm.submit();
}
//function for articles post for a company
function articlefun(frm)
{
	if(document.forms['articles'].elements['item[article_title]'].value == "")
	{
		document.getElementById("articletitle").className = "chcolor";
		document.getElementById("atitlediv").innerHTML = "Please Enter Article Title";
		document.forms['articles'].elements['item[article_title]'].focus();
		return;
	}
	else
	{
		document.getElementById("articletitle").className = "chcolor1";
		document.getElementById("atitlediv").innerHTML = "";
	}
	if(document.forms['articles'].elements['item[article]'].value == "")
	{
		document.getElementById("articledescription").className = "chcolor";
		document.getElementById("adescdiv").innerHTML = "Please Enter Article Content";
		document.forms['articles'].elements['item[article]'].focus();
		return;
	}
	else
	{
		document.getElementById("articledescription").className = "chcolor1";
		document.getElementById("adescdiv").innerHTML = "";
	}
	frm.submit();
}
//function for jobs post for a company
function jobfun(frm)
{
	if(document.forms['jobs'].elements['item[job_title]'].value == "")
	{
		document.getElementById("jobtitle").className = "chcolor";
		document.getElementById("jtitlediv").innerHTML = "Please Blog Title";
		document.forms['jobs'].elements['item[job_title]'].focus();
		return;
	}
	else
	{
		document.getElementById("jobtitle").className = "chcolor1";
		document.getElementById("jtitlediv").innerHTML = "";
	}
	if(document.forms['jobs'].elements['item[job_exp]'].value == "")
	{
		document.getElementById("jobexp").className = "chcolor";
		document.getElementById("jexpdiv").innerHTML = "Please Blog Title";
		document.forms['jobs'].elements['item[job_exp]'].focus();
		return;
	}
	else
	{
		document.getElementById("jobexp").className = "chcolor1";
		document.getElementById("jexpdiv").innerHTML = "";
	}
	if(document.forms['jobs'].elements['item[job_location]'].value == "")
	{
		document.getElementById("joblocation").className = "chcolor";
		document.getElementById("jlocationdiv").innerHTML = "Please Blog Title";
		document.forms['jobs'].elements['item[job_location]'].focus();
		return;
	}
	else
	{
		document.getElementById("joblocation").className = "chcolor1";
		document.getElementById("jlocationdiv").innerHTML = "";
	}
	if(document.forms['jobs'].elements['item[primary_skills]'].value == "")
	{
		document.getElementById("jobskills").className = "chcolor";
		document.getElementById("jskillsdiv").innerHTML = "Please Blog Title";
		document.forms['jobs'].elements['item[primary_skills]'].focus();
		return;
	}
	else
	{
		document.getElementById("jobskills").className = "chcolor1";
		document.getElementById("jskillsdiv").innerHTML = "";
	}
	if(document.forms['jobs'].elements['item[job_description]'].value == "")
	{
		document.getElementById("jobdescription").className = "chcolor";
		document.getElementById("jdescdiv").innerHTML = "Please Enter Blog Content";
		document.forms['jobs'].elements['item[job_description]'].focus();
		return;
	}
	else
	{
		document.getElementById("jobdescription").className = "chcolor1";
		document.getElementById("jdescdiv").innerHTML = "";
	}
	frm.submit();
}
function cleardate(fid)
{
	var field=document.getElementById('fid');
	field.value = '';
	return false;
}
//edit my account function
function editmyaccountfun(frm)
{
	if(document.forms['editoverview'].elements['people[firstname]'].value == "")
	{
		document.getElementById("pfirstname").className = "chcolor";
		document.getElementById("fnamediv").innerHTML = "Please Enter First Name";
		document.forms['editoverview'].elements['people[firstname]'].focus();
		return;
	}
	else
	{
		document.getElementById("pfirstname").className = "chcolor1";
		document.getElementById("fnamediv").innerHTML = "";
	}
	if(document.forms['editoverview'].elements['people[lastname]'].value == "")
	{
		document.getElementById("plastname").className = "chcolor";
		document.getElementById("lnamediv").innerHTML = "Please Enter Last Name";
		document.forms['editoverview'].elements['people[lastname]'].focus();
		return;
	}
	else
	{
		document.getElementById("plastname").className = "chcolor1";
		document.getElementById("lnamediv").innerHTML = "";
	}
	if(document.forms['editoverview'].elements['people[phone]'].value == "")
	{
		document.getElementById("pphone").className = "chcolor";
		document.getElementById("pphonediv").innerHTML = "Please Enter Valid Phone Number";
		document.forms['editoverview'].elements['people[phone]'].focus();
		return;
	}
	else
	{
		document.getElementById("pphone").className = "chcolor1";
		document.getElementById("pphonediv").innerHTML = "";	
	}
	if(document.forms['editoverview'].elements['people[designation]'].value == "")
	{
		document.getElementById("pdesignation").className = "chcolor";
		document.getElementById("pdesignationdiv").innerHTML = "Please Enter Designation of the employee";
		document.forms['editoverview'].elements['people[designation]'].focus();
		return;
	}
	else
	{
		document.getElementById("pdesignation").className = "chcolor1";
		document.getElementById("pdesignationdiv").innerHTML = "";	
	}
	frm.mayaccounthid.value ="set";
	frm.submit();
}
//add people to company function
function checkpeople(frm)
{
	if(document.forms['cpeople'].elements['people[firstname]'].value == "")
	{
		document.getElementById("cpfirstname").className = "chcolor";
		document.getElementById("cpfirstnamediv").innerHTML = "Please Enter First Name";
		document.forms['cpeople'].elements['people[firstname]'].focus();
		return;
	}
	else
	{
		document.getElementById("cpfirstname").className = "chcolor1";
		document.getElementById("cpfirstnamediv").innerHTML = "";
	}
	if(document.forms['cpeople'].elements['people[lastname]'].value == "")
	{
		document.getElementById("cplastname").className = "chcolor";
		document.getElementById("cplastnamediv").innerHTML = "Please Enter Last Name";
		document.forms['cpeople'].elements['people[lastname]'].focus();
		return;
	}
	else
	{
		document.getElementById("cplastname").className = "chcolor1";
		document.getElementById("cplastnamediv").innerHTML = "";
	}
	if(document.forms['cpeople'].elements['people[phone]'].value == "")
	{
		document.getElementById("cpphone").className = "chcolor";
		document.getElementById("cpphonediv").innerHTML = "Please Enter Valid Phone Number";
		document.forms['cpeople'].elements['people[phone]'].focus();
		return;
	}
	else
	{
		document.getElementById("cpphone").className = "chcolor1";
		document.getElementById("cpphonediv").innerHTML = "";	
	}
	if(document.forms['cpeople'].elements['people[company_mailid]'].value == "")
	{
		document.getElementById("cpemail").className = "chcolor";
		document.getElementById("cpemaildiv").innerHTML = "Please Enter Valid Phone Number";
		document.forms['cpeople'].elements['people[phone]'].focus();
		return;
	}
	else
	{
		document.getElementById("cpemail").className = "chcolor1";
		document.getElementById("cpemaildiv").innerHTML = "";	
	}
	if(document.forms['cpeople'].elements['people[designation]'].value == "")
	{
		document.getElementById("cpdesignation").className = "chcolor";
		document.getElementById("cpdesignationdiv").innerHTML = "Please Enter Designation of the employee";
		document.forms['cpeople'].elements['people[designation]'].focus();
		return;
	}
	else
	{
		document.getElementById("cpdesignation").className = "chcolor1";
		document.getElementById("cpdesignationdiv").innerHTML = "";	
	}
	frm.submit();
}
//edit company people
function editcompanypeople(frm)
{
	if(document.forms['editcpeople'].elements['cpeople[firstname]'].value == "")
	{
		document.getElementById("cpefirstname").className = "chcolor";
		document.getElementById("cpefirstnamediv").innerHTML = "Please Enter First Name";
		document.forms['editcpeople'].elements['cpeople[firstname]'].focus();
		return;
	}
	else
	{
		document.getElementById("cpefirstname").className = "chcolor1";
		document.getElementById("cpefirstnamediv").innerHTML = "";
	}
	if(document.forms['editcpeople'].elements['cpeople[lastname]'].value == "")
	{
		document.getElementById("cpelastname").className = "chcolor";
		document.getElementById("cpelastnamediv").innerHTML = "Please Enter Last Name";
		document.forms['editcpeople'].elements['cpeople[lastname]'].focus();
		return;
	}
	else
	{
		document.getElementById("cpelastname").className = "chcolor1";
		document.getElementById("cpelastnamediv").innerHTML = "";
	}
	if(document.forms['editcpeople'].elements['cpeople[phone]'].value == "")
	{
		document.getElementById("cpephone").className = "chcolor";
		document.getElementById("cpephonediv").innerHTML = "Please Enter Valid Phone Number";
		document.forms['editcpeople'].elements['cpeople[phone]'].focus();
		return;
	}
	else
	{
		document.getElementById("cpephone").className = "chcolor1";
		document.getElementById("cpephonediv").innerHTML = "";	
	}
	if(document.forms['editcpeople'].elements['cpeople[designation]'].value == "")
	{
		document.getElementById("cpedesignation").className = "chcolor";
		document.getElementById("cpedesignationdiv").innerHTML = "Please Enter Designation of the employee";
		document.forms['editcpeople'].elements['cpeople[designation]'].focus();
		return;
	}
	else
	{
		document.getElementById("cpedesignation").className = "chcolor1";
		document.getElementById("cpedesignationdiv").innerHTML = "";	
	}
	frm.editpeoplehid.value = "set";
	frm.submit();
}
//Products
function checkproduct(frm)
{
	if(document.forms['cproduct'].elements['product[product_name]'].value == "")
	{
		document.getElementById("producttitle").className = "chcolor";
		document.getElementById("producttitlediv").innerHTML = "Please Enter Product Title";
		document.forms['cproduct'].elements['product[product_name]'].focus();
		return;
	}
	else
	{
		document.getElementById("producttitle").className = "chcolor1";
		document.getElementById("producttitlediv").innerHTML = "";	
	}
	if(document.forms['cproduct'].elements['product[stage]'].value == "")
	{
		document.getElementById("productstage").className = "chcolor";
		document.getElementById("productstagediv").innerHTML = "Please Enter Product Title";
		document.forms['cproduct'].elements['product[stage]'].focus();
		return;
	}
	else
	{
		document.getElementById("productstage").className = "chcolor1";
		document.getElementById("productstagediv").innerHTML = "";	
	}
	if(document.forms['cproduct'].elements['product[homepage_url]'].value == "")
	{
		document.getElementById("producthomepage").className = "chcolor";
		document.getElementById("producthomepagediv").innerHTML = "Please Sekect Product Stage";
		document.forms['cproduct'].elements['product[homepage_url]'].focus();
		return;
	}
	else
	{
		document.getElementById("producthomepage").className = "chcolor1";
		document.getElementById("producthomepagediv").innerHTML = "";	
	}
	if(document.forms['cproduct'].elements['product[homepage_url]'].value == "")
	{
		document.getElementById("producthomepage").className = "chcolor";
		document.getElementById("producthomepagediv").innerHTML = "Please Enter Product Home page URL";
		document.forms['cproduct'].elements['product[homepage_url]'].focus();
		return;
	}
	else
	{
		document.getElementById("producthomepage").className = "chcolor1";
		document.getElementById("producthomepagediv").innerHTML = "";	
	}
	if(document.forms['cproduct'].elements['product[launched_date]'].value == "")
	{
		document.getElementById("date_from").className = "chcolor";
		document.getElementById("date_fromdiv").innerHTML = "Please Enter Product Launched Date";
		document.forms['cproduct'].elements['product[launched_date]'].focus();
		return;
	}
	else
	{
		document.getElementById("date_from").className = "chcolor1";
		document.getElementById("date_fromdiv").innerHTML = "";	
	}
	if(document.forms['cproduct'].elements['product[deadpooled_date]'].value == "")
	{
		document.getElementById("deadpooled_date").className = "chcolor";
		document.getElementById("deadpooled_datediv").innerHTML = "Please Enter Product Deadpool Date";
		document.forms['cproduct'].elements['product[deadpooled_date]'].focus();
		return;
	}
	else
	{
		document.getElementById("deadpooled_date").className = "chcolor1";
		document.getElementById("deadpooled_datediv").innerHTML = "";	
	}
	if(document.forms['cproduct'].elements['product[product_description]'].value == "")
	{
		document.getElementById("productdescription").className = "chcolor";
		document.getElementById("productdescriptiondiv").innerHTML = "Please Enter Product Description";
		document.forms['cproduct'].elements['product[product_description]'].focus();
		return;
	}
	else
	{
		document.getElementById("productdescription").className = "chcolor1";
		document.getElementById("productdescriptiondiv").innerHTML = "";	
	}
	frm.submit();
}
//Edit Products
function checkeditproduct(frm)
{
	if(document.forms['cproduct'].elements['product[product_name]'].value == "")
	{
		document.getElementById("producttitle").className = "chcolor";
		document.getElementById("producttitlediv").innerHTML = "Please Enter Product Title";
		document.forms['cproduct'].elements['product[product_name]'].focus();
		return;
	}
	else
	{
		document.getElementById("producttitle").className = "chcolor1";
		document.getElementById("producttitlediv").innerHTML = "";	
	}
	if(document.forms['cproduct'].elements['product[stage]'].value == "")
	{
		document.getElementById("productstage").className = "chcolor";
		document.getElementById("productstagediv").innerHTML = "Please Enter Product Title";
		document.forms['cproduct'].elements['product[stage]'].focus();
		return;
	}
	else
	{
		document.getElementById("productstage").className = "chcolor1";
		document.getElementById("productstagediv").innerHTML = "";	
	}
	if(document.forms['cproduct'].elements['product[homepage_url]'].value == "")
	{
		document.getElementById("producthomepage").className = "chcolor";
		document.getElementById("producthomepagediv").innerHTML = "Please Sekect Product Stage";
		document.forms['cproduct'].elements['product[homepage_url]'].focus();
		return;
	}
	else
	{
		document.getElementById("producthomepage").className = "chcolor1";
		document.getElementById("producthomepagediv").innerHTML = "";	
	}
	if(document.forms['cproduct'].elements['product[homepage_url]'].value == "")
	{
		document.getElementById("producthomepage").className = "chcolor";
		document.getElementById("producthomepagediv").innerHTML = "Please Enter Product Home page URL";
		document.forms['cproduct'].elements['product[homepage_url]'].focus();
		return;
	}
	else
	{
		document.getElementById("producthomepage").className = "chcolor1";
		document.getElementById("producthomepagediv").innerHTML = "";	
	}
	if(document.forms['cproduct'].elements['product[launched_date]'].value == "")
	{
		document.getElementById("date_from").className = "chcolor";
		document.getElementById("date_fromdiv").innerHTML = "Please Enter Product Launched Date";
		document.forms['cproduct'].elements['product[launched_date]'].focus();
		return;
	}
	else
	{
		document.getElementById("date_from").className = "chcolor1";
		document.getElementById("date_fromdiv").innerHTML = "";	
	}
	if(document.forms['cproduct'].elements['product[deadpooled_date]'].value == "")
	{
		document.getElementById("deadpooled_date").className = "chcolor";
		document.getElementById("deadpooled_datediv").innerHTML = "Please Enter Product Deadpool Date";
		document.forms['cproduct'].elements['product[deadpooled_date]'].focus();
		return;
	}
	else
	{
		document.getElementById("deadpooled_date").className = "chcolor1";
		document.getElementById("deadpooled_datediv").innerHTML = "";	
	}
	if(document.forms['cproduct'].elements['product[product_description]'].value == "")
	{
		document.getElementById("productdescription").className = "chcolor";
		document.getElementById("productdescriptiondiv").innerHTML = "Please Enter Product Description";
		document.forms['cproduct'].elements['product[product_description]'].focus();
		return;
	}
	else
	{
		document.getElementById("productdescription").className = "chcolor1";
		document.getElementById("productdescriptiondiv").innerHTML = "";	
	}
	frm.editproduct.value = "set";
	frm.submit();
}
//Milestones
function checkmilestone(frm)
{
	if(document.forms['cmilestone'].elements['milestones[mdate]'].value == "")
	{
		document.getElementById("mdate").className = "chcolor";
		document.getElementById("mdate_div").innerHTML = "Please Enter Date";
		document.forms['cmilestone'].elements['milestones[mdate]'].focus();
		return;
	}
	else
	{
		document.getElementById("mdate").className = "chcolor1";
		document.getElementById("mdate_div").innerHTML = "";	
	}
	if(document.forms['cmilestone'].elements['milestones[source_title]'].value == "")
	{
		document.getElementById("sourcetitle").className = "chcolor";
		document.getElementById("sourcetitlediv").innerHTML = "Please Source Title";
		document.forms['cmilestone'].elements['milestones[source_title]'].focus();
		return;
	}
	else
	{
		document.getElementById("sourcetitle").className = "chcolor1";
		document.getElementById("sourcetitlediv").innerHTML = "";	
	}
	if(document.forms['cmilestone'].elements['milestones[source_url]'].value == "")
	{
		document.getElementById("sourceurl").className = "chcolor";
		document.getElementById("sourceurldiv").innerHTML = "Please Source URL";
		document.forms['cmilestone'].elements['milestones[source_url]'].focus();
		return;
	}
	else
	{
		document.getElementById("sourceurl").className = "chcolor1";
		document.getElementById("sourceurldiv").innerHTML = "";	
	}
	if(document.forms['cmilestone'].elements['milestones[description]'].value == "")
	{
		document.getElementById("milestonedescription").className = "chcolor";
		document.getElementById("descriptiondiv").innerHTML = "Please Enter Description";
		document.forms['cmilestone'].elements['milestones[description]'].focus();
		return;
	}
	else
	{
		document.getElementById("milestonedescription").className = "chcolor1";
		document.getElementById("descriptiondiv").innerHTML = "";	
	}
	frm.addmilestones.value = "set";
	frm.editmilestone.value = "set";
	frm.submit();
}
//Edit Milestones
function checkmilestone(frm)
{
	if(document.forms['cmilestone'].elements['milestones[mdate]'].value == "")
	{
		document.getElementById("mdate").className = "chcolor";
		document.getElementById("mdate_div").innerHTML = "Please Enter Date";
		document.forms['cmilestone'].elements['milestones[mdate]'].focus();
		return;
	}
	else
	{
		document.getElementById("mdate").className = "chcolor1";
		document.getElementById("mdate_div").innerHTML = "";	
	}
	if(document.forms['cmilestone'].elements['milestones[source_title]'].value == "")
	{
		document.getElementById("sourcetitle").className = "chcolor";
		document.getElementById("sourcetitlediv").innerHTML = "Please Source Title";
		document.forms['cmilestone'].elements['milestones[source_title]'].focus();
		return;
	}
	else
	{
		document.getElementById("sourcetitle").className = "chcolor1";
		document.getElementById("sourcetitlediv").innerHTML = "";	
	}
	if(document.forms['cmilestone'].elements['milestones[source_url]'].value == "")
	{
		document.getElementById("sourceurl").className = "chcolor";
		document.getElementById("sourceurldiv").innerHTML = "Please Source URL";
		document.forms['cmilestone'].elements['milestones[source_url]'].focus();
		return;
	}
	else
	{
		document.getElementById("sourceurl").className = "chcolor1";
		document.getElementById("sourceurldiv").innerHTML = "";	
	}
	if(document.forms['cmilestone'].elements['milestones[description]'].value == "")
	{
		document.getElementById("milestonedescription").className = "chcolor";
		document.getElementById("descriptiondiv").innerHTML = "Please Enter Description";
		document.forms['cmilestone'].elements['milestones[description]'].focus();
		return;
	}
	else
	{
		document.getElementById("milestonedescription").className = "chcolor1";
		document.getElementById("descriptiondiv").innerHTML = "";	
	}
	frm.editmilestone.value = "set";
	frm.submit();
}
//hide and display comments
function toggle_display(id){
	if(document.getElementById(id).style.display=='')
	{
		document.getElementById(id).style.display='none';
		document.getElementById(id+"_text").innerHTML='View';
	}
	else
	{
		document.getElementById(id).style.display='';
		document.getElementById(id+"_text").innerHTML='Hide';
	}
}

//to hide and display reporspam text boxes
function toggle_spam(id){
	if(document.getElementById("spam"+id).style.display=='')
		document.getElementById("spam"+id).style.display='none';
	else
		document.getElementById("spam"+id).style.display='';
}

function submit_spam(frm,id){	
	var spam_text="spam_text"+id;
	if(document.getElementById('spam_text').value==""){
		alert("Please specify spam text");
		document.getElementById('spam_text').focus();		
		return;
	}else	{	
		frm.commentid.value=id;
		frm.submit();	
	}
}

function checkIt(frm)
{
	if(frm.comment.value == "")
	{
			alert("Please enter comment text.");
			frm.comment.focus();
			return;
	}
	frm.submit();
}

function showdetails(id){		
	if(document.layers)	{		
		document.getElementById("layer1").style.visibility='show';
	}else{		
		document.getElementById("layer1").style.visibility='visible';
	}
	document.getElementById("place_details").innerHTML=document.getElementById("details"+id).value;	
}

function closewindow(){
	if(document.layers)	{		
		document.getElementById("layer1").style.visibility='hide';
	}else{		
		document.getElementById("layer1").style.visibility='hidden';
	}
}
/*********************** To Get the States *******************************/
function createXMLHttpRequest()
{
	try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
	try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
	try { return new XMLHttpRequest(); } catch(e) {}
	alert("XMLHttpRequest not supported");
	return null;
}
var xhReq = createXMLHttpRequest();
// Function for the States Select Box
var statdiv;
function selectcount(val,did,elid,cdiv,cid)
{
	document.getElementById('country_code').value = val;
	statdiv = did;
	xhReq.open("GET", "ajax_functions?fips="+val+"&did="+did+"&id="+elid+"&cdiv="+cdiv+"&cid="+cid, true);
	xhReq.onreadystatechange = onSumResponse1;
	xhReq.send(null);
}	
function onSumResponse1() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	var cell = document.getElementById(statdiv);
	cell.innerHTML = serverResponse;
}
function GetStateCities(val,did,elid)
{
	var cntval = document.getElementById('country_code').value;
	statdiv = did;
	xhReq.open("GET", "ajax_functions?statecode="+val+"&did="+did+"&id="+elid+"&cntval="+cntval, true);
	xhReq.onreadystatechange = onSumResponseCity;
	xhReq.send(null);
}	
function onSumResponseCity() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	var cell = document.getElementById(statdiv);
	cell.innerHTML = serverResponse;
}
//if company name exists
function checkcompany()
{
	var cval = document.getElementById('cccountry').value;
	var val = document.getElementById('companyname').value;
	if(val!='') { 
	xhReq.open("GET", "ajax_functions?comp="+val+"&cval="+cval, true);
	xhReq.onreadystatechange = onSumResponsecompany;
	xhReq.send(null); }
}
function onSumResponsecompany() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	if(serverResponse.indexOf('not') == '-1')
		document.getElementById('SubBtn').disabled = false;
	else
		document.getElementById('SubBtn').disabled = true;
	document.getElementById("compname").innerHTML = serverResponse;
	checkciurl();
}
//if company name exists
function checkcompanyajax(val)
{
	var cval = document.getElementById('comcntry').value;
	if(val!='') { 
	xhReq.open("GET", "ajax_functions?comp="+val+"&cval="+cval, true);
	xhReq.onreadystatechange = onSumResponsecompanyajax;
	xhReq.send(null); }
}
function onSumResponsecompanyajax() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	document.getElementById("comname").innerHTML = serverResponse;
	checkciurl();
}
/*********** To Check & Confirm the Available Url of the Company *********/
function checkciurl()
{
	var urlval = document.getElementById('companyname').value;
	if(urlval!='') { 
	xhReq.open("GET", "ajax_functions?urlval="+urlval, true);
	xhReq.onreadystatechange = onSumResponseCIURL;
	xhReq.send(null); }
}
function onSumResponseCIURL() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	if(serverResponse.indexOf('Already') == '-1')
		document.getElementById('SubBtn').disabled = false;
	else
		document.getElementById('SubBtn').disabled = true;
	document.getElementById("ciurldiv").innerHTML = serverResponse;
}
//if company mail exists
function checkcompanyemail(val)
{
	if(val!='') { 
	xhReq.open("GET", "ajax_functions?emailcom="+val, true);
	xhReq.onreadystatechange = onSumResponsecomemail;
	xhReq.send(null); }
}
function onSumResponsecomemail() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	if(serverResponse.indexOf('not') == '-1')
		document.getElementById('SubBtn').disabled = false;
	else
		document.getElementById('SubBtn').disabled = true;
	document.getElementById("compemail").innerHTML = serverResponse;
}
//if people mail exists
function checkpepemail(val)
{
	var cell = document.getElementById("pepemail");	
	xhReq.open("GET", "ajax_functions?pemail="+val, true);
	xhReq.onreadystatechange = onSumResponsepep;
	xhReq.send(null);
}
function onSumResponsepep() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	var cell = document.getElementById("pepemail");
	if(serverResponse.indexOf('not') == '-1')
		document.getElementById('SubBtn').disabled = false;
	else
		document.getElementById('SubBtn').disabled = true;
	cell.innerHTML = serverResponse;
}
//if Customer mail exists
function checkcustemail(val)
{
	var cell = document.getElementById("custemaildiv");	
	xhReq.open("GET", "ajax_functions?custemail="+val, true);
	xhReq.onreadystatechange = onSumResponseCust;
	xhReq.send(null);
}
function onSumResponseCust() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	var cell = document.getElementById("custemaildiv");
	if(serverResponse.indexOf('not') == '-1')
		document.getElementById('SubBtn').disabled = false;
	else
		document.getElementById('SubBtn').disabled = true;
	cell.innerHTML = serverResponse;
}
//function to highlight the required field
function signup_HL(focusedid,hidval,tothidval)
{
	var reqfields = document.getElementById(hidval).value;
	var allfields = document.getElementById(tothidval).value;
	
	var totarr = new Array()
	var reqarr = new Array();

	totarr = allfields.split(",");
	reqarr = reqfields.split(",");
	var totlen = totarr.length;	
	var reqlen = reqarr.length;
	
	for(var i=0;i<totlen;i++)
	{
		//alert(totarr[i]);
		if(document.getElementById(totarr[i]).value == "" && totarr[i] != focusedid)
		{
			if(in_array(totarr[i], reqarr))
			{
				//alert(totarr[i]);
				document.getElementById(totarr[i]).className = "chcolor";
			}
		}
		else if(totarr[i] == focusedid)
		{
			document.getElementById(totarr[i]).className = "normaltextfield1";
			break;
		}
		else if(document.getElementById(totarr[i]).value != "")
			document.getElementById(totarr[i]).className = "normaltextfield1";
		
	}
}
//function to highlight the required field
function event_date(focusedid,hidval,tothidval)
{
	//alert(focusedid);
	//alert(document.getElementById(focusedid).value);
	var reqfields = document.getElementById(hidval).value;
	var allfields = document.getElementById(tothidval).value;
	
	var totarr = new Array()
	var reqarr = new Array();

	totarr = allfields.split(",");
	reqarr = reqfields.split(",");
	var totlen = totarr.length;	
	var reqlen = reqarr.length;
	
	for(var i=0;i<totlen;i++)
	{
		//alert(totarr[i]);
		if(document.getElementById(totarr[i]).value == "" && totarr[i] != focusedid)
		{
			
			if(in_array(totarr[i], reqarr))
			{
				//alert(totarr[i]);
				document.getElementById(totarr[i]).className = "chcolor";
			}
		}
		else if(totarr[i] == focusedid)
		{
			document.getElementById(totarr[i]).className = "normaltextfield1";
			break;
		}
		else if(document.getElementById(totarr[i]).value != "")
			document.getElementById(totarr[i]).className = "normaltextfield1";
		
	}
}


function in_array(string, array)  
{  
	for (i = 0; i < array.length; i++)  
	{  
		if(array[i] == string)  
		{  
			return true;  
		}
	}  
	return false;  
}  
// Function To Display the company details
function ShowcompanyDetails(id,type)
{
	if(type == 'expand')
	{
		document.getElementById('CompanyFullview'+id).style.display = '';
		document.getElementById('CompanyShortview'+id).style.display = 'none';
	}
	else if(type == 'collapse')
	{
		document.getElementById('CompanyFullview'+id).style.display = 'none';
		document.getElementById('CompanyShortview'+id).style.display = '';
	}
}
// Function ToDisplay the Full View of the Milestones
function ShowMiles(id,type)
{
	if(type == 'expand')
	{
		document.getElementById('MilesFullview'+id).style.display = '';
		document.getElementById('MilesShortview'+id).style.display = 'none';
	}
	else if(type == 'collapse')
	{
		document.getElementById('MilesFullview'+id).style.display = 'none';
		document.getElementById('MilesShortview'+id).style.display = '';
	}
}
// Function To Display all The News 
function ShowAllMiles(num)
{
	var frm=document.CmilesForm;
	var i;
	for (i=1;i<=num;i++)
	{
		if (frm.viewtype.value == "listview")
		{
			document.getElementById('MilesShortview'+i).style.display = '';
			document.getElementById('MilesFullview'+i).style.display = 'none';
		}
		else if (frm.viewtype.value == "detailview")
		{
			document.getElementById('MilesShortview'+i).style.display = 'none';
			document.getElementById('MilesFullview'+i).style.display = '';
		}
	}
}
// Function ToDisplay the Full View of the Jobs
function ShowJobs(id,type)
{
	if(type == 'expand')
	{
		document.getElementById('JobsFullview'+id).style.display = '';
		document.getElementById('JobsShortview'+id).style.display = 'none';
	}
	else if(type == 'collapse')
	{
		document.getElementById('JobsFullview'+id).style.display = 'none';
		document.getElementById('JobsShortview'+id).style.display = '';
	}
}
// Function To Display all The Jobs 
function ShowAlljobs(num)
{
	var frm=document.CjobsForm;
	for (i=1;i<=10;i++)
	{
		if(document.getElementById('viewtype').value == "listview")
		{
			document.getElementById('JobsShortview'+i).style.display = '';
			document.getElementById('JobsFullview'+i).style.display = 'none';
		}
		else if(document.getElementById('viewtype').value == "detailview")
		{
			document.getElementById('JobsShortview'+i).style.display = 'none';
			document.getElementById('JobsFullview'+i).style.display = '';
		}
	}
}
// Function ToDisplay the Full View of the Products
function ShowProducts(id,type)
{
	if(type == 'expand')
	{
		document.getElementById('ProductsFullview'+id).style.display = '';
		document.getElementById('ProductsShortview'+id).style.display = 'none';
	}
	else if(type == 'collapse')
	{
		document.getElementById('ProductsFullview'+id).style.display = 'none';
		document.getElementById('ProductsShortview'+id).style.display = '';
	}
}
// Function To Display all The Products 
function ShowAllProducts(num)
{
	var frm=document.CproductsForm;
	var i;
	for (i=1;i<=num;i++)
	{
		if (frm.viewtype.value == "listview")
		{
			document.getElementById('ProductsShortview'+i).style.display = '';
			document.getElementById('ProductsFullview'+i).style.display = 'none';
		}
		else if (frm.viewtype.value == "detailview")
		{
			document.getElementById('ProductsShortview'+i).style.display = 'none';
			document.getElementById('ProductsFullview'+i).style.display = '';
		}
	}
}
// Function to post Inquiry for the Products
function fnPostInquiry(id,type)
{
	if(type == 'expand')
		document.getElementById('InquiryRow'+id).style.display = '';
	else
	{
		document.getElementById('inquiry'+id).value = '';
		document.getElementById('InquiryRow'+id).style.display = 'none';
	}
}
// Function To Submit the Inquiry For the Products
function fnSendInquiry(id)
{
	var frm=document.CproductsForm;
	if(document.getElementById('frommail'+id).value == '')
	{
		alert("Please Enter From E-Mail Address");
		document.getElementById('frommail'+id).focus();
		return;
	}
	if(!isValidEmailAlert(frm.elements['frommail'+id],"Email"))
	return;
	if(document.getElementById('inquiry'+id).value == '')
	{
		alert("Please Enter Message to send Inquiry");
		document.getElementById('inquiry'+id).focus();
		return;
	}
	frm.keyword.value = 'sendinq';
	frm.cpid.value = id;
	frm.submit();
}
// Function To Submit the Inquiry For the Products
function fnSendInquiryproducts(id)
{
	var frm=document.frmproducts;
	if(document.getElementById('frommail'+id).value == '')
	{
		alert("Please Enter From E-Mail Address");
		document.getElementById('frommail'+id).focus();
		return;
	}
	if(!isValidEmailAlert(frm.elements['frommail'+id],"Email"))
	return;
	if(document.getElementById('inquiry'+id).value == '')
	{
		alert("Please Enter Message to send Inquiry");
		document.getElementById('inquiry'+id).focus();
		return;
	}
	frm.keyword.value = 'sendinquiry';
	frm.cpid.value = id;
	frm.submit();
}

// Function To Display the Full View of the Alliances
function ShowAlliance(id,type)
{
	if(type == 'expand')
	{
		document.getElementById('AllianceFullview'+id).style.display = '';
		document.getElementById('AllianceShortview'+id).style.display = 'none';
	}
	else if(type == 'collapse')
	{
		document.getElementById('AllianceFullview'+id).style.display = 'none';
		document.getElementById('AllianceShortview'+id).style.display = '';
	}
}
// Function To Display all The Products 
function ShowAllAlliances(num)
{
	var frm=document.CallianceForm;
	var i;
	for (i=1;i<=num;i++)
	{
		if (frm.viewtype.value == "listview")
		{
			document.getElementById('AllianceShortview'+i).style.display = '';
			document.getElementById('AllianceFullview'+i).style.display = 'none';
		}
		else if (frm.viewtype.value == "detailview")
		{
			document.getElementById('AllianceShortview'+i).style.display = 'none';
			document.getElementById('AllianceFullview'+i).style.display = '';
		}
	}
}
//Function to Jobalerts
function fnCheckJobalert()
  {
	   var frm=document.alertsform;
	   frm.jobalert.value = "sendalert";
	   return true;
  }
  //Function for the detailed view of finance details
 function ShowDetails(id,type)
{
	if(type == 'expand')
	{
		document.getElementById('FinancialFullview'+id).style.display = '';
		document.getElementById('FinancialShortview'+id).style.display = 'none';
	}
	else if(type == 'collapse')
	{
		document.getElementById('FinancialFullview'+id).style.display = 'none';
		document.getElementById('FinancialShortview'+id).style.display = '';
	}
} 
//Function for the detailed view of investor details
function ShowInvestorDetails(id,type)
{
	if(type == 'expand')
	{
		document.getElementById('InvestorFullview'+id).style.display = '';
		document.getElementById('InvestorShortview'+id).style.display = 'none';
	}
	else if(type == 'collapse')
	{
		document.getElementById('InvestorFullview'+id).style.display = 'none';
		document.getElementById('InvestorShortview'+id).style.display = '';
	}
}
//Function for the detailed view of competitor details
function ShowCompDetails(id,type)
{
	if(type == 'expand')
	{
		document.getElementById('CompFullview'+id).style.display = '';
		document.getElementById('CompShortview'+id).style.display = 'none';
	}
	else if(type == 'collapse')
	{
		document.getElementById('CompFullview'+id).style.display = 'none';
		document.getElementById('CompShortview'+id).style.display = '';
	}
}
/*************** Function to Search Records By Keyword (Selected) ***********/
function searchbyword(word,frm,page)
{
	frm.keyword.value='';
	frm.keywrd.value=word;
	if(page == 'articles' || page == 'blogs' || page == 'news' || page == 'companies')
		frm.action=filepath+page+'/view/';
	else if(page == 'events')
		frm.action=filepath+'events/list/';
	else if(page == 'jobs' || page == 'peoples' || page == 'products')
		frm.action=filepath+page+'/';
	else if(page == 'buy' || page == 'sell')
		frm.action=filepath+'services/'+page+'/';
	frm.submit();
}
/**************** Function for the Gallery Photos *****************/
var xhReq1 = createXMLHttpRequest();
function fnGetImage(id,cid,type)
{
	document.getElementById("anchordiv").innerHTML = '';
	document.getElementById("photodiv").innerHTML = '<table width="100%" border="0"cellspacing="0" cellpadding="5" height="430px"><tr><td valign="middle"><img src="'+imagepath_cal+'/loading2.gif" width="32" height="32"></td></tr></table>';
	xhReq1.open("GET", "ajax_functions?photo_id="+id+"&comid="+cid+"&type="+type, true);
	xhReq1.onreadystatechange = onimgSumResponse;
	xhReq1.send(null);	
}
function onimgSumResponse() 
{
	if (xhReq1.readyState != 4)  { return; }
	var serverResponse = xhReq1.responseText;
	var arr = serverResponse.split('#@#');
	document.getElementById("photodiv").innerHTML = arr[0];
	document.getElementById("anchordiv").innerHTML = arr[1];
}
/************** Function for the Events Page (Calender View) ***************/
function calchange(ac,y,m)
{
	frm = document.frmCalevents;
	frm.act.value = ac;
	frm.year.value = y;
	frm.month.value = m;
	frm.submit();
}
/********** Function to Display the Events in List View From the Calender *******/
function fnGetEvents(date,page,cid)
{
	frm = document.frmCalevents;
	frm.eventdate.value=date;
	if(page=='')
		frm.action = filepath+'events/list/';
	else
		frm.action = filepath+'company/'+cid+'/events/list/';
	frm.submit();
}
/*********** Function to Change the Categories in Home Page Left Side **********/
var xhReq2 = createXMLHttpRequest();
function fnChangeType(type)
{
	if(type == 'C')
	{
		document.getElementById('BrowseBtn1').src = imagepath_cal+'/companies_on.gif';
		document.getElementById('BrowseBtn2').src = imagepath_cal+'/people_off.gif';
	}
	else if(type == 'P')
	{
		document.getElementById('BrowseBtn1').src = imagepath_cal+'/companies_off.gif';
		document.getElementById('BrowseBtn2').src = imagepath_cal+'/people_on.gif';
	}
	document.getElementById('Catdiv').innerHTML = '<table width="100%" cellpadding="0"><tr height="300"><td align="center" valign="middle"><img src="'+imagepath_cal+'/loading1.gif"></td></tr></table>';
	xhReq1.open("GET", "ajax_functions?home_type="+type, true);
	xhReq1.onreadystatechange = onhomeSumResponse;
	xhReq1.send(null);
}
function onhomeSumResponse()
{
	if (xhReq1.readyState != 4)  { return; }
	var serverResponse = xhReq1.responseText;
	document.getElementById("Catdiv").innerHTML = serverResponse;
}
/************ Function to Change the Tabs in the Browse Categories Page ******/
function fnMainChangeType(type)
{
	if(type == 'C')
	{	
		document.getElementById('CompBtn').src = imagepath_cal+'/company_tab_b1.gif';
		document.getElementById('PeoBtn').src = imagepath_cal+'/people_tab_b.gif';
	}
	else if(type == 'P')
	{
		document.getElementById('CompBtn').src = imagepath_cal+'/company_tab_b.gif';
		document.getElementById('PeoBtn').src = imagepath_cal+'/people_tab_b1.gif';
	}
	else if(type == 'F')
	{
		document.getElementById('CompBtn').src = imagepath_cal+'/company_tab_b.gif';
		document.getElementById('PeoBtn').src = imagepath_cal+'/people_tab_b.gif';
	}
	document.getElementById('Catdiv').innerHTML = '<table width="100%" cellpadding="0"><tr height="600"><td align="center" valign="middle"><img src="'+imagepath_cal+'/loading1.gif"></td></tr></table>';
	xhReq1.open("GET", "ajax_functions?browse_type="+type, true);
	xhReq1.onreadystatechange = onbrowseSumResponse;
	xhReq1.send(null);
}
function onbrowseSumResponse()
{
	if (xhReq1.readyState != 4)  { return; }
	var serverResponse = xhReq1.responseText;
	document.getElementById("Catdiv").innerHTML = serverResponse;
}
/****************** Function to Change the Location in Header **********/
function fngetLocDet()
{
	Cntval = document.getElementById('EntCountry').value;
	if(Cntval=='')
	{
		document.getElementById('ErrorLn').innerHTML='<font color="red">Location Should not Empty</font>';
	}
	else
	{
		document.getElementById('ErrorLn').innerHTML='';
		document.getElementById('LoadImg').innerHTML = '<img src="'+imagepath_cal+'/loading1.gif">';
		xhReq1.open("GET", "ajax_functions?Cntval="+Cntval, true);
		xhReq1.onreadystatechange = onHeadSumResponse;
		xhReq1.send(null);
	}
}
function onHeadSumResponse()
{
	if (xhReq1.readyState != 4)  { return; }
	var serverResponse = xhReq1.responseText;
	document.getElementById('LoadImg').innerHTML = '&nbsp;';
	document.getElementById("CntResDiv").innerHTML = serverResponse;
}
function fnSetDef(Codeval)
{
	document.getElementById('hid_DefLocCode').value = Codeval;
	document.HeadForm.submit();
}
/************ Function to Redirect from the Home Page With Category *************/
function fnGetRecCat(type,id,vartype)
{
	var frm = document.homeCatForm;
	if(vartype == 1)
		frm.Industry.value = id;
	else if(vartype == 2)
		frm.Category.value = id;
	if(type == 'C')
		frm.action = filepath+'companies/';
	else if(type == 'P')
		frm.action = filepath+'peoples/';
	else if(type == 'F')
		frm.action = filepath+'financials/view/';	
	frm.submit();
}
/************************ Function for support ******************************/
function frm_support(frm)
{
	var reqarr = new Array();
	reqarr = document.getElementById("tot_hid").value.split(",");
	var reqlen = reqarr.length;
	var flag = 0;
	for(var i=0;i<reqlen;i++)
	{
		if(document.getElementById(reqarr[i]).value == "")
		{
			document.getElementById(reqarr[i]).className = "chcolor";
			flag++;
		}
		else
		{
			document.getElementById(reqarr[i]).className = "normaltextfield1";
			if(document.getElementById(reqarr[i]).id == 'email')
			{
				if(!isValidEmail(frm.elements['email'],"Email",''))
					return false;
			}
		}
		
	}
	if(flag > 0)
	{
		document.getElementById("errormsg").innerHTML = "Please fill the Required information.";
		return false;
	}
	else
	{
		frm.ins_support.value='add';
		return true;	
	}
}	
/*************************** Function to get the Share this page for all the pages *************/
function fnsharethis()
{
	document.getElementById('light_share').style.display='block';
	xhReq.open("GET", "ajax_functions?keyword=shareit", true);
	xhReq.onreadystatechange = onSumshareResponse1;
	xhReq.send(null);
	
}
function onSumshareResponse1() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	var cell = document.getElementById('sharediv');
	cell.innerHTML = serverResponse;
}
/*************************** Function to suggest a company *************/
var xhReqsug = createXMLHttpRequest();
function fnsuggest()
{
	document.getElementById('light_share').style.display='block';
	xhReqsug.open("GET", "ajax_functions?keyword=suggest", true);
	xhReqsug.onreadystatechange = onSumsuggestResponse;
	xhReqsug.send(null);
	
}
function onSumsuggestResponse() 
{
	if(xhReqsug.readyState != 0 && xhReqsug.readyState != 4){ return; }
	var serverResponse = xhReqsug.responseText;
	var cell = document.getElementById('sharediv');
	cell.innerHTML = serverResponse;
}
/**************** Function to send messages to companies ***************/
function fncompanymsg(id,type,email)
{
	document.getElementById('light').style.display='block';
	xhReq.open("GET", "ajax_functions?keyword=sendmsg&id="+id+"&type="+type+"&email="+email, true);
	xhReq.onreadystatechange = onSumMsgResponse;
	xhReq.send(null);
}
function onSumMsgResponse() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	var cell = document.getElementById('sendmsgdiv');
	cell.innerHTML = serverResponse;
}
/**************** For Peoples *************************/
//Function to send Messages to Peoples
function fnpeoplemsg(id,type,email)
{
	document.getElementById('light').style.display='block';
	xhReq.open("GET", "ajax_functions?keyword=sendpeomsg&id="+id+"&type="+type+"&email="+email, true);
	xhReq.onreadystatechange = onSumMsgPeoResponse;
	xhReq.send(null);
	
}
function onSumMsgPeoResponse() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	var cell = document.getElementById('sendmsgdiv');
	cell.innerHTML = serverResponse;
}
function checkmail()
{
	var frm = document.frmsendpeomsg;
	if(frm.subject.value!="")
		document.getElementById('send').disabled = false;
	else
		document.getElementById('send').disabled = true;
}
//Function to send messages to People
function sendpeomessage(rectype,recid)
{
	var frm = document.frmsendpeomsg;
	document.getElementById('send').value = 'Please wait. Sending...';
	var sendermail = frm.sendermail.value;
	var receivermail = frm.receivermail.value;
	var subject = frm.subject.value;
	var message = frm.message.value;
	xhReq.open("GET", "ajax_functions?keyword=sendemails&sendermail="+sendermail+ "&receivermail="+receivermail+ "&subject="+subject+ "&message="+message+"&type="+rectype+"&id="+recid,true);
	document.getElementById('send').disabled = true;
	xhReq.onreadystatechange = onSumsendmsgResponse1;
	xhReq.send(null);
}
function onSumsendmsgResponse1() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	var cell = document.getElementById('sendmsgdiv');
	cell.innerHTML = serverResponse;
	//alert(serverResponse);
}


// Function to Check Usermail ID exists or not for Newsletters
function checkmailsub()
{
	var frm = document.subform;
	if(frm.subname.value!="" && frm.subemail.value!="")
		document.getElementById('subbutton').disabled = false;
	else
		document.getElementById('subbutton').disabled = true;
}

// Function for the subscription of newsletters
function subnews()
{
	var frm = document.subform;
	if(!isValidEmail(frm.subemail,"Email"))
		return false;
	document.getElementById('subbutton').value = 'Please wait. Sending...';
	document.getElementById('subbutton').disabled = true;
	frm.keyword.value = 'subscribe';
	return true;
}
function referfriend()
{
	var frm = document.referform;
	document.getElementById('sendbutton').value = 'Please wait. Sending...';
	var username = frm.username.value;
	var useremail = frm.useremail.value;
	var senderemail = frm.senderemail.value;
	var message = frm.message.value;
	xhReq.open("GET", "ajax_functions?keyword=sendmail&username="+username+ "&useremail="+useremail+ "&senderemail="+senderemail+ "&message="+message,true);
	document.getElementById('sendbutton').disabled = true;
	xhReq.onreadystatechange = onSumsendResponse1;
	xhReq.send(null);
}
function onSumsendResponse1() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	var cell = document.getElementById('sharediv');
	cell.innerHTML = serverResponse;
	//alert(serverResponse);
}
function suggestcompany()
{
	var frm = document.registercomp;
	document.getElementById('sbutton').value = 'Please wait. Sending...';
	var comcntry	 = document.getElementById('comcntry').value;
	var comname = document.getElementById('compyname').value;
	var comsize	 = document.getElementById('comtype').value;
	var comind 	 = document.getElementById('comindtry').value;
	var comcat		 = document.getElementById('ccats').value;
	var comtyp		 = document.getElementById('cptype').value;
	var comsec	 = document.getElementById('csector').value;
	if(document.getElementById('urphone').value!='')
		var comph	 = document.getElementById('urphone').value;
	else 
		var comph	 = '';	
	var comeml     = document.getElementById('uremail').value;
	var comadd	 = document.getElementById('uraddr').value;
	var comstt		 = frm.cstate.value;
	var comcity		 = document.getElementById('comcity').value;
	var comzip		 = document.getElementById('comzip').value;
	var comov		 = document.getElementById('comoverview').value;
	xhReq.open("GET", "ajax_functions?keyword=suggcomp&comcntry="+comcntry+ "&comname="+comname+ "&comsize="+comsize+ "&comind="+comind+"&comcat="+comcat+"&comtyp="+comtyp+"&comsec="+comsec+"&comph="+comph+"&comeml="+comeml+"&comadd="+comadd+"&comstt="+comstt+"&comcity="+comcity+"&comzip="+comzip+"&comov="+comov,true);
	document.getElementById('sbutton').disabled = true;
	xhReq.onreadystatechange = onSumsendResponsesugg;
	xhReq.send(null);
	
}
function onSumsendResponsesugg() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	var cell = document.getElementById('sharediv');
	cell.innerHTML = serverResponse;
	//alert(serverResponse);
}
function checkmailid()
{
	var frm = document.referform;
	if(frm.useremail.value!='')
	{
		if(!isValidEmail(frm.useremail,"receiver email"))
			return;
	}
	if(frm.senderemail.value!='')
	{
		if(!isValidEmail(frm.senderemail,"receiver email"))
			return;
	}
	if(frm.username.value!="" && frm.useremail.value!="" && frm.senderemail.value!="")
		document.getElementById('sendbutton').disabled = false;
	else
		document.getElementById('sendbutton').disabled = true;
}
function checkreg(frm)
{
	if(document.getElementById('comcntry').value!='' && document.getElementById('compyname').value!=''  && document.getElementById('comtype').value!=''  && document.getElementById('comindtry').value!=''  && document.getElementById('ccats').value!=''  && document.getElementById('cptype').value!=''  && document.getElementById('csector').value!=''  && document.getElementById('uremail').value!=''  && document.getElementById('uraddr').value!=''  && frm.cstate.value!='' && document.getElementById('comcity').value!='' && document.getElementById('comzip').value!='' && document.getElementById('comoverview').value!='')
		document.getElementById('sbutton').disabled = false;
	else
		document.getElementById('sbutton').disabled = true;
}
function checkmsgid()
{
	var frm = document.frmsendmsg;
	if(frm.subject.value!="")
		document.getElementById('send').disabled = false;
	else
		document.getElementById('send').disabled = true;
}
//Function to send messages to company
function sendmessage(rectype,recid)
{
	var frm = document.frmsendmsg;
	document.getElementById('send').value = 'Please wait. Sending...';
	var sendermail = frm.sendermail.value;
	var receivermail = frm.receivermail.value;
	var subject = frm.subject.value;
	var message = frm.message.value;
	xhReq.open("GET", "ajax_functions?keyword=sendmails&sendermail="+sendermail+ "&receivermail="+receivermail+ "&subject="+subject+ "&message="+message+"&type="+rectype+"&id="+recid,true);
	document.getElementById('send').disabled = true;
	xhReq.onreadystatechange = onSumsendmsgResponse1;
	xhReq.send(null);
}
function onSumsendmsgResponse1() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	var cell = document.getElementById('sendmsgdiv');
	cell.innerHTML = serverResponse;
	//alert(serverResponse);
}
//for inquiries
function ShowInq(id,val)
{
	if(val == 'expand')
	{
		document.getElementById('showfullmsg'+id).style.display="";
		document.getElementById('showshortmsg'+id).style.display="none";
	}
	else if(val == 'hide')
	{
		document.getElementById('showfullmsg'+id).style.display="none";
		document.getElementById('showshortmsg'+id).style.display="";
	}
}
//for watchlist
function addtowatchlist(id,type)
{
	xhReq.open("GET", "ajax_functions?watchid="+id+"&type="+type, true);
	xhReq.onreadystatechange = onSumResponseWatch;
	xhReq.send(null);
}	
function onSumResponseWatch() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	var cell = document.getElementById('watchdiv');
	cell.innerHTML =serverResponse;
}
//for alphabetical search
function callfun(id,frm,page)
{ 
	frm.hid.value=id;
	if(page == 'articles' || page == 'blogs' || page == 'news' || page == 'companies')
		frm.action=filepath+page+'/view/';
	else if(page == 'events')
		frm.action=filepath+'events/list_events.html';
	else if(page == 'jobs' || page == 'peoples' || page == 'products')
		frm.action=filepath+page+'/';
	else if(page == 'buy' || page == 'sell')
		frm.action=filepath+'services/'+page+'/';
	frm.submit();
}
/***************** Function for the Client Speak Page *************/
function fnPostSpeak(frm)
{
	if(document.getElementById('client_comment').value == '' || 
		document.getElementById('client_comment').value == 'Please Enter Comment Here')
	{
		document.getElementById('client_comment').className = "chcolor";
		return false;
	}
	else
	{
		frm.keyword.value = "Post";
		return true;
	}
}
//function to highlight the required field
function validatereq(focusedid,hidval,tothidval)
{
	var reqfields = document.getElementById(hidval).value;
	var allfields = document.getElementById(tothidval).value;
	var totarr = new Array()
	var reqarr = new Array();
	totarr = allfields.split(",");
	reqarr = reqfields.split(",");
	var totlen = totarr.length;	
	var reqlen = reqarr.length;
	for(var i=0;i<totlen;i++)
	{
		if((document.getElementById(totarr[i]).value == "" || document.getElementById(totarr[i]).value == 0) && totarr[i] != focusedid)
		{
			if(in_array(totarr[i], reqarr))
			{
				document.getElementById(totarr[i]).className = "chcolor";
			}
		}
		else if(totarr[i] == focusedid)
		{
			document.getElementById(totarr[i]).className = "normaltextfield1";
			document.getElementById("errormsg").innerHTML='';
			break;
		}
		else if(document.getElementById(totarr[i]).value != "")
		{
			document.getElementById(totarr[i]).className = "normaltextfield1";
			document.getElementById("errormsg").innerHTML='';
		}
	}
}
/************* Function To Perform Search in All Modules from Home Page ********/
function fnGetRec(stype)
{
	document.getElementById('SearchType').value = stype;
	document.getElementById('SearchLayer').style.display = 'none';
}
function fnStartSearch()
{
	var frm = document.HomeSearchForm;
	var stype = document.getElementById('SearchType').value;
	var pageName = '';
	switch(stype)
	{
		case	'All'		: 	pageName = filepath+'searchresults/';
								break;
		case	'Companies'	: 	pageName = filepath+'companies/';
								break;
		case	'Professionals'	:	pageName = filepath+'peoples/';
								break;
		case	'Products'	:	pageName = filepath+'products/';
								break;
		case	'Services'	:	pageName = filepath+'services/sell/';
								break;
		case	'News'		:	pageName = filepath+'news/view/';
								break;
		case	'Jobs'		:	pageName = filepath+'jobs/';
								break;
		case	'Articles'	:	pageName = filepath+'articles/view/';
								break;
		case	'Blogs'		:	pageName = filepath+'blogs/view/';
								break;
		case	'Events'	:	pageName = filepath+'events/list/';
								break;
	}
	if(frm.keywrd.value == 'Enter Keyword' || frm.keywrd.value == '')	{	}
	else
	{
		frm.action = pageName;
		frm.submit();
	}
}
var flag = '';
function fnChangeHomeCnt(tabType,val)
{
	if(flag != '')
	{
		flag = '';
		return false;
	}
	else
	{
		switch(tabType)
		{
			case	'C'	:	document.getElementById('CompanyNote').style.display = '';
							document.getElementById('PeopleNote').style.display = 'none';
							document.getElementById('ProductNote').style.display = 'none';
							document.getElementById('ServiceNote').style.display = 'none';
							document.getElementById('BorderRow').className = 'ComRow';
							document.getElementById('WelcomeNote').style.display = 'none';
							break;
			case	'P'	:	document.getElementById('CompanyNote').style.display = 'none';
							document.getElementById('PeopleNote').style.display = '';
							document.getElementById('ProductNote').style.display = 'none';
							document.getElementById('ServiceNote').style.display = 'none';
							document.getElementById('BorderRow').className = 'PeoRow';
							document.getElementById('WelcomeNote').style.display = 'none';
							break;
			case	'T'	:	document.getElementById('CompanyNote').style.display = 'none';
							document.getElementById('PeopleNote').style.display = 'none';
							document.getElementById('ProductNote').style.display = '';
							document.getElementById('ServiceNote').style.display = 'none';
							document.getElementById('BorderRow').className = 'ProRow';
							document.getElementById('WelcomeNote').style.display = 'none';
							break;
			case	'S'	:	document.getElementById('CompanyNote').style.display = 'none';
							document.getElementById('PeopleNote').style.display = 'none';
							document.getElementById('ProductNote').style.display = 'none';
							document.getElementById('ServiceNote').style.display = '';
							document.getElementById('BorderRow').className = 'SerRow';
							document.getElementById('WelcomeNote').style.display = 'none';
							break;	
			case	'H'	:	document.getElementById('CompanyNote').style.display = 'none';
							document.getElementById('PeopleNote').style.display = 'none';
							document.getElementById('ProductNote').style.display = 'none';
							document.getElementById('ServiceNote').style.display = 'none';
							document.getElementById('BorderRow').className = 'WelRow';
							document.getElementById('WelcomeNote').style.display = '';
							break;				
		}
		flag = val;
	}
}
/********** Function for the Validating Login Details in the Header *********/
var xhReq5 = createXMLHttpRequest();
function fnvalidLogin()
{
	var frm = document.login;
	if(document.getElementById('Utype').value == '')
	{
		document.getElementById('HeadError').innerHTML = 'Please select User type';
		return;
	}
	if(document.getElementById('Uemail').value == 'Your e-mail address' || document.getElementById('Uemail').value == '')
	{
		document.getElementById('HeadError').innerHTML = 'Please Enter e-mail';
		return;
	}
	if(document.getElementById('Upassword').value == 'Your Password' || document.getElementById('Upassword').value == '')
	{
		document.getElementById('HeadError').innerHTML = 'Please Enter Password';
		return;
	}
	if(document.getElementById('Utype').value != '' && document.getElementById('Uemail').value != 'Your e-mail address' && document.getElementById('Uemail').value != '' && document.getElementById('Upassword').value != 'Your Password' || document.getElementById('Upassword').value != '')
	{
		
	}
	frm.submit();
}
/**************** Function to Change the Password of the Customer ***********/
function fnCusChPass(val)
{
	var frm = document.ChPassForm;
	var reqarr = new Array();
	reqarr = document.getElementById("tot_hid").value.split(",");
	var reqlen = reqarr.length;
	var flag = 0;
	for(var i=0;i<reqlen;i++)
	{
		if(document.getElementById(reqarr[i]).value == "")
		{
				document.getElementById(reqarr[i]).className = "chcolor";
				flag++;
		}
		else
		{	
			document.getElementById(reqarr[i]).className = "normaltextfield1";
			if(document.getElementById('newcpassword').value != document.getElementById('newpassword').value)
			{
				document.getElementById("errormsg").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'> Password & Confirm password should be the Same";
					return false;
			}
		}
	}
	if(flag > 0)
	{
		document.getElementById("errormsg").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'> Please fill the information in the fields that are highlighted";
		return false;
	}
	else
	{
		document.getElementById('hid_key').value = 'chpass';
		return true;
	}
}
/********** Function to Update the Profile of the Customer **********/
function fnEditInfo(val)
{
	var frm = document.InfoForm;
	var reqarr = new Array();
	reqarr = document.getElementById("customer_hid").value.split(",");
	var reqlen = reqarr.length;
	var flag = 0;
	for(var i=0;i<reqlen;i++)
	{
		if(document.getElementById(reqarr[i]).value == "")
		{
				document.getElementById(reqarr[i]).className = "chcolor";
				flag++;
		}
		else
		{	
			document.getElementById(reqarr[i]).className = "normaltextfield1";
			if(document.getElementById(reqarr[i]).id == 'custemail')
			{
				if(!isValidEmail(frm.elements['customer[email]'],"Email"))
					return false;
			}
		}
	}
	if(flag > 0)
	{
		document.getElementById("errormsg").innerHTML = "<img src='"+val+"/exclamation.gif' border='0'> Please fill the information in the fields that are highlighted";
		return false;
	}
	else 
	{
		if(frm.elements['customer[phone]'].value!='')
		{
			if(!isValidNumber(frm.elements['customer[phone]'],"Phone Number",''))
				return false;
		}
		document.getElementById('hid_key').value = 'EditInfo';
		return true;
	}
}
//Function for the subcategories select box
function selectsubcat(val)
{
	var cell = document.getElementById("subcatids");	
	xhReq.open("GET", "ajax_functions?cats="+val, true);
	xhReq.onreadystatechange = onSumResponsesubcats;
	xhReq.send(null);
}	
function onSumResponsesubcats() 
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	var cell = document.getElementById("subcatids");
	cell.innerHTML = serverResponse;
}
/********** Function to Invite the People for Customers Network ******/
function inviteusers(frm)
{
	var reqarr = new Array();
	reqarr = document.getElementById("req_hid").value.split(",");
	hidarr	 = document.getElementById("tot_hid").value.split(",");
	var reqlen = reqarr.length;
	var hidlen	=	hidarr.length;
	var flag = 0;
	for(var i=0;i<reqlen;i++)
	{
		if(document.getElementById(reqarr[i]).value == "")
		{
			document.getElementById(reqarr[i]).className = "chcolor";
			flag++;
		}
		else
		{
			document.getElementById(reqarr[i]).className = "normaltextfield1";
			if(document.getElementById(reqarr[i]).id == 'firstname0')
			{
				if(!isValidAlphabet(frm.elements['firstname[0]'],"Firstname",''))
					return false;
			}
			if(document.getElementById(reqarr[i]).id == 'lastname0')
			{
				if(!isValidAlphabet(frm.elements['lastname[0]'],"Lastname"))
					return false;
			}
			if(document.getElementById(reqarr[i]).id == 'email0')
			{
				if(!isValidEmail(frm.elements['email[0]'],"Email"))
					return false;
			}
			for(var j=3;j<hidlen;j++)
			{
				for(var k=1;k<4;k++)
				{
					if(document.getElementById(hidarr[j]).id == 'firstname'+k && frm.elements['firstname['+k+']'].value!='')
					{
						if(!isValidAlphabet(frm.elements['firstname['+k+']'],"Firstname"))
							return false;
					}
					if(document.getElementById(hidarr[j]).id == 'lastname'+k && frm.elements['lastname['+k+']'].value!='')
					{
						if(!isValidAlphabet(frm.elements['lastname['+k+']'],"Lastname"))
							return false;
					}
					if(document.getElementById(hidarr[j]).id == 'email'+k && frm.elements['email['+k+']'].value!='')
					{
						if(!isValidEmail(frm.elements['email['+k+']'],"Email"))
							return false;
					}
				}
			}
		}
	}
	if(flag > 0)
	{
		document.getElementById("errormsg").innerHTML = "Please fill the Required information.";
		return false;
	}
	else 
	{
		frm.overviewhid.value = "invite";
		return true;
	}
}
function sentinv(act)
{
	var frm=document.invsent;
	var checkName = "";
	var count = 0;
	var invids = "";
	for(var i = 0; i < frm.elements.length; i++)
	{	
		if(frm.elements[i].type == "checkbox")
		{
			checkName = frm.elements[i].name.substr(0,7);
			if(checkName == "network")
			{
				if(frm.elements[i].checked == true)
				{
					count++;
					if(invids == "")
						invids = frm.elements[i].value;
					else
						invids += ","+frm.elements[i].value;
				}
			}
		}
	}
	if(count == 0)
	{
		alert("Please select atleast one record to "+act);
		return;
	}
	frm.invids.value = invids;
	frm.keyword.value = act;
	frm.submit();
}
function recinv(act)
{
	var frm=document.invreceived;
	var checkName = "";
	var count = 0;
	var invids = "";
	for(var i = 0; i < frm.elements.length; i++)
	{	
		if(frm.elements[i].type == "checkbox")
		{
			checkName = frm.elements[i].name.substr(0,7);
			if(checkName == "network")
			{
				if(frm.elements[i].checked == true)
				{
					count++;
					if(invids == "")
						invids = frm.elements[i].value;
					else
						invids += ","+frm.elements[i].value;
				}
			}
		}
	}
	if(count == 0)
	{
		alert("Please select atleast one record to "+act);
		return;
	}
	if(act == 'delete')
	{
		if(confirm("Are you sure want to Delete the Selected Records"))
		{
			frm.invids.value = invids;
			frm.keyword.value = act;
			frm.submit();
		}
	}
	else
	{
		frm.invids.value = invids;
		frm.keyword.value = act;
		frm.submit();
	}
}
/*************** Function to Search Records By Keyword (Selected) ***********/
function searchpages(frm,page)
{
	if(page == 'articles' || page == 'blogs' || page == 'news' || page == 'companies')
		frm.action=filepath+page+'/view/';
	else if(page == 'events')
		frm.action=filepath+'events/list/';
	else if(page == 'jobs' || page == 'peoples' || page == 'products')
		frm.action=filepath+page+'/';
	else if(page == 'buy' || page == 'sell')
		frm.action=filepath+'services/'+page+'/';
	frm.submit();
}
//function for services for sort options
function sortservices(type)
{
	var frm=document.CproductsForm;
	frm.submit();
}
//function for alliances for sort options
function sortalliance()
{
	var frm=document.CallianceForm;
	frm.submit();
}
//function for events for sort options
function sortevents()
{
	var frm=document.CeventsForm;
	frm.submit();
}
//function for people for sortoptions
function sortpeople()
{
	var frm=document.CpeopleForm;
	frm.submit();
}
//function for products for sortoptions
function sortproducts()
{
	var frm=document.CproductsForm;
	frm.submit();
}
//function for financials for sort options
function sortfinancial()
{
	var frm=document.financialfrm;
	frm.submit();
}
//function for investors for sort options
function sortinvestors()
{
	var frm=document.investorsfrm;
	frm.submit();
}
//function for milestones for sort options
function sortmilestones()
{
	var frm=document.CmilesForm;
	frm.submit();
}
//function for competitors for sort options
function sortcompetitors()
{
	var frm=document.competitors;
	frm.submit();
}
//function for news for sort options
function sortnews()
{
	var frm=document.CnewsForm;
	frm.submit();
}
//function for blogs for sort options
function sortblogs()
{
	var frm=document.CblogsForm;
	frm.submit();
}
//function for articles for sort options
function sortarticles()
{
	var frm=document.CarticlesForm;
	frm.submit();
}
//function for jobs for sort options
function sortjobs()
{
	var frm=document.CjobsForm;
	frm.submit();
}
//function for links for sort options
function sortlinks()
{
	var frm=document.ClinksForm;
	frm.submit();
}
//function for people blogs for sort options
function sortblogspeople()
{
	var frm=document.CblogsForm;
	frm.submit();
}
//function for people articles for sort options
function sortarticlespeople()
{
	var frm=document.CarticlesForm;
	frm.submit();
}
//function for people products for sortoptions
function sortproductspeople()
{
	var frm=document.CproductsForm;
	frm.submit();
}
//function for people services for sort options
function sortservicespeople(type)
{
	var frm=document.CproductsForm;
	frm.submit();
}
//customer network
function selectAllNetwork()
{
	var frm = document.invsent;
	var checkName = "";
	for(var i = 0; i < frm.elements.length; i++)
	{
		if(frm.elements[i].type == "checkbox")
		{
			checkName = frm.elements[i].name.substr(0,7);
			if(frm.ntwrkall.checked == true)
			{	
 				if(checkName == "network")
					frm.elements[i].checked = true;
			}
			else
			{
 				if(checkName == "network")
					frm.elements[i].checked = false;
 			}
		}			
	}	
}
function fnOpenPaymentOption(val)
{
	var frm = document.reg;
	if(val == 'basic')
	{
		document.getElementById('PaymentRow').style.display = 'none';
		document.getElementById('CreditRow').style.display = 'none';
	}
	else if(val == 'cpduration' || val == 'cgduration')
	{
		document.getElementById('PaymentRow').style.display = '';
		document.getElementById('CreditRow').style.display = '';
	}
}
function fnGetpaymentDetails(val)
{
	if(val == 'Credit Card')
		document.getElementById('CreditRow').style.display = '';
	else
		document.getElementById('CreditRow').style.display = 'none';
}
var xhReqBef = createXMLHttpRequest();
function fnOpenBenefits(type)
{
	//document.getElementById('light_benefits').style.display = 'block';
	xhReqBef.open("GET", "ajax_functions?keyword=benefits&type="+type, true);
	xhReqBef.onreadystatechange = onSumBenefitsResponse;
	xhReqBef.send(null);
}
function onSumBenefitsResponse() 
{
	if(xhReqBef.readyState != 0 && xhReqBef.readyState != 4){ return; }
	var serverResponse = xhReqBef.responseText;
	var cell = document.getElementById('benefitsdiv');
	cell.innerHTML = serverResponse;
}
function fnCloseBenefits(imgpath,utype)
{
	document.getElementById('benefitsdiv').innerHTML = '<a href="javascript:fnOpenBenefits(\''+utype+'\');" class="bluelinks"><img src="'+imgpath+'/benifints-down.gif" alt="Compare Benefits" title="Compare Benefits" width="141" height="28" border="0"/></a>';
}
function fnCheckSecurityCode(ele_id,val,path)
{
	if(val.length != 5)
	{
		document.getElementById(ele_id).className = "chcolor";
		document.getElementById("errormsg").innerHTML = "<img src='"+path+"/exclamation.gif' border='0'> Please enter 5 Characters";
		document.getElementById('SubBtn').disabled = true;
		return false;
	}
	else
	{
		document.getElementById("errormsg").innerHTML = "&nbsp;";
		if(val.length == 5)
		{
			xhReq.open("GET", "ajax_functions?seccode="+val, true);
			xhReq.onreadystatechange = onSumResponseSecurityCode;
			xhReq.send(null);
		}
	}
}
function onSumResponseSecurityCode()
{
	if(xhReq.readyState != 0 && xhReq.readyState != 4){ return; }
	var serverResponse = xhReq.responseText;
	var type = document.getElementById('type').value;
	if(serverResponse == 0)
	{
		document.getElementById("errormsg").innerHTML = "Please enter Correct Security Code";
		document.getElementById('SubBtn').disabled = true;
	}
	else if(serverResponse == 1)
	{
		if(type == 'company')
		{
			var email = document.getElementById('cemail').value;
			checkcompanyemail(email);
		}
		else if(type == 'people')
		{
			var email = document.getElementById('pemail').value;
			checkpepemail(email);
		}
		document.getElementById("errormsg").innerHTML = "&nbsp;";
		document.getElementById('SubBtn').disabled = false;
	}
}