//Run when the Form loads but only if the form has been loaded
	
	
		
function show_div(well) {

		if (well ==1){
		//hide all the divs
		document.getElementById('ExemptStatus').style.display = 'block';
	
		document.getElementById('ExemptStatusLower').style.display = 'none';
		document.getElementById('ExemptStatusLowerNi').style.display = 'none';
		document.getElementById('ipay').style.display = 'none';
			document.nhs_pres.ExemptionStatusYes.value = document.nhs_pres.ExemptionStatusYes_1.value;
		}else{
		document.getElementById('ExemptStatus').style.display = 'none';
	
		document.getElementById('ExemptStatusLower').style.display = 'none';
		document.getElementById('ExemptStatusLowerNi').style.display = 'none';
		document.getElementById('ipay').style.display = 'block';
		document.nhs_pres.ExemptionStatusYes.value = 0;
		
		
			}
	}

function get_exempt_value()
	{	// Get the value of the radio button Exempt
		for (var i=0; i < document.register.Exempt.length; i++)
   			{
   				if (document.register.Exempt[i].checked)
      				{	var rad_val = document.register.Exempt[i].value;     }
			}
		return rad_val;
	}	
	
function ShowExemptionLower()
	{
	
		document.nhs_pres.ExemptionStatusYes.value = document.nhs_pres.ExemptionStatusYes_1.value;
		//Hide all both text boxes
		document.getElementById('ExemptStatusLower').style.display = 'none';
		document.getElementById('ExemptStatusLowerNi').style.display = 'none';

		//alert(document.getElementById('ExemptionStatusYes').value);
		//alert(OptionArray);
		//alert(NIArray);
		
		//only open those that should display
		for ( var i=OptionArray.length-1; i>=0; --i ){
 			if (OptionArray[i] == document.getElementById('ExemptionStatusYes_1').value){
				document.getElementById('ExemptStatusLower').style.display = 'block';
				if (i == 0){
					document.getElementById('f1').innerHTML="PPC number";
				}else if(i == 1){
					document.getElementById('f1').innerHTML="TCEC number";
					document.getElementById('f2').innerHTML="National insurance number";
				}
				
				
			}
		}
		for ( var i=NIArray.length-1; i>=0; --i ){
 			if (NIArray[i] == document.getElementById('ExemptionStatusYes_1').value){
				document.getElementById('ExemptStatusLowerNi').style.display = 'block';
				
			}
		}
	}
	
function ValPresAdd(key,product){
document.private_pres.Product_Key.value=key;
document.private_pres.Product_Name.value=product;
var q = "document.private_pres.qty_" + key + ".value"
document.private_pres.Product_Quantity.value=eval(q)
var red_url = "http://www.lifeandlooks.com/cart/cart_addItem.cfm/p/" + key + "/str_pres/" + document.searching.str_pres.value;
document.private_pres.action=red_url;
document.private_pres.submit();
}	
	
	
function ValPres(){
	// yes
	
	
	if (document.nhs_pres.exempt[0].checked == true){
		
		//var w = window.open('about:blank','Popup_Window','width=100,height=100,resizable=1');
		document.nhs_pres.Product_Quantity.value=document.nhs_pres.qty.value;
		//document.nhs_pres.target = 'Popup_Window';
		
		if (document.nhs_pres.redirecti.value ==1){
		var red_url = "http://www.lifeandlooks.com//cart/cart_addItem.cfm/P/1" + document.nhs_pres.Product_Key.value;
		}else{
		var red_url = "http://www.lifeandlooks.com/cart/cart_addItem.cfm";
		}
		
		document.nhs_pres.action=red_url;
		
		}else if (document.nhs_pres.exempt[1].checked == true){
	if (document.nhs_pres.ExemptionStatusYes_1.value== 0){
				alert ("Please select an exemption status")
			return false;
		}else {
			document.nhs_pres.ExemptionStatusYes.value = document.nhs_pres.ExemptionStatusYes_1.value;
			document.nhs_pres.exstat.value=1;
			document.nhs_pres.Product_Key.value=document.nhs_pres.Product_Key_nhs.value;
			document.nhs_pres.Product_Name.value=document.nhs_pres.Product_Name_nhs.value;
		   var red_url = "http://www.lifeandlooks.com/cart/cart_addItem.cfm";
          document.nhs_pres.action=red_url;
	return true;
		}
	}
}

