// JavaScript Document

function toggleFields()

{
	document.addOrder.CardType.options.selectedIndex=4;
	document.addOrder.CardNum.value='000000000000';
	document.addOrder.CardExpire.value='00/00';
	document.addOrder.CVV.value='000';	
	}

function CheckContactForm()
{
if(document.ContactForm.Name.value=="")
{
alert('Please Enter Your Name');
document.ContactForm.Name.blur();
document.ContactForm.Name.focus();
return false;
}
if(document.ContactForm.Email.value=="")
{
alert('Please Enter Your Email Address');
document.ContactForm.Email.blur();
document.ContactForm.Email.focus();
return false;
}

if(document.ContactForm.Department.options.selectedIndex == 0)
{
alert('Which Department would you like to contact?');
document.ContactForm.Department.blur();
document.ContactForm.Department.focus();
return false;
}
if(document.ContactForm.Comments.value=="")
{
alert('Please Enter Your Comments');
document.ContactForm.Comments.blur();
document.ContactForm.Comments.focus();
return false;
}

//ContactForm


}


function setCountry()


{
if(document.CountryForm.BillingCountry.value=="UnitedStates")
{
document.CountryForm.getCountry[0].checked= true;
}
else if(document.CountryForm.BillingCountry.value=="Canada")
{
document.CountryForm.getCountry[1].checked= true;
}
else if(document.CountryForm.BillingCountry.value=="UnitedKingdom")
{
document.CountryForm.getCountry[2].checked= true;
}
else
{
document.CountryForm.getCountry[0].checked= false;
document.CountryForm.getCountry[1].checked= false;
document.CountryForm.getCountry[2].checked= false;
}

}

function SelectCountry(myVal)
{
document.CountryForm.BillingCountry.value=document.CountryForm.getCountry[myVal].value;
}

function testMe()
{
alert(document.listmenu0.firstlevel.value);
alert(document.listmenu0.secondlevel.options.selectedIndex);
return false;

/*


 if(document.CountryForm.BillingCountry.value=="")


		{


		alert("Please select Your Country!");


		document.CountryForm.BillingCountry.blur();


		document.CountryForm.BillingCountry.focus();


		return false;


		}


		else if ((document.CountryForm.BillingCountry.value=="Canada") && (document.CountryForm.BillingState.value=="")   )


		{


	   alert("Please select Your Province");


		document.CountryForm.BillingState.blur();


		document.CountryForm.BillingState.focus();


		return false;


		}


		


		else if ((document.CountryForm.BillingCountry.value=="UnitedStates") && (document.CountryForm.BillingState.value=="")   )


		{


	   alert("Please select Your State");


		document.CountryForm.BillingState.blur();


		document.CountryForm.BillingState.focus();


		return false;


		}


		


if((document.CountryForm.Coupon.value!="") && (document.CountryForm.CoupPw.value=="") )		


{


alert("Please insert Coupon Password.");


document.CountryForm.CoupPw.blur();


document.CountryForm.CoupPw.focus();


return false;


}


*/





}


function getCountry()

{

 if(document.CountryForm.BillingCountry.value=="")
		{
		alert("Please select Your Country,,");
		document.CountryForm.BillingCountry.blur();
		document.CountryForm.BillingCountry.focus();
		return false;
		}
		else
			{
			Country=document.CountryForm.BillingCountry.value;
			window.location.href = "checkout.php?Country="+Country;
			} 
}// eof getCountry func

function checkMyForm()
{ 
	
	/**/
if(document.addOrder.terms_box.checked==true)
{}
else
{
	alert('Please make sure to read the Terms and Conditions');
			document.addOrder.terms.blur();
			document.addOrder.terms.focus();
	return false;
	}

//PaymentNotificationbtn
	if(document.addOrder.ShipCountry.value=="")
		{
		alert("Please Specify Your Country");
		document.addOrder.ShipCountry.blur();
		document.addOrder.ShipCountry.focus();
		return false;
		}


} // eof checkMyForm function


function CalculateMe(myShip)
{
document.addOrder.OrderGrandTotal.value="0.00";
if(myShip==0)
{
var A=new Number(document.addOrder.Prior.value);
document.addOrder.shipType.value="Priority";
}
else if(myShip==1)
{
var A=new Number(document.addOrder.Over.value);
document.addOrder.shipType.value="Overnight";
}
else
{
var A=new Number(document.addOrder.Ground.value);
document.addOrder.shipType.value="Ground";
}
if(document.addOrder.Tax.value=="0.00")
{
var B=new Number(0.00);
}
else
{
var B=new Number(document.addOrder.Tax.value);
}
var C=new Number(document.addOrder.OrderSubTotal.value);
var D=new Number();
D=A+B+C;
document.addOrder.OrderGrandTotal.value=   D ;
}

function getShipping()
{
FD2 = -1
for (k=0;k<addOrder.TotalShipping.length;k++){
if (addOrder.TotalShipping[k].checked){FD2=1}
}
if (FD2 == -1)
{
alert ("Please Select Shipping Method.")
document.addOrder.TotalShipping[1].focus()
return false
}
}// end of ftn


/*
Gradual-Highlight Image Script- © Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/

function high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",2)
}


function low(which2){
clearInterval(highlighting)
which2.filters.alpha.opacity=40
}


function highlightit(cur2){


if (cur2.filters.alpha.opacity<100)


cur2.filters.alpha.opacity+=10


else if (window.highlighting)


clearInterval(highlighting)


}

function CopyAddress()
{
document.addOrder.ShipName.value = document.addOrder.CustLastName.value+","+document.addOrder.CustFirstName.value;


document.addOrder.ShipStreet.value = document.addOrder.BillingStreet.value;


document.addOrder.ShipCity.value = document.addOrder.BillingCity.value;


document.addOrder.ShipState.value = document.addOrder.BillingState.value;


document.addOrder.ShipCode.value = document.addOrder.BillingZip.value;


document.addOrder.ShipCountry.value = document.addOrder.BillingCountry.value;


}


function CheckForm()
{
	if ( (document.addOrder.ShipName.value=="") || (document.addOrder.ShipStreet.value=="") || (document.addOrder.ShipCity.value=="")


 	|| (document.addOrder.ShipState.value=="") || (document.addOrder.ShipCode.value=="") || (document.addOrder.ShipCountry.value==""))


	{
	//alert ("The Shipping Address is Incomplete!");


		if(window.confirm("Is Your Shipping Information same as Your Billing Information? "))


		CopyAddress();


		return false;


		//	


	}





}

function del_entry(entry) {


 if (window.confirm("Are sure you want to empty the Shopping Cart?")) {


    window.location.href = "kill.php";


 }


}

function checkWarForm()


{
 	if (document.warform.Day.options.selectedIndex == 0)
	{
		alert ("Please Select a Day");
		document.warform.Day.blur();
		document.warform.Day.focus();
		return false;


	}


	


	if (document.warform.Month.options.selectedIndex == 0)


	{


		alert ("Please Select a Month");


		document.warform.Month.blur();


		document.warform.Month.focus();


		return false;


	}


	


	if (document.warform.Year.options.selectedIndex == 0)


	{


		alert ("Please Select a Year");


		document.warform.Year.blur();


		document.warform.Year.focus();


		return false;


	}
	if (document.warform.Fname.value=="")
	{
		alert ("Please enter First Name");
		document.warform.Fname.blur();
		document.warform.Fname.focus();
		return false;
	}

	if (document.warform.Lname.value=="")
	{
		alert ("Please enter Last Name");
		document.warform.Lname.blur();
		document.warform.Lname.focus();
		return false;
	}


	if (document.warform.Address.value=="")


	{
		alert ("Please enter Street Address");
		document.warform.Address.blur();
		document.warform.Address.focus();
		return false;
	}
	if (document.warform.City.value=="")
	{
		alert ("Please enter City Name");


			document.warform.City.blur();


			document.warform.City.focus();


			return false;


	}

	if (document.warform.Province.value=="")
	{
		alert ("Please enter Province");
		document.warform.Province.blur();
		document.warform.Province.focus();
		return false;
	}


	if (document.warform.Postal.value=="")
	{
		alert ("Please enter Postal/Zip Code");
		document.warform.Postal.blur();
		document.warform.Postal.focus();
		return false;
	}

	if (document.warform.Country.value=="")


	{


			alert ("Please enter Country name");


			document.warform.Country.blur();


			document.warform.Country.focus();


			return false;


	}


	


	if (document.warform.Tel.value=="")


	{


			alert ("Please enter Telephone Number");


			document.warform.Tel.blur();


			document.warform.Tel.focus();


			return false;


	}


	


		if (document.warform.Email.value=="")


	{


			alert ("Please enter  Email address");


			document.warform.Email.blur();


			document.warform.Email.focus();


			return false;


	}


	


		if (document.warform.Items.value=="")


	{


			alert ("Please enter Item name");


			document.warform.Items.blur();


			document.warform.Items.focus();


			return false;


	}


	


		if (document.warform.Reason.value=="")


	{


			alert ("Please indicate your Reason(s)");


			document.warform.Reason.blur();


			document.warform.Reason.focus();


			return false;


	}


	


	if (document.warform.Payment.options.selectedIndex == 0)


	{


		alert ("Please Select you payment method");


		document.warform.Payment.blur();


		document.warform.Payment.focus();


		return false;


	} 


	


	





} //end of checkWarform function








// JavaScript Document





function showValue()


{


alert (screen.width+"<=="+"H"+screen.height);


alert ("W"+screen.width);


return false;


}








function checkSearch()


{


 


if (document.SearchForm.SearchCriteria.options.selectedIndex == 0)


	{


		alert ("Please Select a Criteria");


		document.SearchForm.SearchCriteria.blur();


		document.SearchForm.SearchCriteria.focus();


		return false;


	}


if (document.SearchForm.SearchParameter.value=="")


{


alert ("Please Enter a Name or Order Number");


document.SearchForm.SearchParameter.blur();


document.SearchForm.SearchParameter.focus();


return false;}





}





function MM_openBrWindow(theURL,winName,features) { //v2.0


  window.open(theURL,winName,features);


}








function CheckAddForm()


{ // CheckAddForm starts








if (document.addProduct.ProductName.value=="")


		{


		alert("Enter Product Name");


		document.addProduct.ProductName.blur;


		document.addProduct.ProductName.focus();


		return false;


		}





if (document.addProduct.Category.options.selectedIndex==0)


		{


		alert("Select a Category");


		document.addProduct.Category.blur;


		document.addProduct.Category.focus();


		return false;


		}








if (document.addProduct.ProductItemsIncluded.value != "")


	{


 		


	}





if ((!(document.addProduct.Publish[0].checked)) && (!(document.addProduct.Publish[1].checked)) )


{


alert ("Do you want this Product published on the Website?");


return false;


}





} //end of CheckAddForm





function valueOver()


{


document.addProduct.ECCartProdPrices.value=document.addProduct.Price.value;





}





// start is radio function


function isRadio(myRadio)
{
	var getRadioName
	var fam
	getRadioName = myRadio
	fam = -1;
	for (k=0;k<getRadioName.length;k++)
	{
		if (getRadioName[k].checked)
		{
		fam=1;
		}
	}

	
	if (fam= -1)
	return false;

}


//end isRadio

//open new win without window moving


var hw=""


var nhw=""


function openHelpWindow(path){if(navigator.appName.indexOf("WebTV")==-1){hw=window.open(path,"helpwin","height=420,width=350,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no,resizable=yes,titlebar=no");hw.focus();return false;}


else{document.location.href=path;}}

function openNonHelpWindow(path){if(navigator.appName.indexOf("WebTV")==-1){nhw=window.open(path,"third","height=400,width=600,scrollbars=yes,status=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes,titlebar=yes");nhw.focus();return false;}


else{document.location.href=path;}}

// end of new win without window moving

// start my function to open a new win

function openMyWindow (path,myWidth,myHeight)


{//func starts

var specials= "width="+myWidth+",height="+myHeight+",scrollbars=yes,status=no,toolbar=no,menubar=no,location=no,resizable=yes,titlebar=no, top=0, left=0"; 


if(navigator.appName.indexOf("WebTV")==-1){hw=window.open(path,"helpwin",specials);


hw.focus();

return false;}

else{document.location.href=path;}
}//func ends

//


//onclick="return openMyWindow(this.href);" 


function MM_validateForm() { //v4.0


  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;


  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);


    if (val) { nm=val.name; if ((val=val.value)!="") {


      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');


        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';


      } else if (test!='R') { num = parseFloat(val);


        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';


        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');


          min=test.substring(8,p); max=test.substring(p+1);


          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';


    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }


  } if (errors) alert('The following error(s) occurred:\n'+errors);


  document.MM_returnValue = (errors == '');


}



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_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 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 validate_order_form(form){
	if (form.first_name.value.length == 0){
		window.alert("You must enter a valid first name");
		return false;
	} else if (form.last_name.value.length == 0){
		window.alert("You must enter a valid last name");
		return false;
	} else if (form.address.value.length == 0){


		window.alert("You must supply a valid mailing address");


		return false;


	} else if (form.city.value.length == 0){


		window.alert("You must enter the name of a valid city");


		return false;


	} else if (form.state_code.value == "select"){


		window.alert("You must choose your state");


		return false;


	} else if (form.postal_code.value.length == 0){


		window.alert("You must enter a 5 digit zip code");


		return false;


	} else if (form.phone.value.length < 10 || form.phone.value.length > 10){


		window.alert("You must supply a valid 10 digit phone number");


		return false;


	} else if (form.email.value.length == 0){


		window.alert("Your e-mail address appears to be invalid");


		return false;


	} else if (!(form.card_type[0].checked || form.card_type[1].checked)){


		window.alert("You must choose your credit card type");


		return false;


	} else if (form.card_number.value.length < 16 || form.card_number.value.length > 16){


		window.alert("You must supply a valid 16 digit credit card number");


		return false;


	} else if (form.month.value.length == 0){


		window.alert("you must enter the year of your credit card's expiration date");


		return false;


	} else if (form.year.value.length == 0){


		window.alert("You must enter the month of your credit card's expiration date");
		return false;


	}
	return true;	
}

function validate_comments(form){
	if (form.name.value.length == 0){
		window.alert("Please enter your name before submitting");
		return false;
	} else if (form.email.value.length == 0){
		window.alert("Please enter your e-mail address before submitting");
		return false;
	} else if (form.feedback.value.length == 0){
		window.alert("Please enter a comment before submitting");
		return false;
	}
	return true;
}
