

// Adds a message to the search area prompting the user to use the tabs
//-----------------------------------------------------------------
function searchPromptMSG() {
if(!document.getElementById || !document.createTextNode){return;}

var supDiv = document.getElementById("supMsg");
var venDiv = document.getElementById("venMsg");
var evtDiv = document.getElementById("evtMsg");

if(!supDiv){return;}
if(!venDiv){return;}
if(!evtDiv){return;}

// build the element and append the text
	
	//venues
		var venuePara=document.createElement("p");
		var venueTxt=document.createTextNode("To search for events or vendors use the tabs above.");
		venuePara.appendChild(venueTxt);
	//supplier
		var supplierPara=document.createElement("p");
		var supplierTxt=document.createTextNode("To search for venues or events use the tabs above.");
		supplierPara.appendChild(supplierTxt);
	//events
		var eventPara=document.createElement("p");
		var eventTxt=document.createTextNode("To search for venues or vendors use the tabs above.");
		eventPara.appendChild(eventTxt);
		
	venDiv.appendChild(venuePara);
	supDiv.appendChild(supplierPara);
	evtDiv.appendChild(eventPara);

}

// Clear search box text (thank you, Mirek Komárek : http://js-playground.blogspot.com)
// -----------------------------------------------------------------

function clearSearchValues(){
if(!document.getElementById || !document.createTextNode){return;}

var searchArea = document.getElementById('search');
if(!searchArea){return;}

var inp=searchArea.getElementsByTagName('input');
for(var i=0;i<inp.length;i++){
	if(inp[i].type=='text'){
		
		switch(inp[i].getAttribute('name')){
		case 'fName4':inp[i].setAttribute('rel','Event name');break;
		case 'fCity4':inp[i].setAttribute('rel','City');break;
		case 'fName2':inp[i].setAttribute('rel','Vendor name');break;
		case 'fCity2':inp[i].setAttribute('rel','City');break;
		case 'fName3':inp[i].setAttribute('rel','Venue name');break;
		case 'fCity3':inp[i].setAttribute('rel','City');break;
		}
	
		inp[i].onfocus=function(){
			if(this.value==this.getAttribute('rel')){this.value='';}
			else{return false;}
	}
	inp[i].onblur=function(){
		if(this.value==''){this.value=this.getAttribute('rel');}
		else{return false;}}

	}}	
}

// Cue up the onloads
//-----------------------------------
addLoadEvent(searchPromptMSG);
addLoadEvent(clearSearchValues);