function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

function showhide(selObj, changevalue, changeobject)
{ 
	if (selObj.options[selObj.selectedIndex].value == changevalue) 
	{
		x = new getObj(changeobject);
		x.style.display = 'inline';  
	}
	else
	{
		x = new getObj(changeobject);
		x.style.display = 'none';  
	}
}

function changevataddress(radio)
{
		if (radio.value == "same_address") {
			x = new getObj('newvataddress');
			x.style.display = 'none';		
		}
		else {
			x = new getObj('newvataddress');
			x.style.display = 'inline';		

		}
}
function changemembershipoption(checkbox)
{
	if (checkbox.name == "subscription_type") {
		if (checkbox.value == "new") {
			x = new getObj('additional_subscription_desc');
			x.style.display = 'none'; 
			 
			x = new getObj('membershipchoicealert');
			x.style.display = 'none'; 

			x = new getObj('normalsub_desc');
			x.style.display = 'inline'; 
			 
			x = new getObj('offer_subscription_desc');
			x.style.display = 'none'; 

			x = new getObj('membership_offer');
			x.style.display = 'inline';  
	
			x = new getObj('worldpayoption');
			x.obj.disabled = false;  

			x = new getObj('membershipdisabled');
			x.style.display = 'none'; 
	
			x = new getObj('selectedmembership');
			x.obj.innerHTML = "<strong>You have currently selected:</strong><br />Standard membership @ £250.00 plus VAT (£293.75 including VAT)";  
			
		}
		else {
			x = new getObj('additional_subscription_desc');
			x.style.display = 'inline'; 
			 
			x = new getObj('offer_subscription_desc');
			x.style.display = 'none'; 

			x = new getObj('membership_offer');
			x.style.display = 'none'; 
			
			x = new getObj('normalsub_desc');
			x.style.display = 'none'; 
			
			 
			x = new getObj('offer_code_check');
			x.obj.checked = false;  

			x = new getObj('worldpayoption');
			x.obj.disabled = true;  

			x = new getObj('membershipchoicealert');
			x.style.display = 'block'; 
			x = new getObj('membershipdisabled');
			x.style.display = 'inline'; 


			x = new getObj('selectedmembership');
			x.obj.innerHTML = '<strong>You have currently selected:</strong><br />Additional subscription rate @ £60.00 plus VAT (£70.50 including VAT)';  

		}
	}
	else if (checkbox.name == "offer_code_check") 
	{
		x = new getObj('membershipchoicealert');
		x.style.display = 'none'; 
		x = new getObj('membershipdisabled');
		x.style.display = 'none'; 

		
		
		x = new getObj('worldpayoption');
		x.obj.disabled = false;  
		if (checkbox.checked == true)
		{		
			x = new getObj('offer_subscription_desc');
			x.style.display = 'inline'; 
	
			x = new getObj('normalsub_desc');
			x.style.display = 'none'; 
	
			x = new getObj('selectedmembership');
			x.obj.innerHTML = "<strong>You have currently selected:</strong><br />Special membership rate @ £190.00 plus VAT (£223.25 including VAT)";  
		}
		else
		{
			x = new getObj('offer_subscription_desc');
			x.style.display = 'none'; 
	
			x = new getObj('normalsub_desc');
			x.style.display = 'inline'; 
	
			x = new getObj('selectedmembership');
			x.obj.innerHTML = "<strong>You have currently selected:</strong><br />Standard membership @ £250.00 plus VAT (£293.75 including VAT)";  
		}
	}
}

function hideoptions()
{
	var idArray = new Array("membershipdisabled", "membershipchoicealert", "othertitleinput", "othersectorinput", "hearaboutother", "additional_subscription_desc", "newvataddress", "offer_subscription_desc");
	for (var i=0; i<idArray.length; i++)
	{
		x = new getObj(idArray[i]);
		x.style.display = 'none';
	}
	if (getSelectedRadioValue(document.forms[0].subscription_type) == "additional")
	{
			x = new getObj('additional_subscription_desc');
			x.style.display = 'inline';
			x = new getObj('normalsub_desc');
			x.style.display = 'none';
			x = new getObj('membership_offer');
			x.style.display = 'none';
		
	}
	else
	{
		x = new getObj('offer_subscription_desc');
		x.style.display = 'none';
		x = new getObj('offer_code_check');
		if (x.obj.checked == true)
		{
			x = new getObj('offer_subscription_desc');
			x.style.display = 'inline';
			x = new getObj('normalsub_desc');
			x.style.display = 'none';
			
		}		
	}

	x = new getObj('subscription_type');
	

}
function getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} // Ends the "getSelectedRadio" function


function getSelectedRadioValue(buttonGroup) {
   // returns the value of the selected radio button or "" if no button is selected
   var i = getSelectedRadio(buttonGroup);
   if (i == -1) {
      return "";
   } else {
      if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)
         return buttonGroup[i].value;
      } else { // The button group is just the one button, and it is checked
         return buttonGroup.value;
      }
   }
} // Ends the "getSelectedRadioValue" function


function loadform()
{
	x = new getObj("position");
	if (x.obj.options[x.obj.selectedIndex].value == "Other") 
	{
		x = new getObj("othertitleinput");
		x.style.display = 'inline';  
	}
	x = new getObj("sector");
	  

	if (x.obj.options[x.obj.selectedIndex].value == "Other Business Services") 
	{
		x = new getObj("othersectorinput");
		x.style.display = 'inline';  
	}	

	

}