function clearF(fld){
	document.getElementById(fld).value = "";
}


var xmlHttp;
var suggdrop;
var ffield;
var getfile;
//gallery show pic
function getSuggest(drop,values,parent,formfld){ 

suggdrop = drop;
ffield = formfld;

getfile = 'suggest.php';

if (document.getElementById(parent).value.length > 2){


xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="http://www.mornington-peninsula.com/includes/"+getfile
url=url+"?values="+values
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=getDrop
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
//document.getElementById("testing").innerHTML = directory;
}
}


function getDrop() {


if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	if (xmlHttp.responseText == 'kill'){
	document.getElementById(suggdrop).style.display = "none";
	} else {
	document.getElementById(suggdrop).innerHTML = xmlHttp.responseText;
	document.getElementById(suggdrop).style.display = "inline";
	}
}

}

//function to set selected value
function setVals(ref){
	document.getElementById(ffield).value = ref;
	document.getElementById(suggdrop).style.display = "none";
}

//kill the suggestion window
function killSuggest(sugwindow){
	document.getElementById(sugwindow).style.display = "none";
}

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;
}

// animated preloader
		$(function () {
			$('img').hide();//hide all the images on the page
		});
		
		var i = 0;//initialize
		var int=0;//Internet Explorer Fix
		$(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded
			var int = setInterval("doThis(i)",50);//500 is the fade in speed in milliseconds
		});

		function doThis() {
			var imgs = $('img').length;//count the number of images on the page
			if (i >= imgs) {// Loop the images
				clearInterval(int);//When it reaches the last image the loop ends
			}
			$('img:hidden').eq(0).fadeIn(50);//fades in the hidden images one by one
			i++;//add 1 to the count
		}
		
// custom tool tip	
$(function() {
$('#set1 *').tooltip();


$('#formwrap label, #catwrap a, #maincats a').tooltip({
	
	track: true,

	delay: 0,

	showURL: false,

	showBody: " - ",
	fade: 50

});

});
