function chkqty()

{

  if(document.getElementById("txt_quant").value=="")

	{

		 alert("Please enter the quantity!!!");

		 document.getElementById("txt_quant").focus();

		 document.getElementById("txt_quant").select();

		 return false;

	}



  if(document.getElementById("txt_quant").value!="")

    {

	   if((isNaN(document.getElementById("txt_quant").value))||((document.getElementById("txt_quant").value)=="0"))

		{

        alert("Please enter valid quantity!!!");

		document.getElementById("txt_quant").focus();

		document.getElementById("txt_quant").select();

		return false;

		}
	}

	return true;
}
function display_shipping(frm)
{
  document.getElementById("sh_name").value =  document.getElementById("cus_name").value;
  document.getElementById("sh_add_1").value =  document.getElementById("add_1").value;
  document.getElementById("sh_add_2").value =  document.getElementById("add_2").value;
  document.getElementById("sh_county").value = document.getElementById("county").value;
  document.getElementById("sh_town").value   = document.getElementById("town").value;
  document.getElementById("sh_country").value   = document.getElementById("country").value;
  document.getElementById("sh_postcode").value   = document.getElementById("postcode").value;
  document.getElementById("sh_phone").value      = document.getElementById("phone").value;  
}

function chkfields()

 {

	if(document.getElementById("cus_name").value=="")

		{

			 alert("Please enter your full name!!!");

			 document.getElementById("cus_name").focus();

			 document.getElementById("cus_name").select();

			 return false;

		}

	

	if(document.getElementById("email").value=="")

		{

			 alert("Please enter your email id!!!");

			 document.getElementById("email").focus();

			 document.getElementById("email").select();

			 return false;

		}



    if (echeck(document.getElementById("email").value)==false)

		  {

			document.getElementById("email").value=""

			document.getElementById("email").focus()

			return false

		  }



	if(document.getElementById("add_1").value=="")

		{

			 alert("Please enter your address!!!");

			 document.getElementById("add_1").focus();

			 document.getElementById("add_1").select();

			 return false;

		}



	if(document.getElementById("town").value=="")

		{

			 alert("Please enter your town name!!!");

			 document.getElementById("town").focus();

			 document.getElementById("town").select();

			 return false;

		}



	if(document.getElementById("county").value=="")

		{

			 alert("Please enter your state name!!!");

			 document.getElementById("county").focus();

			 document.getElementById("county").select();

			 return false;

		}



	if(document.getElementById("postcode").value=="")

		{

			 alert("Please enter your postcode!!!");

			 document.getElementById("postcode").focus();

			 document.getElementById("postcode").select();

			 return false;

		}



	if(document.getElementById("postcode").value!="")

		{

		 

		 if(isNaN(document.getElementById("postcode").value))

			{ 

				 alert("Please enter valid postcode!!!");

				 document.getElementById("postcode").focus();

				 document.getElementById("postcode").select();

				 return false;

			}

		}



	if(document.getElementById("phone").value=="")

		{

			 alert("Please enter your phone number!!!");

			 document.getElementById("phone").focus();

			 document.getElementById("phone").select();

			 return false;

		}

	if(document.getElementById("phone").value!="")

		{ 

			var str=document.getElementById("phone").value;

  	 	    var len=str.length;

			if(isNaN(document.getElementById("phone").value)||(len < 8))

				{

					 alert("Please enter valid phone number!!!");

					 document.getElementById("phone").focus();

					 document.getElementById("phone").select();

					 return false;

				}

		}



	if(document.getElementById("password1").value=="")

		{

			 alert("Please enter your password!!!");

			 document.getElementById("password1").focus();

			 document.getElementById("password1").select();

			 return false;

		}

	else if(document.getElementById("password1").value.length<6)

		{

			alert("Password entered should be minimum of 6 characters/digits !!!!");

			return false;

		}

		



	if(document.getElementById("password2").value=="")

		{

			 alert("Please enter your confirm password!!!");

			 document.getElementById("password2").focus();

			 document.getElementById("password2").select();

			 return false;

		}



	if((document.getElementById("password1").value!="")&&(document.getElementById("password2").value!=""))

		{

		  var val1=document.getElementById("password1").value;

		  var val2=document.getElementById("password2").value;

		  

		  if(val1!=val2)

			{

				alert("Password and confirm password must be the same!!!");

				document.getElementById("password2").focus();

				document.getElementById("password2").select();

				return false;

			}

		}

return true;

}

	
function echeck(str) {

		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 E-mail ID")

		   return false

		}



		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

		   alert("Invalid E-mail ID")

		   return false

		}



		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

		    alert("Invalid E-mail ID")

		    return false

		}



		 if (str.indexOf(at,(lat+1))!=-1){

		    alert("Invalid E-mail ID")

		    return false

		 }



		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

		    alert("Invalid E-mail ID")

		    return false

		 }

		 if (str.indexOf(dot,(lat+2))==-1){

		    alert("Invalid E-mail ID")

		    return false

		 }
		 if (str.indexOf(" ")!=-1){

		    alert("Invalid E-mail ID")

		    return false
    
		 }
	 // return true					

}

function edit_shipping()
{

  window.open("edit_personal_details.php","","resizable=no,width=1000,height=620,scrollbars=yes,status=no,top=75,screenY=255,left=200,screenX=350");

}
function edit_shipping_details()
{
   window.open("edit_shipping_details.php","","resizable=no,width=1000,height=620,scrollbars=yes,status=no,top=75,screenY=255,left=200,screenX=350");
	
}
function close_parent()
{
  window.opener.location.href = './confirm_shopping.php';
  self.close();
}

function refresh_file()
{
  window.location.href='./confirm_shopping.php?final=1';
}
function validate_data(frm)
{
   if(document.getElementById("email").value=="")

		{

			 alert("Please enter your email id!!!");

			 document.getElementById("email").focus();

			 document.getElementById("email").select();

			 return false;

		}



    if (echeck(document.getElementById("email").value)==false)

		  {

			document.getElementById("email").value=""

			document.getElementById("email").focus()

			return false

		  }
 
 
   if(document.getElementById("pass_word").value=="")

		{

			 alert("Please enter your password!!!");

			 document.getElementById("pass_word").focus();

			 document.getElementById("pass_word").select();

			 return false;

		}

	else if(document.getElementById("pass_word").value.length<6)

		{

			alert("Password entered should be minimum of 6 characters/digits !!!!");

			return false;

		}

   return true;
	
}
function validate_forgot_data(frm)
{
	
	if(document.getElementById("email").value=="")

		{

			 alert("Please enter your email id!!!");

			 document.getElementById("email").focus();

			 document.getElementById("email").select();

			 return false;

		}



    if (echeck(document.getElementById("email").value)==false)

		  {

			document.getElementById("email").value=""

			document.getElementById("email").focus()

			return false

		  }
 
 
   return true;
	
}

function exchangeRate(amount,currency,exchangeIn)
{
	document.subform1.exchangeIn.value=exchangeIn;
	document.subform1.submit();
}


function validate_data_contact(frm)
{
	 
	if(document.getElementById("txtfname").value=="")
	{
			 alert("Please enter your name!!!");
			 document.getElementById("txtfname").focus();
			 document.getElementById("txtfname").select();
			 return false;
	}

    if(document.getElementById("country").value=="")
	{
		alert("Please enter your country!!!");
		document.getElementById("country").focus();
		//document.getElementById("country").select();
		return false;
	}
	if(document.getElementById("txtemailaddress").value=="")
	{
		 alert("Please enter your email id!!!");
		 document.getElementById("txtemailaddress").focus();
		 document.getElementById("txtemailaddress").select();
		 return false;
	}
    if (echeck(document.getElementById("txtemailaddress").value)==false)
    {
			document.getElementById("txtemailaddress").value=""
			document.getElementById("txtemailaddress").focus()
			return false;
	}
	if(document.getElementById("txtsubject").value=="")
	{
			 alert("Please enter your Subject!!!");
			 document.getElementById("txtsubject").focus();
			 document.getElementById("txtsubject").select();
			 return false;
	}
	if(document.getElementById("txtcomments").value=="")
	{
			 alert("Please enter your Comments!!!");
			 document.getElementById("txtcomments").focus();
			 document.getElementById("txtcomments").select();
			 return false;
	}

   
	
   return true;
}
function validate_data_feedback(frm)
{
	 
	if(document.getElementById("txtfname").value=="")
	{
			 alert("Please enter your name!!!");
			 document.getElementById("txtfname").focus();
			 document.getElementById("txtfname").select();
			 return false;
	}
	if(document.getElementById("txtemail").value=="")
	{
		 alert("Please enter your email id!!!");
		 document.getElementById("txtemail").focus();
		 document.getElementById("txtemail").select();
		 return false;
	}
    if (echeck(document.getElementById("txtemail").value)==false)
    {
			document.getElementById("txtemail").value=""
			document.getElementById("txtemail").focus()
			return false;
	}
	if(document.getElementById("txtsite").value=="")
	{
		 alert("Please Enter your review!!!");
		 document.getElementById("txtsite").focus();
		 document.getElementById("txtsite").select();
		 return false;
	}
	if(document.getElementById("txtcomments").value=="")
	{
			 alert("Please enter your Comments!!!");
			 document.getElementById("txtcomments").focus();
			 document.getElementById("txtcomments").select();
			 return false;
	}
	
   return true;
}
	