var thisPage = location.href;
thispagens = thisPage.substring(4,5);
if (thispagens == ":"){

   var navLinkImgRootNames = new Array('starthere','contactus');
   var navLinkImgTypes = new Array('gif','gif');
   preLoadMouseOverImgs('http://www.tshirts-online.co.uk/images',navLinkImgRootNames,navLinkImgTypes);
}


function setSelectByValue( oSelectName, defVal ) {
    if (document.forms.length >= "1") {
    var oForm = document.forms[0];
    var combo = oForm.elements[oSelectName];
    var rv=false;
       if( combo.type == 'select-one' )  {
              for ( var i=0; i < combo.options.length && combo.options[i].value!=defVal; i++ );
                 if ( rv = (i != combo.options.length) )
                 combo.selectedIndex = i;
       }
    return rv; // true = success;
    }
}


function setSelectUKText( oSelectName, oValue ) {
    if (document.forms.length >= "1") {
    var oForm = document.forms[0];
    var combo = oForm.elements[oSelectName];
    combo.options[2].text = 'United Kingdom Mainland';
    }
}

function addComboOption(oSelectName, oPosition, oText, oValue){
      if (document.forms.length >= "1") {
	ex=0;
	var oForm = document.forms[0];
	var combo = oForm.elements[oSelectName];
	if (combo) {
	oOption = document.createElement("OPTION");	
            try {
                combo.add(oOption, combo.options[oPosition]);
            }catch(ex){
                combo.add(oOption, oPosition);
            }
	oOption.text=oText;	
	oOption.value=oValue;	
}}}

function disableFormElement (oSelectName) {
      if (document.forms.length >= "1") {
	var oForm = document.forms[0];
	var formElem = oForm.elements[oSelectName];
	formElem.disabled = true;
     }
}

function checkoutUPdate () {
      if (document.forms.length >= "1") {
	var oForm = document.forms[0];
	var combo = oForm.elements.ch_country
             var combo2 = oForm.elements.ch_pmtCode
	if (combo) {
	   disableFormElement('ch_state');
//	   setSelectUKText('ch_country', 'UK');  
	   setSelectByValue('ch_country', 'UK' );
//	   addComboOption('ch_country',3, 'UK Offshore Islands and Scottish Highlands', 'UI');
//	   addComboOption('ch_shCountry',3, 'UK Offshore Islands and Scottish Highlands', 'UI');
	}
// If we re only using PayPal, make it the default option
	if(combo2) {
	   setSelectByValue('ch_pmtCode', 'PP' );
	}
     }
}
     	

window.onload=initAll;

function initAll() {
checkoutUPdate();
}
