var thewin;
function changePage(selectObj) {
	if( selectObj.value != '' ){
		thePageForm = selectObj.parentNode;
		thePageForm.submit();
	}
}
function show_hide(id, show){
	el = document.getElementById(id)
	if (null==show) show = el.style.display=='none';
	el.style.display = (show ? '' : 'none');
}
function openWindow(url){
	var theUrl = url;
	thewin = window.open(theUrl,'arbitrary',"menubar=no,location=no,resizable=no,scrollbars=yes,status=no,dependent=yes,width=415,height=350,alwaysRaised=yes");
}
function returnDay(inputBox,wantedValue){
	if(window.opener && !window.opener.closed)
	inbox = window.opener.document.getElementById(inputBox).value=wantedValue;
	window.close();
}
function showBig(input){
	var source = input.src;
	var label = input.alt;
	var bi = document.getElementById("bigImage");
	bi.src=source;
	var bigLabel = document.getElementById("bigLabel");
	bigLabel.innerHTML = label; 
}
function popThis(input,loc_dog){
	var xWind;
	imageName = input.src
	imageName = imageName.substr(imageName.lastIndexOf("/")+1);
	urlUse = "showImage.php?image=" + imageName + "&location_id=" + loc_dog;
	xWind = window.open(urlUse, "modWindowName","menubar=no,location=no,resizable=no,scrollbars=no,status=no, dependent=yes, width=" + (input.width+10)+ ", height=" + (input.height+200) + ", alwaysRaised=yes");
	xWind.reload;
}
function swap_media(){
	show_hide('lib_contain');
	show_hide('dish_contain');
}
function addQTYPRICE() {
	var ni = document.getElementById('price_info');
  
	try {
	    element = document.createElement("<input name='qty[]' type='text' class='text' />");
		element2 = document.createElement("<input name='price[]' type='text' class='text' />");
	} catch (e) {
	    element = document.createElement("input");
	    element.setAttribute("name", "qty[]");
	    element.setAttribute("type", "text");
	    element.setAttribute("class", "text");
		element2 = document.createElement("input");
		element2.setAttribute("name", "price[]");
		element2.setAttribute("type", "text");
		element2.setAttribute("class", "text");
	}
	ulelement = document.createElement("ul");
	ulelement.setAttribute("class","list_qtyprice");
	liPrice = document.createElement("li");
	liPriceText = document.createTextNode("Price");
	liPrice.appendChild(liPriceText);
	liPrice.innerHTML += "<br />";
	liPrice.appendChild(element2);
	
	liQty = document.createElement("li");
	liQtyText = document.createTextNode("Quantity");
	liQty.appendChild(liQtyText);
	liQty.innerHTML += "<br />";
	liQty.appendChild(element);
	
	ulelement.appendChild(liPrice);
	ulelement.appendChild(liQty);
	//ni.appendChild(ulelement);
	var input = document.getElementById('addQTY');
	ni.insertBefore(ulelement, input);

}
function buildsearch(){
	var gin = window.document.getElementById("wild_search").value;
	var searchstring = "menu-retrieve.php?act=wildsearch&search_terms="+gin;
	ajaxManager('load_page',searchstring,'menu_display_area',"on");
}

function enterSubmit(iForm) {
	if(window.event && window.event.keyCode == 13)
		//iForm.submit();
		buildsearch();
	else
		return true;
		}
function select_all(div_name,on_off){
		var dhandle = document.getElementById(div_name);
		namz = dhandle.getElementsByTagName('*');
		for(var i=0;i<namz.length;i++){
			var elem = namz[i];
			if(on_off=="on")elem.checked=true;
			if(on_off=="off")elem.checked=false;
		}
}