function runHeight(){
	if (document.getElementById("content-m").offsetHeight < "700"){
		document.getElementById("content-m").style.height = "700px";
	}
}


//make sure all fields are completed
function valSearch(){
	if (document.getElementById("Sub-Categoryx").value != '0'){
		document.getElementById("ads1").submit();
	} else {
		if ((document.getElementById("Gourmet-Category").value != 1) && (document.getElementById("Sub-Category").value != 1) || (document.getElementById("Suburbx").value != 1)){
		document.getElementById("ads1").submit();
		} else {
			
			alert('You must select from all three drop menus.');
			
			
		}
	}
	
}


function login(){
	document.memblog.submit();
}


function openClose(popid,status){
	document.getElementById(popid).style.display = status;
}

function getLocation(address){
	window.location = address;	
	
}
//show rollovers
var currantmenu;
function showDrops(menu){
	if (currantmenu){
	document.getElementById(currantmenu).style.display = "none";
	}
	currantmenu = menu;
	if (menu){
	document.getElementById(menu).style.display = "inline";
	}
	
}

function clicker(){
	
	//only do this if image not locked
	//if ((lockimage != 1) && (lockfins != 1)){
	
	var thediv=document.getElementById('displaybox');
	if(thediv.style.display == "none"){
		thediv.style.display = "inline";
		//thediv.innerHTML = "<table width='100%' height='100%'><tr><td align='center' valign='middle' width='100%' height='100%'>test<br><br><a href='#' onclick='return clicker();'>CLOSE WINDOW</a></td></tr></table>";
	}else{
		thediv.style.display = "none";
		//thediv.innerHTML = '';
	}
	return false;
	
	//}
}


//clears the selected text field
function clearField(fields){
	document.getElementById(fields).value = "";
}

var xmlHttp;
//gallery show pic
var imagex;
var nextpic;
var prevpic;
var aquire;
var galpostat = "block";
var picblurb;
function showPic(pic,numberx,dir){ 


if (dir == 1){
	aquire = nextpic;
} else if (dir == 2){
	aquire = prevpic;
} else {
	aquire = numberx;
}

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="/includes/gallery_ajax.php"
url=url+"?imid="+aquire
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=getPic
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function getPic() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	eval(xmlHttp.responseText);
	document.getElementById("gallerypopwrap").style.display = galpostat;
	document.getElementById("poppic").src = "/exfiles/gourmetgallery/"+imagex;
	document.getElementById("caption").innerHTML = picblurb;
	
	if (galpostat == "none"){
		clicker();
	}
}

}

//this gets the events for the pod on the left hand side
function getEvent(evid){ 


xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="/includes/event_ajax.php"
url=url+"?itemid="+evid
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=showEvent
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function showEvent() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	document.getElementById("mod-l-container2").innerHTML = xmlHttp.responseText;
}

}

//this gets the events for the pod on the left hand side
var slevel;
function getSUbCat(cat,lev){ 

slevel = lev;

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="/includes/general_ajax.php"
url=url+"?cat="+cat
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=showDrop
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function showDrop() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 

	if (xmlHttp.responseText != 'F'){
	document.getElementById("search-cat").innerHTML = "sub category:<br />"+xmlHttp.responseText;
		if (slevel == 2){
			document.getElementById("search-catx").innerHTML = xmlHttp.responseText;
		}
	//alert('test');
	} else {
	document.getElementById("search-cat").innerHTML = "sub category:<br /><select name=\"Sub-Category\" id=\"Sub-Category\" disabled=\"disabled\"><option value=\"1\">-- Select --</option></select>";
		if (slevel == 2){
			document.getElementById("ads1").submit();
		} else {
			document.getElementById("searchf").submit();
		}
	}
	
	if (document.getElementById("Sub-Categoryx").value != '0'){
		document.getElementById("Suburbx").disabled = true;
	} else {
		document.getElementById("Suburbx").disabled = false;
	}
}

}


function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
