// JavaScript Document
var key1;
function showProductInfo(prid)
{
	
var wind=window.open("modproduct.php?productid="+prid,null,"height=500,top=100,left=100,width=600,scrollbars=1");
	
	
	
	
	
}

function swapImage()
{
	param1=key1;
	alert(param1);
ctl1=getCtl('imgantispam');	
	ctl1.src="antispam.php?key="+param1;
	
	
}
function validateForm2()
{
	 
	 
		    ctl=getCtl('txtpcode');
   
   
     if(ctl.value.search(sth)==-1)
	     {
			 
			 
			alert("Enter product code properly");
			
			ctl.focus();
			
			return false;
			 
			 
		 }
   
		  
		  //setBandsaw(ctl.value);
		  
		  
		  val=getCtl("blank");
		    if(val.checked)
			  {
				  
				  
				return true;  
				  
			  }
			val=getCtl("featured");
		    if(val.checked)
			  {
					  
				return true;  
				  
			  }
		  
		/*
		
		sawv=getValue('saw');
		//alert(sawv);
		sawv*=1;
		
		 if(sawv==1)
		    {
				*/
			pr=	getValue('txtprice');
				
				
				if(pr.search(decreg)==-1)
				  {
			    alert("You must enter price per unit ");
				
				
				return false;
				
				
				  }
				
				
			/*}
		 
		
		
		
		
		
		  
	 /*

ctl=getCtl('txtprice')
   
    if(ctl.value.search(decreg)==-1)
	    {
			
			
		alert("Enter product price properly");
		
		ctl.focus();
		
		return false;
			
			
			
			
		}*/
   
 
   
   
return true;


}


function showProductDetails(prid)
{
	
	var x=getobject();


  if(x)
     {
		 
		 
	var url="../aja/productdetails.php?productid="+prid;
	
	var method="get";
	
	var async=true;
	
	            x.open(method,url,async);
			   x.onreadystatechange=function()
			              {
						   if(x.readyState==1)
						   setHTML("mydiv","Retrieving... data");
						    if(x.readyState==2)
							 setHTML("mydiv","Data Loading..");
							 if(x.readyState==3)
							 setHTML("mydiv","Data Loading Complete... Displaying data");
						 
						    if(x.readyState==4) 
							
							
							         {
							           
									 if(x.status==200)
									 
									       {
										   
										   //alert(x.responseText);
										   setHTML("mydiv",x.responseText);
										   
										   
										   }
										   else
										   {
										   
										   
										   setHTML("mydiv","Error Occured");
										   
										   }
									 
									 
									 
									 }//readustate4
						  
						  
						  
						  
						  
						  }//onreadustatechante
	
	x.send(null);
	
	
	
	
	  
	
	
		 
		 
		 
	 }
	 
	 else
	 {
		 
		alert("Your Browser needs upgradation"); 
		 
		 
	 }
	 
	 
	
	
	
}

function mailFriend()
{
	

  var errm;
  var errctl;
  errm="";
	var errflag;
	errflag=false;
ctl=getCtl('txtsemail');
if(ctl.value.search(emlreg)==-1)
    {
		errm+="Please enter your email properly\n";  
		 
		if(errflag==false)
		   {
			   
			
			 
			   errctl=ctl;
			   
		   }
		
		errflag=true; 
	}
ctl=getCtl('txtemail1');
	if(ctl.value.search(emlreg)==-1)
    {
		errm+="Please enter your friend email properly\n";   
		if(errflag==false)
		   {
			   
			
			 
			   errctl=ctl;
			   
		   }
		
		  errflag=true;
	}
	
	ctl=getCtl('txtname');
	if(ctl.value.search(sth)==-1)
    {
		errm+="Please enter your name properly\n";   
		if(errflag==false)
		   {
			   
			
			  
			   errctl=ctl;
			   
		   }
		
		 errflag=true;
	}
	val1=getValue('txtantispam');
	val2=getValue('antispam');
	if(val1.toUpperCase()!==val2.toUpperCase())
	   {
		    errm+="Please write the code as shown, your written code is invalid\n";
			if(errflag==false)
			   {
		   errctl=getCtl('txtantispam');
		
		 
			   }
		
		    errflag=true;
		   
	   }
	   
	   if(errflag==true)
	      {
			  
			alert(errm);  
			 
			  errctl.focus();
			  
			  return 
		  }
	getCtl('cmdSend').disabled=true;
	xajax_sendMail(xajax.getFormValues('form2'),'spanpro');
}

