<!--
function chkEmail(oComp) 
{
	IsItReal = oComp.value ;
	if (typeof(IsItReal) != "undefined")
	{
		IsItReal = IsItReal.match(/(\w+)@(.+)\.(\w+)$/);

		if (IsItReal !=null)
		{
				if ((IsItReal[3].length==2) || (IsItReal[3].length==3) || (IsItReal[3].length==4))
				return true;
		}
	}
	oComp.focus();	
	return false;
}

function validpno(ctrl)
{
	var i, strnum;
	strValue = ctrl.value;
	for(i=0; i<=strValue.length-1; i++)
	{
		strnum = strValue.charCodeAt(i);
		
		if ((strnum >= 48 && strnum <=57) || strnum == 32 || strnum == 45 || strnum == 40 || strnum == 41)
		{
		}
		else
		{
			return false;
		}
	}
	return true;
}

function checkInt(a)
{
	a= Ltriming(RLtriming(a));
	if (a.split(" ").join("").length ==0)
	{
		return false;
	}
	var Anum = "0123456789";
	for (i=0;i<a.length;i++)
	{
		if (Anum.indexOf(a.substr(i,1)) == -1)
		{
			return false;
		}
		
	}
	return true;
}
function Ltriming(a)
{
	var aa=a;
	var ctr=0;
	for (ctr=0;ctr<a.length;ctr++)
	{
		if (aa.substr(ctr,1)==' ')
		{
			ctr=ctr-1;
			aa=aa.replace(' ','');
		}
		else
		{
			break;
		}
	}

	return aa;	
}
function RLtriming(a)
{
	var aa=a;
	var ctr=0;
	for (ctr=aa.length-1;ctr>=0;ctr--)
	{
		if (aa.substr(ctr,1)==' ')
		{
			ctr=ctr;
			aa=aa.replace(' ','');
		}
		else
		{
			break;
		}
	}
	return aa;	
}
function FormEvent()
{
	if (window.event.keyCode == 13)
	{
		window.event.keyCode = 0;
	}
}
function compchng()
{
	if(document.frmsearch.cmbcomp.value == "0")
	{
		alert("Please select a company.");
		document.frmsearch.cmbcomp.focus();
		return false;
	}
	temp = document.frmsearch.cmbcomp.value;
	comp = temp.indexOf(",");
	companyid = temp.substr(0,comp);
	pg1 = temp.substr(comp+1,temp.length);
	document.frmsearch.method = "post";
	document.frmsearch.action = pg1 + "?companyid=" + companyid ;
	document.frmsearch.submit();
}
function searchcheck()
{
	if(document.frmtopsearch.txtsearch.value.split(" ").join("").length == 0)
	{
		alert("Please enter search keyword.");
		document.frmtopsearch.txtsearch.focus();
		return false;
	}
	document.frmtopsearch.method = "post";
	document.frmtopsearch.action = "search.php";
	document.frmtopsearch.submit();
}
function gotocatlist(c)
{
	document.form1.companyid.value=c;
	document.form1.action="categorylist.php";
	document.form1.submit();
}
function gotodisp(a,a1,b,c)
{
	document.form1.companyid.value=a;

	document.form1.categoryid.value=a1;

	document.form1.pid.value=b;
	if(c=='1')
	document.form1.action ="productdisp1.php";
	else if(c=='2')
	document.form1.action ="productdisp2.php";
	else 
	document.form1.action ="productdisp3.php";
	
	document.form1.submit();
}
function prodchange(a)	
{
	
	document.form1.action = a;
	document.form1.submit();
}
function ChangePage(a)
{
	curpage = document.form1.txtPageNo.value;
	if(a == "goto")
	{
		if(document.form1.txtgoto.value.split(" ").join("").length == 0)
		{
			alert("Please enter page no.");
			document.form1.txtgoto.focus();
			return false;
		}
		pageno = document.form1.txtgoto.value.split(" ").join("");
		if(!checkInt1(pageno))
		{
			alert("Please enter non-decimal numeric value only.");
			document.form1.txtgoto.focus();
			return false;
		}
		if(pageno <= 0  || pageno > 2)
		{

			alert("Please enter page no. between 1 and " + 2 + ".");
			document.form1.txtgoto.focus();
			return false;
		}
		document.form1.txtPageNo.value = document.form1.txtgoto.value;
	}	
	else
	{
		document.form1.txtPageNo.value = a;
	}
	if(document.form1.txtPageNo.value != curpage)
	{
		document.form1.action = "productlist.php";
		document.form1.submit();
	}
}

function checkInt1(str)
{
	if(isNaN(str))
		return false;
	else if(str.substring(0,str.indexOf(".")) == "")
		return true;
	else
		return false;
}
function myfunction()
{
		var Phone=document.form_ask.Phone.value;
		var Email=document.form_ask.email.value;
		var Company=document.form_ask.Company.value;
		var Questions=document.form_ask.Questions.value
		var Name=document.form_ask.name.value;
		//alert(Phone);alert(Email);alert(Questions);alert(Name);
		
		if(Name.split(" ").join("").length == 0)
				{
					alert("Please enter name.");
					document.form_ask.name.focus();
					return false;
				}
				
			
			
		var	IsItReal = Email;
		var len=IsItReal.split(" ").join("").length;
		//alert(len);		
				if (IsItReal.split(" ").join("").length != 0)
				{
					IsItReal = IsItReal.match(/(\w+)@(.+)\.(\w+)$/);
							if(IsItReal !=null )
							{
									if ((IsItReal[3].length==2) || (IsItReal[3].length==3) || (IsItReal[3].length==4))
													{
													}
													else
													{
													alert('Please enter valid email address!');
													document.form_ask.email.focus();	
													return false;
													}
							}
							else
							{
							alert('Please enter valid email address!');
							document.form_ask.email.focus();	
							return false;
							}
				}
				else 
				{
				alert('Please enter email address!');
				document.form_ask.email.focus();	
				return false;
				}
				
		if(Company.split(" ").join("").length == 0)
				{
					alert("Please enter company.");
					document.form_ask.Company.focus();
					return false;
				}
				
		if(Phone.split(" ").join("").length > 0)
			{
			var strnum;
				for(i=0; i<=Phone.length-1; i++)
				{
					strnum = Phone.charCodeAt(i);
					
					if ((strnum >= 48 && strnum <=57) || strnum == 32 || strnum == 45 || strnum == 40 || strnum == 41)
					{
					}
					else
					{  
					  alert("Please enter valid phone");
					  document.form_ask.Phone.focus();
					  return false;
					}
				}
				
			}
			if(Questions.split(" ").join("").length == 0)
				{
					alert("Please enter questions.");
					document.form_ask.Questions.focus();
					return false;
				}
		
		document.form_ask.action="AskExpert.php";
document.form_ask.submit();	
}
function gotoAsk()
{
  window.open("AskExpert.php","_self");
}
//-->