<!--- hide script from old browsers

// Take user here after session timed out
timedouturl = "./index.php?timeout=1";
var newWin = null;
var version4 = false
if(navigator.appVersion.charAt(0) == "4") version4 = true

function validate_email(emailStr) {
	var msg = "";
	
	/* The following variable tells the rest of the function whether or not
	to verify that the e-mail address ends in a two-letter country or well-known
	TLD.  1 means check it, 0 means don't. */

	var checkTLD=1;

	/* The following is the list of known TLDs that an e-mail address must end with. */

	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

	/* The following pattern is used to check if the entered e-mail address
	fits the user@domain format.  It also is used to separate the username
	from the domain. */

	var emailPat=/^(.+)@(.+)$/;

	/* The following string represents the pattern for matching all special
	characters.  We don't want to allow special characters in the e-mail address.
	These characters include ( ) < > @ , ; : \ " . [ ] */

	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

	/* The following string represents the range of characters allowed in a
	username or domainname.  It really states which chars aren't allowed.*/

	var validChars="\[^\\s" + specialChars + "\]";

	/* The following pattern applies if the "user" is a quoted string (in
	which case, there are no rules about which characters are allowed
	and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
	is a legal e-mail address. */

	var quotedUser="(\"[^\"]*\")";

	/* The following pattern applies for domains that are IP addresses,
	rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
	e-mail address. NOTE: The square brackets are required. */

	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

	/* The following string represents an atom (basically a series of non-special characters.) */
	
	var atom=validChars + '+';

	/* The following string represents one word in the typical username.
	For example, in john.doe@somewhere.com, john and doe are words.
	Basically, a word is either an atom or quoted string. */

	var word="(" + atom + "|" + quotedUser + ")";

	// The following pattern describes the structure of the user
	
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

	/* The following pattern describes the structure of a normal symbolic
	domain, as opposed to ipDomainPat, shown above. */

	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

	/* Finally, let's start trying to figure out if the supplied e-mail address is valid. */

	/* Begin with the coarse pattern to simply break up user@domain into
	different pieces that are easy to analyze. */
	
	var matchArray=emailStr.match(emailPat);
  
	if (matchArray != null) {
		if(matchArray[1])
			var user=matchArray[1];
		if(matchArray[2])
			var domain=matchArray[2];

		// Start by checking that only basic ASCII characters are in the strings (0-127).
		for (i=0; i<user.length; i++) {
			if (user.charCodeAt(i)>127) {
				msg += "Ths username contains invalid characters.";
  		}
		}
		for (i=0; i<domain.length; i++) {
			if (domain.charCodeAt(i)>127) {
				msg += "Ths domain name contains invalid characters.";
   		}
		}

		// See if "user" is valid

		if (user.match(userPat)==null) {

			// user is not valid

			msg += "The username doesn't seem to be valid.";
		}

		/* if the e-mail address is at an IP address (as opposed to a symbolic
		host name) make sure the IP address is valid. */

		var IPArray=domain.match(ipDomainPat);
		
		if (IPArray!=null) {

			// this is an IP address

			for (var i=1;i<=4;i++) {
				if (IPArray[i]>255) {
					msg += "Destination IP address is invalid!";
   			}
			}
		}

		// Domain is symbolic name.  Check if it's valid.

		var atomPat=new RegExp("^" + atom + "$");
		var domArr=domain.split(".");
		var len=domArr.length;
		for (i=0;i<len;i++) {
			if (domArr[i].search(atomPat)==-1) {
				msg += "The domain name does not seem to be valid.";
   		}
		}

		/* domain name seems valid, but now make sure that it ends in a
		known top-level domain (like com, edu, gov) or a two-letter word,
		representing country (uk, nl), and that there's a hostname preceding
		the domain or country. */

		if (checkTLD && domArr[domArr.length-1].length!=2 &&
			domArr[domArr.length-1].search(knownDomsPat)==-1) {
			msg += "The e-mail address must end in a well-known domain or two letter " + "country.";
		}

		// Make sure there's a host name preceding the domain.
	
		if (len<2) {
			msg += "This e-mail address is missing a hostname!";
		}
	}
	else
		msg += "E-mail address seems incorrect check for @";

	return msg;
}
 
function isblank(s) {
    for(var i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
    }
    return true;
}

// This is the function that performs form verification. It will be invoked
// from the onSubmit() event handler. The handler should return whatever
// value this function returns.
function verify(f,tot_val) {
    var msg;
    var str;
    var empty_fields = "";
    var errors = "";

		var radio_rcnt 	= 0;
		var radio_fcnt 	= 0;
		var radio_rad 	= "";
		var radio_ltype = "";
	
		var chk_rcnt 	= 0;
		var chk_fcnt 	= 0;
		var chk_rad 	= "";
		var chk_ltype = "";
   	
   	// Loop through the elements of the form, looking for all
    // text and textarea elements that don't have an "optional" property
    // defined. Then, check for fields that are empty and make a list of them.
    // Also, if any of these elements have a "min" or a "max" property defined,
    // then verify that they are numbers and that they are in the right range.
    // Put together error messages for fields that are wrong.
    for(var i = 0; i < f.length; i++) {
    	var e = f.elements[i];
				
      if (((e.type == "text") 
      	|| (e.type == "select-one") 
       	|| (e.type == "select-multiple") 
       	|| (e.type == "textarea") 
       	|| (e.type == "password") 
       	|| (e.type == "radio") 
       	|| (e.type == "file") 
       	|| (e.type == "checkbox")) && !e.optional) {
          
        if(radio_rad != e.name && e.type == "radio") {
					if(radio_rcnt == radio_fcnt && radio_fcnt > 0 && radio_ltype=="radio") {
						empty_fields += "\n          " + radio_rad;
						radio_ltype="";
					}
					radio_rad		=e.name;
					radio_ltype	="radio";
					radio_fcnt	=0;
					radio_rcnt	=0;
				}
          	
        if(chk_rad != e.name && e.type == "checkbox") {
					if(chk_rcnt == chk_fcnt && chk_fcnt > 0 && chk_ltype=="checkbox") {
						empty_fields += "\n          " + chk_rad;
						chk_ltype="";
					}
					chk_rad		=e.name;
					chk_ltype	="checkbox";
					chk_fcnt	=0;
					chk_rcnt	=0;
				}
				
        // Check for email field
        var temp = e.name.split('_');
				for (k=0; k < temp.length; k++)
					if(temp[k]=="email")
      			errors += validate_email(e.value);
				if (e.type == "select-one" || e.type == "select-multiple") {
					var n;
					var sel=0;
					for (n = 0; n < e.options.length; n++) {
						if (e.options[n].selected && e.value != null && e.value != "") {
							sel=1;
							break;
						}
					}
					if(sel==0)
						empty_fields += "\n          " + e.name;
					continue;
  			}
	
				if(e.type == "radio") {
					if(!e.checked)
						radio_rcnt++;
					radio_fcnt++;
				}
				if(e.type == "checkbox") {
					if(!e.checked)
						chk_rcnt++;
					chk_fcnt++;
				}

				if (e.value == null || e.value == "" || isblank(e.value)) {
       	 	empty_fields += "\n          " + e.name;
         	continue;
       	}
        	
    	 	// Now check for fields that are supposed to be numeric.
        if (e.numeric || (e.min != null) || (e.max != null)) {
         	var v = parseFloat(e.value);
 	       	if (isNaN(v) ||
   	        ((e.min != null) && (v < e.min)) ||
     	      ((e.max != null) && (v > e.max))) {
       	    errors += "- The field " + e.name + " must be a number";
         	  if (e.min != null)
           	   errors += " that is greater than or equal to " + e.min;
            if (e.max != null && e.min != null)
           	  errors += " and less than " + e.max;
            else if (e.max != null)
              errors += " that is less than or equal to " + e.max;
 	          errors += ".\n";
   				}
     		}
   		}
 		}
 		if(radio_rcnt == radio_fcnt && radio_fcnt > 0 && radio_ltype=="radio")
			empty_fields += "\n          " + radio_rad;
		if(chk_rcnt == chk_fcnt && chk_fcnt > 0 && chk_ltype=="checkbox")
			empty_fields += "\n          " + chk_rad;
				
    // Now, if there were any errors, display the messages, and
    // return false to prevent the form from being submitted.
    // Otherwise return true.

    if(tot_val == 1) {
    	var qty_member			=document.getElementById("qty_member").value * 1;
		var qty_nonmember	=document.getElementById("qty_nonmember").value * 1;
		var qty_student			=document.getElementById("qty_student").value * 1;
		var qty_resident			=document.getElementById("qty_resident").value *1;
		var qty_award			=document.getElementById("qty_award").value * 1;
		
		if(document.getElementById("exibit_space").checked)
			var t_space		= 2500;
		else
			var t_space		= 0;
		var total = qty_member + qty_nonmember + qty_student + qty_resident	+ qty_award + t_space;
		if(total <= 0)
			errors += "Please enter a quantity for at least one of the options or select the exhibit space.";
	}
		
		
    if (!empty_fields && !errors) return true;

    msg += "______________________________________________________\n\n"
    msg += "The form was not submitted because of the following error(s).\n";
    msg += "Please correct these error(s) and re-submit.\n";
    msg += "______________________________________________________\n\n"

    if (empty_fields) {
        msg += "- The following required field(s) are empty:"
                + empty_fields + "\n";
        if (errors) msg += "\n";
    }
    msg += errors;
    alert(msg);
    return false;
}

var newWin = null;
var version4 = false
if(navigator.appVersion.charAt(0) == "4") version4 = true

// Take user here after session timed out
timedouturl = "./index.php?timeout=1";

function Minutes(data) {
	for (var i = 0; i < data.length; i++)
		if (data.substring(i, i + 1) == ":")
	break;
	return (data.substring(0, i));
}

function Seconds(data) {
	for (var i = 0; i < data.length; i++)
		if (data.substring(i, i + 1) == ":")
	break;
	return (data.substring(i + 1, data.length));
}

function Display(min, sec) {
	var disp;
	if (min <= 9) disp = " 0";
	else disp = " ";
	disp += min + ":";
	if (sec <= 9) disp += "0" + sec;
	else disp += sec; 
	return (disp);
}

function Down() { 
	sec--;      
	if (sec == -1) { sec = 59; min--; }
	document.timerform.clock.value = Display(min, sec);
	window.status = "Session will time out in: " + Display(min, sec);
	if (min == 0 && sec == 0) {
		alert("Your session has timed out.");
		window.location.href = timedouturl;
	}
	else down = setTimeout("Down()", 1000);
}

function timeIt() {
	min = 1 * Minutes(document.timerform.clock.value);
	sec = 0 + Seconds(document.timerform.clock.value);
	Down();
}

function OpenPriceWindow(url) { 
  var newWin = window.open(url,'MyWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=445,height=465,left=150,top=50'); 
} 
function popWin(){ 
     window.open("http://www.ibabrokers.com/popWin.html","Popup","width=450,height=400,toolbars=no,menubar=no,status=yes,scrollbars=no,resizable=no,left=150,top=50");
} 
function validate(field,theValue) {
  var ok = "yes";
  var temp;
  for (var i=0; i<field.value.length; i++) {
    temp = "" + field.value.substring(i, i+1);
    if (theValue.indexOf(temp) == "-1") ok = "no";
  }
  if (ok == "no") {
    msg = "Invalid entry!  Only ";
	msg += theValue;
	msg += " characters are accepted!";
    alert(msg);
    field.focus();
  }
}

var x;
var w;
var h;
var newWin = null;
function openWindow(hiddenWindow, WindowName) {
	w=Math.round(WindowName/1000);
	h=((WindowName/1000)-(Math.round(WindowName/1000))) * 1000;
	if(h < 0)
		h=h*-1;
	if (!newWin || newWin.closed){
		if (WindowName == "login"){
			newWin = window.open(hiddenWindow, WindowName, "width=650,height=600,toolbar=no,menubar=no,status=no,scrollbars=yes,resize=yes");
		}else{
			newWin = window.open(hiddenWindow, WindowName, "width=650,height=600,toolbar=no,menubar=no,status=no,scrollbars=yes,resize=yes");
		}
	}else{
		newWin.location.href = hiddenWindow;
		newWin.focus();
	}
}
function newWindow(hiddenWindow, WindowName) {
	if (!newWin || newWin.closed){
		if (WindowName == "login"){
			newWin = window.open(hiddenWindow, WindowName, "width=700,height=450,toolbar=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes");
		}else{
			newWin = window.open(hiddenWindow, WindowName, "width=700,height=450,toolbar=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes");
		}
	}else{
		newWin.location.href = hiddenWindow;
		newWin.focus();
	}
}
function fullWindow(hiddenWindow, WindowName,theWidth,theHeight) {
	if (!newWin || newWin.closed){
		if (WindowName == "login"){
			newWin = window.open(hiddenWindow, WindowName, "width=800,height=600,toolbars=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes");
		}else{
			newWin = window.open(hiddenWindow, WindowName, "width=800,height=600,toolbars=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes");
		}
	}else{
		newWin.location.href = hiddenWindow;
		newWin.focus();
	}
}
function linkSelect(form) {
  window.parent.location = form.link.options[form.link.selectedIndex].value
}
function linkSelect1(form) {
  window.parent.location = form.link1.options[form.link1.selectedIndex].value
}
function PrintPage() {
if (navigator.appName.indexOf("Microsoft")>=0 && navigator.appVersion.substring(22,23) == 4 || navigator.platform.substring(0,3) == "Mac") {
		alert("Your current browser does not support this button.  Please choose File/Print from your browser's menu.");
	} else {
		window.print();
	}
}
function password(form) {
  if(form.password1.value != form.password2.value) {  
    alert("Two passwords not equal please renter!");
    form.password1.focus();
    form.password1.select();	
  }	
}
function SetPhoto(val,fld) {
	dml=document.childForm;
	len = dml.elements.length;
	var i=0;
	var total=0;
	for( i=0 ; i<len ; i++) {
		if (dml.elements[i].name==fld) {
			dml.elements[i].checked=val;
		}
	}
}

function getDirections(address,city,state,zip) {

var toAdd = prompt("From Street Address (No City/State):","");
if ((toAdd == "") || (toAdd == null)) { return false }
var toCity = prompt("From City (No State):","");
if ((toCity == "") || (toCity == null)) { return false }
var toState = prompt("From State (2 letter abbrev.):","CT");
if ((toState == "") || (toState == null)) { return false }
var escapedURL = "";

myUrl = "http://www.mapquest.com/directions/main.adp?go=1&do=nw&ct=NA&1y=US&1a="
myUrl += toAdd
myUrl += "&1c="
myUrl += toCity
myUrl += "&1s="
myUrl += toState
myUrl += "&1z="
myUrl += "&2y=US&2a="
myUrl += address
myUrl += "&2c="
myUrl += city
myUrl += "&2s="
myUrl += state
myUrl += "&2z="
myUrl += zip

for (var i=0, output='', space=" "; i<myUrl.length; i++)
    if (space.indexOf(myUrl.charAt(i)) != -1) {
       escapedURL += "+" } else {
       escapedURL += myUrl.charAt(i)
    }
	window.open(escapedURL,'','toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes')
}


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){
	   alert("Invalid E-mail Address")
	   return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Invalid E-mail Address")
	   return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    alert("Invalid E-mail Address")
	    return false
	}
	 if (str.indexOf(at,(lat+1))!=-1){
	    alert("Invalid E-mail Address")
	    return false
	 }
	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    alert("Invalid E-mail Address")
	    return false
	 }
	 if (str.indexOf(dot,(lat+2))==-1){
	    alert("Invalid E-mail Address")
	    return false
	 }
	 if (str.indexOf(" ")!=-1){
	    alert("Invalid E-mail Address")
	    return false
	 }
	 return true					
}
function ValidateForm(email){
	var emailID=email;
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email Address")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
 
 function showClass(form) {
 	st=form.state.value;
	if(st=="NY") {
		try { 
			document.getElementById('mlsli').style.display = ""; 
			document.getElementById('armls').style.display = "none";
			document.getElementById('mlspin').style.display = "none"; 
		} 
		catch(ex) {}
	}
	else if(st=="AZ") {
		try { 
			document.getElementById('armls').style.display = "";
			document.getElementById('mlsli').style.display = "none";
			document.getElementById('mlspin').style.display = "none";
		} 
		catch(ex) {}
	}
	else {
		try { 
			document.getElementById('mlspin').style.display = "";
			document.getElementById('armls').style.display = "none";
			document.getElementById('mlsli').style.display = "none";
		} 
		catch(ex) {}
		
	}
}

function checkit() {
		var qty_member			=document.getElementById("qty_member").value * 1;
		var qty_nonmember	=document.getElementById("qty_nonmember").value * 1;
		var qty_student			=document.getElementById("qty_student").value * 1;
		var qty_resident			=document.getElementById("qty_resident").value *1;
		var qty_award			=document.getElementById("qty_award").value * 1;
		
		if(document.getElementById("exibit_space").checked)
			var t_space		= 2500;
		else
			var t_space		= 0;
		var total = qty_member + qty_nonmember + qty_student + qty_resident	+ qty_award + t_space;
		if(total <= 0) {
			alert("Please enter a quantity for at least one of the options or select the exhibit space.");
			return false;
		}
}
//--> Stop hiding
