function Photo(url)
	{
			var j=window.open("","jj","top=60, left=130,width=191,height=124,scrollbars=no,resizable=no,titlebar=no,menubar=no,toolbar=no,locationbar=no,location=no,status=no")
				with (j.document)
				{
					open();
					writeln ('<html><head><title>' + url + '</title></head><body topMargin="0" leftMargin="0" marginwidth="0" marginheight="200" onload="var imgHeight=document.all.xyz.height;var imgWidth=document.all.xyz.width; window.resizeTo((imgWidth+12),(imgHeight+31));return true;" marginwidth=0 marginheight=500 topmargin=0 leftmargin=0>');			
					writeln ('<center><img border="0" name="xyz" src=businessImages/'+ url +'>');
					writeln ('</body></html>');
					close();
				}

		
	}

function limitlength(obj, length){
	var maxlength=length
	if (obj.value.length>maxlength){
	document.getElementById("error7").innerHTML="<span style='font-size:9px;color:red'>250 characters maximum </span>";
	obj.value=obj.value.substring(0, maxlength)
	 }else{
	 	document.getElementById("error7").innerHTML=" ";
	}
	}

function chk_feedbackform(frm){
		var x=0;
	if(frm.cname.value==""){
		document.getElementById("error1").innerHTML="<span style='font-size:9px;color:red'>Enter Name</span>";
		
	}else{
		document.getElementById("error1").innerHTML="  <img src='images/round_icon.gif'>";
		x=x+1;
	}
	/*
	if(frm.cphone.value!=""){
		if(chkNumeric(frm.cphone.value) == false){
		 document.getElementById("error3").innerHTML="<span style='font-size:10px;color:red'>Enter valid telephone</span>";
		 }else{
		 document.getElementById("error3").innerHTML="  <img src='images/round_icon.gif'>";
		 x=x+1;
		 }

	}
	*/
	if (validateEmail(frm.cemail.value)!=1){
		document.getElementById("error2").innerHTML="<span style='font-size:10px;color:red'>Enter valid E-mail</span>";
		}else{
		document.getElementById("error2").innerHTML="  <img src='images/round_icon.gif'>";
		x=x+1;
		}
	if(frm.cquery.value==""){
		document.getElementById("error4").innerHTML="<span style='font-size:9px;color:red'>Enter Your Query</span>";
		
	}else{
		document.getElementById("error4").innerHTML="  <img src='images/round_icon.gif'>";
		x=x+1;
	}
	
	if(x==3)
	return true;
	else
	return false;
}
function chksignupform(frm,val){
var x=0;
	if(frm.bname.value==""){
		document.getElementById("error1").innerHTML="<span style='font-size:9px;color:red'>Enter Name</span>";
	}else{
		document.getElementById("error1").innerHTML="  <img src='images/round_icon.gif'>";
		x=x+1;
	}
	if(frm.businessname.value==""){
		document.getElementById("error2").innerHTML="<span style='font-size:9px;color:red'>Enter Business Name</span>";
	}else{
		document.getElementById("error2").innerHTML="  <img src='images/round_icon.gif'>";
		x=x+1;
	}
	if(frm.tradingadress.value==""){
		document.getElementById("error3").innerHTML="<span style='font-size:9px;color:red'>Enter Trading Address</span>";
	}else{
		document.getElementById("error3").innerHTML="  <img src='images/round_icon.gif'>";
		x=x+1;
	}
	if(frm.catid.value==""){
		document.getElementById("error4").innerHTML="<span style='font-size:9px;color:red'>Select Category</span>";
	}else{
		document.getElementById("error4").innerHTML="  <img src='images/round_icon.gif'>";
		x=x+1;
	}
	if(chkNumeric(frm.telephonenumber.value) == false){
		 document.getElementById("error5").innerHTML="<span style='font-size:10px;color:red'>Enter valid telephone</span>";
		 }else{
		 document.getElementById("error5").innerHTML="  <img src='images/round_icon.gif'>";
		 x=x+1;
		 }
		
	if (validateEmail(frm.email.value)!=1){
		document.getElementById("error6").innerHTML="<span style='font-size:10px;color:red'>Enter valid E-mail</span>";
		}else{
		document.getElementById("error6").innerHTML="  <img src='images/round_icon.gif'>";
		x=x+1;
		}
	
	if(frm.businessdescription.value==""){
		document.getElementById("error7").innerHTML="<span style='font-size:9px;color:red'>Enter Business description</span>";
	}else{
		document.getElementById("error7").innerHTML="  <img src='images/round_icon.gif'>";
		x=x+1;
	}
	if(eval(val)!=1){
	if(frm.img.value==""){
		document.getElementById("error11").innerHTML="<span style='font-size:9px;color:red'>Upload an image</span>";
	}else{
		document.getElementById("error11").innerHTML="<span style='font-size:9px;color:red'></span>";
		x=x+1;
	}
	
}else{
	x=x+1;
}
	if(frm.username.value==""){
		document.getElementById("error9").innerHTML="<span style='font-size:9px;color:red'>Enter User name</span>";
	}else{
		document.getElementById("error9").innerHTML="  <img src='images/round_icon.gif'>";
		x=x+1;
	}
	if(frm.password.value==""){
		document.getElementById("error10").innerHTML="<span style='font-size:9px;color:red'>Enter Password</span>";
	}else{
		document.getElementById("error10").innerHTML="  <img src='images/round_icon.gif'>";
		x=x+1;
	}
	if(frm.repassword.value==""){
		document.getElementById("error12").innerHTML="<span style='font-size:9px;color:red'>Re-enter Password</span>";
	}else{
		if(frm.repassword.value!=frm.password.value){
			document.getElementById("error12").innerHTML="<span style='font-size:9px;color:red'>Password did not match</span>";
		}else{
			x=x+1;
		}
	}
	
	if(x==11)
	return true;
	else
	return false;
	
}


function check_loginfrm(frm){
	if(frm.textfield.value==""){
		alert("Please enter Username");
		frm.textfield.focus();
		return false;
	}
	if(frm.textfield2.value==""){
		alert("Please enter Password");
		frm.textfield2.focus();
		return false;
	}
}









function validateEmail(email)
{
	
	
	// This function is used to validate a given e-mail 
	// address for the proper syntax
	
	if (email == ""){
		return false;
	}
	badStuff = ";:/,' \"\\";
	for (i=0; i<badStuff.length; i++){
		badCheck = badStuff.charAt(i)
		if (email.indexOf(badCheck,0) != -1){
			return false;
		}
	}
	posOfAtSign = email.indexOf("@",1)
	if (posOfAtSign == -1){
		return false;
	}
	if (email.indexOf("@",posOfAtSign+1) != -1){
		return false;
	}
	posOfPeriod = email.indexOf(".", posOfAtSign)
	if (posOfPeriod == -1){
		return false;
	}
	if (posOfPeriod+2 > email.length){
		return false;
	}
	return true
}
function chkNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.- ";
   var strChar;
   var blnResult = true;

   if (strString.length < 5 ) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      //alert(strString.charAt(i));
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }