var num_menu_items = menus.length;

function show_menu(menu) {
	hide_menus();
	document.getElementById(menu+'_menu').style.display='block';
	return false;
}

function hide_menus() {
	for (var i=0;i<num_menu_items;i++) {
		document.getElementById(menus[i]+'_menu').style.display='none';
	}
	return false;
}

function pop_up_win(page,title,width,height) {
	window.open(cgi_dir+page,title,"toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=1,width="+width+",height="+height);
}
function pop_up_win2(page,title,width,height) {
	window.open(cgi_dir+page,title,"toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width="+width+",height="+height);
}

function check_form(form_id,cmd) {
	var errors = new Array();
	var error_list = '';
	var js_alert_begin = 'The following errors were found with your submission:' + "\n" + '-----------------------------' + "\n";
	var js_alert_end = '-----------------------------' + "\n" + 'Please fix and re-submit the form' + "\n";
	var form_ref = document.getElementById(form_id);
	if (cmd && form_ref.cmd) { form_ref.cmd.value = cmd; }

	switch (form_id) {
	case 'search_news_form' :
		if (form_ref.search_phrase.value == '' || form_ref.search_phrase.value == ' ') {
			errors.push('Please enter some search text.');
		}
		break;
	case 'search_faqs_form' :
		if ((form_ref.search_phrase.value == '' || form_ref.search_phrase.value == ' ') && form_ref.search_category.value == '') {
			errors.push('Please either choose a category OR enter some search text.');
		}
		break;
	case 'site_search_form' :
		if (form_ref.search_phrase.value == '' || form_ref.search_phrase.value == ' ') {
			errors.push('Please enter some search text.');
		}
		break;
	}
	
	var num_errors = errors.length;
	if (num_errors > 0) {
		for (var i=0;i<num_errors;i++) {
			error_list += (i+1) + '. ' + errors[i] + "\n";
		}
		alert(js_alert_begin + error_list + js_alert_end);
		return false;
	} else {
		form_ref.submit();
		return true;
	}
}
//------------- ROUTE 66 SPECIFIC
function get_cal(m,y) {
	var cal = document.getElementById('e_cal');
	cal.innerHTML = '<p>Loading ...</p>';

	var ajax_params = 'm=' + m + '&y=' + y;
	var ajax_url = 'http://www.chicagolandspeedway.com/rt66_mini_cal.php';
	var ajax_method = 'GET';
	if (ajax_available()) {
		ajax_action = function() {
			//alert(ajax_response_txt);
			cal.innerHTML = ajax_response_txt;
		}
		ajax_send(ajax_method,ajax_url,ajax_params);
	}
}


//------------- OLD CLS
function MM_openBrWindow(theURL,winName,features) { //used on inc_maps.html
  window.open(theURL,winName,features);
}

function checkSurvey() { //used on cls_surveys.html
  var echk=eval('document.theForm.A'+document.theForm.emnum.value);
  if (echk.value.indexOf('@') > -1 && echk.value.indexOf('.') > -1) {
    return true;
  } else {
    alert('You MUST enter a valid email address.');
    return false;
  }
}


//------------- INTERACTIVE SEATING FLASH
var win=null;
function New2ndWindow(mypage,myname,w,h,pos,infocus){
if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
else if((pos!='center' && pos!="random") || pos==null)

<!--// change screen position here //--> 
{myleft=0;mytop=0}
settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";win=window.open(mypage,myname,settings);
win.focus();}