function other(f1,f2)
{
	if(f1.options[f1.options.selectedIndex].text=="Other")
		f2.disabled=false;
	else
	{
		f2.value="";
		f2.disabled=true;
	}
}
function show(f1)
{

	if(!f1.uid.value){
	if(f1.Email.value=="")
	{
		alert("Enter your E-Mail Address");
		f1.Email.focus();
		return false;
	}
		if (f1.Email.value) {
		emailErr=checkEmail(f1.Email.value) ;
		if(emailErr)
		{
		alert(emailErr);
		f1.Email.focus();
		return false;
		}
	}
	if(f1.Password.value=="")
	{
		alert("Enter your Password");
		f1.Password.focus();
		return false;
	}
	if (f1.Password.value.length<4){
		alert("Password should be of Min. 4 character");
		f1.Password.focus();
		return false;
	}
	if(f1.Password.value!=f1.confirmPassword.value)
	{
		alert("Password does not match");
		f1.confirmPassword.focus();
		return false;
	}
	}
	if(f1.billFirstName.value=="")
	{
		alert("Enter your First Name for Billing Address");
		f1.billFirstName.focus();
		return false;
	}
		if(f1.billLastName.value=="")
	{
		alert("Enter your Last Name for Billing Address");
		f1.billLastName.focus();
		return false;
	}
	if(f1.billPhone1.value=="")
	{
		alert("Enter your Billing Phone #");
		f1.billPhone1.focus();
		return false;
	}
	if(f1.billPhone2.value=="")
	{
		alert("Enter your Billing Phone #");
		f1.billPhone2.focus();
		return false;
	}
	if(f1.billPhone3.value=="")
	{
		alert("Enter your Billing Phone #");
		f1.billPhone3.focus();
		return false;
	}
	if(f1.billAddress.value=="")
	{
		alert("Enter your Billing Address");
		f1.billAddress.focus();
		return false;
	}
	if(f1.billCity.value=="")
	{
		alert("Enter your City for Billing Address");
		f1.billCity.focus();
		return false;
	}
	if(f1.billState.value=="")
	{
		alert("Enter your State for Billing Address");
		f1.billState.focus();
		return false;
	}
	if(f1.billZip.value=="")
	{
		alert("Enter your Zip Code for Billing Address");
		f1.billZip.focus();
		return false;
	}
// 	if(f1.billCountry.value=="")
// 	{
// 		alert("Enter your Country for Billing Address");
// 		f1.billCountry.focus();
// 		return false;
// 	}
	if(!f1.ship_same.checked)
	{
		if(f1.shippingFirstName.value=="")
		{
			alert("Enter your First Name for Shipping Address");
			f1.shippingFirstName.focus();
			return false;
		}
		if(f1.shippingLastName.value=="")
		{
			alert("Enter your Last Name for Shipping Address");
			f1.shippingLastName.focus();
			return false;
		}
		if(f1.shippingPhone1.value=="")
		{
			alert("Enter your Shipping Phone #");
			f1.shippingPhone1.focus();
			return false;
		}
		if(f1.shippingPhone2.value=="")
		{
			alert("Enter your Shipping Phone #");
			f1.shippingPhone2.focus();
			return false;
		}
		if(f1.shippingPhone3.value=="")
		{
			alert("Enter your Shipping Phone #");
			f1.shippingPhone3.focus();
			return false;
		}
		if(f1.shippingAddress.value=="")
		{
			alert("Enter your Shipping Address");
			f1.shippingAddress.focus();
			return false;
		}
		if(f1.shippingCity.value=="")
		{
			alert("Enter your City for Shipping ");
			f1.shippingCity.focus();
			return false;
		}
		if(f1.shippingState.value=="")
		{
			alert("Enter your State for Shipping Address");
			f1.shippingState.focus();
			return false;
		}
		if(f1.shippingZip.value=="")
		{
			alert("Enter your Zip Code for Shipping Address");
			f1.shippingZip.focus();
			return false;
		}
	}



return true;
}


function bill()
{


	if(document.billform.billFirstName.value=="")
	{
		alert("Please Enter first Name");
		document.billform.billFirstName.focus();
		return false;
	}
	if(document.billform.billLastName.value=="")
	{
		alert("Please Enter last Name");
		document.billform.billLastName.focus();
		return false;
	}
	if(document.billform.billAddress.value=="")
	{
		alert("Please Enter Address");
		document.billform.billAddress.focus();
		return false;
	}
	if(document.billform.billCity.value=="")
	{
		alert("Please Enter city");
		document.billform.billCity.focus();
		return false;
	}
	BillStateSelect=billform.billState.options[billform.billState.options.selectedIndex].value;
		if(BillStateSelect=='')
		{
		alert('Kindly select state.');
		return false;
		}
	if(isNaN(document.billform.billZip.value))     
	{
		alert("Please enter a valid Zip Code ");
		document.billform.billZip.value="";
		document.billform.billZip.focus();			
		return false;
	}	

	BillCountry=billform.billCountry.options[billform.billCountry.options.selectedIndex].value;
	if(BillCountry=='')
		{
		alert('Kindly select country.');
		return false;
		}
	if(document.billform.email.value=="")
	{
		alert("Please Enter Email Address");
		document.billform.email.focus();
		return false;
	}
	//email(this);
	validRegExp=/^[-a-zA-Z0-9._%-+']+@[a-zA-Z0-9.-]+.[a-z]{2,4}$/i;
	strEmail = document.billform.email.value;
	if (strEmail.search(validRegExp) == -1) 
	{
		alert("Invalid Email Address !!!");
		document.billform.email.value="";
		document.billform.email.focus();
		return false;
	}
	if(document.billform.cemail.value!=document.f1.email.value)
	{
		alert("Email Address dosen't match");
		document.billform.email.focus();
		return false;
	}
return true;
}

function ship()
{
	if(document.frm.cardname.value=="")
	{
		alert("Please Enter card Name");
		document.frm.cardname.focus();
		return false;
	}
	if(document.frm.cardno.value=="")
	{
		alert("Please Enter card number");
		document.frm.cardno.focus();
		return false;
	}
	if(document.frm.ccv.value=="")
	{
		alert("Please Enter ccv/security code");
		document.frm.ccv.focus();
		return false;
	}
	expirationMonth=frm.expirationMonth.options[frm.expirationMonth.options.selectedIndex].value;
	if(expirationMonth=='')
	{
		alert('Kindly select Month.');
		return false;
	}
	expirationYear=frm.expirationYear.options[frm.expirationYear.options.selectedIndex].value;
	if(expirationYear=='')
	{
		alert('Kindly select Year.');
		return false;
	}
		
	if(document.getElementById('hide').checked)
	{
		if(document.frm.shippingFirstName.value=="")
		{
			alert("Please Enter first Name");
			document.frm.shippingFirstName.focus();
			return false;
		}
		if(document.frm.shippingLastName.value=="")
		{
			alert("Please Enter last Name");
			document.frm.shippingLastName.focus();
			return false;
		}
		if(document.frm.shippingAddress.value=="")
		{
			alert("Please Enter address");
			document.frm.shippingAddress.focus();
			return false;
		}
		if(document.frm.shippingCity.value=="")
		{
			alert("Please Enter city");
			document.frm.shippingCity.focus();
			return false;
		}
		ShipStateSelect=frm.shippingState.options[frm.shippingState.options.selectedIndex].value;
			if(ShipStateSelect=='')
			{
			alert('Kindly select state.');
			return false;
		}
		if(isNaN(document.frm.shippingZip.value))
		{
			alert("Please enter a valid Zip Code ");
			document.frm.shippingZip.value="";
			document.frm.shippingZip.focus();			
			return false;
		}
		ShipCountry=frm.shippingCountry.options[frm.shippingCountry.options.selectedIndex].value;
		if(ShipCountry=='')
		{
			alert('Kindly select country.');
			return false;
		}
	}
	return true;
}


function mailing_validate(f1){

	if(f1.email.value=="")
	{
		alert("Enter your E-Mail Address");
		f1.email.focus();
		return false;
	}
		if (f1.email.value) {
		emailErr=checkEmail(f1.email.value) ;
		if(emailErr)
		{
		alert(emailErr);
		f1.email.focus();
		return false;
		}
	}
	if(f1.city.value=="")
	{
		alert("Enter your City");
		f1.city.focus();
		return false;
	}
	if(f1.country.value=="")
	{
		alert("Enter your Country");
		f1.country.focus();
		return false;
	}
return true;
}


function validate_contact(f1){

	if(f1.name.value=="")
	{
		alert("Enter your Name");
		f1.name.focus();
		return false;
	}
	if(f1.email.value=="")
	{
		alert("Enter your E-Mail Address");
		f1.email.focus();
		return false;
	}
		if (f1.email.value) {
		emailErr=checkEmail(f1.email.value) ;
		if(emailErr)
		{
		alert(emailErr);
		f1.email.focus();
		return false;
		}
	}
	if(f1.comment.value=="")
	{
		alert("Enter your Comments");
		f1.comment.focus();
		return false;
	}
return true;
}

function promoregistration(f1){


	if(f1.email.value=="")
	{
		alert("Enter your E-Mail Address");
		f1.email.focus();
		return false;
	}
		if (f1.email.value) {
		emailErr=checkEmail(f1.email.value) ;
		if(emailErr)
		{
		alert(emailErr);
		f1.email.focus();
		return false;
		}
	}

return true;
}


function checkEmail(strEmail)
{
var ar;
validRegExp= /^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})([\ ]*)$/;
if (strEmail.search(validRegExp) == -1) 
{
ar="Enter your E-Mail Address in this format abc@abc.com";
}
else
ar="";
return ar;
}





















/*
i=0;

while(i!=f1.elements.length)
	{
		if(f1.elements[i].disabled||f1.elements[i].name=="jobId")
		{
		i++;
		continue;
		}
		if(f1.elements[i].value.length==0)
		{
		alert("Enter your "+f1.elements[i].name);
		f1.elements[i].focus();
		return 0;
		}
		if (f1.elements[i].name=="Email") {
			emailErr=checkEmail(f1.Email.value) ;
			if(emailErr)
			{
			alert(emailErr);
			return false;
			}
	}
		if (f1.elements[i].name=="billEmail") {
			emailErr=checkEmail(f1.billEmail.value) ;
			if(emailErr)
			{
			alert(emailErr);
			return false;
			}
	}	
		if(f1.elements[i].name=="billPhone" || f1.elements[i].name=="billZip" ||f1.elements[i].name=="phoneNo" || f1.elements[i].name=="Zip_Code")
		{
			if(isNaN(f1.elements[i].value))
			{
				alert(f1.elements[i].name+" should be numeric");
				f1.elements[i].focus();
				return 0;
			}
		}

		i++;
	}
	
	if(i==f1.elements.length)
	{
		return 1;
	}
	return 0;
}

function email(f1)
{
if(f1.Email.value.indexOf('@')=='-1' || f1.Email.value.indexOf('.')=='-1' || f1.Email.value.indexOf(' ')!='-1')
	{
		alert("check your email");
		f1.Email.focus();
		return 0;
	}
	else
		return 1;
}

function checkEmail(strEmail)
{
var ar;
validRegExp= /^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})([\ ]*)$/;
if (strEmail.search(validRegExp) == -1) 
{
ar="Please enter a valid Email";
}
else
ar="";
return ar;
}

// function checkEmail(str) {
// 		var eerr="";
// 		var at="@"
// 		var dot="."
// 		var lat=str.indexOf(at)
// 		var lstr=str.length
// 		var ldot=str.indexOf(dot)
// 		if (str.indexOf(at)==-1){
// 		   eerr="Invalid E-mail ID";
// 		   return eerr
// 		}
// 
// 		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
// 		   eerr="Invalid E-mail ID";
// 		   return eerr
// 		}
// 
// 		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
// 		    eerr="Invalid E-mail ID";
// 		    return eerr
// 		}
// 
// 		 if (str.indexOf(at,(lat+1))!=-1){
// 		    eerr="Invalid E-mail ID";
// 		    return eerr
// 		 }
// 
// 		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
// 		    eerr="Invalid E-mail ID";
// 		    return eerr
// 		 }
// 
// 		 if (str.indexOf(dot,(lat+2))==-1){
// 		    eerr="Invalid E-mail ID";
// 		    return eerr
// 		 }
// 		
// 		 if (str.indexOf(" ")!=-1){
// 		    eerr="Invalid E-mail ID";
// 		    return eerr
// 		 }
// 		 return ""
// 	}
*/

function compare(f1,f2)
{
	if(!document.getElementById("uid").value){
if (f1.value.length<4){
alert("Password should be of Min. 4 character");
	f1.focus();
	return false;
}
  if(f1.value!=f2.value)
  {
  	alert("Check Your Confirm Password");
	f2.focus();
	return false;
  }
	else
	return true;

}
}
