// JavaScript Document

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

 //Function phone validation Script
// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isNumber (s) //Checks whether the number is numeric
	{  
	    var i;
		var bag="1234567890"
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
	}
	
function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    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);
}
function isString (s) //Checks whether the string contains only alphabets, . and _
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ._-"
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
	}
function isAlphaNumeric (s) //Checks whether the string contains only alphabets and Numbers
	{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789,-_. ";
	    for (i = 0; i < s.length; i++)
	    {   var c = s.charAt(i);
			if (bag.indexOf(c) == -1) return false;
		}
		return true;
	}

var whitespace = " \t\n\r";

function isEmpty(s)  //Checks whether string is Empty
	{  
		return ((s == null) || (s.length == 0))
	}

function isWhitespace (s) //Checks for White spaces in the string 
	{  
		var i;
	 	if (isEmpty(s)) return true;
	 	   for (i = 0; i < s.length; i++)
	 	   {   
	 	       var c = s.charAt(i);
	 	       if (whitespace.indexOf(c) == -1) return false;
	 	   }
		   return true;
	}
	


function poplinks(url)
{
	newwindow=window.open(url,'ImageDisplay','height=600,width=600,left=0,top=0,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}
function matrixpoplinks(url)
{
	newwindow=window.open(url,'ImageDisplay','height=500,width=950,left=0,top=0,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}
function szchartpoplinks(url)
{
	newwindow=window.open(url,'ImageDisplay','height=510,width=820,left=0,top=0,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}
//Validation for Bookmark site
function bookmarksite(title, url){
	if (document.all)
	window.external.AddFavorite(url, title);
	else if (window.sidebar)
	window.sidebar.addPanel(title, url, "");
}

function confirmMsg(msg){
	if(!confirm(msg)){
		return false;

	} else {
		return true;

	}
}
function search_validate()
{
	Searchfor=document.frm_search.searchfor;
	if(Searchfor.value=="")
	{
		alert("Enter the Search Phrase");
		Searchfor.focus();
		return false;
	}
	if(isWhitespace(Searchfor.value)){
		alert("Please Enter Search Phrase without white spaces");
		Searchfor.focus();
		return false;
	}
}
function member_validate()
{
	if(document.frm_member.txtusername.value=="")
	{
		alert("Enter the Username");
		document.frm_member.txtusername.focus();
		return false;
	}
	if (!validateEmail(document.frm_member.txtusername.value,1,1)) 
	{
			document.frm_member.txtusername.focus();
			return false;
	}
	if(document.frm_member.txtpassword.value=="")
	{
		alert("Enter the Password");
		document.frm_member.txtpassword.focus();
		return false;
	}
	if(document.frm_member.txtckcpassword.value=="")
	{
		alert("Please Retype the password");
		document.frm_member.txtckcpassword.focus();
		return false;
	}
	if(document.frm_member.txtckcpassword.value!=document.frm_member.txtpassword.value )
	{
		alert("Password and Retype password should be same");
		document.frm_member.txtckcpassword.focus();
		return false;
	}
	BFirstName=document.frm_member.varBFirstName;
	if(BFirstName.value=="")
	{
		alert("Enter the Billing First name");
		BFirstName.focus();
		return false;
	}
	if(isWhitespace(BFirstName.value)){
		alert("Please Enter your Billing First name without white spaces");
		BFirstName.focus();
		return false;
	}
	if(!isString(BFirstName.value)){
		alert("Please Enter your Billing First name without any special characters");
		BFirstName.focus();
		return false;
	}
	
	BLastName=document.frm_member.varBLastName;
	if(BLastName.value=="")
	{
		alert("Enter the Billing Last name");
		BLastName.focus();
		return false;
	}
	if(isWhitespace(BLastName.value)){
		alert("Please Enter your Billing Last name without white spaces");
		BLastName.focus();
		return false;
	}
	if(!isString(BLastName.value)){
		alert("Please Enter your Billing Last name without any special characters");
		BLastName.focus();
		return false;
	}
	BAddress1=document.frm_member.varBAddress1;
	if(BAddress1.value=="")
	{
		alert("Enter the Billing Address");
		BAddress1.focus();
		return false;
	}
	if(isWhitespace(BAddress1.value)){
		alert("Please Enter your Billing Address without white spaces");
		BAddress1.focus();
		return false;
	}
	
	if(!isAlphaNumeric(BAddress1.value)){
		alert("Please Enter your Billing Address without any special characters");
		BAddress1.focus();
		return false;
		}
		
	BCity=document.frm_member.varBCity;
	if(BCity.value=="")
	{
		alert("Enter the Billing City");
		BCity.focus();
		return false;
	}
	if(isWhitespace(BCity.value)){
		alert("Please Enter your Billing City without white spaces");
		BCity.focus();
		return false;
	}
	if(!isString(BCity.value)){
		alert("Please Enter your Billing City without any special characters");
		BCity.focus();
		return false;
	}
	
	if(document.frm_member.varBState.value==0)
	{
		alert("Select the Billing State");
		document.frm_member.varBState.focus();
		return false;
	}
	if(document.frm_member.varBPostcode.value=="")
	{
		alert("Enter the Billing Zipcode");
		document.frm_member.varBPostcode.focus();
		return false;
	}
	if(isWhitespace(document.frm_member.varBPostcode.value)){
		alert("Please Enter your Billing Zipcode without white spaces");
		document.frm_member.varBPostcode.focus();
		return false;
	}
	if(isNaN(document.frm_member.varBPostcode.value) ){
						alert("Enter the Zipcode in numeric value");
						document.frm_member.varBPostcode.focus();
						return false;
			}
	zipcodelength = document.frm_member.varBPostcode.value.length;
		if(zipcodelength != 5){
			alert("Please Enter your 5 digit card Billing zipcode");
			document.frm_member.varBPostcode.focus();
			return false;
		}
	if(document.frm_member.varBPhoneNo1.value=="")
	{
		alert("Enter the Billing Phone Number1");
		document.frm_member.varBPhoneNo1.focus();
		return false;
	}
	if(isWhitespace(document.frm_member.varBPhoneNo1.value)){
		alert("Please Enter your Billing Phone1 without white spaces");
		document.frm_member.varBPhoneNo1.focus();
		return false;
	}
	zipcodelength1 = document.frm_member.varBPhoneNo1.value.length;
		if(zipcodelength1 != 3){
			alert("Please Enter your 3 digit card Billing zipcode");
			document.frm_member.varBPhoneNo1.focus();
			return false;
		}
	
	if(document.frm_member.varBPhoneNo2.value=="")
	{
		alert("Enter the Billing Phone Number2");
		document.frm_member.varBPhoneNo2.focus();
		return false;
	}
	if(isWhitespace(document.frm_member.varBPhoneNo2.value)){
		alert("Please Enter your Billing Phone2 without white spaces");
		document.frm_member.varBPhoneNo2.focus();
		return false;
	}
	zipcodelength1 = document.frm_member.varBPhoneNo2.value.length;
		if(zipcodelength1 != 3){
			alert("Please Enter your 3 digit card Billing Phone2");
			document.frm_member.varBPhoneNo2.focus();
			return false;
		}
	if(document.frm_member.varBPhoneNo3.value=="")
	{
		alert("Enter the Billing Phone Number3");
		document.frm_member.varBPhoneNo3.focus();
		return false;
	}
	if(isWhitespace(document.frm_member.varBPhoneNo3.value)){
		alert("Please Enter your Billing Phone3 without white spaces");
		document.frm_member.varBPhoneNo3.focus();
		return false;
	}
	zipcodelength1 = document.frm_member.varBPhoneNo3.value.length;
		if(zipcodelength1 != 4){
			alert("Please Enter your 4 digit card Billing Phone3");
			document.frm_member.varBPhoneNo3.focus();
			return false;
		}
	
	if(document.frm_member.varShipFirstName.value=="")
	{
		alert("Enter the Shipping First name");
		document.frm_member.varShipFirstName.focus();
		return false;
	}
	if(isWhitespace(document.frm_member.varShipFirstName.value)){
		alert("Please Enter your Shipping First name without white spaces");
		document.frm_member.varShipFirstName.focus();
		return false;
	}
	if(!isString(document.frm_member.varShipFirstName.value)){
		alert("Please Enter your Shipping first name without any special characters");
		document.frm_member.varShipFirstName.focus();
		return false;
	}
	ShipLastName=document.frm_member.varShipLastName;
	if(ShipLastName.value=="")
	{
		alert("Enter the Shipping Last name");
		ShipLastName.focus();
		return false;
	}
	if(isWhitespace(ShipLastName.value)){
		alert("Please Enter your Shipping Last name without white spaces");
		ShipLastName.focus();
		return false;
	}
	if(!isString(ShipLastName.value)){
		alert("Please Enter your Shipping Last name without any special characters");
		ShipLastName.focus();
		return false;
	}
	if(document.frm_member.varShipAddress1.value=="")
	{
		alert("Enter the Shipping Address name");
		document.frm_member.varShipAddress1.focus();
		return false;
	}
	if(isWhitespace(frm_member.varShipAddress1.value)){
		alert("Please Enter your Shipping Address without white spaces");
		frm_member.varShipAddress1.focus();
		return false;
	}
	if(!isAlphaNumeric(document.frm_member.varShipAddress1.value)){
		alert("Please Enter your Shipping Address without any special characters");
		document.frm_member.varShipAddress1.focus();
		return false;
		}
	if(document.frm_member.varShipCity.value=="")
	{
		alert("Enter the Shipping City");
		document.frm_member.varShipCity.focus();
		return false;
	}
	if(isWhitespace(document.frm_member.varShipCity.value)){
		alert("Please Enter your Shipping City without white spaces");
		document.frm_member.varShipCity.focus();
		return false;
	}
	if(!isString(document.frm_member.varShipCity.value)){
		alert("Please Enter your Shipping City without any special characters");
		document.frm_member.varShipCity.focus();
		return false;
	}
	if(document.frm_member.varShipState.value==0)
		{
			alert("Select the Shipping State");
			document.frm_member.varShipState.focus();
			return false;
		}
	if(isWhitespace(document.frm_member.varShipState.value)){
			alert("Please Enter your Shipping State without white spaces");
			document.frm_member.varShipState.focus();
			return false;
		}
	if(!isString(document.frm_member.varShipState.value)){
			alert("Please Enter your Shipping State without any special characters");
			document.frm_member.varShipState.focus();
			return false;
		}
	
	if(document.frm_member.varShipZip.value=="")
	{
		alert("Enter the Shipping zipcode");
		document.frm_member.varShipZip.focus();
		return false;
	}
	if(isNaN(document.frm_member.varShipZip.value) ){
						alert("Enter the Zipcode in numeric value");
						document.frm_member.varShipZip.focus();
						return false;
			}
	if(isWhitespace(document.frm_member.varShipZip.value)){
		alert("Please Enter your Shipping Zipcode without white spaces");
		document.frm_member.varShipZip.focus();
		return false;
	}
	zipcodelength = document.frm_member.varShipZip.value.length;
		if(zipcodelength != 5){
			alert("Please Enter your 5 digit card shipping zipcode");
			document.frm_member.varShipZip.focus();
			return false;
		}
	if(document.frm_member.varShipPhone1.value=="")
	{
		alert("Enter the Shipping Phone1");
		document.frm_member.varShipPhone1.focus();
		return false;
	}
	if(isWhitespace(document.frm_member.varShipPhone1.value)){
		alert("Please Enter your Shipping Phone1 without white spaces");
		document.frm_member.varShipPhone1.focus();
		return false;
	}
	zipcodelength1 = document.frm_member.varShipPhone1.value.length;
		if(zipcodelength1 != 3){
			alert("Please Enter your 3 digit card shipping zipcode");
			document.frm_member.varShipPhone1.focus();
			return false;
		}
	
	if(document.frm_member.varShipPhone2.value=="")
	{
		alert("Enter the Shipping Phone2");
		document.frm_member.varShipPhone2.focus();
		return false;
	}
	if(isWhitespace(document.frm_member.varShipPhone2.value)){
		alert("Please Enter your Shipping Phone2 without white spaces");
		document.frm_member.varShipPhone2.focus();
		return false;
	}
	varShipPhone2length = document.frm_member.varShipPhone2.value.length;
		if(varShipPhone2length != 3){
			alert("Please Enter your 3 digit card shipping zipcode");
			document.frm_member.varShipPhone2.focus();
			return false;
		}
	
	if(document.frm_member.varShipPhone3.value=="")
	{
		alert("Enter the Shipping Phone3");
		document.frm_member.varShipPhone3.focus();
		return false;
	}
	if(isWhitespace(document.frm_member.varShipPhone3.value)){
		alert("Please Enter your Shipping Phone3 without white spaces");
		document.frm_member.varShipPhone3.focus();
		return false;
	}
	zipcodelength3 = document.frm_member.varShipPhone3.value.length;
		if(zipcodelength3 != 4){
			alert("Please Enter your shipping Phone3 in 4 digit ");
			document.frm_member.varShipPhone3.focus();
			return false;
		}
	/*if(document.frm_member.varShipPhone.value=="")
	{
		alert("Enter the Shipping Phone");
		document.frm_member.varShipPhone.focus();
		return false;
	}
	phoneno = document.frm_member.varShipPhone;
	if(checkInternationalPhone(phoneno.value)==false)
	{
		alert("Please Enter a Valid Phone Number")
		phoneno.value=""
		phoneno.focus()
		return false
	}*/
}

function shipaddr_validate(){
	if(document.frm_shipaddr.IntShipId.value=="")
	{
		alert("Enter the Shipping ID");
		document.frm_shipaddr.IntShipId.focus();
		return false;
	}
	if(isWhitespace(document.frm_shipaddr.IntShipId.value)){
		alert("Please Enter your Shipping ID without white spaces");
		document.frm_shipaddr.IntShipId.focus();
		return false;
	}
	if(!isAlphaNumeric(document.frm_shipaddr.IntShipId.value)){
		alert("Please Enter your Shipping ID without any special characters");
		document.frm_shipaddr.IntShipId.focus();
		return false;
		}
	if(document.frm_shipaddr.varShipFirstName.value=="")
	{
		alert("Enter the Shipping First name");
		document.frm_shipaddr.varShipFirstName.focus();
		return false;
	}
	if(isWhitespace(document.frm_shipaddr.varShipFirstName.value)){
		alert("Please Enter your Shipping First name without white spaces");
		document.frm_shipaddr.varShipFirstName.focus();
		return false;
	}
	if(!isString(document.frm_shipaddr.varShipFirstName.value)){
		alert("Please Enter your Shipping first name without any special characters");
		document.frm_shipaddr.varShipFirstName.focus();
		return false;
	}
	ShipLastName=document.frm_shipaddr.varShipLastName;
	if(ShipLastName.value=="")
	{
		alert("Enter the Shipping Last name");
		ShipLastName.focus();
		return false;
	}
	if(isWhitespace(ShipLastName.value)){
		alert("Please Enter your Shipping Last name without white spaces");
		ShipLastName.focus();
		return false;
	}
	if(!isString(ShipLastName.value)){
		alert("Please Enter your Shipping Last name without any special characters");
		ShipLastName.focus();
		return false;
	}
	if(document.frm_shipaddr.varShipAddress1.value=="")
	{
		alert("Enter the Shipping Address name");
		document.frm_shipaddr.varShipAddress1.focus();
		return false;
	}
	if(isWhitespace(frm_shipaddr.varShipAddress1.value)){
		alert("Please Enter your Shipping Address without white spaces");
		frm_shipaddr.varShipAddress1.focus();
		return false;
	}
	if(!isAlphaNumeric(document.frm_shipaddr.varShipAddress1.value)){
		alert("Please Enter your Shipping Address without any special characters");
		document.frm_shipaddr.varShipAddress1.focus();
		return false;
		}
	if(document.frm_shipaddr.varShipCity.value=="")
	{
		alert("Enter the Shipping City");
		document.frm_shipaddr.varShipCity.focus();
		return false;
	}
	if(isWhitespace(document.frm_shipaddr.varShipCity.value)){
		alert("Please Enter your Shipping City without white spaces");
		document.frm_shipaddr.varShipCity.focus();
		return false;
	}
	if(!isString(document.frm_shipaddr.varShipCity.value)){
		alert("Please Enter your Shipping City without any special characters");
		document.frm_shipaddr.varShipCity.focus();
		return false;
	}
	if(document.frm_shipaddr.varShipState.value==0)
		{
			alert("Select the Shipping State");
			document.frm_shipaddr.varShipState.focus();
			return false;
		}
	if(isWhitespace(document.frm_shipaddr.varShipState.value)){
			alert("Please Enter your Shipping State without white spaces");
			document.frm_shipaddr.varShipState.focus();
			return false;
		}
	if(!isString(document.frm_shipaddr.varShipState.value)){
			alert("Please Enter your Shipping State without any special characters");
			document.frm_shipaddr.varShipState.focus();
			return false;
		}
	
	if(document.frm_shipaddr.varShipZip.value=="")
	{
		alert("Enter the Shipping zipcode");
		document.frm_shipaddr.varShipZip.focus();
		return false;
	}
	if(isNaN(document.frm_shipaddr.varShipZip.value) ){
						alert("Enter the Zipcode in numeric value");
						document.frm_shipaddr.varShipZip.focus();
						return false;
			}
	if(isWhitespace(document.frm_shipaddr.varShipZip.value)){
		alert("Please Enter your Shipping Zipcode without white spaces");
		document.frm_shipaddr.varShipZip.focus();
		return false;
	}
	zipcodelength = document.frm_shipaddr.varShipZip.value.length;
		if(zipcodelength != 5){
			alert("Please Enter your 5 digit card shipping zipcode");
			document.frm_shipaddr.varShipZip.focus();
			return false;
		}
	
	if(document.frm_shipaddr.varShipPhone1.value=="")
	{
		alert("Enter the Shipping Phone1");
		document.frm_shipaddr.varShipPhone1.focus();
		return false;
	}
	if(isWhitespace(document.frm_shipaddr.varShipPhone1.value)){
		alert("Please Enter your Shipping Phone1 without white spaces");
		document.frm_shipaddr.varShipPhone1.focus();
		return false;
	}
	zipcodelength1 = document.frm_shipaddr.varShipPhone1.value.length;
		if(zipcodelength1 != 3){
			alert("Please Enter your 3 digit card shipping zipcode");
			document.frm_shipaddr.varShipPhone1.focus();
			return false;
		}
	
	if(document.frm_shipaddr.varShipPhone2.value=="")
	{
		alert("Enter the Shipping Phone2");
		document.frm_shipaddr.varShipPhone2.focus();
		return false;
	}
	if(isWhitespace(document.frm_shipaddr.varShipPhone2.value)){
		alert("Please Enter your Shipping Phone2 without white spaces");
		document.frm_shipaddr.varShipPhone2.focus();
		return false;
	}
	varShipPhone2length = document.frm_shipaddr.varShipPhone2.value.length;
		if(varShipPhone2length != 3){
			alert("Please Enter your 3 digit card shipping zipcode");
			document.frm_shipaddr.varShipPhone2.focus();
			return false;
		}
	
	if(document.frm_shipaddr.varShipPhone3.value=="")
	{
		alert("Enter the Shipping Phone3");
		document.frm_shipaddr.varShipPhone3.focus();
		return false;
	}
	if(isWhitespace(document.frm_shipaddr.varShipPhone3.value)){
		alert("Please Enter your Shipping Phone3 without white spaces");
		document.frm_shipaddr.varShipPhone3.focus();
		return false;
	}
	zipcodelength3 = document.frm_shipaddr.varShipPhone3.value.length;
		if(zipcodelength3 != 4){
			alert("Please Enter your 4 digit card shipping zipcode");
			document.frm_shipaddr.varShipPhone3.focus();
			return false;
		}
	
	/*phoneno = document.frm_shipaddr.varShipPhone;
	if(checkInternationalPhone(phoneno.value)==false)
	{
		alert("Please Enter a Valid Phone Number")
		phoneno.value=""
		phoneno.focus()
		return false
	}*/
}
function memlogin_validate(){
	if(document.memlogin.txtusername.value==""){
		alert("Please Enter your Email");
		document.memlogin.txtusername.focus();
		return false;
	}
	if (!validateEmail(document.memlogin.txtusername.value,1,1)) 
	{
			document.memlogin.txtusername.focus();
			return false;
	}
	if(document.memlogin.txtpassword.value==""){
		alert("Please Enter your Password");
		document.memlogin.txtpassword.focus();
		return false;
	}
}
//Email Validation
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 for popup menu
function popupmenu(url)
{
	newwindow=window.open(url,'ImageDisplay','height=500,width=600,left=0,top=0,resizable=no,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}


function CartValidation(formname)
{

		//Product size validation
		var x=0;
		var sum=0;

		ProductSizeLength = document.forms[formname].ProductSize.length;
		

		if(ProductSizeLength > 1){
			for(PrIndex = 0; PrIndex < ProductSizeLength; PrIndex++ ){
				if(document.forms[formname].ProductSize[PrIndex].value == "" || document.forms[formname].ProductSize[PrIndex].value == "N/A"){
					x=x+1;
				}
				if(document.forms[formname].ProductSize[PrIndex].value != "N/A" && document.forms[formname].ProductSize[PrIndex].value != "") {
				sum = parseInt(sum) + parseInt(document.forms[formname].ProductSize[PrIndex].value);
				}
			}
			
			if(x==ProductSizeLength){
			alert("Please enter the Quanitity");
			return false;
			}
			for(PrIndex = 0; PrIndex < ProductSizeLength; PrIndex++ ){
			
				if(document.forms[formname].ProductSize[PrIndex].value != "N/A"){
					if(isNaN(document.forms[formname].ProductSize[PrIndex].value) ){
						alert("Enter the quantity in numeric value");
						document.forms[formname].ProductSize[PrIndex].focus();
						return false;
					}
				}
				
			}
		}
		else{
			if(document.forms[formname].ProductSize.value=="") {
						alert("Please enter the Quanitity");
						document.forms[formname].ProductSize.focus();
						return false;
			}
			if(isNaN(document.forms[formname].ProductSize.value) ){
						alert("Enter the quantity in numeric value");
						document.forms[formname].ProductSize.focus();
						return false;
			}
		sum = parseInt(document.forms[formname].ProductSize.value);	
		}
		
	
		if(sum < 1){
			alert("Total number of quantity must not be less than 1");
			return false;
		}
			
	
}
function placeordervalidation()
{
		Minimumorder= parseInt(document.frm_placeorder.minimumorder.value);
		Quantity= parseInt(document.frm_placeorder.quantity.value);
		if(Quantity < Minimumorder){
			alert("Your order must be for a minimum of "+Minimumorder+" pieces using the exact same art and ink colors.  Please add more items to your cart to proceed");
			return false;
		}	
}
function emailquote(url)
{
	Minimumorder= parseInt(document.frm_placeorder.minimumorder.value);
	Quantity= parseInt(document.frm_placeorder.quantity.value);
	if(Quantity < Minimumorder){
		alert("Your order must be for a minimum of "+Minimumorder+" pieces using the exact same art and ink colors.  Please add more items to your cart to proceed");
		return false;
	}	
	window.location.href=url;
	//newwindow=window.location.href=(url);
	//if (window.focus) {newwindow.focus()}
}

//function shipresi()
//{
//	document.frm_shipsubmit.submit();
//}
//Validate function for Order details
function validate_order(){
	if(document.orderdetails.name.value==""){
		alert("Please Enter your Name");
		document.orderdetails.name.focus();
		return false;
	}
	if(document.orderdetails.address1.value==""){
		alert("Please Enter your Address");
		document.orderdetails.address1.focus();
		return false;
	}
	if(document.orderdetails.city.value==""){
		alert("Please Enter your City");
		document.orderdetails.city.focus();
		return false;
	}
	if(document.orderdetails.state.value==""){
		alert("Please Enter your State");
		document.orderdetails.state.focus();
		return false;
	}
	if(document.orderdetails.zipcode.value==""){
		alert("Please Enter your Zipcode");
		document.orderdetails.zipcode.focus();
		return false;
	}
	zipcodelength = document.orderdetails.zipcode.value.length;
		if(zipcodelength != 5){
			alert("Please Enter your 5 digit zipcode");
			document.orderdetails.zipcode.focus();
			return false;
		}
	if(document.orderdetails.phone.value==""){
		alert("Please Enter your Phone number");
		document.orderdetails.phone.focus();
		return false;
	}
	phoneno = document.orderdetails.phone;
	if (checkInternationalPhone(phoneno.value)==false)
	{
		alert("Please Enter a Valid Phone Number")
		phoneno.value=""
		phoneno.focus()
		return false
	}
	if (!validateEmail(document.orderdetails.email.value,1,1)) 
	{
			document.orderdetails.email.focus();
			return false;
	}
	if(document.orderdetails.cc.value==""){
		alert("Please Enter your Credit Card Number");
		document.orderdetails.cc.focus();
		return false;
	}
	if(isNaN(document.orderdetails.cc.value)){
		alert("Credit Card value shoud be numeric");
		document.orderdetails.cc.focus();
		return false;
	}
	if(document.orderdetails.cardtype.value==""){
		alert("Please Enter your Credit Card type");
		document.orderdetails.cardtype.focus();
		return false;
	}
/*	if(document.orderdetails.BilltoState.value==""){
		alert("Please Select your State");
		document.orderdetails.BilltoState.focus();
		return false;
	}
	if(document.orderdetails.BilltoZipcode.value==""){
		alert("Please Enter your Zip Code");
		document.orderdetails.BilltoZipcode.focus();
		return false;
	}
*/
}
function doCheck(IndexValue){
	if(document.frm_productdisplay.rdo_imprint[IndexValue].checked){
		for(innercount=0; innercount < 6; innercount++){
			if(IndexValue != innercount){
			document.frm_productdisplay.ImprintAdditional[innercount].disabled = false;
			}
		}
		document.frm_productdisplay.ImprintAdditional[IndexValue].disabled = true;
	}
}


	function ProductOrderValidate(){

		ShirtColor = "";
		ProductSize = "";
		rdo_imprint="";
		ArtSource = "";
		ShirtColorLength = document.frm_productdisplay.ShirtColor.length;
		
		//InkColorLength = document.frm_productdisplay.InkColor.length;
		ProductSizeLength = document.frm_productdisplay.ProductSize.length;
		/*rdo_imprintlength = document.frm_productdisplay.rdo_imprint.length;
		ImprintAdditionallength = document.frm_productdisplay.ImprintAdditional.length;*/
		
		//Shirt Color validation
		var i=0;
		if(ShirtColorLength > 1){
			for(ShIndex = 0; ShIndex < ShirtColorLength; ShIndex++ ){
				if(document.frm_productdisplay.ShirtColor[ShIndex].checked == false){
					i=i+1;
				}
			}
		}
		if(i==ShirtColorLength)
		{
			alert("Please select the Shirt Color");
			return false;
		}
		
		//Ink color validation
		/*var j=0;
		if(InkColorLength > 1){
			for(InIndex = 0; InIndex < InkColorLength; InIndex++ ){
				if(document.frm_productdisplay.InkColor[InIndex].checked == false){
					j=j+1;
				}
			}
		}
		if(j==InkColorLength)
		{
			alert("Please select the Ink Color");
			return false;
		}*/
		
		//Product size validation
		var x=0;
		var sum=0;
		if(ProductSizeLength > 1){
			for(PrIndex = 0; PrIndex < ProductSizeLength; PrIndex++ ){
				if(document.frm_productdisplay.ProductSize[PrIndex].value == "" || document.frm_productdisplay.ProductSize[PrIndex].value == "N/A"){
					x=x+1;
				}
				if(document.frm_productdisplay.ProductSize[PrIndex].value != "N/A" && document.frm_productdisplay.ProductSize[PrIndex].value != "") {
				sum = parseInt(sum) + parseInt(document.frm_productdisplay.ProductSize[PrIndex].value);
				}
			}
		}
		if(x==ProductSizeLength)
		{
			alert("Please enter the number of shirts");
			return false;
		}
		for(PrIndex = 0; PrIndex < ProductSizeLength; PrIndex++ ){
		
			if(document.frm_productdisplay.ProductSize[PrIndex].value != "N/A"){
				if(isNaN(document.frm_productdisplay.ProductSize[PrIndex].value) ){
					alert("Enter the number of shirts in numeric value");
					document.frm_productdisplay.ProductSize[PrIndex].focus();
					return false;
				}
			}
			
		}
		if(sum < 1){
			alert("Total number of shirts must not be less than 1");
			return false;
		}
		

		
		if((document.frm_productdisplay.FrontLocation.value=="") && (document.frm_productdisplay.BackLocation.value=="") && (document.frm_productdisplay.RightLocation.value=="") && (document.frm_productdisplay.LeftLocation.value=="")) 
		{
			alert("Please select atleast one location");
			return false;
			
		}
		
		
		if(document.frm_productdisplay.FrontLocation.value!="")
		{
			if(document.frm_productdisplay.FrontColor.value=="0")
			{
				alert("Please select the front location color");
				document.frm_productdisplay.FrontColor.focus();
				return false;
			}
			
		}
		
		
		
		//validation for print location(Back)
		if(document.frm_productdisplay.BackLocation.value!="")
		{
			if(document.frm_productdisplay.BackColor.value=="0")
			{
				alert("Please select the Back location color");
				document.frm_productdisplay.BackColor.focus();
				return false;
			}
			
		}
		//validation for print location(Right)
		if(document.frm_productdisplay.RightLocation.value!="")
		{
			if(document.frm_productdisplay.RightColor.value=="0")
			{
				alert("Please select the Right sleeve color");
				document.frm_productdisplay.RightColor.focus();
				return false;
			}
			
		}
		//validation for print location(Left)
		if(document.frm_productdisplay.LeftLocation.value!="")
		{
			if(document.frm_productdisplay.LeftColor.value=="0")
			{
				alert("Please select the Left sleeve color");
				document.frm_productdisplay.LeftColor.focus();
				return false;
			}
			
		}
		
		//validation for Art source
		artsourcelength=document.frm_productdisplay.ArtSource.length
		
		var i=0;
		if(artsourcelength > 1){
			for(artIndex = 0; artIndex < artsourcelength; artIndex++ ){
				if(document.frm_productdisplay.ArtSource[artIndex].checked == false){
					i=i+1;
				}
			}
		}
		if(i==artsourcelength)
		{
			alert("Please select the Art Source Type");
			return false;
		}
		if(document.frm_productdisplay.ArtSource[2].checked == true)
		{
			
			if(document.frm_productdisplay.JobId.value=="")
			{
				alert("Please select the job id")
				document.frm_productdisplay.JobId.focus()
				return false;
				
			}
			
		}
		
		
		
		if(document.frm_productdisplay.ArtSource[1].checked == true)
		{
			
			if(document.frm_productdisplay.Artorderid.value=="")
			{
				alert("Please enter your Previous Order Id")
				document.frm_productdisplay.Artorderid.focus()
				return false;
				
			}
			
		}
		
		//validation for zip code
		if(document.frm_productdisplay.ShipToZip.value=="")
			{
				alert("Please enter the zip code")
				document.frm_productdisplay.ShipToZip.focus()
				return false;
				
			}
		
			
	}
	/*function PlaceOrderValidate()
	{
		if(document.frm_placeorder.ShipToZip.value=="")
			{
				alert("Please enter the zip code")
				document.frm_placeorder.ShipToZip.focus()
				return false;
				
			}
		
	}*/
	function UpdatePreview(ProductId){
		
	ShirtColor = "";
	InkColor = "";
	ShirtColorLength = document.frm_productdisplay.ShirtColor.length;
	InkColorLength = document.frm_productdisplay.InkColor.length;
	var i=0;
	if(ShirtColorLength > 1){
		for(ShIndex = 0; ShIndex < ShirtColorLength; ShIndex++ ){
			if(document.frm_productdisplay.ShirtColor[ShIndex].checked == false){
			 	i=i+1;
			}
			else
			{
				ShirtColor = document.frm_productdisplay.ShirtColor[ShIndex].value;
			}
		}
	}
	if(i==ShirtColorLength)
	{
		alert("Please select the Shirt Color");
		return false;
	}

	var j=0;
	if(InkColorLength > 1){
		for(InIndex = 0; InIndex < InkColorLength; InIndex++ ){
			if(document.frm_productdisplay.InkColor[InIndex].checked == false){
			 	j=j+1;
			}
			else
			{
				InkColor = document.frm_productdisplay.InkColor[InIndex].value;
			}
		}
	}
	if(j==InkColorLength)
	{
		alert("Please select the Ink Color");
		return false;
	}

	window.location.href = "productdisplay.asp?ShirtId="+ShirtColor+"&ColorId="+InkColor+"&productID="+ProductId
}
function UpdatePreviewpop(ProductId){
		
	ShirtColor = "";
	InkColor = "";
	ShirtColorLength = document.frm_productdisplay.ShirtColor.length;
	InkColorLength = document.frm_productdisplay.InkColor.length;
	var i=0;
	if(ShirtColorLength > 1){
		for(ShIndex = 0; ShIndex < ShirtColorLength; ShIndex++ ){
			if(document.frm_productdisplay.ShirtColor[ShIndex].checked == false){
			 	i=i+1;
			}
			else
			{
				ShirtColor = document.frm_productdisplay.ShirtColor[ShIndex].value;
			}
		}
	}
	if(i==ShirtColorLength)
	{
		alert("Please select the Shirt Color");
		return false;
	}

	var j=0;
	if(InkColorLength > 1){
		for(InIndex = 0; InIndex < InkColorLength; InIndex++ ){
			if(document.frm_productdisplay.InkColor[InIndex].checked == false){
			 	j=j+1;
			}
			else
			{
				InkColor = document.frm_productdisplay.InkColor[InIndex].value;
			}
		}
	}
	if(j==InkColorLength)
	{
		alert("Please select the Ink Color");
		return false;
	}

	window.location.href = "prodisp.asp?ShirtId="+ShirtColor+"&ColorId="+InkColor+"&productID="+ProductId
}
function UpdateSizes(ShirtColor,ProductId){
	window.location.href = "productdisplay.asp?ShirtId=" + ShirtColor + "&productID="+ProductId
}
function UpdateSizespop(ShirtColor,ProductId){
	window.location.href = "prodisp.asp?ShirtId=" + ShirtColor + "&productID="+ProductId
}
/*// copy
var ShippingFname;
var ShippingLname;
var ShippingCompany;
var ShippingAddress1;
var ShippingAddress2;
var ShippingCity;
var ShippingState
var ShippingZipCode;
var ShippingPhone1
var ShippingPhone2
var ShippingPhone3

function InitSaveVariables(form) {
		ShippingFname = form.varShipFirstName.value;
		ShippingLname = form.varShipLastName.value;
		ShippingCompany = form.varShipCompany.value;
		ShippingAddress1 = form.varShipAddress1.value;
		ShippingAddress2 = form.varShipAddress2.value;
        ShippingCity = form.varShipCity.value;
		ShippingStateIndex = form.varShipState.selectedIndex;
        ShippingState = form.varShipState[ShippingStateIndex].value;
        ShippingZipCode = form.varShipZip.value;
		ShippingPhone1 = form.varShipPhone1.value;
		ShippingPhone2 = form.varShipPhone2.value;
		ShippingPhone3 = form.varShipPhone3.value;
}

function ShipToBillPerson(form){
		if (form.Shipcheck.checked) {
			//alert("test1");
                InitSaveVariables(form);
				form.varShipFirstName.value 	= form.varBFirstName.value;
				form.varShipLastName.value 		= form.varBLastName.value;
				form.varShipCompany.value   	= form.varBCompany.value;
				form.varShipAddress1.value   	= form.varBAddress1.value;
				form.varShipAddress2.value   	= form.varBAddress2.value;
				form.varShipCity.value      	= form.varBCity.value;
				form.varShipState.value     	= form.varBState.value;
				form.varShipZip.value     	 	= form.varBPostcode.value;
				form.varShipPhone1.value      	= form.varBPhoneNo1.value;
				form.varShipPhone2.value      	= form.varBPhoneNo2.value;
				form.varShipPhone3.value      	= form.varBPhoneNo3.value;
				form.varShipFirstName.disabled = true;
				form.varShipLastName.disabled = true;
				form.varShipCompany.disabled = true;
				form.varShipAddress1.disabled = true;
				form.varShipAddress2.disabled = true;
				form.varShipCity.disabled = true;
				form.varShipState.disabled = true;
				form.varShipZip.disabled = true;
				form.varShipPhone1.disabled = true;
				form.varShipPhone2.disabled = true;
				form.varShipPhone3.disabled = true;
			if(confid > 0)		
				window.location.href = 'checkout.php?confid='+confid+'&chstate='+form.varBState.value;
			else
				window.location.href = 'checkout.php?chstate='+form.varBState.value;
		}
        else {
			//alert("1");
				form.varShipFirstName.value = ShippingFname;
				form.varShipLastName.value  = ShippingLname;
				form.varShipCompany.value   = ShippingCompany; 
				form.varShipAddress1.value   = ShippingAddress1; 
				form.varShipAddress2.value   = ShippingAddress2; 
				form.varShipCity.value	    = ShippingCity;
				form.varShipState.value     = ShippingState;
				form.varShipZip.value       = ShippingZipCode;
				form.varShipPhone1.value     = ShippingPhone1;
				form.varShipPhone2.value     = ShippingPhone2;
				form.varShipPhone3.value     = ShippingPhone3;
				
				form.varShipFirstName.disabled = false;
				form.varShipLastName.disabled = false;
				form.varShipCompany.disabled = false;
				form.varShipAddress1.disabled = false;
				form.varShipAddress2.disabled = false;
				form.varShipCity.disabled = false;
				form.varShipState.disabled = false;
				form.varShipZip.disabled = false;
				form.varShipPhone1.disabled = false;
				form.varShipPhone2.disabled = false;
				form.varShipPhone3.disabled = false;
   			}
}*/

//Check out
 function setValue(FieldValue,FieldName) {   
        var FieldObject = document.getElementById(FieldName);   
        FieldObject.value = FieldValue;   
        return false;  
 } 

//Validation For Check out
function checkout_validate()
{
	if (!validateEmail(document.checkout.b_email.value,1,1)) 
	{
			document.checkout.b_email.focus();
			return false;
	}
	if(document.checkout.b_fname.value==""){
		alert("Please Enter your First Name");
		document.checkout.b_fname.focus();
		return false;
	}
	if(document.checkout.b_lname.value==""){
		alert("Please Enter your Last Name");
		document.checkout.b_lname.focus();
		return false;
	}
	if(document.checkout.b_address1.value==""){
		alert("Please Enter Address1 field");
		document.checkout.b_address1.focus();
		return false;
	}
	if(document.checkout.b_city.value==""){
		alert("Please Enter your City");
		document.checkout.b_city.focus();
		return false;
	}
	if(document.checkout.b_state.value==""){
		alert("Please Enter your State");
		document.checkout.b_state.focus();
		return false;
	}
	if(document.checkout.b_zipcode.value==""){
		alert("Please Enter your City Zipcode");
		document.checkout.b_zipcode.focus();
		return false;
	}
	if(document.checkout.b_phone.value==""){
		alert("Please Enter your Phone number");
		document.checkout.b_phone.focus();
		return false;
	}
	phoneno = document.checkout.b_phone;
	if (checkInternationalPhone(phoneno.value)==false)
	{
		alert("Please Enter a Valid Phone Number")
		phoneno.value=""
		phoneno.focus()
		return false
	}
	if(document.checkout.s_fname.value==""){
		alert("Please Enter your First Name");
		document.checkout.s_fname.focus();
		return false;
	}
	if(document.checkout.s_lname.value==""){
		alert("Please Enter your Last Name");
		document.checkout.s_lname.focus();
		return false;
	}
	if(document.checkout.s_address1.value==""){
		alert("Please Enter Address1 field");
		document.checkout.s_address1.focus();
		return false;
	}
	if(document.checkout.s_city.value==""){
		alert("Please Enter your City");
		document.checkout.s_city.focus();
		return false;
	}
	if(document.checkout.s_state.value==""){
		alert("Please Enter your State");
		document.checkout.s_state.focus();
		return false;
	}
	if(document.checkout.s_zipcode.value==""){
		alert("Please Enter your City Zipcode");
		document.checkout.s_zipcode.focus();
		return false;
	}
	if(document.checkout.s_phone.value==""){
		alert("Please Enter your Phone number");
		document.checkout.s_phone.focus();
		return false;
	}
	phoneno = document.checkout.s_phone;
	if (checkInternationalPhone(phoneno.value)==false)
	{
		alert("Please Enter a Valid Phone Number")
		phoneno.value=""
		phoneno.focus()
		return false
	}
	if(document.checkout.cardtype.value==""){
		alert("Please select the Card type");
		document.checkout.cardtype.focus();
		return false;
	}
	if(document.checkout.cardnumber.value==""){
		alert("Please enter the Card Number");
		document.checkout.cardnumber.focus();
		return false;
	}
	if(isNaN(document.checkout.cardnumber.value)){
		alert("Card Number field must be numeric");
		document.checkout.cardnumber.focus();
		return false;
	}
	if(document.checkout.expmonth.value==""){
		alert("Please enter the Expiry Month");
		document.checkout.expmonth.focus();
		return false;
	}
	if(document.checkout.expyear.value==""){
		alert("Please enter the Expiry Year");
		document.checkout.expyear.focus();
		return false;
	}
	if(document.checkout.nameoncard.value==""){
		alert("Please enter the Card Name");
		document.checkout.nameoncard.focus();
		return false;
	}
	if(document.checkout.cardbilladdr1.value==""){
		alert("Please enter the Card Billing Address1");
		document.checkout.cardbilladdr1.focus();
		return false;
	}
	if(document.checkout.cardcity.value==""){
		alert("Please enter the Card Billing City");
		document.checkout.cardcity.focus();
		return false;
	}
	if(document.checkout.cardstate.value==""){
		alert("Please enter the Card Billing State");
		document.checkout.cardstate.focus();
		return false;
	}
	if(document.checkout.cardzipcode.value==""){
		alert("Please enter the Card Billing ZipCode");
		document.checkout.cardzipcode.focus();
		return false;
	}
}

var CardBillingAddress1;
var CardBillingAddress2;
var CardBillingCity;
var CardBillingState
var CardBillingZipCode;

function InitCSaveVariables(form) {
		CardBillingAddress1 = form.cardbilladdr1.value;
		CardBillingAddress2 = form.cardbilladdr2.value;
        CardBillingCity = form.cardcity.value;
		CardBillingState = form.cardstate.value;
        CardBillingZipCode = form.cardzipcode.value;
}

function ShipToCardBillPerson(form) {
        if (form.copyaddr.checked) {
                InitCSaveVariables(form);
                form.cardbilladdr1.value = form.b_address1.value;
                form.cardbilladdr2.value = form.b_address2.value;
                form.cardcity.value = form.b_city.value;
                form.cardstate.value = form.b_state.value;
                form.cardzipcode.value = form.b_zipcode.value;
		}
        else {
                form.cardbilladdr1.value = CardBillingAddress1;
                form.cardbilladdr2.value = CardBillingAddress2;
                form.cardcity.value = CardBillingCity;
                form.cardstate.value = CardBillingState;
                form.cardzipcode.value = CardBillingZipCode;
	   }
}


function MailQuoteValidate()
{
	quoteName=document.frm_quotemail.txtname;
	if(quoteName.value=="")
	{
		alert("Enter the your name");
		quoteName.focus();
		return false;
	}
	if(isWhitespace(quoteName.value)){
		alert("Please Enter your name without white spaces");
		quoteName.focus();
		return false;
	}
	if(!isString(quoteName.value)){
		alert("Please Enter your name without any special characters");
		quoteName.focus();
		return false;
	}
	
	if(document.frm_quotemail.txtemail.value==""){
		alert("Please enter your email");
		document.frm_quotemail.txtemail.focus();
		return false;
	}
	if (!validateEmail(document.frm_quotemail.txtemail.value,1,1)) 
	{
			document.frm_quotemail.txtemail.focus();
			return false;
	}
	if(document.frm_quotemail.txttoemail.value==""){
		alert("Please enter the To mail address ");
		document.frm_quotemail.txttoemail.focus();
		return false;
	}
	if (!validateEmail(document.frm_quotemail.txttoemail.value,1,1)) 
	{
			document.frm_quotemail.txttoemail.focus();
			return false;
	}
}
function checkoutvalidity()
{
	cardtype=document.checkout_form.card_type;
	if(cardtype.value=="")
	{
		alert("Please select your credit card type");
		cardtype.focus();
		return false;
	}
	cardname=document.checkout_form.card_name;
	if(cardname.value=="")
	{
		alert("Enter the your name");
		cardname.focus();
		return false;
	}
	if(isWhitespace(cardname.value)){
		alert("Please Enter your name without white spaces");
		cardname.focus();
		return false;
	}
	if(!isString(cardname.value)){
		alert("Please Enter your name without any special characters");
		cardname.focus();
		return false;
	}
	cardnumber=document.checkout_form.card_number;
	if(cardnumber.value=="")
	{
		alert("Enter the your credit card number");
		cardnumber.focus();
		return false;
	}
	if(isWhitespace(cardnumber.value)){
		alert("Please Enter your credit card number without white spaces");
		cardnumber.focus();
		return false;
	}
	if(!isInteger(cardnumber.value)){
		alert("Please Enter your credit card number without any special characters");
		cardnumber.focus();
		return false;
	}
	if(cardnumber.value.length > 16){
		alert("Please Enter your correct credit card number");
		cardnumber.focus();
		return false;
	}
	cardexpiremonth=document.checkout_form.card_expire_Month;
	if(cardexpiremonth.value=="")
	{
		alert("Please select your credit card expiremonth");
		cardexpiremonth.focus();
		return false;
	}
	cardexpireyear=document.checkout_form.card_expire_Year;
	if(cardexpireyear.value=="")
	{
		alert("Please select your credit card expireyear");
		cardexpireyear.focus();
		return false;
	}
	Cardverifynumber=document.checkout_form.cardverifynumber;
	if(Cardverifynumber.value=="")
	{
		alert("Enter the your card verification number");
		Cardverifynumber.focus();
		return false;
	}
	if(isWhitespace(Cardverifynumber.value)){
		alert("Please Enter your card verification number without white spaces");
		Cardverifynumber.focus();
		return false;
	}
	if(!isInteger(Cardverifynumber.value)){
		alert("Please Enter your card verification number without any special characters");
		Cardverifynumber.focus();
		return false;
	}
	if(Cardverifynumber.value.length != 3){
		alert("Please Enter your 3 digit card verification number");
		Cardverifynumber.focus();
		return false;
	}
}
	

function memregister_validate(){
	var txtUsername=document.frm_memregister.txt_username.value;
		 if(txtUsername == "")
			 {
			 alert("Please enter the Username");
			 document.frm_memregister.txt_username.focus();
			 return false;
			 }
	var txtPassword=document.frm_memregister.txt_password.value;
		 if(txtPassword == ""){
				 alert("Please enter the Password");
				 document.frm_memregister.txt_password.focus();
				 return false;
		} 
	var txtconfirmPassword=document.frm_memregister.txt_confirm.value;
		 if(txtconfirmPassword == ""){
				 alert("Please enter the Confirm Password");
				 document.frm_memregister.txt_confirm.focus();
				 return false;
		}
		if(txtconfirmPassword != txtPassword){
				 alert("Please enter the Confirm Password Same as the Password");
				 document.frm_memregister.txt_confirm.focus();
				 return false;
		}
	
	/////////////Billing
	var txtfirstname=document.frm_memregister.txt_firstname;
		 if(txtfirstname.value == ""){
			 alert("Please enter the Billing First Name");
			 txtfirstname.focus();
			 return false;
		 }
	var txtlastname=document.frm_memregister.txt_lastname;
		 if(txtlastname.value == ""){
			 alert("Please enter the Billing Last Name");
			 txtlastname.focus();
			 return false;
		 }
	/*var txtcompany=document.frm_memregister.txt_company;
		 if(txtcompany.value == ""){
			 alert("Please enter the Billing Company");
			 txtcompany.focus();
			 return false;
		 }*/
	var txtaddress=document.frm_memregister.txt_address;
		 if(txtaddress.value == ""){
			 alert("Please enter the Billing Address");
			 txtaddress.focus();
			 return false;
		 }
	var txtcity=document.frm_memregister.txt_city;
		 if(txtcity.value == ""){
			 alert("Please enter the Billing City");
			 txtcity.focus();
			 return false;
		 }	
	var txtstate=document.frm_memregister.txt_state;
		 if(txtstate.value == ""){
			 alert("Please enter the Billing State");
			 txtstate.focus();
			 return false;
		 } 
	var txtzip=document.frm_memregister.txt_zip;
		 if(txtzip.value == ""){
			 alert("Please enter the Billing Zip");
			 txtzip.focus();
			 return false;
		 }
	var txtcountry=document.frm_memregister.txt_country;
		 if(txtcountry.value == ""){
			 alert("Please enter the Billing Country");
			 txtcountry.focus();
			 return false;
		 }
	
	var txtphone=document.frm_memregister.txt_phone;
		 if(txtfirstname.value == ""){
			 alert("Please enter the Billing Name");
			 txtfirstname.focus();
			 return false;
		 }
	var txtemail=document.frm_memregister.txt_email;
		 if(txtemail.value == ""){
			 alert("Please enter the Billing Email");
			 txtemail.focus();
			 return false;
		 }
	
		if (!validateEmail(txtemail.value,1,1)) 
		 {
		 txtemail.focus();
		 return false;
		 }
	if(document.frm_memregister.Shipcheck.checked == false){	 
		/////////////Shipping
		var txtshipfirstname=document.frm_memregister.txtship_firstname;
			 if(txtshipfirstname.value == ""){
				 alert("Please enter the Shipping First Name");
				 txtshipfirstname.focus();
				 return false;
			 }
		var txtshiplastname=document.frm_memregister.txtship_lastname;
			 if(txtshiplastname.value == ""){
				 alert("Please enter the Shipping Last Name");
				 txtshiplastname.focus();
				 return false;
			 }
		/*var txtshipcompany=document.frm_memregister.txtship_company;
			 if(txtshipcompany.value == ""){
				 alert("Please enter the Shipping Company");
				 txtshipcompany.focus();
				 return false;
			 }*/
		var txtshipaddress=document.frm_memregister.txtship_address;
			 if(txtshipaddress.value == ""){
				 alert("Please enter the Shipping Address");
				 txtshipaddress.focus();
				 return false;
			 }
		var txtshipcountry=document.frm_memregister.txtship_country;
			 if(txtshipcountry.value == ""){
				 alert("Please enter the Shipping Country");
				 txtshipcountry.focus();
				 return false;
			 }
		var txtshipcity=document.frm_memregister.txtship_city;
			 if(txtshipfirstname.value == ""){
				 alert("Please enter the Shipping Name");
				 txtshipfirstname.focus();
				 return false;
			 }
		var txtshipstate=document.frm_memregister.txtship_state;
			 if(txtshipfirstname.value == ""){
				 alert("Please enter the Shipping Name");
				 txtshipfirstname.focus();
				 return false;
			 }
		var txtshipzip=document.frm_memregister.txtship_zip;
			 if(txtshipzip.value == ""){
				 alert("Please enter the Shipping Zip");
				 txtshipzip.focus();
				 return false;
			 }
		var txtshipphone=document.frm_memregister.txtship_phone;
			 if(txtshipfirstname.value == ""){
				 alert("Please enter the Shipping Name");
				 txtshipfirstname.focus();
				 return false;
			 }
		var txtshipemail=document.frm_memregister.txtship_email;
			 if(txtshipemail.value == ""){
				 alert("Please enter the Shipping Email");
				 txtshipemail.focus();
				 return false;
			 }
		
			if (!validateEmail(txtshipemail.value,1,1)) 
			 {
			 txtshipemail.focus();
			 return false;
			 }
	}
	if(document.frm_memregister.agreechk.checked == false){	 
		alert("Please indicate that you have read and agreed to the Terms & Conditions and Privacy Policy associated with use of this website.");
			 document.frm_memregister.agreechk.focus();
			 return false;
		 }
	
}

function Productdisvalidate(){
		var minorder = document.frm_product.minorder.value;
		
		var x=0;
		var sum=0;
		var totqty = 0;
		QuantityLength = document.frm_product.CSQuantity.length;
		
		if(QuantityLength > 1){
			for(PrIndex = 0; PrIndex < QuantityLength; PrIndex++ ){
				if(document.frm_product.CSQuantity[PrIndex].value == "" || document.frm_product.CSQuantity[PrIndex].value == "N/A"){
					x=x+1;
				}
				
			}
			if(x==QuantityLength)
			{
			alert("Please enter the any one quantity");
			return false;
			}	
		}
		if(QuantityLength > 1){
			for(PrIndex = 0; PrIndex < QuantityLength; PrIndex++ ){
				if(document.frm_product.CSQuantity[PrIndex].value != "" && document.frm_product.CSQuantity[PrIndex].value != "N/A"){
					if(!isNumber(document.frm_product.CSQuantity[PrIndex].value)){
							alert("Quantity value shoud be numeric");
							document.frm_product.CSQuantity[PrIndex].focus();
							return false;
					}
					totqty = totqty + parseInt(document.frm_product.CSQuantity[PrIndex].value);
				}
			}
			
			if(totqty < minorder){
						alert("Your order must be for a minimum of "+minorder+" pieces using the exact same art and ink colors. Please add more items to your cart to proceed");
						return false;
				}
		}
		
		/*txtFrontColor = document.frm_product.FrontColor.value;
		if(txtFrontColor==0) 
		{
			alert("Please select the #Ink-Color for artwork");
			return false;
		}*/
		
		frradioLength = document.frm_product.frontlocation.length;
		if(frradioLength>1){
			FrontLocation = 0;
			for(var i = 0; i < frradioLength; i++) {
				if(document.frm_product.frontlocation[i].checked) {
					FrontLocation = document.frm_product.frontlocation[i].value;
				}
			}
		}
		bkradioLength = document.frm_product.backlocation.length;
		if(bkradioLength>1){
			BackLocation = 0;
			for(var i = 0; i < bkradioLength; i++) {
				if(document.frm_product.backlocation[i].checked) {
					BackLocation = document.frm_product.backlocation[i].value;
				}
			}
		}
		rtradioLength = document.frm_product.rightlocation.length;
		if(rtradioLength>1){
			RightLocation = 0;
			for(var i = 0; i < rtradioLength; i++) {
				if(document.frm_product.rightlocation[i].checked) {
					RightLocation = document.frm_product.rightlocation[i].value;
				}
			}
		}
		ltradioLength = document.frm_product.leftlocation.length;
		if(ltradioLength>1){
			LeftLocation = 0;
			for(var i = 0; i < ltradioLength; i++) {
				if(document.frm_product.leftlocation[i].checked) {
					LeftLocation = document.frm_product.leftlocation[i].value;
				}
			}
		}
		/*alert(FrontLocation);
		if((FrontLocation==0) && (BackLocation==0) && (RightLocation==0) && (LeftLocation==0)) 
		{
			alert("Please select at least one location");
			return false;
		}*/
		
		if(FrontLocation>0) {
				if(document.frm_product.frontupdfile.value==""){
					alert("Please upload the front loaction file");
					return false;
				}
		}
		if(BackLocation>0) {
				if(document.frm_product.backupdfile.value==""){
					alert("Please upload the back loaction file");
					return false;
				}
		}
		/*if(document.frm_product.chkagree.checked == false)
		{
		   alert("Please select the Terms and condition check box");
		   return false;
		}*/
}

function updateQtyValidate(formname,minorder){
	//minorder  = document.forms[formname].minorder.value;	
	var ProductQtyLength = document.forms[formname].CSQuantity.length;

	sum = 0;
	for(PrIndex = 0; PrIndex < ProductQtyLength; PrIndex++ ){
		//alert(document.forms[formname].CSQuantity[PrIndex].value);
		sum = sum + parseInt(document.forms[formname].CSQuantity[PrIndex].value);
	}
		
	if(sum < minorder){
		alert("Your order must be for a minimum of "+minorder+" pieces using the exact same art and ink colors. Please add more items to your cart to proceed");
		return false;
	}
	return true;
}

function updateValidate(minorder){
	var ProductQtyLength = document.frm_product.CSQuantity.length;
	sum = 0;
	for(PrIndex = 0; PrIndex < ProductQtyLength; PrIndex++ ){
		qty = 0;
		var qty = parseInt(document.frm_product.CSQuantity[PrIndex].value);
		if((document.frm_product.CSQuantity[PrIndex].value != "" ) && isNumber(document.frm_product.CSQuantity[PrIndex].value)){
			if(document.frm_product.CSQuantity[PrIndex].value >0 || document.frm_product.CSQuantity[PrIndex].value != ""){
				sum = sum + qty;
			}
		}
	}
	if(sum < minorder){
		alert("Your order must be for a minimum of "+minorder+" pieces using the exact same art and ink colors. Please add more items to your cart to proceed");
		return false;
	}
	return true;
}

function shipdisp(textrel,gid,servicename,subtotamd,taxamd){
var quotetotal;

	document.getElementById("gshipamd").innerHTML = textrel ;
	quotetotal = (parseFloat(subtotamd) + parseFloat(taxamd)  + parseFloat(textrel));
	totalprice = quotetotal.toFixed(2);;
	document.getElementById("QuotePriceDisplay").innerHTML = totalprice;
	document.frm_chkvalue.totprice.value = totalprice;
	document.frm_chkvalue.shippingamt.value = textrel;
	
	//document.getElementById("TotalPriceDisplay").innerHTML = '<input type="hidden" name="totprice" id="totprice" value="'+quotetotal+'" /> ' ;
}

function ChkRegEnter(e){ //e is event object passed from function invocation
var characterCode; //literal character code will be stored in this variable
	if(e && e.which){ //if which property of event object is supported (NN4)
	e = e
	characterCode = e.which //character code is contained in NN4's which property
	}
	else{
	e = event;
	characterCode = e.keyCode //character code is contained in IE's keyCode property
	}
	
	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
	memregister_validate();
	return false;
	}
	else{
	return true;
	}
}

function pay_search1(getsearch){
	window.location.href='orderhistory.php?paystatus1='+getsearch;
}

function shiprecalculate(confid,type,shiptype){
	if (document.frm_chkvalue.Shipcheck.checked == true && type == "bill") {
		state = document.frm_chkvalue.txt_state.value;		
	}
	else{
		state = document.frm_chkvalue.txtship_state.value;
	}
	if(confid > 0)		
		window.location.href = 'checkout.php?confid='+confid+'&chstate='+state+'&rdoshipmethod='+document.frm_chkvalue.rdoshipmethod.value+'&getshiptype='+shiptype+'';
	else
		window.location.href = 'checkout.php?chstate='+state+'&rdoshipmethod='+document.frm_chkvalue.rdoshipmethod.value+'&getshiptype='+shiptype+'';
}

function shipziprecalculate(confid,type,shiptype){
	if (document.frm_chkvalue.Shipcheck.checked == true && type == "bill") {
		zipcode = document.frm_chkvalue.txt_zip.value;		
	}
	else{
		zipcode = document.frm_chkvalue.txtship_zip.value;
	}
	if(confid > 0)		
		window.location.href = 'checkout.php?confid='+confid+'&chzip='+zipcode+'&rdoshipmethod='+document.frm_chkvalue.rdoshipmethod.value+'&getshiptype='+shiptype+'';
	else
		window.location.href = 'checkout.php?chzip='+zipcode+'&rdoshipmethod='+document.frm_chkvalue.rdoshipmethod.value+'&getshiptype='+shiptype+'';
}

// Shipping as same as the billing
var ShippingFname;
var ShippingLname;
var ShippingAddress1;
var ShippingCountry;
var ShippingCity;
var ShippingState
var ShippingZipCode;
var ShippingPhone1
var ShippingEmail

function InitSaveVariables(form) {
		ShippingFname = form.txtship_firstname.value;
		ShippingLname = form.txtship_lastname.value;
		ShippingAddress1 = form.txtship_address.value;
		ShippingCountry = form.txtship_country.value;
        ShippingCity = form.txtship_city.value;
		ShippingStateIndex = form.txtship_state.selectedIndex;
        ShippingState = form.txtship_state[ShippingStateIndex].value;
        ShippingZipCode = form.txtship_zip.value;
		ShippingPhone1 = form.txtship_phone.value;
		ShippingEmail = form.txtship_email.value;
}
function ShipToBillPerson(form){
		if(form.Shipcheck.checked==true) {
			InitSaveVariables(form);
                form.txtship_firstname.value 	= form.txt_firstname.value;
				form.txtship_lastname.value 	= form.txt_lastname.value;
				form.txtship_address.value   	= form.txt_address.value;
				form.txtship_country.value   	= form.txt_country.value;
				form.txtship_city.value      	= form.txt_city.value;
				form.txtship_state.value     	= form.txt_state.value;
				form.txtship_zip.value     	 	= form.txt_zip.value;
				form.txtship_phone.value      	= form.txt_phone.value;
				form.txtship_email.value      	= form.txt_email.value;
				form.txtship_firstname.disabled = true;
				form.txtship_lastname.disabled = true;
				form.txtship_address.disabled = true;
				form.txtship_country.disabled = true;
				form.txtship_city.disabled = true;
				form.txtship_state.disabled = true;
				form.txtship_zip.disabled = true;
				form.txtship_phone.disabled = true;
				form.txtship_email.disabled = true;
		}
        else {
				//InitSaveVariables(form);
				form.txtship_firstname.value = ShippingFname;
				form.txtship_lastname.value  = ShippingLname;
				form.txtship_address.value   = ShippingAddress1; 
				form.txtship_country.value   = ShippingCountry; 
				form.txtship_city.value	     = ShippingCity;
				form.txtship_state.value     = ShippingState;
				form.txtship_zip.value       = ShippingZipCode;
				form.txtship_phone.value     = ShippingPhone1;
				form.txtship_email.value     = ShippingEmail;
				
				form.txtship_firstname.disabled = false;
				form.txtship_lastname.disabled = false;
				form.txtship_address.disabled = false;
				form.txtship_country.disabled = false;
				form.txtship_city.disabled = false;
				form.txtship_state.disabled = false;
				form.txtship_zip.disabled = false;
				form.txtship_phone.disabled = false;
				form.txtship_email.disabled = false;
   			}
}


function CheckoutShipToBillPerson(form,confid){
		
		if(form.Shipcheck.checked==true) {
			InitSaveVariables(form);
                form.txtship_firstname.value 	= form.txt_firstname.value;
				form.txtship_lastname.value 	= form.txt_lastname.value;
				form.txtship_address.value   	= form.txt_address.value;
				form.txtship_country.value   	= form.txt_country.value;
				form.txtship_city.value      	= form.txt_city.value;
				form.txtship_state.value     	= form.txt_state.value;
				form.txtship_zip.value     	 	= form.txt_zip.value;
				form.txtship_phone.value      	= form.txt_phone.value;
				form.txtship_email.value      	= form.txt_email.value;
				form.txtship_firstname.disabled = true;
				form.txtship_lastname.disabled = true;
				form.txtship_address.disabled = true;
				form.txtship_country.disabled = true;
				form.txtship_city.disabled = true;
				form.txtship_state.disabled = true;
				form.txtship_zip.disabled = true;
				form.txtship_phone.disabled = true;
				form.txtship_email.disabled = true;
				
				var shipmentval = form.rdoshipmethod.value;
				
				getlen = form.getfdshiptype.length;
				
					for(j=0; j<getlen; j++){
						
						if(form.getfdshiptype[j].checked == true){
							shiptype = form.getshiptype[j].value;
						}
					}	
					
				
				/*if(shipmentval == "UPS Shipping"){
					upsgetlen = form.getfdshiptype.length
					for(j=0; j<upsgetlen; j++){
						if(form.getfdshiptype[j].checked == true){
							shiptype = form.getshiptype[j].value;
						}
					}	
				}
				else{
					fdxgetlen = form.getshiptypeval.length;

					for(j=0; j<fdxgetlen; j++){
					
						//alert(form.getshiptypeval[j].value);
						if(form.getfdshiptype[j].checked == true){
							shiptype = form.getshiptypeval[j].value;
							alert(shiptype);
						}
					}
				}*/
				
				if(confid > 0){		
					window.location.href = 'checkout.php?confid='+confid+'&billstate='+form.txt_state.value+'&billzip='+form.txt_zip.value+'&rdoshipmethod='+shipmentval+'&getshiptype='+shiptype+'';
				}
				else{
					window.location.href = 'checkout.php?chstate='+form.txt_state.value+'&billzip='+form.txt_zip.value+'&rdoshipmethod='+shipmentval+'&getshiptype='+shiptype+'';
				}
		}
        else {
				//InitSaveVariables(form);
				form.txtship_firstname.value = ShippingFname;
				form.txtship_lastname.value  = ShippingLname;
				form.txtship_address.value   = ShippingAddress1; 
				form.txtship_country.value   = ShippingCountry; 
				form.txtship_city.value	     = ShippingCity;
				form.txtship_state.value     = ShippingState;
				form.txtship_zip.value       = ShippingZipCode;
				form.txtship_phone.value     = ShippingPhone1;
				form.txtship_email.value     = ShippingEmail;
				
				form.txtship_firstname.disabled = false;
				form.txtship_lastname.disabled = false;
				form.txtship_address.disabled = false;
				form.txtship_country.disabled = false;
				form.txtship_city.disabled = false;
				form.txtship_state.disabled = false;
				form.txtship_zip.disabled = false;
				form.txtship_phone.disabled = false;
				form.txtship_email.disabled = false;
   			}
}


function showshipmethod(upsamt,fdxamt,subtotamd,taxamd){
		if (document.frm_chkvalue.rdoshipmethod.value == "UPS Shipping"){
			var textrel = upsamt;
			ap1=document.getElementById("showups");
		    if(ap1){
				ap1.style.display="block";
				ap1.style.visibility="visible";
			}
			ap2=document.getElementById("showfedex");
		    if(ap2){
				ap2.style.display="none";
				ap2.style.visibility="hidden";
			}
		}
		else{
			var textrel = fdxamt;
			ap1=document.getElementById("showups");
			if(ap1){
			ap1.style.display="none";
			ap1.style.visibility="hidden";
			}
			ap2=document.getElementById("showfedex");
		    if(ap2){
				ap2.style.display="block";
				ap2.style.visibility="visible";
			}
		}
	var quotetotal;

	document.getElementById("gshipamd").innerHTML = textrel ;
	quotetotal = (parseFloat(subtotamd) + parseFloat(taxamd)  + parseFloat(textrel));
	totalprice = quotetotal.toFixed(2);;
	document.getElementById("QuotePriceDisplay").innerHTML = totalprice;
	document.frm_chkvalue.totprice.value = totalprice;
	document.frm_chkvalue.shippingamt.value = textrel;
}