// JavaScript Document
 
function LoginValidation()
	{
	 if(document.getElementById('username').value=="username")
		{
		alert("Please Enter The Valid Username");
		document.getElementById('username').focus();
		return false;
		}
			
	}

function blankvalidation()
	{
	if(document.getElementById('firstname').value=="")
		{
		alert("Please Enter The First Name");
		document.getElementById('firstname').focus();
		return false;
		}
	if(document.getElementById('lastname').value=="")
		{
		alert("Please Enter The Last Name");
		document.getElementById('lastname').focus();
		return false;
		}	
	if(document.getElementById('email').value=="")
		{
		alert("Please Enter The Email Address");
		document.getElementById('email').focus();
		return false;
		}
	if(document.getElementById('address').value=="")
		{
		alert("Please Enter The Address");
		document.getElementById('address').focus();
		return false;
		}
	if(document.getElementById('city').value=="")
		{
		alert("Please Enter The City");
		document.getElementById('city').focus();
		return false;
		}	
	if(document.getElementById('zip').value=="")
		{
		alert("Please Enter The Zip Code");
		document.getElementById('zip').focus();
		return false;
		}	
	if(document.getElementById('state').value=="")
		{
		alert("Please Select The State");
		document.getElementById('state').focus();
		return false;
		}		
	if(document.getElementById('phone').value=="")
		{
		alert("Please Enter The Phone Number");
		document.getElementById('phone').focus();
		return false;
		}	
	if(document.getElementById('shipfname').value=="")
		{
		alert("Please Enter The Shipping First Name");
		document.getElementById('shipfname').focus();
		return false;
		}	
	if(document.getElementById('shiplname').value=="")
		{
		alert("Please Enter The Shipping Last Name");
		document.getElementById('shiplname').focus();
		return false;
		}	
	if(document.getElementById('shipaddress').value=="")
		{
		alert("Please Enter The Shipping Address");
		document.getElementById('shipaddress').focus();
		return false;
		}	
	if(document.getElementById('shipcity').value=="")
		{
		alert("Please Enter The Shipping City");
		document.getElementById('shipcity').focus();
		return false;
		}		
	if(document.getElementById('shipzip').value=="")
		{
		alert("Please Enter The Shipping Zip Code");
		document.getElementById('shipzip').focus();
		return false;
		}	
	if(document.getElementById('shipstate').value=="")
		{
		alert("Please Enter The Shipping State");
		document.getElementById('shipstate').focus();
		return false;
		}	
	if(document.getElementById('shipcountry').value=="")
		{
		alert("Please Select The Shipping Country");
		document.getElementById('shipcountry').focus();
		return false;
		}	
	}

function myfunction(str)
{

	//str=com.email.value;
		
                var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid Email Address");
			document.getElementById('email').value="";
		document.getElementById('email').focus();
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
		{
		     alert("Invalid Email Address");
				document.getElementById('email').value="";
		document.getElementById('email').focus();
		   return false;
		}


		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
		{
		   alert("Invalid Email Address");
		   	document.getElementById('email').value="";
		document.getElementById('email').focus();
		     return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		      alert("Invalid Email Address");
				document.getElementById('email').value="";
		document.getElementById('email').focus();
		     return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
		 {
		      alert("Invalid Email Address");
				document.getElementById('email').value="";
		document.getElementById('email').focus();
		     return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid Email Address");
			document.getElementById('email').value="";
		document.getElementById('email').focus();
		     return false;
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("Invalid Email Address");
				document.getElementById('email').value=="";
		document.getElementById('email').focus();
		document.getElementById('email').value="";
		     return false;
		 }
		 
 }
 
function numbercheck(string)	
{
var Chars = "0123456789";
    
    for (var i = 0; i < string.length; i++)
    {
       
       if (Chars.indexOf(string.charAt(i)) == -1)
       {
            alert("Please Provide Only Numeric values");
			document.getElementById('noofstore').value="";
          document.getElementById('noofstore').focus();
           
            return false;
       }
    }	
}
function fun1(str)
{
 x = str.value;
 for(i=0;i<x.length;i++)
 {
   ch=x.charAt(i);
   if(!(ch>='0' && ch<='9'))
   {
     str.value = x.substr(0,x.indexOf(ch));
   }
 }
}

function on(){

document.getElementById('username').value="";

}
function pass(){
//alert();
document.getElementById('password').value="";

}

function pass1(){
//alert();
if(document.getElementById('password').value==""){

document.getElementById('password').value="password";

}

}

function on1(){
//alert();
if(document.getElementById('username').value==""){

document.getElementById('username').value="username";

}

}



function copy()
{
	
	if(document.billing.chkbox.checked == true)
	{
		
		document.billing.shipfname.value=document.billing.firstname.value;
		document.billing.shiplname.value=document.billing.lastname.value;
		document.billing.shipaddress.value=document.billing.address.value;
		document.billing.shipcity.value=document.billing.city.value;
		document.billing.shipstate.value=document.billing.state.value;
		document.billing.shipzip.value=document.billing.zip.value;
		document.billing.shipcountry.value=document.billing.country.value;
		
	
		
		document.getElementById('shipfname').readOnly="readonly";
		document.getElementById('shiplname').readOnly="readonly";
		document.getElementById('shipaddress').readOnly="readonly";
		document.getElementById('shipcity').readOnly="readonly";
		document.getElementById('shipstate').readOnly="readonly";
		document.getElementById('shipzip').readOnly="readonly";
		document.getElementById('shipcountry').readOnly="readonly";
		
	}
	
	else
	{
		document.billing.shipfname.value="";
		document.billing.shiplname.value="";
		document.billing.shipaddress.value="";
		document.billing.shipcity.value="";
		document.billing.shipzip.value="";
		document.billing.shipstate.value="";
		document.billing.shipcountry.value="";
		document.getElementById('shipfname').readOnly=false;
		document.getElementById('shiplname').readOnly=false;
		document.getElementById('shipaddress').readOnly=false;
		document.getElementById('shipcity').readOnly=false;
		document.getElementById('shipstate').readOnly=false;
		document.getElementById('shipzip').readOnly=false;
		document.getElementById('shipcountry').readOnly=false;
		
	}
}



function cancelall()
	{
	 document.location.href='cancelall_inner.php';
	}
function validatecheckout()
	{
		if(document.f2.total.value=="")
		{
			alert('Total Price Should not be blank');
			return false;
		}		
		else if(document.f2.holder_name.value=="")
		{
			alert('Card holder name Should not be blank');
			return false;
		}		
		else if(document.f2.card_type.value=="")
		{
			alert('Card Type should not be Blank');
			return false;
		}		
		else if(document.f2.card_no.value=="")
		{
			alert('Card No should not be Blank');
			return false;
		}
		else if(document.f2.cvv_no.value=="")
		{
			alert('CVV No should not be Blank');
			return false;
		}	
		else if(document.f2.exp_month.value=="")
		{
			alert('Exp month should not be Blank');
			return false;
		}
		else if(document.f2.exp_yr.value=="")
		{
			alert('Exp year should not be Blank');
			return false;
		}	
	}
function fun(str)
{
 x = str.value;
 
 for(i=0;i<x.length;i++)
 {
   ch=x.charAt(i);
   if(!(ch>='0' && ch<='9' ))
   {
     str.value = x.substr(0,x.indexOf(ch));
   }
 }
}



