/** pop ups **/
function addFav(url){var top_center,left_center;top_center=(screen.height/2)-78;left_center=(screen.width/2)-137;mywin=window.open(url,"win","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=274,height=170,top="+top_center+",left="+left_center+"");}
function open_window4(url){mywin=window.open(url,"win",'menubar=1,directories=1,toolbar=1,scrollbars=yes,resizable=yes,status=yes');}

/** forms **/
function mOvr(src,clrOver){if(!src.contains(event.fromElement)){src.background=clrOver;}}
function mOut(src,clrIn){if(!src.contains(event.toElement)){src.background=clrIn;}}
function btnOvr(src,clrOver){if(!src.contains(event.fromElement)){src.background=clrOver;}}
function btnOut(src,clrIn){if(!src.contains(event.toElement)){src.background=clrIn;}}
function isCoupon(CouponForm)
{if(CouponForm.coupon.value!="")
return true;else
alert("Please enter a valid coupon!");CouponForm.coupon.focus();return false;}
function runClock(){}
function SubmitDeleteForm()
{var agree=false;agree=confirm('Are you sure you want to remove this item from shopping cart?');if(agree){}
else{return false;}}
function phoneMe(checkbox)
{if(checkbox.checked==true)
{return true;}
else
{alert("Please check the phone me option!")
return false;}}
function ToSubmit(a){document.selectParentForm.ProductsID.value=a;document.selectParentForm.submit();}
function goTo(sURL,sAnchor,sSessionID)
{document.CalcShipAndTax.action=sURL+"?xs="+sSessionID+"#"+sAnchor;}
function checkAddrgoTo(sURL,sAnchor,sSessionID,sSameAddress)
{var agree=confirm("Do you want to change the shipping address ?");if(agree)
{document.CalcShipAndTax.action=sURL+"?xs="+sSessionID+"&redir=1#"+sAnchor;}
else
{document.CalcShipAndTax.action=sURL+"?xs="+sSessionID+"&gMsg=1#"+sAnchor;}}
function goTo2(sURL,sAnchor,sSessionID)
{document.ShowPhone.action=sURL+"?xs="+sSessionID+"#"+sAnchor;}
function travelto(el)
{here=document.getElementById(el).offsetTop
window.scrollTo(0,here)}

function chooseCity(bs,no)
{if(bs=="1")
for(var i=0;i<document.BillingForm.CorrectBillToCity.length;i++)
{if(document.BillingForm.CorrectBillToCity[i].checked)
{document.BillingForm.BillTocity.value=document.BillingForm.CorrectBillToCity[i].value;if(no=='x')
document.BillingForm.dnvbc.value=1;else
document.BillingForm.dnvbc.value=0;}}
else
{for(var i=0;i<document.ShippingForm.CorrectShipToCity.length;i++)
{if(document.ShippingForm.CorrectShipToCity[i].checked)
{document.ShippingForm.ShipTocity.value=document.ShippingForm.CorrectShipToCity[i].value;if(no=='x')
document.ShippingForm.dnvsc.value=1;else
document.ShippingForm.dnvsc.value=0;}}}}
function chooseProvince(bs,no)
{if(bs=="1")
{for(var i=0;i<document.BillingForm.CorrectBillToProvince.length;i++)
{if(document.BillingForm.CorrectBillToProvince[i].checked)
{document.BillingForm.BillToProvinceCanadaID.value=document.BillingForm.CorrectBillToProvince[i].value;if(no=='x')
document.BillingForm.dnvbc.value=1;else
document.BillingForm.dnvbc.value=0;}}}
else
{for(var i=0;i<document.ShippingForm.CorrectShipToProvince.length;i++)
{if(document.ShippingForm.CorrectShipToProvince[i].checked)
{document.ShippingForm.ShipToProvinceCanadaID.value=document.ShippingForm.CorrectShipToProvince[i].value;if(no=='x')
document.ShippingForm.dnvsc.value=1;else
document.ShippingForm.dnvsc.value=0;}}}}
function validate(field){var valid="0123456789"
var ok="yes";var temp;for(var i=0;i<field.value.length;i++){temp=""+field.value.substring(i,i+1);if(valid.indexOf(temp)=="-1")ok="no";}
if(ok=="no"){alert("Invalid entry!  Only numbers are accepted!");field.focus();field.select();}}
function DeleteProduct(PName,l){var agree=false;agree=confirm("Are you sure you want to remove "+PName+" from your "+l+"");if(agree){return true;}
else{return false;}}


function SameAddress()
{if(document.anonymous.m_sameaddress.checked==false)return;document.anonymous.ShipTofname.value=document.anonymous.BillTofname.value;document.anonymous.ShipTolname.value=document.anonymous.BillTolname.value;document.anonymous.ShipToaddress.value=document.anonymous.BillToaddress.value;document.anonymous.ShipToAptNum.value=document.anonymous.BillToAptNum.value;document.anonymous.ShipTocity.value=document.anonymous.BillTocity.value;document.anonymous.ShipTozipcode.value=document.anonymous.BillTozipcode.value;document.anonymous.ShipTozipcode2.value=document.anonymous.BillTozipcode2.value;document.anonymous.ShipToPostalCode.value=document.anonymous.BillToPostalCode.value;document.anonymous.ShipToProvince.value=document.anonymous.BillToProvince.value;document.anonymous.ShipToIntPhone.value=document.anonymous.BillToIntPhone.value;document.anonymous.ShipToIntFax.value=document.anonymous.BillToIntFax.value;document.anonymous.ShipTophone1.value=document.anonymous.BillTophone1.value;document.anonymous.ShipTophone2.value=document.anonymous.BillTophone2.value;document.anonymous.ShipTophone3.value=document.anonymous.BillTophone3.value;document.anonymous.ShipTofax1.value=document.anonymous.BillTofax1.value;document.anonymous.ShipTofax2.value=document.anonymous.BillTofax2.value;document.anonymous.ShipTofax3.value=document.anonymous.BillTofax3.value;document.anonymous.ShipToStateID.selectedIndex=document.anonymous.BillToStateID.selectedIndex;document.anonymous.ShipTocountryID.selectedIndex=document.anonymous.BillTocountryID.selectedIndex;for(i=0;i<document.anonymous.BillToTitle.length;i++)
{if(document.anonymous.BillToTitle[i].checked==true)
{document.anonymous.ShipToTitle[i].checked=true;}}}
function UncheckBox(){document.anonymous.m_sameaddress.checked=false;document.anonymous.m_sameaddress2.checked=false;}
function country_validate()
{var USIndex;for(var i=0;i<document.anonymous.BillTocountryID.length;i++)
{if(document.anonymous.BillTocountryID.options[i].value=="226")
{USIndex=i;}}
if(document.anonymous.BillTocountryID.value!=226)
{if(document.anonymous.BillToStateID.selectedIndex>1)
{alert("Your selected state requires United States as your country!");document.anonymous.BillTocountryID.options[USIndex].selected=true;}
else
{document.anonymous.BillToStateID.options[0].selected=true;document.anonymous.BillToPostalCode.value="";document.anonymous.BillToProvince.value="";document.anonymous.BillToIntPhone.value="";document.anonymous.BillToIntFax.value="";}}}
function country_validate2()
{var USIndex;for(var i=0;i<document.anonymous.BillTocountryID.length;i++)
{if(document.anonymous.BillTocountryID.options[i].value=="226")
{USIndex=i;}}
if(document.anonymous.ShipTocountryID.value!=226)
{if(document.anonymous.ShipToStateID.selectedIndex>1)
{alert("Your selected state requires United States as your country!");document.anonymous.ShipTocountryID.options[USIndex].selected=true;}
else
{document.anonymous.ShipToStateID.options[0].selected=true;document.anonymous.ShipToPostalCode.value="";document.anonymous.ShipToProvince.value="";document.anonymous.ShipToIntPhone.value="";document.anonymous.ShipToIntFax.value="";}}}
function state_validate()
{var USIndex;for(var i=0;i<document.anonymous.BillTocountryID.length;i++)
{if(document.anonymous.BillTocountryID.options[i].value=="226")
{USIndex=i;}}
if(document.anonymous.BillTocountryID.selectedIndex>1)
{document.anonymous.BillTocountryID.options[USIndex].selected=true;document.anonymous.BillToPostalCode.value="Not Applicable";document.anonymous.BillToProvince.value="Not Applicable";document.anonymous.BillToIntPhone.value="Not Applicable";document.anonymous.BillToIntFax.value="Not Applicable";}}
function state_validate2()
{var USIndex;for(var i=0;i<document.anonymous.BillTocountryID.length;i++)
{if(document.anonymous.BillTocountryID.options[i].value=="226")
{USIndex=i;}}
if(document.anonymous.ShipTocountryID.selectedIndex>1)
{document.anonymous.ShipTocountryID.options[USIndex].selected=true;document.anonymous.ShipToPostalCode.value="Not Applicable";document.anonymous.ShipToProvince.value="Not Applicable";document.anonymous.ShipToIntPhone.value="Not Applicable";document.anonymous.ShipToIntFax.value="Not Applicable";}}