// JavaScript Document
var common_dir = "/";
function avalid(){
  
  if(!validate_text(document.allp.pkeyword,1,"Please enter the search Keyword")){
	  return false;
  }
  
  if (/^[^\\\/\:\*\?\"\<\>\|\.\+\-]+$/.test(document.allp.pkeyword.value)) {
	// no code  
  }else{
	  alert("This keyword is invalid");
	  document.allp.pkeyword.focus();
	  return false;
  }
  
  return true;
}

function oopp() {
  var a=window.open("pass.php","Pass","width=400px, height=200px, top=10px, left=10px")
} 

function news_check(){
     
	 if(!validate_text(document.news_ff.nname,1,"Please enter your Name")){
	    return false;
	 }	 
	 
	 
	 if(!validate_email(document.news_ff.nemail,1,"Please enter your Email ID")){
	    return false;
	 }
	
     return true;
   }
   
function add_ct(aa,bb,cc)
	{
	  location.href=common_dir+"add_cart.php?id="+aa+"&pname="+bb+"&att_no="+cc
	}

function order_det(aa)
   {  
	var url = 'admin/order_det.php?ucode='+aa;
	var ttl = 'Order';
	var params = 'status=yes, resizable=yes ,width=650px, height=485px, top=10px, left=10px, scrollbars=yes';
	window.open(url, ttl, params);
   }

   
function checkk(){
 
 if(!validate_email(document.dff1.t1,1,"Please enter your Email ID")){
	 return false;
 }
 
 if(!validate_text(document.dff1.t2,1,"Please enter your Password")){
	 return false;
 } 

 return true;
}

function a_checkk(){
 
 if(!validate_email(document.a_dff1.t1,1,"Please enter your Email ID")){
	 return false;
 }
 
 if(!validate_text(document.a_dff1.t2,1,"Please enter your Password")){
	 return false;
 } 

 return true;
}

function go_display(){
    
    document.productfm.submit();
}

function go_displayb(){
    
    document.bproductfm.submit();
}
  
function getManu(objSel){
	//alert(objSel.value);
	url = "/manufacturer/"+objSel.value+".html";
	location.href=url;
}
function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 
}
function isInteger(s)
{   
    var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
	
}
function formcheck()
{
var name=document.getElementById("name").value;
var email=document.getElementById("email").value;
var pno=document.getElementById("phoneno").value;
var orderno=document.getElementById("orderno").value;
var subject=document.getElementById("sub").value;
var comments=document.getElementById("qcommments").value;

if(name=="") {alert("Please enter first and last name"); return false;}
if(email=="") {alert("Please enter your registered email address"); return false;}
if(!isValidEmail(email)) {alert("Invalid e-mail address! please re-enter."); return false;}
if(pno=="") {alert("Please enter Phone no"); return false;}
if(!isInteger(pno)) {alert("Invalid Phone no! please enter numerics."); return false;}
if(orderno=="") {alert("Please enter Order no"); return false;}
if(subject=="") {alert("Please select Subject"); return false;}
if(comments=="") {alert("Comments field shouldn't be blank"); return false;}

return true;
}