function hideFields(type)
{
   if(type)
   {
      if(confirm("Are You sure? All Billing fields will be cleaned."))
      {
         clearBillingForm();
         $('#billingInformation li').not('.special').hide();
         return true;
      }
      else
      {
         return false;
      }      
   }
   else
   {
      $('#billingInformation li').not('.special').hide();
   }
}



function clearBillingForm()
{
   $('#billingInformation ul span input').val('');
}


function showFields()
{
   $('#billingInformation li').not('.special').show('normal');
}

function manageFields()
{
   if($('#billingInformation li:nth-child(2)').is(':hidden'))
   {
      showFields();
      //$('dt.special span').html('(now other than Shipping)');
      $('#billingInformation li.special strong').html('Set Billing same as Shipping');      
   }
   else
   {
      if(hideFields(true))
      {
         $('#billingInformation li.special strong').html('Set Billing different than Shipping');
      }
      //$('dt.special span').html('(now same as Shipping)');      
   }
}

$(document).ready(function(){
    
   if(!$('#billingInformation').hasClass('nohide'))
   {
      hideFields(false); 
   }
   
   
   $('#billingInformation li.special a').click(function(){
      manageFields();
      return false;
   });   
   
});