function  backcolorout(me)
{//#7db0c6
	me.style.backgroundColor="#FFF9CF";
}
function  backcolorover(me)
{
	me.style.backgroundColor="#efd189";
}//efd189
function  backcolorout1(me)
{//#7db0c6
	me.style.backgroundColor="#ffffff";
}
function  backcolorover1(me)
{
	me.style.backgroundColor="#FFF9CF";
}//efd189
function emailcheck(txtbox) 
	{
		var emailStr=txtbox.value;

		var FormData=document.frm
		var dot=0
		var at2=0
		var at
		var emailPat=/^(.+)@(.+)$/
		var specialChars="\\(\\)<>@,;:'\\\\\\\"\\.\\[\\]"
		var validChars="\[^\\s" + specialChars + "\]"
		var quotedUser="(\"[^\"]*\")"
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom=validChars + '+'
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

		var matchArray=emailStr.match(emailPat)
		if (matchArray==null) 
		{
			alert("Email address seems incorrect (check @ and .'s)")
			txtbox.focus();
			error=0;
			return false
		}
		var user=matchArray[1]
		var domain=matchArray[2]
		if (user.match(userPat)==null) 
		{
			alert("The username doesn't seem to be valid.")
			txtbox.focus();
			error=0;
			return false
		}

		var IPArray=domain.match(ipDomainPat)

		if (IPArray!=null) 
		{
			for (var i=1;i<=4;i++) 
			{
				if (IPArray[i]>255) 
				{
					alert("Destination IP address is invalid!")
					txtbox.focus();
					error=0;
					return false
				}
			}
			return true
		}

		var domainArray=domain.match(domainPat)

		if (domainArray==null) 
		{
			alert("The domain name doesn't seem to be valid.")
			txtbox.focus();
			error=0;
			//document.frmsubscribe.txtemail.focus();
			return false;
		}

		var atomPat=new RegExp(atom,"g")
		var domArr=domain.match(atomPat)
		var len=domArr.length

		if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) 
		{
			alert("The address must end in a three-letter domain, or two letter country.")
			txtbox.focus();
			error=0;
			return false;
		}

		if (len<2) 
		{
			var errStr="This address is missing a hostname!"
			alert(errStr)
			txtbox.focus();
		return false;
		}
	return true;	
	}
	
	function Checktxtbox(txtB)
	{
		var str,lnth,chrCode,nStr

		str = txtB.value
		lnth = str.length
		nstr=""

		for(i=0;i<lnth;i++)
		{
			chrCode=str.charCodeAt(i)
		
			if((chrCode==34) ||(chrCode==39))
			{
				alert("\' and \"  charcter are not allowed.")
				txtB.focus();
			    return false;
			}
		}
     return true;
	}
	function Trim (ns)
	{
		s=ns.value;
		//trim lefthand spaces
		var i=0;
		while(s.charAt(i)==' ')
		i++;
		s=s.substring(i,s.length);
		//trim righthand spaces
		if (s.length > 0) 
		{
			while(''+s.charAt(s.length-1)==' ') 
			s = s.substring(0,s.length-1);
			ns.value=s;
		}
		else
		{	ns.value=s; }
	return ns;	
	
	}
	
	function validateemail(frm)
	{
	 if (Trim(frm.txtmailid).value=="" )
	     {
		   frm.txtmailid.focus();
		   alert("Enter your email address to subscribe news letter.");
		   return false;
		 }

     if (! emailcheck(frm.txtmailid))
	     {
		   return false;
		 }
		 
	}
	function validateregistration(frm)
	{
	 if (Trim(frm.txtfname).value=="")
      {
	     frm.txtfname.focus();
		 alert("Enter  first name.")
		 return false; 
	  }
	 if (Trim(frm.txtlname).value=="")
      {
	     frm.txtlname.focus();
		 alert("Enter  last name.");
		 return false; 
	  }

	 if (Trim(frm.txtpwd).value=="")
      {
	     frm.txtpwd.focus();
		 alert("Enter password. ");
		 return false; 
	  }

	 if (Trim(frm.txtcpwd).value=="")
      {
	     frm.txtcpwd.focus();
		 alert("Enter confirm password.")
		 return false; 
	  }

	 if (frm.txtpwd.value!=frm.txtcpwd.value)
      {
	      frm.txtpwd.focus();
		 alert("Password and confirm password must be same.")
		 return false; 
	  }

	 if (Trim(frm.txtmailid).value=="")
      {   
		 alert("Enter Email address.");
		   frm.txtmailid.focus();
		 return false; 
	  }
  if  (!emailcheck(frm.txtmailid))
      {
	   return false;
	  }    
   
  if (Trim(frm.txtphone).value=="")
      {
	     frm.txtphone.focus();
		 alert("Enter your phone number.")
		 return false; 
	  }
	  if(isNaN(Trim(frm.txtphone).value))
      {
	     frm.txtphone.focus();
		 alert("Enter Correct phone number.")
		 return false; 
	  }
  if (Trim(frm.txtaddress).value=="")
      {
	     frm.txtaddress.focus();
		 alert("Enter your address.")
		 return false; 
	  }
  if (Trim(frm.txtzipcode).value=="")
      {
	     frm.txtzipcode.focus();
		 alert("Enter Zip/postal/Pin code.")
		 return false; 
	  }
	    if(isNaN(Trim(frm.txtzipcode).value))
      {
	     frm.txtzipcode.focus();
		 alert("Enter Correct Values.")
		 return false; 
	  }
  if (Trim(frm.txtcity).value=="")
      {
	     frm.txtcity.focus();
		 alert("Enter city.")
		 return false; 
	  }
  if (Trim(frm.txtstate).value=="")
      {
	     frm.txtstate.focus();
		 alert("Enter state.")
		 return false; 
	  }
  if (frm.cmbcountry.selectedIndex==0)
      {
	     frm.cmbcountry.focus();
		 alert("Select country.")
		 return false; 
	  }
  return true;
  	}
	

function updatecart(me)
{

me.action="updatecart.asp"
me.submit();
}
function submitcart()
{
 me.submit();
}

function checkme(me)
{
 if (Trim(me).value=="" || isNaN(me.value) )
    {  me.focus();
     alert("Enter a valid quantity for this product. \n Or enter zero(0) to remove it from your cart.")  
   }
}
function validatelogin(me)
{
 if (Trim(me.txtuid).value=="")
    {
	  me.txtuid.focus();
	  alert("Enter your userid (email-id).")
	  return false;
	}
 if (!emailcheck(me.txtuid))
    {
	 return false;
	}
if (Trim(me.txtpwd).value=="")
   {
    me.txtpwd.focus();
	alert("Eneter your password.")
	return false;
    }
if (!Checktxtbox(me.txtpwd))
  {
   return false;
  }
return true;
}
function disableme(me)
{
me.disabled=true;
}
function saveorder()
{
window.document.frmorder.submit();
}
