<!--
function getRecipient(){
	
	
	
	for (var i=0; i < document.form1.topic.length; i++){
		
	   if (document.form1.topic[i].checked){
		  var rad_val = i;
		  break;
	   }
	}
	
	var addrs = ["vicki","vicki","press","webtech"];
	var subjects = ["GENERAL COMMENT","CATERING + PRIVATE EVENT INQUIRY","PRESS INQUIRY","SITE ISSUE"];
	
	
	document.form1.subject.value = "Beacon-la.com: " + subjects[rad_val];
	document.form1.recipient.value = addrs[rad_val] + "@" + "beacon-la.com";
}

function stringConvert(){
	document.form1.realname.value = escape(document.form1.realname.value);
}


function elimSpace(text){
	// removes leading spaces
	while (text.charAt(0) == " "){
		text = text.substring(1,text.length);
	}
	while (text.charAt(text.length - 1) == " "){
		text = text.substring(0,text.length-1);
	}
	return text;
}



function replaceWith(string,text,by) {    //replaceWith(this.form.myField.value,' ','')
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replaceWith(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}



/* Propery of Site Systems, Copyright 2001. All rights Reserved.
   Developers: Matthew Edwards, 

*/

// set global params
var focusfield = '';

function checkForm(formname) {

	// create some default parameters for the error message if one is needed
	var final_msg = ""; 
	var intro = "There was a problem with your message.          \n\n"; // create intro 
	var ending = "\n\nPlease make the appropriate changes and try resending.     \n\n" // create ending
	
	// define default messages 
	var err_text = "     - Incomplete Form"
	var err_ptext = "     - Incomplete Form"
	var err_month = "     - Invalid Month"
	var err_zip = "     - Invalid Zip Code"
	var err_credit = "     - Invalid Credit Card Number" 
	var err_phone = "     - Invalid Phone Number"
	var err_day = "     - Invalid Day"
	var err_year = "     - Invalid Year"
	var err_dropdown = "     - Incomplete Form"
	var err_checkbox = "     - No checkbox selected"
	var err_email = "     - Invalid Email"
	
	
	var f = eval("document." + formname + ".elements"); // define the scope to save time
	var vArray = new Array(); // Create an Array to hold fields to be validated
		
	//Check for fields that need to be validated
	for (i=0; i<f.length; i++) {
		if(f[i].name.indexOf('_validate') != -1) {
			if (vArray.length == 0) {
				vCurrent = 0;
			} else {
				vCurrent = vCurrent + 1;
			}
			vArray[vCurrent]  = f[i].name;
		}
		// check for a hidden test to stop form from submitting
		if(f[i].name == 'sitesys_test') {
			var testing = true;
		}
	}

	// Now that we have the validated fields, start checking values
	for (i=0; i<vArray.length; i++) {
		var fposition = vArray[i].indexOf('_validate'); // find the position of "_validate"
		var fname = vArray[i].substring(0, fposition); // extract field name
		var validate = eval("document." + formname + "." + vArray[i] + ".value"); // define scope
		var dash = validate.indexOf('-'); // find the position of the "-"

		if(dash == -1) {
			var type = validate; // if there is no dash set error_msg to blank/default
			var err_msg = '';
		} else {	
			var type = validate.substring(0,dash); // get field type
			var err_msg = validate.substring(dash + 1, validate.length); // get custom error message if any
		}	

		
		var field = eval("document." + formname + "." + fname); // define field scope

		// validate text fields
		if(type == 'text') {

			// removes leading spaces
			if (field.value){
				field.value = elimSpace(field.value);
			}
				
			if(!field.value) {
				if (err_msg == "") {
					final_msg = final_msg + err_text + "\n";
				} else {
					final_msg = final_msg + err_msg + "\n";
				}	
			setFocus(field); // run focus function
			}	
		}
		// end text validation
		
		// validate radio
		if(type == 'radio'){
			var rempty = true;
			for (r=0;r<field.length;r++) {
				if(field[r].checked) {
					rempty = false;
				}
			}
			if(rempty) {
				if (err_msg == "") {
					final_msg = final_msg + err_radio + "\n";
					} else {
						final_msg = final_msg + err_msg + "\n";
				}
			setFocus('nofocus'); // run focus function											
			}
		}
		// end radio validation
		
		// validate email
		if (type == 'email') {
		
			field.value = replaceWith(field.value,' ','');
			
			var bademail = false
	
			if (field.value) { 
			
				var emailStr = field.value;
				var emailPat=/^(.+)@(.+)$/;
				var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
				var validChars="\[^\\s" + specialChars + "\]";
				var quotedUser="(\"[^\"]*\")";
				var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
				var atom=validChars + '+';
				var word="(" + atom + "|" + quotedUser + ")";
				var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
				var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
				var matchArray=emailStr.match(emailPat);
				
				if (matchArray==null) { 
					bademail = true; 
				} else {
				
						var user=matchArray[1];
						var domain=matchArray[2];
						
						if (user.match(userPat)==null)  { bademail = true; }
						
						var IPArray=domain.match(ipDomainPat);
						if (IPArray!=null) {
						    // this is an IP address
							  for (var i=1;i<=4;i++) {
							    if (IPArray[i]>255) {
									 bademail = true;
							    }
						    }
						}
				
				
						var domainArray=domain.match(domainPat);
						if (domainArray==null)  { bademail = true; }
						
						var atomPat=new RegExp(atom,"g");
						var domArr=domain.match(atomPat);
						var len=domArr.length;
						if (domArr[domArr.length-1].length<2 || 
						    domArr[domArr.length-1].length>3) {
							bademail = true;
						}
						
						if (len<2) {
							bademail = true;
						}
				}	
			}
				
			if(bademail) {
				if (err_msg == "") {
					final_msg = final_msg + err_email + "\n";
					} else {
						final_msg = final_msg + err_msg + "\n";
				}
			setFocus(field); // run focus function											
			}
		}
		//end email validation

	}


	// stop the submission if there are errors and notify the user
	if (final_msg != "") {
		alert(intro + final_msg + ending); // give the user the error
		if(focusfield != "false") {
			var focus_on = eval("document." + formname + "." + focusfield); // define scope
			focus_on.focus(); // focus on first field that needs to be fixed
		 }

		focusfield = ''; // clear out the focus field for next run
		return false; 

	}
	

	
	// check and see if we are testing, if so, then stop the form from submitting
	if(testing) { return false; }	
	
}

		//confirm before submitting	
		

function setFocus(field) {
	if(focusfield == '') {
		if (field == 'nofocus') {
			focusfield = "false";
		} else {
			focusfield = field.name;
		} 
	}	
}
-->