//****************************************************************
// created & modified by Sandhie Valianto (sandhiev@yahoo.com)
// some script develop by Tim Wallace (timothy@essex1.com)
//****************************************************************

function submitForms()
   {
   if ( isFieldEntered('Name','Name') && isFieldEntered('Job_Title','Job Title') 
	   && isFieldEntered('Job_Title','Job Title') && isFieldEntered('Company','Company') && isFieldEntered('Address1','Address')
	   && isFieldEntered('City','City') && isFieldEntered('Zip','Zip') && isFieldEntered('Country','Country')
	   && isFieldEntered('Telephone','Telephone') && isEmail())
      if (confirm("\nYou're about to send your submission.\n"))
         {
		 return true;
		 }
      else
         {
         alert("\nYou have chosen to abort the submission.");
         return false;
         }
   else
      return false;
   }

function isEmail()
   {
   // Return false if site e-mail field is blank.
   if (document.forms[0].Email.value == "")
      {
      alert("\nPlease enter your E-mail Address.")
      document.forms[0].Email.focus();
      return false; 
      }
   // Return false if e-mail field does not contain a '@' and '.' .
   if (document.forms[0].Email.value.indexOf ('@',0) == -1 || 
       document.forms[0].Email.value.indexOf ('.',0) == -1)
      {
      alert("\nThe E-MAIL field requires a \"@\" and a \".\"be used.\n\nPlease re-enter your E-mail Address.")
      document.forms[0].Email.select();
      document.forms[0].Email.focus();
      return false;
      }
   return true;
   }

function isFieldEntered(element,comment)
   {
   var str = document.forms[0].elements[element].value;
   // Return false if the field is blank.
   if (str == "")
      {
      alert("\nPlease enter field: "+ comment +".")
      document.forms[0].elements[element].focus();
      return false;
      }
   return true;
   }
// ---- End Form Functions


// Used to id browsers.
var browser="";
if(navigator.appName=="Netscape" && parseInt(navigator.appVersion)==2) { browser="n2"; }
if(navigator.appName=="Netscape" && parseInt(navigator.appVersion)==3) { browser="n3"; }
if(navigator.appName=="Netscape" && parseInt(navigator.appVersion)>=4) { browser="n4"; }
if(navigator.appVersion.indexOf("MSIE 3.0") != -1) { browser="ie3"; }
if(navigator.appVersion.indexOf("MSIE 4.0") != -1) { browser="ie4"; }
if(navigator.appVersion.indexOf("MSIE 5.0") != -1) { browser="ie5"; }
if(navigator.appVersion.indexOf("MSIE 6.0") != -1) { browser="ie6"; }

// Used to position window for Netscape 4
var w=0;
var h=0;
if ( browser=="n4" )
   {
   var screen_height=parent.screen.height;
   var screen_width=parent.screen.width;
   var main_height=parent.window.innerHeight;
   h=(screen_height-main_height);
   w=(screen_width/2)-275;
   }

function openPopUp(fileName,formID,wi,he)
   {
   var newForm=window.open(fileName,formID,"width="+wi+",height="+he+",resizable=0,scrollbars=0,menubar=0,screenX="+w+",screenY="+(h-125));
   if (newForm.opener == null)
      {newForm.opener = window;}
   else
      {
      if ( browser=="n3"  ||  browser=="n4"  ||  browser=="ie4"  ||  browser=="ie5" ||  browser=="ie6")
         newForm.focus();
      }
   }

function openPopUp2(fileName,formID,wi,he)
   {
   var newForm=window.open(fileName,formID,"width="+wi+",height="+he+",resizable=0,scrollbars=1,menubar=0,screenX="+w+",screenY="+(h-125));
   if (newForm.opener == null)
      {newForm.opener = window;}
   else
      {
      if ( browser=="n3"  ||  browser=="n4"  ||  browser=="ie4"  ||  browser=="ie5" ||  browser=="ie6")
         newForm.focus();
      }
   }

function uc(){
alert('This section is under construction.\nPlease come back later.');
}

function cari_delegate1(form) {
d1=(form.additional.value)*900
form.t_second_delegate1.value = d1
}

function cari_delegate2(form) {
d2=(form.exhibitor.value)*900
form.t_second_delegate2.value = d2
}

function cari_proceedings(form) {
p=(form.proceedings.value)*250
form.t_proceedings.value = p
}

function cari_total(form) {
a=eval(form.t_second_delegate1.value)
b=eval(form.t_second_delegate2.value)
c=eval(form.t_proceedings.value)
d=eval(form.t_first_delegate.value)
t=a+b+c+d
form.t_no_vat.value = t
}

function cari_vat(form) {
v=((form.t_no_vat.value)*10)/100
form.vat.value = v
}

function cari_grand_total(form) {
a=eval(form.t_second_delegate1.value)
b=eval(form.t_second_delegate2.value)
c=eval(form.t_proceedings.value)
d=eval(form.t_first_delegate.value)
t=a+b+c+d
form.t_no_vat.value = t

v=((form.t_no_vat.value)*10)/100
form.vat.value = v

e=eval(form.t_no_vat.value)
f=eval(form.vat.value)
g=e-f
form.grand_total.value = g
}

function imageon(name_image) { 
document[name_image].src = "images/ic_"+name_image+"_on.jpg";
}

function imageoff(name_image) { 
document[name_image].src = "images/ic_"+name_image+"_off.jpg";
}
