// JavaScript Document
function calldel(m)
{
  if(!confirm(m))
  {
    return false;
  }
  else
  return true;
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}


function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

// JavaScript Document
function poplinks(url)
{
	newwindow=window.open(url,'ImageDisplay','height=400,width=600,left=0,top=0,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}
function popup(url)
{
	newwindow=window.open(url,'ImageDisplay','height=400,width=600,left=0,top=0,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}
function validateEmail(addr,man,db) {
	if (addr == '' && man) {
	   if (db) alert('Email address is mandatory');
	   return false;
	}
	var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
	for (i=0; i<invalidChars.length; i++) {
	   if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
		  if (db) alert('Email address contains invalid characters');
		  return false;
	   }
	}
	for (i=0; i<addr.length; i++) {
	   if (addr.charCodeAt(i)>127) {
		  if (db) alert("Email address contains non ascii characters.");
		  return false;
	   }
	}

	var atPos = addr.indexOf('@',0);
	if (atPos == -1) {
	   if (db) alert('Email address must contain an @');
	   return false;
	}
	if (atPos == 0) {
	   if (db) alert('Email address must not start with @');
	   return false;
	}
	if (addr.indexOf('@', atPos + 1) > - 1) {
	   if (db) alert('Email address must contain only one @');
	   return false;
	}
	if (addr.indexOf('.', atPos) == -1) {
	   if (db) alert('Email address must contain a period in the domain name');
	   return false;
	}
	if (addr.indexOf('@.',0) != -1) {
	   if (db) alert('period must not immediately follow @ in email address');
	   return false;
	}
	if (addr.indexOf('.@',0) != -1){
	   if (db) alert('period must not immediately precede @ in email address');
	   return false;
	}
	if (addr.indexOf('..',0) != -1) {
	   if (db) alert('two periods must not be adjacent in email address');
	   return false;
	}
	var suffix = addr.substring(addr.lastIndexOf('.')+1);
	if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
	   if (db) alert('invalid primary domain in email address');
	   return false;
	}
return true;
}

function validate_frgtpasswrd()
{
	if (document.frm_frgtpasswrd.EmailId.value == "")
	 { 
		 alert ("Please enter the Email Address");
		 document.frm_frgtpasswrd.EmailId.focus();
		 return false;
	 }	
	 if (!validateEmail(document.frm_frgtpasswrd.EmailId.value,1,1)) 
	 {
		 document.frm_frgtpasswrd.EmailId.focus();
		 return false;
	 }
}

function showState(passcountry){
		if (document.getElementById(passcountry).value == "US"){
			postate = document.getElementById("poststate");
			if(postate){
				postate.style.display="block";
				postate.style.visibility="visible";
			}
			pootherstate = document.getElementById("postotherstate");
			if(pootherstate){
				pootherstate.style.display="none";
				pootherstate.style.visibility="hidden";
			}
		}
		else{
			pootherstate = document.getElementById("postotherstate");
			if(pootherstate){
				pootherstate.style.display="block";
				pootherstate.style.visibility="visible";
			}
			postate = document.getElementById("poststate");
			if(postate){
				postate.style.display="none";
				postate.style.visibility="hidden";
			}
		}
	}
 function showState1(passcountry){
		if (document.getElementById(passcountry).value == "US"){
			postate_bill = document.getElementById("poststate_bill");
			if(postate_bill){
				postate_bill.style.display="block";
				postate_bill.style.visibility="visible";
			}
			pootherstate_bill = document.getElementById("postotherstate_bill");
			if(pootherstate_bill){
				pootherstate_bill.style.display="none";
				pootherstate_bill.style.visibility="hidden";
			}
		}
		else{
			pootherstate_bill = document.getElementById("postotherstate_bill");
			if(pootherstate_bill){
				pootherstate_bill.style.display="block";
				pootherstate_bill.style.visibility="visible";
			}
			postate_bill = document.getElementById("poststate_bill");
			if(postate_bill){
				postate_bill.style.display="none";
				postate_bill.style.visibility="hidden";
			}
		}
	}
		
function showhide(){
		if (!(document.frm_register.chkDelivery.checked)){
		delistyle=document.getElementById("delivery");
		    if(delistyle){
			delistyle.style.display="block";
			delistyle.style.visibility="visible";
			}				
		}
		else
		{
			delistyle=document.getElementById("delivery");
			if(delistyle){
			delistyle.style.display="none";
			delistyle.style.visibility="hidden";
			}
		}
	}
	
//validation for register
//validation for register
function register_validate(){
	
	 if (document.frm_register.txtEmail.value == "")
	 {
		alert("Enter the Email");
		document.frm_register.txtEmail.focus();
		return false;
	 }
	
	 if(!validateEmail(document.frm_register.txtEmail.value,1,1))
	{
	   document.frm_register.txtEmail.focus();
	   return false;
	}
	 if (document.frm_register.txtPassword.value == "")
	 {
		alert("Enter the password");
		document.frm_register.txtPassword.focus();
		return false;
	 }
	 if (document.frm_register.txtConfirmPassword.value == "")
	 {
		alert("Enter the confirm password");
		document.frm_register.txtConfirmPassword.focus();
		return false;
	 }
	  if (document.frm_register.txtPassword.value != document.frm_register.txtConfirmPassword.value)
	 {
		alert("Enter the same password");
		document.frm_register.txtConfirmPassword.value="";
		document.frm_register.txtConfirmPassword.focus();
		return false;
	 }
	if (document.frm_register.txtFirst.value == "")
	 {
		alert("Enter the first name");
		document.frm_register.txtFirst.focus();
		return false;
	 }
	 if (document.frm_register.txtLast.value == "")
	 {
		alert("Enter the last name");
		document.frm_register.txtLast.focus();
		return false;
	 }
	/* if (document.frm_register.txtCompany.value == "")
	 {
		alert("Enter the Company name");
		document.frm_register.txtCompany.focus();
		return false;
	 }
	 
	 if (document.frm_register.txtAbout.value == "")
	 {
		alert("Enter the aboutarea");
		document.frm_register.txtAbout.focus();
		return false;
	 }*/
	 if (document.frm_register.txtPostcode1.value == "")
	 {
		alert("Enter the address");
		document.frm_register.txtPostcode1.focus();
		return false;
	 }
	
	/*if (document.frm_register.txtPostcode2.value == "")
	 {
		alert("Enter the address line2");
		document.frm_register.txtPostcode2.focus();
		return false;
	 }*/
	 if (document.frm_register.txtPostCity.value == "")
	 {
		alert("Enter the city");
		document.frm_register.txtPostCity.focus();
		return false;
	 }
	
	/*if(document.frm_register.txtPostCountry.value == "Choose")
		{
		   alert("Select the country");
		   document.frm_register.txtPostCountry.focus();
		   return false;
		}
	 if (document.frm_register.txtPostState.value == "")
	 {
		alert("Enter the Post State");
		document.frm_register.txtPostState.focus();
		return false;
	 }*/
	 
	 if (document.frm_register.txtPostZip.value == "")
	 {
		alert("Enter the zipcode");
		document.frm_register.txtPostZip.focus();
		return false;
	 }
	
	if(!(document.frm_register.chkDelivery.checked))
		{
		    if(document.frm_register.txtDelicode1.value=="")
			{
			   alert("Enter the delivery address line1");
			   document.frm_register.txtDelicode1.focus();
			   return false;
			} 
/*			if(document.frm_register.txtDelicode2.value=="")
			{
			   alert("Enter the delivery address line2");
			   document.frm_register.txtDelicode2.focus();
			   return false;
			}
*/			if(document.frm_register.txtDeliCity.value=="")
			{
			   alert("Enter the city");
			   document.frm_register.txtDeliCity.focus();
			   return false;
			}
			if(document.frm_register.txtDeliCountry.value == "Choose")
			{
			   alert("Select the country");
			   document.frm_register.txtDeliCountry.focus();
			   return false;
			}
			if(document.frm_register.txtDeliState.value=="")
			{
			   alert("Enter the state");
			   document.frm_register.txtDeliState.focus();
			   return false;
			}
			if(document.frm_register.txtDeliZip.value=="")
			{
			   alert("Enter the zipcode");
			   document.frm_register.txtDeliZip.focus();
			   return false;
			}
		}
		
		if(document.frm_register.txtBusinessph.value=="")
			{
			   alert("Enter the Business phone number");
			   document.frm_register.txtBusinessph.focus();
			   return false;
			}
		if(document.frm_register.txtBusinessph.value=="")
			{
			   alert("Enter the  phone number");
			   document.frm_register.txtBusinessph.focus();
			   return false;
			}
			

	
}
function validate_shippinginfo(){
	if (document.frm_shippinginfo.name.value == "")
		 { 
			 alert ("Please enter the Name");
			 document.frm_shippinginfo.name.focus();
			 return false;
		 }	
	
	if(document.frm_shippinginfo.incship.value > 0)	 {
		if (document.frm_shippinginfo.txtDelicode1.value == "")
		 { 
			 alert ("Please enter the shipping address");
			 document.frm_shippinginfo.txtDelicode1.focus();
			 return false;
		 }	
		if (document.frm_shippinginfo.varDeliCity.value == "")
		 { 
			 alert ("Please enter the shipping city");
			 document.frm_shippinginfo.varDeliCity.focus();
			 return false;
		 }	
		if (document.frm_shippinginfo.Country.value == "")
		 { 
			 alert ("Please select the shipping country");
			 document.frm_shippinginfo.Country.focus();
			 return false;
		 }
		 if (document.frm_shippinginfo.Country.value == "US") { 	
				if (document.frm_shippinginfo.State.value == "")
				 { 
					 alert ("Please select the shipping state");
					 document.frm_shippinginfo.State.focus();
					 return false;
				 }
		} else {
			if (document.frm_shippinginfo.State1.value == "")
				 { 
					 alert ("Please enter the shipping state");
					 document.frm_shippinginfo.State1.focus();
					 return false;
				 }
		
		}
			
		if (document.frm_shippinginfo.intDeliZip.value == "")
		 { 
			 alert ("Please enter the shipping zipcode");
			 document.frm_shippinginfo.intDeliZip.focus();
			 return false;
		 }
		 if(isNaN(document.frm_shippinginfo.intDeliZip.value))
		 {
			 alert ("shipping zipcode must be numeric");
			 document.frm_shippinginfo.intDeliZip.value = "";
			 document.frm_shippinginfo.intDeliZip.focus();
			 return false;
		 }
	}
	
}
	function dsMoveNext(dsObj, dsLength) {
		if (dsObj.value.length >= dsLength) {
			for (i = 0; i < frm_shippinginfo.elements.length; i++) {
				if(dsObj == frm_shippinginfo.elements[i]) {
					frm_shippinginfo.elements[i+1].focus();
					break;
				}
			}
		}
	}



function payment_validation() {
if (document.frm_shippinginfo.Cardnum1.value == "")
	 { 
		 alert ("Please enter the card number");
		 document.frm_shippinginfo.Cardnum1.focus();
		 return false;
	 }
	 if(isNaN(document.frm_shippinginfo.Cardnum1.value))
	 {
		 alert ("Card Number must be numeric");
		 document.frm_shippinginfo.Cardnum1.value = "";
		 document.frm_shippinginfo.Cardnum1.focus();
		 return false;
	 }
	 
if (document.frm_shippinginfo.Cardnum2.value == "")
	 { 
		 alert ("Please enter the card number");
		 document.frm_shippinginfo.Cardnum2.focus();
		 return false;
	 }
	 if(isNaN(document.frm_shippinginfo.Cardnum2.value))
	 {
		 alert ("Card Number must be numeric");
		 document.frm_shippinginfo.Cardnum2.value = "";
		 document.frm_shippinginfo.Cardnum2.focus();
		 return false;
	 }
	 
if (document.frm_shippinginfo.Cardnum3.value == "")
	 { 
		 alert ("Please enter the card number");
		 document.frm_shippinginfo.Cardnum3.focus();
		 return false;
	 }
	 if(isNaN(document.frm_shippinginfo.Cardnum3.value))
	 {
		 alert ("Card Number must be numeric");
		 document.frm_shippinginfo.Cardnum3.value = "";
		 document.frm_shippinginfo.Cardnum3.focus();
		 return false;
	 }
	 
if (document.frm_shippinginfo.Cardnum4.value == "")
	 { 
		 alert ("Please enter the card number");
		 document.frm_shippinginfo.Cardnum4.focus();
		 return false;
	 }
	 if(isNaN(document.frm_shippinginfo.Cardnum4.value))
	 {
		 alert ("Card Number must be numeric");
		 document.frm_shippinginfo.Cardnum4.value = "";
		 document.frm_shippinginfo.Cardnum4.focus();
		 return false;
	 }
	 
if (document.frm_shippinginfo.textfield.value == "")
	 { 
		 alert ("Please enter the CVV2 ");
		 document.frm_shippinginfo.textfield.focus();
		 return false;
	 }
	 if(isNaN(document.frm_shippinginfo.textfield.value))
	 {
		 alert ("CVV2 Number must be numeric");
		 document.frm_shippinginfo.textfield.value = "";
		 document.frm_shippinginfo.textfield.focus();
		 return false;
	 }
	 

}
function validate_login()
{
if (document.Loginform.EmailId.value == "")
	 { 
		 alert ("Please enter the Email Address");
		 document.Loginform.EmailId.focus();
		 return false;
	 }	
	 if (!validateEmail(document.Loginform.EmailId.value,1,1)) 
	 {
		 document.Loginform.EmailId.focus();
		 return false;
	 }
	 if (document.Loginform.Password.value == "")
	 { 
		 alert ("Please enter the password");
		 document.Loginform.Password.focus();
		 return false;
	 }
	 return true;
}

function editregister_validate(){
	
	 if (document.frm_register.txtPassword.value == "")
	 {
		alert("Enter the password");
		document.frm_register.txtPassword.focus();
		return false;
	 }

	if (document.frm_register.txtFirst.value == "")
	 {
		alert("Enter the first name");
		document.frm_register.txtFirst.focus();
		return false;
	 }
	 if (document.frm_register.txtLast.value == "")
	 {
		alert("Enter the last name");
		document.frm_register.txtLast.focus();
		return false;
	 }

	 if (document.frm_register.txtPostcode1.value == "")
	 {
		alert("Enter the address");
		document.frm_register.txtPostcode1.focus();
		return false;
	 }
	
	 if (document.frm_register.txtPostCity.value == "")
	 {
		alert("Enter the city");
		document.frm_register.txtPostCity.focus();
		return false;
	 }
	

	 
	 if (document.frm_register.txtPostZip.value == "")
	 {
		alert("Enter the zipcode");
		document.frm_register.txtPostZip.focus();
		return false;
	 }
	
	if(!(document.frm_register.chkDelivery.checked))
		{
		    if(document.frm_register.txtDelicode1.value=="")
			{
			   alert("Enter the delivery address line1");
			   document.frm_register.txtDelicode1.focus();
			   return false;
			} 
			if(document.frm_register.txtDeliCity.value=="")
			{
			   alert("Enter the city");
			   document.frm_register.txtDeliCity.focus();
			   return false;
			}
			if(document.frm_register.txtDeliCountry.value == "Choose")
			{
			   alert("Select the country");
			   document.frm_register.txtDeliCountry.focus();
			   return false;
			}
			if(document.frm_register.txtDeliState.value=="")
			{
			   alert("Enter the state");
			   document.frm_register.txtDeliState.focus();
			   return false;
			}
			if(document.frm_register.txtDeliZip.value=="")
			{
			   alert("Enter the zipcode");
			   document.frm_register.txtDeliZip.focus();
			   return false;
			}
		}
		
		if(document.frm_register.txtBusinessph.value=="")
			{
			   alert("Enter the Business phone number");
			   document.frm_register.txtBusinessph.focus();
			   return false;
			}
		phone = document.frm_register.txtBusinessph;
		if (checkInternationalPhone(phone.value)==false)
		{
			alert("Please Enter a Valid Phone Number")
			phone.value=""
			phone.focus()
			return false
		}

}

function validate_shippinginfo1() {
if (document.frm_shippinginfo.name.value == "")
	 { 
		 alert ("Please enter the Name ");
		 document.frm_shippinginfo.name.focus();
		 return false;
	 }	
	
if (document.frm_shippinginfo.emailaddress.value == "")
	 { 
		 alert ("Please enter the Email Address");
		 document.frm_shippinginfo.emailaddress.focus();
		 return false;
	 }	
	 if (!validateEmail(document.frm_shippinginfo.emailaddress.value,1,1)) 
	 {
		 document.frm_shippinginfo.emailaddress.focus();
		 return false;
	 }



	if (document.frm_shippinginfo.txtDelicode1_bill.value == "")
	 { 
		 alert ("Please enter the Billing address");
		 document.frm_shippinginfo.txtDelicode1_bill.focus();
		 return false;
	 }	
	if (document.frm_shippinginfo.varDeliCity_bill.value == "")
	 { 
		 alert ("Please enter the Billing city");
		 document.frm_shippinginfo.varDeliCity_bill.focus();
		 return false;
	 }	
	if (document.frm_shippinginfo.Country_bill.value == "")
	 { 
		 alert ("Please select the Billing country");
		 document.frm_shippinginfo.Country_bill.focus();
		 return false;
	 }
	 if (document.frm_shippinginfo.Country_bill.value == "US") { 	
			if (document.frm_shippinginfo.State_bill.value == "")
			 { 
				 alert ("Please select the Billing state");
				 document.frm_shippinginfo.State_bill.focus();
				 return false;
			 }
	} else {
		if (document.frm_shippinginfo.State1_bill.value == "")
			 { 
				 alert ("Please enter the Billing state");
				 document.frm_shippinginfo.State1_bill.focus();
				 return false;
			 }
	
	}
	 	
	if (document.frm_shippinginfo.intDeliZip_bill.value == "")
	 { 
		 alert ("Please enter the Billing zipcode");
		 document.frm_shippinginfo.intDeliZip_bill.focus();
		 return false;
	 }
	 if(isNaN(document.frm_shippinginfo.intDeliZip_bill.value))
	 {
		 alert ("Billing zipcode must be numeric");
		 document.frm_shippinginfo.intDeliZip_bill.value = "";
		 document.frm_shippinginfo.intDeliZip_bill.focus();
		 return false;
	 }


if(document.frm_shippinginfo.incship.value > 0)	 {

	if (document.frm_shippinginfo.txtDelicode1.value == "")
	 { 
		 alert ("Please enter the shipping address");
		 document.frm_shippinginfo.txtDelicode1.focus();
		 return false;
	 }	
	if (document.frm_shippinginfo.varDeliCity.value == "")
	 { 
		 alert ("Please enter the shipping city");
		 document.frm_shippinginfo.varDeliCity.focus();
		 return false;
	 }	
	if (document.frm_shippinginfo.Country.value == "")
	 { 
		 alert ("Please select the shipping country");
		 document.frm_shippinginfo.Country.focus();
		 return false;
	 }
	 if (document.frm_shippinginfo.Country.value == "US") { 	
			if (document.frm_shippinginfo.State.value == "")
			 { 
				 alert ("Please select the shipping state");
				 document.frm_shippinginfo.State.focus();
				 return false;
			 }
	} else {
		if (document.frm_shippinginfo.State1.value == "")
			 { 
				 alert ("Please enter the shipping state");
				 document.frm_shippinginfo.State1.focus();
				 return false;
			 }
	
	}
	 	
	if (document.frm_shippinginfo.intDeliZip.value == "")
	 { 
		 alert ("Please enter the shipping zipcode");
		 document.frm_shippinginfo.intDeliZip.focus();
		 return false;
	 }
	 if(isNaN(document.frm_shippinginfo.intDeliZip.value))
	 {
		 alert ("shipping zipcode must be numeric");
		 document.frm_shippinginfo.intDeliZip.value = "";
		 document.frm_shippinginfo.intDeliZip.focus();
		 return false;
	 }
}
	
}

function search_validation() {
	if(document.frmsearch.searchtext.value == "") {
		alert("Enter Search Key");
		document.frmsearch.searchtext.focus();
		return false;
	}

}


function validate_concert(){
	
		if (document.frm_shippinginfo.fname.value == "")
			 { 
				 alert ("Please enter the First Name");
				 document.frm_shippinginfo.fname.focus();
				 return false;
			 }	
		if (document.frm_shippinginfo.lname.value == "")
			 { 
				 alert ("Please enter the Last Name");
				 document.frm_shippinginfo.lname.focus();
				 return false;
			 }	
		if (document.frm_shippinginfo.email.value == "")
			 { 
				 alert ("Please enter the Email");
				 document.frm_shippinginfo.email.focus();
				 return false;
			 }	
			 
		 if (!validateEmail(document.frm_shippinginfo.email.value,1,1)) 
		 {
			 document.frm_shippinginfo.email.focus();
			 return false;
		 }



		if (document.frm_shippinginfo.txtDelicode1.value == "")
		 { 
			 alert ("Please enter the shipping address");
			 document.frm_shippinginfo.txtDelicode1.focus();
			 return false;
		 }	
		if (document.frm_shippinginfo.varDeliCity.value == "")
		 { 
			 alert ("Please enter the shipping city");
			 document.frm_shippinginfo.varDeliCity.focus();
			 return false;
		 }	
		if (document.frm_shippinginfo.Country.value == "")
		 { 
			 alert ("Please select the shipping country");
			 document.frm_shippinginfo.Country.focus();
			 return false;
		 }
		 if (document.frm_shippinginfo.Country.value == "US") { 	
				if (document.frm_shippinginfo.State.value == "")
				 { 
					 alert ("Please select the shipping state");
					 document.frm_shippinginfo.State.focus();
					 return false;
				 }
		} else {
			if (document.frm_shippinginfo.State1.value == "")
				 { 
					 alert ("Please enter the shipping state");
					 document.frm_shippinginfo.State1.focus();
					 return false;
				 }
		
		}
			
		if (document.frm_shippinginfo.intDeliZip.value == "")
		 { 
			 alert ("Please enter the shipping zipcode");
			 document.frm_shippinginfo.intDeliZip.focus();
			 return false;
		 }
		 if(isNaN(document.frm_shippinginfo.intDeliZip.value))
		 {
			 alert ("shipping zipcode must be numeric");
			 document.frm_shippinginfo.intDeliZip.value = "";
			 document.frm_shippinginfo.intDeliZip.focus();
			 return false;
		 }

if (document.frm_shippinginfo.Cardnum1.value == "")
	 { 
		 alert ("Please enter the card number");
		 document.frm_shippinginfo.Cardnum1.focus();
		 return false;
	 }
	 if(isNaN(document.frm_shippinginfo.Cardnum1.value))
	 {
		 alert ("Card Number must be numeric");
		 document.frm_shippinginfo.Cardnum1.value = "";
		 document.frm_shippinginfo.Cardnum1.focus();
		 return false;
	 }
	 
if (document.frm_shippinginfo.Cardnum2.value == "")
	 { 
		 alert ("Please enter the card number");
		 document.frm_shippinginfo.Cardnum2.focus();
		 return false;
	 }
	 if(isNaN(document.frm_shippinginfo.Cardnum2.value))
	 {
		 alert ("Card Number must be numeric");
		 document.frm_shippinginfo.Cardnum2.value = "";
		 document.frm_shippinginfo.Cardnum2.focus();
		 return false;
	 }
	 
if (document.frm_shippinginfo.Cardnum3.value == "")
	 { 
		 alert ("Please enter the card number");
		 document.frm_shippinginfo.Cardnum3.focus();
		 return false;
	 }
	 if(isNaN(document.frm_shippinginfo.Cardnum3.value))
	 {
		 alert ("Card Number must be numeric");
		 document.frm_shippinginfo.Cardnum3.value = "";
		 document.frm_shippinginfo.Cardnum3.focus();
		 return false;
	 }
	 
if (document.frm_shippinginfo.Cardnum4.value == "")
	 { 
		 alert ("Please enter the card number");
		 document.frm_shippinginfo.Cardnum4.focus();
		 return false;
	 }
	 if(isNaN(document.frm_shippinginfo.Cardnum4.value))
	 {
		 alert ("Card Number must be numeric");
		 document.frm_shippinginfo.Cardnum4.value = "";
		 document.frm_shippinginfo.Cardnum4.focus();
		 return false;
	 }
	 
	if (document.frm_shippinginfo.textfield.value == "")
	 { 
		 alert ("Please enter the CVV2 ");
		 document.frm_shippinginfo.textfield.focus();
		 return false;
	 }
	 if(isNaN(document.frm_shippinginfo.textfield.value))
	 {
		 alert ("CVV2 Number must be numeric");
		 document.frm_shippinginfo.textfield.value = "";
		 document.frm_shippinginfo.textfield.focus();
		 return false;
	 }
	
}

function ticketvalidation(formname) {
	
	if(formname.reserved_bench.checked == false && formname.reserved_grass.checked == false) {
		alert("Select bench seats or grass seats")	;
		return false;
	}
	
	if(formname.reserved_bench.checked == true) {
		if(formname.totbench_res.value == "") {
			alert("Enter the Number of Tickets for  bench Seats")	;
			formname.totbench_res.focus();
			return false;
		}
		
		if(isNaN(formname.totbench_res.value) ) {
			alert("Enter valid Number in  the Number of Tickets ")	;
			formname.totbench_res.focus();
			return false;
		}
		
		if(formname.totbench_res.value == 0) {
			alert("Enter valid Number in the Number of Tickets ")	;
			formname.totbench_res.focus();
			return false;
		}
		
		
	}
	
	
	if(formname.reserved_grass.checked == true) {
		if(formname.totgrass_res.value == "") {
			alert("Enter the Number of Tickets for Grass Seats")	;
			formname.totgrass_res.focus();
			return false;
		}
		
		if(isNaN(formname.totgrass_res.value) ) {
			alert("Enter valid Number in  the Number of Tickets ")	;
			formname.totgrass_res.focus();
			return false;
		}
		
		if(formname.totgrass_res.value == 0) {
			alert("Enter valid Number in the Number of Tickets ")	;
			formname.totgrass_res.focus();
			return false;
		}
		
		
	}
	
	if(formname.general_bench.checked == true) {
		if(formname.totbench_gen.value == "") {
			alert("Enter the Number of Tickets for General Bench Seats")	;
			formname.totbench_gen.focus();
			return false;
		}
		
		if(isNaN(formname.totbench_gen.value) ) {
			alert("Enter valid Number in  the Number of Tickets ")	;
			formname.totbench_gen.focus();
			return false;
		}
		
		if(formname.totbench_gen.value == 0) {
			alert("Enter valid Number in the Number of Tickets ")	;
			formname.totbench_gen.focus();
			return false;
		}
		
		
	}
	
	if(formname.general_grass.checked == true) {
		if(formname.totgrass_gen.value == "") {
			alert("Enter the Number of Tickets for General Grass Seats")	;
			formname.totgrass_gen.focus();
			return false;
		}
		
		if(isNaN(formname.totgrass_gen.value) ) {
			alert("Enter valid Number in  the Number of Tickets ")	;
			formname.totgrass_gen.focus();
			return false;
		}
		
		if(formname.totgrass_gen.value == 0) {
			alert("Enter valid Number in the Number of Tickets ")	;
			formname.totgrass_gen.focus();
			return false;
		}
		
		
	}
	
}

function InitSaveVariables(form) {
        
        Address1 = form.txtDelicode1.value;
        Address2 = form.txtDelicode2.value;
        CityValue = form.varDeliCity.value;
        ZipValue = form.intDeliZip.value;
        CountryValue = form.Country.value;
		if(CountryValue == 'Us') {
		StateValue = form.State.value;
		} else {
		StateValue = form.State1.value;
		}
        
        
}

function ShipToBillPerson(form) {
        if (form.ShipAddress.checked) {
                InitSaveVariables(form);
                form.txtDelicode1.value = form.txtDelicode1_bill.value;
                form.txtDelicode2.value = form.txtDelicode2_bill.value;
                form.varDeliCity.value = form.varDeliCity_bill.value;
                form.intDeliZip.value = form.intDeliZip_bill.value;
                form.Country.value = form.Country_bill.value;
				if(form.Country.value == 'US') {
                	form.State.value = form.State_bill.value;
					form.State.style.visibility = 'visible';
					form.State.style.display = 'block';
					form.State1.style.visibility = 'hidden';
					form.State1.style.display = 'none';
					//alert(form.State.value);
				} else {
					form.State1.value = form.State1_bill.value;
					form.State.style.visibility = 'hidden';
					form.State.style.display = 'none';
					form.State1.style.visibility = 'visible';
					form.State1.style.display = 'block';
				}
}
        else {
                form.txtDelicode1.value = Address1;
                form.txtDelicode2.value = Address2;
                form.varDeliCity.value = CityValue;
                form.intDeliZip.value = ZipValue;
                form.Country.value = CountryValue;
				if( form.Country.value == 'US') {
                	form.State.value = StateValue;
					form.State.style.visibility = 'visible';
					form.State.style.display = 'block';
					form.State1.style.visibility = 'hidden';
					form.State1.style.display = 'none';
					
				} else {
					form.State1.value = StateValue;
					form.State.style.visibility = 'hidden';
					form.State.style.display = 'none';
					form.State1.style.visibility = 'visible';
					form.State1.style.display = 'block';
					
					
				}
  }
}