function selectText(){
document.TheForm.TheText.focus();
document.TheForm.TheText.select();
}

function gotosite(site) {
  if (site != "") {
  self.location=site
  } 
}

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,toolbar=no'
win = window.open(mypage, myname, winprops)
/* if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } */
}

function popup_null() {
}

function do_submit() {
// Verify that required data exists prior
// to submitting review to server.


var buttonwaspressed = false;


   	// MUST ENTER NAME
	if (theform.name.value.length == 0) {
		alert( "Please enter Your Name");
		theform.name.focus();
		return;
	}

   	// MUST SELECT CONTACT PREFERENCE
	if ((theform.contact_phone.checked == false) && (theform.contact_email.checked == false)) {
		alert( "Please indicate a Contact Preference");
		theform.phone.focus();
		return;
	}

   	// WANTS PHONE CONTACT, MUST ENTER PHONE
	if ((theform.contact_phone.checked == true) && (theform.phone.value.length == 0)) {
		alert( "Please enter Phone Number");
		theform.phone.focus();
		return;
	}

   	// WANTS E-MAIL CONTACT, MUST ENTER E-MAIL
	if ((theform.contact_email.checked == true) && (theform.emailaddr.value.length == 0)) {
		alert( "Please enter E-mail Address");
		theform.emailaddr.focus();
		return;
	}

    // CHECK EMAIL FORMAT
    var input_str=theform.emailaddr.value;
    var input_len1=input_str.length;
    var iserror=0;
    input_len1=input_str.length;
    var lastdot=-1;
    var lastat=-1;
    var numberat=0;

    if (theform.emailaddr.value.length != 0) {

        for (var j = 0; j < input_len1; j++) {
             var ch2 = input_str.substring(j, j + 1);
             if (((ch2 < "a") ||  (ch2 > "z")) && ((ch2 < "A") || (ch2 > "Z")) && ((ch2 < "0") ||  (ch2 > "9")) && (ch2 != "@" ) && (ch2 != ".") && (ch2 != "_") && (ch2 != "-")){
                 alert("Please input a valid email address!\nValid characters include A-Z, a-z, 0-9, -, _, . and @");
                 iserror=1;
             }
             if (ch2==".") {
                 if ( j == lastdot + 1) {
                     alert("Please input a valid email address!\nYou can't have two dots next to\neach other'..'.");
                     iserror=1;
                 }
                 lastdot=j;
             }
             if (ch2=="@") {
                 lastat=j;
                 numberat=numberat+1
             }
             if (ch2==" ") {
                 alert("Please input a valid email address!\nYou can't have any spaces in the address.");
                 iserror=1;
             }
        }
        if (lastat == -1) {
             alert("Please input a valid email address!\nYou don't have an '@'.");
             iserror=1;
        }
        if (lastat == 0) {
             alert("Please input a valid email address!\nYou don't have a name before the '@'.");
             iserror=1;
        }
        if (numberat > 1) {
             alert("Please input a valid email address!\nYou may have only one '@'.");
             iserror=1;
        }
        if ((lastdot <= lastat) || (lastdot > input_len1 - 3 ) || (input_len1 - lastdot > 4)) {
             alert("Please input a valid email address!\nYou don't have a proper domain name!\nUse .com, .org, .net, .us, etc");
             iserror=1;
        }
        if (lastdot == lastat + 1) {
             alert("Please input a valid email address!\nYou don't have a proper organization name!\nUse name@organization.domain");
             iserror=1;
        }
        if (iserror==1) {
             theform.emailaddr.focus();
             return;
        }

    }

   	// MUST SELECT EVENT TYPE
	if ((theform.event_type[0].checked == false) && 
       (theform.event_type[1].checked == false) && 
       (theform.event_type[2].checked == false) && 
       (theform.event_type[3].checked == false) && 
       (theform.event_type[4].checked == false) && 
       (theform.event_type[5].checked == false) && 
       (theform.event_type[6].checked == false)) {
		alert( "Please select an Event Type");
		theform.event_type[0].focus();
		return;
	}

   	// SELECTED EVENT TYPE OTHER, MUST SPECIFY DETAILS
	if ((theform.event_type[6].checked == true) && (theform.event_type_other.value.length == 0)) {
		alert( "You selected Other, please indicate Event Type");
		theform.event_type_other.focus();
		return;
	}

   	// MUST ENTER ENTERTAINMENT TYPE
	if (theform.entertainment_type.value.length == 0) {
		alert( "Please enter Entertainment Type");
		theform.entertainment_type.focus();
		return;
	}

   	// MUST ENTER EVENT DATE
	if (theform.event_date.value.length == 0) {
		alert( "Please enter Event Date");
		theform.event_date.focus();
		return;
	}

   	// MUST ENTER EVENT LOCATION
	if (theform.event_location.value.length == 0) {
		alert( "Please enter Event Location");
		theform.event_location.focus();
		return;
	}

   	// MUST SELECT EVENT TIME OF DAY
	if ((theform.event_tod[0].checked == false) && 
       (theform.event_tod[1].checked == false) && 
       (theform.event_tod[2].checked == false)) {
		alert( "Please select an Event Time of Day");
		theform.event_tod[0].focus();
		return;
	}

   	// MUST SELECT EVENT FLOW
	if ((theform.flow_cocktail.checked == false) && 
        (theform.flow_dinner.checked == false) &&
        (theform.flow_dancing.checked == false) &&
        (theform.flow_awards.checked == false)) {
		alert( "Please make an Event Flow entry");
		theform.flow_cocktail.focus();
		return;
	}

   	// MUST ENTER ATTENDANCE
	if (theform.attendance.value.length == 0) {
		alert( "Please enter number of Persons Attending");
		theform.attendance.focus();
		return;
	}

	buttonwaspressed = true;
	theform.submit();

}


