//rollovers
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];}
}

//set currency cookie and refresh page
function setCurrency(Curr) 
    {	
        if (navigator.cookieEnabled == 0)
            {
                alert("You must enable cookies to change Currency");
            }
        else
            {
		        expireDate = new Date
		        expireDate.setMonth(expireDate.getMonth()+6)		
		        document.cookie = "currency="+Curr+";expires=" + expireDate.toGMTString()		
		        window.location.reload();
		        //window.location.reload( true );
		    }
	}
	
//set LCID cookie and refresh page
function setLocale(LCID) 
    {
        if (navigator.cookieEnabled == 0)
            {
                alert("You must enable cookies to change Language");
            }
        else
            {	
		        expireDate = new Date
		        expireDate.setMonth(expireDate.getMonth()+6)		
		        document.cookie = "locale="+LCID+";expires=" + expireDate.toGMTString()		
		        window.location.reload();
		        //window.location.reload( true );
		     }
	}

//SITE TRACKER CODE
// METATRAFFIC -- COPYRIGHT (C) 2002-2005, Metasun Software Corp. 
var pagetitle = document.title;
var scriptlocation = "/metatraffic/track.asp"; 
var pagedata = 'mtpt=' + escape(pagetitle) + '&mtr=' + escape(document.referrer) + '&mtt=2&mts=' + window.screen.width + 'x' + window.screen.height + '&mti=1&mtz=' + Math.random();
document.write ('<img height=1 width=1 ');
document.write ('src="' + scriptlocation + '?' + pagedata + '" style=display:none;>');



//PopUp Window Function
//---------------------------------------
var win = ""

function openPopUpWindow(mypage,myname,w,h,scroll) {
if (win!="") {
 win.close();
 }
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=no';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

//Forms Button Hanlders
//----------------------
function submitForm(passedForm) {
	document.forms[passedForm].submit();
}

function submitFormConfirmFre(passedForm)
{
    strText = "SECURE PAYMENT SYSTEM" + '\n\n' + "Vous serez connecte avec le system de paiement Barclaycard. Les instructions vont être en anglais. Pouvez vous faire le suivant:" + '\n\n' + "étape 1 : entrée votre numéro de carte et click sur CONTINUE" + '\n' + "étape 2 : entrée votre prénom et nom dans le champ FULL NAME et click sur CONTINUE" + '\n' + "étape 3 : entrée votre prénom et nom dans le champ FULL NAME et click sur COMPLETE PAYMENT" + '\n' + "étape finale: click sur COMPLETE ORDER"
    if (confirm(strText))
    {
    document.forms[passedForm].submit();
    }
}

function submitFormConfirmEng(passedForm)
{
    strText = "SECURE PAYMENT SYSTEM" + '\n\n' + "You are about to enter the secure Barclaycard payment system." + '\n\n' + "You will be required to do the following:" + '\n\n' + "- Step 1: Enter your CARD DETAILS & then click CONTINUE button." + '\n' + "- Step 2: Enter FIRST NAME & SURNAME in the box headed FULL NAME & then click CONTINUE button." + '\n' + "- Step 3: Enter FIRST NAME & SURNAME in the box headed FULL NAME & then click COMPLETE PAYMENT button." + '\n' + "- Final Step: Click COMPLETE ORDER button" + '\n\n' + "Please click OK to proceed to the secure Barclaycard payment system."
    if (confirm(strText))
    {
    document.forms[passedForm].submit();
    }
}

function resetForm(passedForm) {
	document.forms[passedForm].reset()
}

//Pass billing address info to shipping
//-------------------------------------
function shipppingPassThrough() {
	if(frm_ayurveda_checkout_form.bolShippingAddress.checked==true){
		frm_ayurveda_checkout_form.sFirstname.value = frm_ayurveda_checkout_form.Firstname.value;
		frm_ayurveda_checkout_form.ssurname.value = frm_ayurveda_checkout_form.surname.value;
		frm_ayurveda_checkout_form.sAddress1.value = frm_ayurveda_checkout_form.Address1.value;
		frm_ayurveda_checkout_form.sAddress2.value = frm_ayurveda_checkout_form.Address2.value;
		frm_ayurveda_checkout_form.sCity.value = frm_ayurveda_checkout_form.city.value;
		frm_ayurveda_checkout_form.sCounty.value = frm_ayurveda_checkout_form.county.value;
		frm_ayurveda_checkout_form.sPostCode.value = frm_ayurveda_checkout_form.PostCode.value;
		frm_ayurveda_checkout_form.sPhone.value = frm_ayurveda_checkout_form.Phone.value;
	}
	else {
		frm_ayurveda_checkout_form.sFirstname.value = "";
		frm_ayurveda_checkout_form.ssurname.value = "";
		frm_ayurveda_checkout_form.sAddress1.value = "";
		frm_ayurveda_checkout_form.sAddress2.value = "";
		frm_ayurveda_checkout_form.sCity.value = "";
		frm_ayurveda_checkout_form.sCounty.value = "";
		frm_ayurveda_checkout_form.sPostCode.value = "";
		frm_ayurveda_checkout_form.sPhone.value = "";
	}
}
//Pass billing Country to Shipping Country
//----------------------------------------
function changeCountryValue()
{
var x=document.getElementById("shippingCountry")
x.options[x.selectedIndex].text = frm_ayurveda_checkout_form.Country.value;
x.options[x.selectedIndex].value = frm_ayurveda_checkout_form.Country.value;
}