function update_div(div_name, app_path, query_string) {
		
	var xmlHttpReq = false;	// Default to false just incase we can't create a req object

	if (window.XMLHttpRequest) {					// Non-IE browsers can do XMLHttpRequest
		xmlHttpReq = new XMLHttpRequest();
	} else if (window.ActiveXObject) {				// IE handles an ActiveXObject
		xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlHttpReq.open('POST', app_path, true);
	xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	
	xmlHttpReq.onreadystatechange = function() {
		if (xmlHttpReq.readyState == 4) {
			updatepage(div_name, xmlHttpReq.responseText);
		}
	}
			
	xmlHttpReq.send(query_string);
}


function updatepage(div_name, html_output){
	document.getElementById(div_name).innerHTML = html_output;
}

function send_email(the_form) {
	var email_address = the_form.email_address.value;
	update_div('email_signup','../elements/php/apps/email_signup.php','email_address='+email_address);
}

function send_form(div_name, app_path,the_form) {
	//show_screen();
	var full_app_path = app_path;
	var query_string = "";
	
	for(i=0; i<the_form.elements.length; i++) {
		//if(the_form.elements[i].type == "text" || the_form.elements[i].type == "textarea" || the_form.elements[i].type == "hidden" || the_form.elements[i].type == "radio") {
				//alert(the_form.elements[i].value);
			if(query_string != "") {
				query_string = query_string + "&";
			}
			
			if((the_form.elements[i].type == "checkbox") && (the_form.elements[i].checked == 0)) {
				continue;
			}
			
			query_string = query_string + escape(the_form.elements[i].name) + '=' + escape(the_form.elements[i].value);
		//}
	}
		
	update_div(div_name,full_app_path,query_string);
}


function image_on(div_id, image_src) {
	document.getElementById(div_id).src = image_src;	
}

function image_off(div_id, image_src) {
	document.getElementById(div_id).src = image_src;	
}

function show_menu(menu_name) {
	
	var menus = new Array();
	menus[0] = "menu_general";
	menus[1] = "menu_breakfast";
	menus[2] = "menu_cold";
	menus[3] = "menu_hot";
	
	for(var i=0;i<4;i++) {
		document.getElementById(menus[i]).style.display="none";
	}
	document.getElementById("menu_" + menu_name).style.display="block";
	document.getElementById("menu_background").style.background="url(../elements/images/menu_background_" + menu_name + ".jpg) top left no-repeat";

}
