function movewin(win, width, height) {
		var fullWidth = screen.availWidth;
		var fullHeight = screen.availHeight;
		var x = (fullWidth/2)-(width/2);
		var y = (fullHeight/2)-(height/2);
		win.moveTo(x,y); 
	}
			
function viewWin(filenames,width,Height)
{

	filenames=filenames;
		
	var newwin = window.open(filenames, 'Image', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,maximize=0,width='+width+',height='+Height);
	
	movewin(newwin, width, Height);
	    if (navigator.appName=="Netscape") 
	        newwin.location=url;
		
		newwin.opener=window;
		newwin.focus();
		return false;
}
		
// validate email

function validateEmail(email){
	
	
if (email == ""){return false;}


badStuff = ";:/,' \"\\";
for (i=0; i<badStuff.length; i++)
{
badCheck = badStuff.charAt(i)
if (email.indexOf(badCheck,0) != -1){return false;}
}

posOfAtSign = email.indexOf("@",1)
if (posOfAtSign == -1){return false;}


if (email.indexOf("@",posOfAtSign+1) != -1){return false;}

posOfPeriod = email.indexOf(".", posOfAtSign)
if (posOfPeriod == -1){return false;}

if (posOfPeriod+2 > email.length){return false;}

return true;
}




function check_bill_ship()
{
	with (document.form1)
	{
		
		if (useremail.value=="") { alert("Please Enter Useremail."); useremail.focus(); return false;}
		
		if (useremail.value!="")
		{
			if (!validateEmail(useremail.value)) { alert("Please Enter validemail."); useremail.focus(); return false;}
		}
		
		if (password.value=="") { alert("Please Enter Password."); password.focus(); return false;}
		
		if (Title.value=="") { alert("Please Select Title"); Title.focus(); return false;}
		if (fname.value=="") { alert("Please Enter the First Name"); fname.focus(); return false;}
		if (lname.value==""){alert ("Please Enter the Last Name"); lname.focus();return false;}
		if (address1.value==""){alert ("Please Enter Address 1"); address1.focus();return false;}
		
		if (city.value==""){alert ("Please Enter City"); city.focus();return false;}
		if (statss.value==false){alert ("Please Select State"); statss.focus();return false;}
		
		if (zip.value==""){alert ("Please Enter Zip"); zip.focus();return false;}
		if (email.value==""){alert ("Please Enter Email Address"); email.focus();return false;}
		if (!validateEmail(email.value)) {alert ("Please enter the correct Email Address") ; email.focus(); return false ; }
		
		if (telephone1.value==""){alert ("Please Enter Telephone Number");telephone1.focus();return false;}
		if (telephone2.value==""){alert ("Please Enter Telephone Number");telephone2.focus();return false;}
		if (telephone3.value==""){alert ("Please Enter Telephone Number");telephone3.focus();return false;}
				
		
		
		
		if (Title1.value=="") { alert("Please Select Title"); Title1.focus(); return false;}
		if (sh_fname.value=="") { alert("Please Enter the First Name"); sh_fname.focus(); return false;}
		if (sh_lname.value==""){alert ("Please Enter the Last Name"); sh_lname.focus();return false;}
		if (sh_address1.value==""){alert ("Please Enter Address 1"); sh_address1.focus();return false;}
		if (sh_city.value==""){alert ("Please Enter City"); sh_city.focus();return false;}
		if (sh_statss.value==false){alert ("Please Select State"); sh_statss.focus();return false;}
		if (sh_zip.value==""){alert ("Please Enter Zip"); sh_zip.focus();return false;}
		if (sh_email.value==""){alert ("Please Enter Email Address");sh_email.focus();return false;}
		if (!validateEmail(sh_email.value)) {alert ("Please enter the correct Email Address") ; sh_email.focus(); return false ; }
		
		if (stelephone1.value==""){alert ("Please Enter Telephone Number");stelephone1.focus();return false;}
		if (stelephone2.value==""){alert ("Please Enter Telephone Number");stelephone2.focus();return false;}
		if (stelephone3.value==""){alert ("Please Enter Telephone Number");stelephone3.focus();return false;}
		
		
		
		
	}
	
	if (isNaN(document.form1.telephone1.value))
	 { alert("Please enter a numeric value");document.form1.telephone1.focus(); return false;}	
	
	if (isNaN(document.form1.telephone2.value))
	 { alert("Please enter a numeric value");document.form1.telephone2.focus(); return false;}	
	
	if (isNaN(document.form1.telephone3.value))
	 { alert("Please enter a numeric value");document.form1.telephone3.focus(); return false;}	
	
	
	
	
	if (isNaN(document.form1.zip.value))
	 { alert("Please enter a numeric value");document.form1.zip.focus(); return false;}	
	
	if (isNaN(document.form1.stelephone1.value))
	 { alert("Please enter a numeric value");document.form1.stelephone1.focus(); return false;}	
	
	if (isNaN(document.form1.stelephone2.value))
	 { alert("Please enter a numeric value");document.form1.stelephone2.focus(); return false;}	
	
	if (isNaN(document.form1.stelephone3.value))
	 { alert("Please enter a numeric value");document.form1.stelephone3.focus(); return false;}	
	
	
	
	if (isNaN(document.form1.sh_zip.value))
	 { alert("Please enter a numeric value");document.form1.sh_zip.focus(); return false;}
	
}



function billship()
{
window.document.form1.sh_fname.value=window.document.form1.fname.value;
window.document.form1.sh_lname.value=window.document.form1.lname.value;
window.document.form1.sh_address1.value=window.document.form1.address1.value;
window.document.form1.sh_address2.value=window.document.form1.address2.value;
window.document.form1.sh_city.value=window.document.form1.city.value;
window.document.form1.sh_country.value=window.document.form1.country.value;
window.document.form1.sh_zip.value=window.document.form1.zip.value;
window.document.form1.sh_statss.value=window.document.form1.statss.value;
window.document.form1.sh_email.value=window.document.form1.email.value;


window.document.form1.Title1.value=window.document.form1.Title.value;

window.document.form1.stelephone1.value=window.document.form1.telephone1.value;
window.document.form1.stelephone2.value=window.document.form1.telephone2.value;
window.document.form1.stelephone3.value=window.document.form1.telephone3.value;

}



function chk_credit()
{
	if (isNaN(document.form2.cardnumber.value))
	 {
	  alert("Please enter a numeric value"); document.form2.cardnumber.focus(); return false;
	}
	
	if (isNaN(document.form2.cvno.value))
	 {
	  alert("Please enter a numeric value"); document.form2.cvno.focus(); return false;
	}
	
	with(document.form2)
	{
		
		if (chfname.value=="") { alert("Enter First Name"); chfname.focus(); return false; }
		if (chlname.value=="") { alert("Enter Last Name"); chlname.focus(); return false; }
		if (cardtype.value=="") { alert("Select Card Type"); cardtype.focus(); return false; }
		if (cardnumber.value=="") { alert("Enter Card Number"); cardnumber.focus(); return false; }
		if (cvno.value=="") { alert("Enter Card Verification Number"); cvno.focus(); return false; }
		
		
	}
	
}



function contact_valid()
{
	
	with(document.contactform)
	{
		if (firstname.value=="") { alert("Enter First Name"); firstname.focus(); return false; }
		if (lastname.value=="") { alert("Enter Last Name"); lastname.focus(); return false; }
		if (b_address.value=="") { alert("Enter Address"); b_address.focus(); return false; }
		if (b_zipcode.value=="") { alert("Enter Zipcode"); b_zipcode.focus(); return false; }
		if (b_city.value=="") { alert("Enter City"); b_city.focus(); return false; }
		if (phone.value=="") { alert("Enter Phone no"); phone.focus(); return false; }
		if (email.value==""){alert ("Please Enter Email Address"); email.focus();return false;}
		if (!validateEmail(email.value)) {alert ("Please enter the correct Email Address") ; email.focus(); return false ; }
		if (subject.value=="") { alert("Enter Subject "); subject.focus(); return false; }
		if (msg.value=="") { alert("Enter Message "); msg.focus(); return false; }
		
	}
	
	
	if (isNaN(document.contactform.b_zipcode.value))
	 {
	  alert("Please enter a numeric value");document.contactform.b_zipcode.focus(); return false;
	}
	if (isNaN(document.contactform.phone.value))
	 {
	  alert("Please enter a numeric value");document.contactform.phone.focus(); return false;
	}
	
}	




function catalog_valid()
{
	
	with(document.contactform)
	{
		if (firstname.value=="") { alert("Enter First Name"); firstname.focus(); return false; }
		if (lastname.value=="") { alert("Enter Last Name"); lastname.focus(); return false; }
		
		if (email.value==""){alert ("Please Enter Email Address"); email.focus();return false;}
		if (!validateEmail(email.value)) {alert ("Please enter the correct Email Address") ; email.focus(); return false ; }
		
		if (cemail.value==""){alert ("Please Enter Confirm Email Address"); cemail.focus();return false;}
		if (!validateEmail(cemail.value)) {alert ("Please enter the correct Email Address") ; cemail.focus(); return false ; }
		
		
		
		if (email.value!="" && cemail.value!="")
		{
			if (email.value != cemail.value)
			{
				alert ("Email Address are not same "); email.focus();return false;
			}
		}
		if (zipcode.value=="") { alert("Enter Zip Code"); zipcode.focus(); return false; }
		
	}
	
	
	if (isNaN(document.contactform.zipcode.value))
	 {
	  alert("Please enter a numeric value");document.contactform.zipcode.focus(); return false;
	}
	
	
}	

function chk_credit()
{
	if (isNaN(document.form2.cardnumber.value))
	 {
	  alert("Please enter a numeric value"); document.form2.cardnumber.focus(); return false;
	}
	
	if (isNaN(document.form2.cvno.value))
	 {
	  alert("Please enter a numeric value"); document.form2.cvno.focus(); return false;
	}
	
	with(document.form2)
	{
		
		if (chfname.value=="") { alert("Enter First Name"); chfname.focus(); return false; }
		if (chlname.value=="") { alert("Enter Last Name"); chlname.focus(); return false; }
		if (cardtype.value=="") { alert("Select Card Type"); cardtype.focus(); return false; }
		if (cardnumber.value=="") { alert("Enter Card Number"); cardnumber.focus(); return false; }
		if (cvno.value=="") { alert("Enter Card Verification Number"); cvno.focus(); return false; }
		
		
	}
	
}
