function loadPurchase3PageAttributes(){
	states();
	disPlayDebitCardsSoloMaestro();
	
	
	return true;
}

function checkTerms(){
	var obj = document.getElementById('terms');
	if(obj.checked){
	  hide("purchaseButton");
	  show("purchaseProgress", "<br />Purchase in Progress ... ");
	}
}

function show(id, value){
	var obj = document.getElementById(id);
	if (obj){
	obj.value =value;
		obj.style.display = "";
	}
	
	
}

function test(){
alert("test");
}

function hide(id){
	var obj = document.getElementById(id);
	if (obj){
		obj.style.display = "none";
	}
}

function getProgressPage(pageNum){
	document.processForm._page.value=pageNum;
	document.processForm.PARAM_TARGET.value=pageNum;
	document.processForm._target.value=pageNum;	
	document.processForm.submit();   
}


function yourDetails2(){
	document.processForm.submit();
}


function setCountryName(a){
  var country = document.getElementById("paymentCard.paymentAddress.countryCode");

  var selectedCountry = country.options[country.selectedIndex].value;  
}

  function PreselectMyItem(itemToSelect)
  {

    // Get a reference to the drop-down
    var myDropdownList = document.saveuser.usertitle;

    // Loop through all the items
    for (iLoop = 0; iLoop< myDropdownList.options.length; iLoop++)
    {    
      if (myDropdownList.options[iLoop].value == itemToSelect)
      {
        // Item is found. Set its selected property, and exit the loop
        myDropdownList.options[iLoop].selected = true;
        break;
      }
    }

  }

 function states(){
  var e=document.getElementById("state");
  var country = document.getElementById("paymentCard.paymentAddress.countryCode");
  var selectedCountry = country.options[country.selectedIndex].value;
  if(!e)return true;
  if(e.style.display=="none"){
  if(selectedCountry=="US")
	e.style.display="block"
  } else {
    document.getElementById("paymentCard.paymentAddress.stateCode").value ="";
	e.style.display="none"
  }
  return true;
}

		 
function checkCheckBoxes(theForm) {
	if (theForm.CHECKBOX_1.checked == false) 
	{
		alert ('Please read and accept the User Rights Agreement to continue with your purchase.');
		return false;
	} else { 	
		return true;
	}
}

function highLightProgessBar(maxPageNo, page){
	
	if( maxPageNo == 2 && page == 3){
		var progress4 = document.getElementById('page4');
		progress4.href ='javascript:purchageDetails()';
		progress4.className = 'visited';

		var progressImg4 = document.getElementById('imgPage4');
		progressImg4.src ='images/four_active.gif';

	}else if(maxPageNo == 2 && page == 2){

		var progress4 = document.getElementById('page4');
		progress4.href ='javascript:purchageDetails()';
		progress4.className = 'visited';

		var progressImg4 = document.getElementById('imgPage4');
		progressImg4.src ='images/four_active.gif';

		var progress3 = document.getElementById('page3');
		progress3.href ='JavaScript:paymentDetails();';
		progress3.className = 'visited';

		var progressImg3 = document.getElementById('imgPage3');
	progressImg3.src ='images/three_active.gif';

	}else if(maxPageNo == 1 && page == 2){

		var progress3 = document.getElementById('page3');
		progress3.href ='JavaScript:paymentDetails();';
		progress3.className = 'visited';

		var progressImg3 = document.getElementById('imgPage3');
		progressImg3.src ='images/three_active.gif';

	}

}

 function preSelect(element, value){
 
	if(typeof(element)=='object' && element != null && element != 'null' && element != ''){
  		for(i = 0; i < element.options.length; i++) {
    		if(element.options[i].value == value) {   
		      element.options[i].selected = true;
      		break;
      		}
    	}  
   	}
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }
   
      
   function checkNumber( who, field)
	{
		if(!IsNumeric(who.value)){
		alert('Please enter only numerics for '+field);
		who.focus();		
		}
	}
	
	
	function disPlayDebitCardsSoloMaestro(){

  		var debitSoloMaestroIssueNumber =document.getElementById("debitSoloMaestroIssueNumber");
  		var debitSoloMaestroStartDate =document.getElementById("debitSoloMaestroStartDate");
  		var creditSecurityCode =document.getElementById("creditSecurityCode");
  		
  		
  		var cardType = document.getElementById("paymentCard.creditCardType");
		var selectedCardType = cardType.options[cardType.selectedIndex].value;
		var debitSoloMaestroCardTypeVal = "024";
		
		//alert(selectedCardType);
		var displayNone = "none";
		var displayBlock = "block";
		
   		if(selectedCardType==debitSoloMaestroCardTypeVal){
   			debitSoloMaestroIssueNumber.style.display=displayBlock;
   			debitSoloMaestroStartDate.style.display=displayBlock;
   			creditSecurityCode.style.display=displayNone;
   			//alert('in solo - ' + debitSoloMaestroStartDate.style.display + '  ' +displayBlock);
   		}else {
   		   		//	alert('not in solo');
	   		creditSecurityCode.style.display=displayBlock;
   		   	debitSoloMaestroIssueNumber.style.display=displayNone;
   			debitSoloMaestroStartDate.style.display=displayNone;
   		}
   		
  		return true;
	}

	
	
	
	function changeTotalPrice(){
		
		var radioObj  = document.forms['processForm'].elements['selectedSubscriptionType'];
		var radioLength = radioObj.length;
		var priceElement;
		var frequencyElement;
		for(var i = 0; i < radioLength; i++) {
			if(radioObj[i].checked) {
				priceElement = document.getElementById("price"+radioObj[i].value);
				frequencyElement = document.getElementById("frequency"+radioObj[i].value);
			}
		}
		document.getElementById('totalPrice').innerHTML="&euro;"+priceElement.value+"/"+frequencyElement.value;
			
	}
	
	function getPurchasePage1(){
		device = document.getElementById("device");
		subtype = document.getElementById("subtype");
		if(device.value == "$user.selectedProduct" || subtype.value =="$user.selectedSubscriptionType"){
			window.location.href = "purchase1.htm";
		}
		
	
	}
	
function setFrom(){
	document.trialform.from.value = document.URL;			
}