function setprodvalues(prdid,prdname)
{
	//document.getElementById("prdname").innerHTML=prdname;
	//document.getElementById("treelink").innerHTML=prdname;
}
function pressEnter(e)
{
	key = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
	if(key==13)
	{
		if(trialuser()==false){
			document.profile.email.focus();
			return false;
		}
	}
}
function gettoupperfirst(str)
{ // code added by yogaraja this function used to change the string first char is chang to upper case and also remove the continious space
	return str.toUpperCase();
}
function trialuser()
{	
	var alertlist="";
	var fcs="";

	if(!validateNotEmpty(document.profile.email.value))
	{
		alertlist+="Please enter \" e-mail Id \"\n";
		fcs+="-email"; 
		//return false;
	}
	else if(!validateEmail(document.profile.email.value))
	{
		alertlist+="Please enter valid \" e-mail Id \"\n";
		fcs+="-email"; 
	}
	if(!validateNotEmpty(document.profile.name.value))
	{
		alertlist+="Please enter \" Name \"\n";
		fcs+="-name"; 
		//return false;
	}
	else if(document.profile.name.value==0)
	{
		alertlist+="\" Name \" Should not be allowed zero values\n";
		fcs+="-name"; 
	}
	else if(!validateAlpha2(document.profile.name.value))
	{
		alertlist+="Please enter valid \" Name \"\n";
		fcs+="-name"; 
	}      
	if(!validateNotEmpty(document.profile.phone.value))
	{
		alertlist+="Please enter \" Contact Number \"\n";
		fcs+="-phone"; 
	}
	else if(validate_Phone_mobilenumber('phone','phone/mobile','yes','','')==false)
	{
		//alert('Please enter valid "Contact Number"');
		document.getElementById("phone").focus();
		return false;
	}   

	if(alertlist!="")
	{
		alert(alertlist);
		fcs_splt=fcs.split("-");
		//alert(fcs_splt[1]);
		document.getElementById(fcs_splt[1]).focus();
		alertlist="";
		fcs="";
		return false;
	}
	disablebuttons("-submit_btn-close_btn");
	email=document.profile.email.value;
	//var url="modules/newuser/ajaxfunctions.php";
	var url="ajaxfunctions.php";
	var passvar="emptyarg&function=checkemailvalid&email="+email;
	loadmajax(url,'POST',passvar,'emptyid');
	return false;
}

function email_exit()
{
	alert("E-mail ID already exist");
	document.profile.email.focus();	
	return false;
	
}


function checkPhoneNumber(e)
{

	var charcode=(e.which)?e.which:event.keyCode;
	//alert(charcode)
	if(charcode>31 && charcode!=45 &&(charcode<48 || charcode>57)){
		return false;
	}
	return true;
}


function mailexists_result(fld,resultfld)
{
	if(document.getElementById(resultfld).value==1)
	{
		alert("E-mail ID already exists");
		document.getElementById(fld).focus();
		return false;
	}
	if(document.getElementById("validmail").value=="invalid")
	{
		alert("Please enter valid email id");
		document.getElementById(fld).value='';
		var t=setTimeout("setfocus('email');",10);
		return false;
	}
}


function submitform()
{
	disablebuttons("-submit_btn-close_btn");
	document.profile.operation.value="trynow";
	document.profile.submit();
}
function invalidmail()
{
	alert("Please enter valid e-mail id");
	document.profile.email.focus();
	document.getElementById("submit_btn").disabled=false;
	document.getElementById("close_btn").disabled=false;
	return false;
}

function aftercheck()
{
	var result=document.getElementById("userexists").value;
	showhide('userexists_msg_row','inline');
	if(result=="1")
	{
		document.getElementById("user_name").value='';
		var t=setTimeout("setfocus('user_name');",10);
		return false;
	}
}


function goto_home(actn)
{
	document.profile.operation.value=actn;
	document.profile.submit();
}
