function echeck(str) {

		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);

		if (str.indexOf(at)==-1){
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false;
		 }

 		 return true;					
};

   function subscribe_validate() {
   if (forms_subscribe.subscribe_email.value == null) {
    alert ("Please enter your email - thank you!");
    forms_subscribe.subscribe_email.focus();
    return false;
   } else { 
     if (echeck(forms_subscribe.subscribe_email.value) == false) {
      alert ("Please enter your email - Thank you!");
      forms_subscribe.subscribe_email.focus();
      return false;
     };
   };

   };

   function engine_validate() {

   if (forms_submission.first_name.value.length == 0) {
    alert ("Please enter your name - thank you!");
    forms_submission.first_name.focus();
    return false;
   }; 

   if (forms_submission.last_name.value.length == 0) {
    alert ("Please enter your name - thank you!");
    forms_submission.last_name.focus();
    return false;
   }; 

   if (forms_submission.email.value == null) {
    alert ("Please enter your email - thank you!");
    forms_submission.email.focus();
    return false;
   } else { 
     if (echeck(forms_submission.email.value) == false) {
      alert ("Please enter your email - Thank you!");
      forms_submission.email.focus();
      return false;
     };
   };
      
   if (forms_submission.phone.value.length == 0) {
    alert ("Please enter your phone - thank you!");
    forms_submission.phone.focus();
    return false;
   }; 
   
   if (forms_submission.title.value.length == 0) {
    alert ("Please enter your presentation title - thank you!");
    forms_submission.title.focus();
    return false;
   }; 
   
   if (forms_submission.sum.value.length == 0) {
    alert ("Please enter your presentation summary - thank you!");
    forms_submission.sum.focus();
    return false;
   }; 


   
            
  };

function ValidateRegistration(step) {

 if ( step == "company" ) {

   if (registration.company_name.value.length == 0) {
     alert ("Please enter your company name - thank you!");
     registration.company_name.focus();
     return false;
   }; 
   if (registration.zip.value.length == 0) {
     alert ("Please enter ZIP - thank you!");
     registration.zip.focus();
     return false;
   }; 
   if (registration.city.value.length == 0) {
     alert ("Please enter city - thank you!");
     registration.city.focus();
     return false;
   }; 
   if (registration.address.value.length == 0) {
     alert ("Please enter your company name - thank you!");
     registration.address.focus();
     return false;
   }; 

  return true;

 }; // company

 if ( step == "personal" ) {

   if (registration.fname.value.length == 0) {
     alert ("Please enter your first name - thank you!");
     registration.fname.focus();
     return false;
   }; 
   if (registration.lname.value.length == 0) {
     alert ("Please enter your last name - thank you!");
     registration.lname.focus();
     return false;
   }; 
   if (registration.jtitle.value.length == 0) {
     alert ("Please enter job title - thank you!");
     registration.jtitle.focus();
     return false;
   }; 
   if (registration.email.value.length == 0) {
     alert ("Please enter your email - thank you!");
     registration.email.focus();
     return false;
   }; 
   if (registration.phone.value.length == 0) {
     alert ("Please enter your phone - thank you!");
     registration.phone.focus();
     return false;
   }; 


  return true;

 }; // personal

};

function Registration(step) {

 if ( step == "company") {
  reg_company.style.display = "";
  reg_personal.style.display = "none";
  reg_quest.style.display = "none";
  reg_checkout.style.display = "none";
 };

 if ( step == "personal") {

  if (ValidateRegistration("company")) {

   reg_company.style.display = "none";
   reg_personal.style.display = "";
   reg_quest.style.display = "none";
   reg_checkout.style.display = "none";
 
  };

 };

 if ( step == "quest") {

 if (ValidateRegistration("personal")) {

  reg_company.style.display = "none";
  reg_personal.style.display = "none";
  reg_quest.style.display = "";
  reg_checkout.style.display = "none";

 };
 };

 if ( step == "checkout") {
  reg_company.style.display = "none";
  reg_personal.style.display = "none";
  reg_quest.style.display = "none";
  reg_checkout.style.display = "";

  // calculate
  Checkout();
 };


};

function Checkout() {

 var date = new Date(2006,09,01,00,00,00);
 var now = new Date();
 var diff = date.getTime() - now.getTime();
 var discounts = "";
 var fee = 0;
 var regfee = 0;
 var guru = "";


// if (diff<0) {
//  fee = 150;
//  regfee = 150;
// } else {
//  fee = 200;
//  regfee = 200;
// };

fee = 200;
regfee = 200;

 if (registration.russoftmember.checked == true) {
   discounts = discounts + "<tr><td width=220px align=left>RUSSOFT Member</td><td align=right>- US$10</td></tr>";
   fee = fee - 10;
 };

 if (registration.apkitmember.checked == true) {
   discounts = discounts + "<tr><td width=220px align=left>APKIT Member</td><td align=right>- US$10</td></tr>";
   fee = fee - 10;
 };

 if (registration.edu.checked == true) {
   discounts = discounts + "<tr><td width=220px align=left>Educational</td><td align=right>- US$50</td></tr>";
   fee = fee - 50;
 };

 if (registration.secr2005.checked == true) {
   discounts = discounts + "<tr><td width=220px align=left>SECR 2005 Participant</td><td align=right>- US$10</td></tr>";
   fee = fee - 10;
 };

 if (registration.sep.checked == true) {
   discounts = discounts + "<tr><td width=220px align=left>SEP Alumni</td><td align=right>- US$10</td></tr>";
   fee = fee - 10;
 };

 if (registration.guru.checked == true) {
   discounts = discounts + "<tr><td width=220px align=left>Guru Workshop Series Alumni</td><td align=right>- US$10</td></tr>";
   fee = fee - 10;
 };

 if (registration.fagan.checked == true) {
   guru = guru + "<tr><td width=220px align=left>Workshop by Michael Fagan</td><td align=right>US$100</td></tr>";
   fee = fee + 100;
 };

 if (registration.hefley.checked == true) {
   guru = guru + "<tr><td width=220px align=left>Workshop by Bill Hefley</td><td align=right>US$100</td></tr>";
   fee = fee + 100;
 };

 if (registration.speaker.checked == true) {

 dcheckout.innerHTML = "<table align=center border=0 width=100%><tr><td colspan=2><img src=\"2006/images/regnav-checkout.jpg\" border=0 width=484 height=20><br><br></td></tr><tr><td width=220px align=left>Speaker participation fee, including VAT</td><td align=right>US$100</td></tr><tr><td colspan=2 bgcolor=#8D390B height=1></td></tr><tr><td width=220px align=right><b>Total:</b></td><td align=right><b>US$100</b></td></tr><tr><td colspan=\"2\" align=right><br><input type=\"button\" class=\"button-gradient\" onclick=\"Registration('quest');\" value=\"<< Back\"> <input type=\"submit\" class=\"button-gradient\" value=\"Register >>\"></td></tr></table><input type=\"hidden\" name=\"total\" value=\"100\">";

 } else {

 dcheckout.innerHTML = "<table align=center border=0 width=100%><tr><td colspan=2><img src=\"2006/images/regnav-checkout.jpg\" border=0 width=484 height=20><br><br></td></tr><tr><td width=220px align=left>Participation fee, including VAT</td><td align=right>US$" + regfee + "</td></tr>" + guru + "</td></tr>" + discounts + "<tr><td colspan=2 bgcolor=#8D390B height=1></td></tr><tr><td width=220px align=right><b>Total:</b></td><td align=right><b>US$" + fee + "</b></td></tr><tr><td colspan=\"2\" align=right><br><input type=\"button\" class=\"button-gradient\" onclick=\"Registration('quest');\" value=\"<< Back\"> <input type=\"submit\" class=\"button-gradient\" value=\"Register >>\"></td></tr></table><input type=\"hidden\" name=\"total\" value=\"" + fee + "\">";

 };

};