// JavaScript Document

function CopyFields() {

	if(document.frmcheckout.cf.checked)
	{
		document.frmcheckout.ch1.value = document.frmcheckout.fname.value;
		document.frmcheckout.ch2.value = document.frmcheckout.lname.value;
		document.frmcheckout.BillingAddress1.value = document.frmcheckout.ShippingAddress1.value;
		document.frmcheckout.BillingCity.value = document.frmcheckout.ShippingCity.value;
		document.frmcheckout.BillingState.value = document.frmcheckout.ShippingState.value;
		document.frmcheckout.BillingCountry.value = document.frmcheckout.ShippingCountry.value;
		document.frmcheckout.BillingZip.value = document.frmcheckout.ShippingZip.value;
		
	}
		
	else
	{
		document.frmcheckout.ch1.value = "";
		document.frmcheckout.ch2.value = "";
		document.frmcheckout.BillingAddress1.value = "";	
		document.frmcheckout.BillingCity.value = "";
		document.frmcheckout.BillingState.value = "";
		document.frmcheckout.BillingCountry.value = "";
		document.frmcheckout.BillingZip.value = "";		
	}
}

function CheckThis() 
{

	if(document.frmcheckout.fname.value=="")
	{
		alert("Enter your first name, please!");
		document.frmcheckout.fname.focus();
		return false;
	}

	if(document.frmcheckout.lname.value=="")
	{
		alert("Enter your last name, please!");
		document.frmcheckout.lname.focus();
		return false;
	}

	if(document.frmcheckout.ShippingAddress1.value=="")
	{
		alert("Enter the address, please!");
		document.frmcheckout.ShippingAddress1.focus();
		return false;
	}

	if(document.frmcheckout.ShippingCity.value=="")
	{
		alert("Enter the city, please!");
		document.frmcheckout.ShippingCity.focus();
		return false;
	}

	
	

	if(document.frmcheckout.ShippingZip.value=="")
	{
		alert("Enter the zip code, please!");
		document.frmcheckout.ShippingZip.focus();
		return false;
	}

	

	if(document.frmcheckout.ch1.value=="")
	{
		alert("Enter the credit card holder's first name, please!");
		document.frmcheckout.ch1.focus();
		return false;
	}

	if(document.frmcheckout.ch2.value=="")
	{
		alert("Enter the credit card holder's last name, please!");
		document.frmcheckout.ch2.focus();
		return false;
	}

	if(document.frmcheckout.BillingAddress1.value=="")
	{
		alert("Enter the billing address, please!");
		document.frmcheckout.BillingAddress1.focus();
		return false;
	}

	if(document.frmcheckout.BillingCity.value=="")
	{
		alert("Enter the billing city, please!");
		document.frmcheckout.BillingCity.focus();
		return false;
	}

	
	if(document.frmcheckout.BillingZip.value=="")
	{
		alert("Enter the billing address zip code, please!");
		document.frmcheckout.BillingZip.focus();
		return false;
	}

	if(document.frmcheckout.YourEmail.value=="")
	{
		alert("Enter your email address, please!\n\nWe will send you a receipt.");
		document.frmcheckout.YourEmail.focus();
		return false;
	}

}

function CheckSearch() 
{

	if(document.f1.SearchTerm.value=="")
	{
		window.alert('Enter the search terms, please!');
		document.f1.SearchTerm.focus();
		return false;
	}

	if(document.f1.ord1.value=="")
	{
		window.alert('Select the order by option, please!');
		document.f1.ord1.focus();
		return false;
	}

}
function joinmail()
{
	var fname = document.getElementById('jm_fname');
	
	var email =document.getElementById('jm_email');
	
	if(fname.value == '')
	{
		alert("Please Enter First Name");
		fname.focus();
		return false;
	}	
	else if(email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
	{
		alert("Please Enter E-mail");
		email.focus();
		return false;
	}	
	else
	{
		return true;
	}
}

function postponed()
{
	var fname = document.getElementById('jm_fname');
	
	var email =document.getElementById('jm_email');
	
	if(fname.value == '')
	{
		alert("Please Enter First Name");
		fname.focus();
		return false;
	}	
	else if(email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
	{
		alert("Please Enter E-mail");
		email.focus();
		return false;
	}	
	else
	{
		return true;
	}
}


function contactusmail()
{
	var fname = document.getElementById('con_name');	
	var email =document.getElementById('con_email');
	
	if(fname.value == '')
	{
		alert("Please Enter  Name");
		fname.focus();
		return false;
	}	
	else if(email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
	{
		alert("Please Enter E-mail");
		email.focus();
		return false;
	}	
	else
	{
		return true;
	}
}


function changeDesc()
{	
	var sid = document.getElementById('sdates').value;	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return false;
	}		
	var ran = Math.random();
	var url="ajaxdesc.php?sid="+sid; 
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null);	
} 
function stateChanged() 
{ 
	 if (xmlHttp.readyState==3 || xmlHttp.readyState==1 || xmlHttp.readyState==2)
	 { 
	  	document.getElementById('ajaxdesc').innerHTML="<img src='images/loading.gif'>";
	 }
	 if (xmlHttp.readyState==4)
	 {  
	 	document.getElementById('ajaxdesc').innerHTML=xmlHttp.responseText;
	 }
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}// JavaScript Document

