
function packageSelected()
{
 var theForm = getElement("conference_exhibition_form_2009");
 var accommodation = getRadioButtonValue(theForm.sd_accommodation);
 var standNumber = getSelectValue(theForm.sd_stand_number);

 var amount = calculateInvoiceAmount(standNumber, accommodation);

 setInvoiceAmount(amount);
}


function calculateInvoiceAmount(standNumber, accommodation)
{
 var amount = "";

 if (standNumber != 'NOT_VALID')
 { 
   if (accommodation == "sd_no_accommodation" )
   {
     amount = "1,250";  
   }
   else if (accommodation == "sd_two_nights_accommodation" )
   {
     amount = "1,500";  
   }
    
   
   if (standNumber === 'SOLD - Mark Group')
   {
       if (accommodation == "sd_no_accommodation" )
       {
         amount = "2,000";  
       }
       else if (accommodation == "sd_two_nights_accommodation" )
       {
         amount = "2,250";  
       }
   }
 }

 return amount;
}

function setInvoiceAmount(amount)
{
 var invoice_amount = getElement('inv_amount');

 if (invoice_amount)
 {
   invoice_amount.value = String.fromCharCode(163) + amount;  
 }
}

function getElement(elementId)
{
 var element = null;

 if (document.all)
 {
  element = document.all[elementId];
 }
 else if (document.getElementById)
 {
  element = document.getElementById(elementId);
 }

 return element;
}
