function NewWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}



function calcamt(value)
{
  today = new Date();
  date1 = new Date("August 5, 2002");
  date2 = new Date("September 12, 2002");

  if (today.getTime() <= date1.getTime()) which=1;
  else 
  {
	if (today.getTime() <= date2.getTime()) which=2;
	else which=3;
  }

	if (value == "1")
	{	if (which==1) subtot=300;
		else if (which==2) subtot=330;
		else if (which==3) subtot=375;
	}
	else if (value == "2") 
	{	if (which==1) subtot=165;
		else if (which==2) subtot=999;
		else if (which==3) subtot=999;
	}

        document.RegFee.feetot.value = "$" + subtot ;
	return("$"+subtot);
}

function calcsub(val) {
  subtot + parseInt(val) ;
  document.RegFee.feetot.value = "$" + subtot ;
  return(subtot);

}


function calcdisc(val) {
   if (val.name == "group") {
     if (val.checked == true)
       document.RegFee.a3.value = "$30" ;
      else document.RegFee.a3.value = "" ;
   }
   if (val.name == "spkr") {
     if (val.checked == true)
       document.RegFee.a4.value = "$25" ;
      else document.RegFee.a4.value = "" ;
   }

  var a1 = (document.RegFee.a1.value.length==0) ? 0 : parseInt(document.RegFee.a1.value.substr(1,4))  ;
  var a2 = (document.RegFee.a2.value.length==0) ? 0 : parseInt(document.RegFee.a2.value.substr(1,4))  ;
  var a3 = (document.RegFee.a3.value.length==0) ? 0 : parseInt(document.RegFee.a3.value.substr(1,4))  ;
  var a4 = (document.RegFee.a4.value.length==0) ? 0 : parseInt(document.RegFee.a4.value.substr(1,4))  ;
  var a5 = (document.RegFee.a5.value.length==0) ? 0 : parseInt(document.RegFee.a5.value.substr(1,4))  ;
  var a6 = (document.RegFee.a6.value.length==0) ? 0 : parseInt(document.RegFee.a6.value.substr(1,4))  ;
  feetot = a1 + a2 - (a3 + a4)
  enttot = a5 + a6 ;
  document.RegFee.subtot.value = feetot + enttot ;
  document.RegFee.feetot.value = "$" + feetot ;
  document.RegFee.enttot.value = "$" + enttot ;
}

function blankothers(form)
{
form.a1.value="";
form.a2.value="";
subtot = 0 ;
}

function chkCourse(field,value,val1)
{
  if (field.checked == false ) return ("");
  if (val1 == "3") 
     return("$"+value);
   else return("$"+(value-30));
}

function calctour(value)
{
return("$"+(value*20));
}

function calcguest(value)
{
return("$"+(value*50));
}

function calcdollar(value)
{
return("$"+(value*29));
}




function classtotal()
{
  var T1 = (document.RegClass.TR1.value.length==0) ? 0 : parseInt(document.RegClass.TR1.value.substr(1,4))  ;
  var T2 = (document.RegClass.TR2.value.length==0) ? 0 : parseInt(document.RegClass.TR2.value.substr(1,4)) ;
  var T3 = (document.RegClass.TR3.value.length==0) ? 0 : parseInt(document.RegClass.TR3.value.substr(1,4)) ;
  var T4 = (document.RegClass.TR4.value.length==0) ? 0 : parseInt(document.RegClass.TR4.value.substr(1,4)) ;
  var T5 = (document.RegClass.TR5.value.length==0) ? 0 : parseInt(document.RegClass.TR5.value.substr(1,4)) ;
  var T6 = (document.RegClass.TR6.value.length==0) ? 0 : parseInt(document.RegClass.TR6.value.substr(1,4)) ;
  var T7 = (document.RegClass.TR7.value.length==0) ? 0 : parseInt(document.RegClass.TR7.value.substr(1,4)) ;
  var T8 = (document.RegClass.TR8.value.length==0) ? 0 : parseInt(document.RegClass.TR8.value.substr(1,4)) ;
  var T9 = (document.RegClass.TR9.value.length==0) ? 0 : parseInt(document.RegClass.TR9.value.substr(1,4)) ;
  var T10 = (document.RegClass.TR10.value.length==0) ? 0 : parseInt(document.RegClass.TR10.value.substr(1,4)) ;
  var T11 = (document.RegClass.TR11.value.length==0) ? 0 : parseInt(document.RegClass.TR11.value.substr(1,4)) ;
  var T12 = (document.RegClass.TR12.value.length==0) ? 0 : parseInt(document.RegClass.TR12.value.substr(1,4)) ;
  var T13 = (document.RegClass.TR13.value.length==0) ? 0 : parseInt(document.RegClass.TR13.value.substr(1,4)) ;
  var T14 = (document.RegClass.TR14.value.length==0) ? 0 : parseInt(document.RegClass.TR14.value.substr(1,4)) ;
  var T15 = (document.RegClass.TR15.value.length==0) ? 0 : parseInt(document.RegClass.TR15.value.substr(1,4)) ;
  var T16 = (document.RegClass.TR16.value.length==0) ? 0 : parseInt(document.RegClass.TR16.value.substr(1,4)) ;

return(T1 + T2 + T3 + T4 + T5 + T6 + T7 + T8 + T9 + T10 + T11 + T12 + T13 + T14 + T15 + T16);
}


function validateForm()
{

 var msg,msgText;
    msg="";
    
  if (document.register.fname.value.length == 0) {
	msg+="* First Name \n";
} 

  if (document.register.lname.value.length == 0) {
	msg+="* Last Name \n";
} 

  if (document.register.sstreet1.value.length == 0) {
	msg+="* Street Address \n";
}	

  if (document.register.city.value.length == 0) {
	msg+="* City \n";
} 

  if (document.register.state.options.selectedIndex == 0) {
	msg+="* State \n";
} 

  if (document.register.zip.value.length == 0) {
	msg+="* ZIP / Postal Code \n";
} 

  if ((document.register.wphone.value.length == 0) && (document.register.hphone.value.length == 0) && (document.register.ophone.value.length == 0)) 
{
	msg+="* Phone Number \n";
} 
	
  if (emailCheck() == 0) {
	msg+="* Email Address \n";
} 

		
if (msg.length<=2) return true;
  else {
	msgText = "- The following required field(s) are empty:\n";	
	msgText+=msg;	
	alert(msgText);
	msg="";
	return false;
  }
}


function emailCheck()
 {
   txt_email   =document.register.email.value;
   var at_pos;
   var pd_pos;
   var sp_pos;
   var em_len;
   var email_valid;
   email_valid=1;

   em_len      =txt_email.length;

   sp_pos=txt_email.indexOf(" ",0);
   at_pos=txt_email.indexOf("@",0);
   pd_pos=txt_email.indexOf(".",at_pos);
   if (em_len<1 && email_valid==1){
   email_valid=0;
    alert("An invalid email address has been given.\n\nThis email address seems to be empty.\nPlease"
        +" insure the address is correct.");
   }

   if (at_pos == -1 && email_valid==1){
     alert("An invalid email address has been given.\n\nCheck the prefix and '@' sign.");
         email_valid=0;
   }

   if (sp_pos != -1 && email_valid==1){
     alert("An invalid email address has been given.\n\nYour email address has a space which is not allowed.\nPlease"
        +" insure you have entered it correctly");
         email_valid=0;
   }

   if (pd_pos == -1 && email_valid==1){
     alert("An invalid email address has been given.\n\nYou are missing a period after the @ symbol.\nPlease"
        +" insure you have entered it correctly");
         email_valid=0;
   }

   if (pd_pos == (em_len - 1) && email_valid==1){
     alert("An invalid email address has been given.\n\nYou have a period at the end.\nPlease"
        +" insure you have entered it correctly");
         email_valid=0;
   }

   if (pd_pos == (at_pos+1) && email_valid==1){
     alert("An invalid email address has been given.\n\nYour email address must have at least one character between the @ and the period.\nPlease"
        +" insure you have entered it correctly");
         email_valid=0;
   }

   if (at_pos == 0 && email_valid==1){
     alert("An invalid email address has been given.\n\nYour email address cannot start with a @ symbol.\nPlease"
        +" insure you have entered it correctly");
         email_valid=0;
   }
   return email_valid ;
 }

function validate2Form()
{
 var msg,msgText;
    msg="";
  
  if (document.RegFee.numguest.value != "") 
  {

   if ((document.RegFee.guesttour[0].checked == false) && (document.RegFee.guesttour[1].checked == false))
     {
	msg+="You must select a Tour option for your guests \n ";
     }
  }  

  if ((document.RegFee.guesttour[0].checked == true) || (document.RegFee.guesttour[1].checked == true))   
  {
   if (document.RegFee.numtix.value == "") 
     {
	msg+="You must select the number of Tour tickets \n ";
     }
  }  

  if ((document.RegFee.regtype[0].checked == false) && (document.RegFee.regtype[1].checked == false)) 
 {
	msg+="You must complete this page before continuing with the Conference Registration";
 }
		
if (msg.length<=2) return true;
  else {
	alert(msg);
	msg="";
	return false;
}
}

function popComp()
{
    var URL = "http://www.jadetek.com/sesug/reg2a.asp";
    ChildWin = window.open(URL,'Registration',config="height=450,width=600, toolbars=no, menubars=no, scrollbars=yes, resizable=yes,location=no, directories=no, status=no,top=50,left=80") ;
}

