/* clear fields in form */
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 

/* pop-ups */
function openWindow(windowURL,windowName,windowWidth,windowHeight) {
  window.name = 'parentWnd';
  newWindow = window.open(windowURL,windowName,'width='+windowWidth+',height='+windowHeight+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1');
  newWindow.focus();
}

/* duplicate fields in form function */

function use_billing(frm){ 
   if(frm.chk_billing.checked){ 
      frm.ship_firstname.value = frm.bill_firstname.value;
	  frm.ship_lastname.value = frm.bill_lastname.value;
	  frm.ship_companyorg.value = frm.bill_companyorg.value;
	  frm.ship_Address.value = frm.bill_Address.value; 
	  frm.ship_Suburb.value = frm.bill_Suburb.value; 
	  frm.ship_City.value = frm.bill_City.value; 
	  
   } 
   else{ 
   tag = document.getElementsByTagName('input'); 
      for(x=0; x<tag.length; x++){ 
         if(tag[x].name.indexOf('ship') != -1){ 
            tag[x].value = ''; 
         } 
      } 
   } 
} 

/* stop multiple identical form submits */
var form_submitted = false;

function submit_form ( )
{
  if ( form_submitted )
  {
    alert ( "These form details have already been submitted. You only need to click the submit button once." );
    return false;
  }
  else
  {
    form_submitted = true;
    return true;
  }
}
