/*======================================================================*\
|| ####################################################################
|| # Downloaded: 10:42, Tue May 18th 2004
|| # CVS: $RCSfile: vbulletin_global.js,v $ - $Revision: 1.87 $
|| ####################################################################
\*======================================================================*/

// catch possible bugs with WebTV and other older browsers
var is_regexp = (window.RegExp) ? true : false;

// #############################################################################
// let's find out what DOM functions we can use
var vbDOMtype = '';
if (document.getElementById)
{
	vbDOMtype = "std";
}
else if (document.all)
{
	vbDOMtype = "ie4";
}
else if (document.layers)
{
	vbDOMtype = "ns4";
}

// make an array to store cached locations of objects called by fetch_object
var vBobjects = new Array();

// #############################################################################
// function to emulate document.getElementById
function fetch_object(idname, forcefetch)
{
	if (forcefetch || typeof(vBobjects[idname]) == "undefined")
	{
		switch (vbDOMtype)
		{
			case "std":
			{
				vBobjects[idname] = document.getElementById(idname);
			}
			break;

			case "ie4":
			{
				vBobjects[idname] = document.all[idname];
			}
			break;

			case "ns4":
			{
				vBobjects[idname] = document.layers[idname];
			}
			break;
		}
	}
	return vBobjects[idname];
}

// #############################################################################
// ##################### vBulletin Cookie Functions ############################
// #############################################################################

// #############################################################################
// function to set a cookie
function set_cookie(name, value, expires)
{
	if (!expires)
	{
		expires = new Date();
	}
	document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString() +  "; path=/";
}

// #############################################################################
// function to retrieve a cookie
function fetch_cookie(name)
{
	cookie_name = name + "=";
	cookie_length = document.cookie.length;
	cookie_begin = 0;
	while (cookie_begin < cookie_length)
	{
		value_begin = cookie_begin + cookie_name.length;
		if (document.cookie.substring(cookie_begin, value_begin) == cookie_name)
		{
			var value_end = document.cookie.indexOf (";", value_begin);
			if (value_end == -1)
			{
				value_end = cookie_length;
			}
			return unescape(document.cookie.substring(value_begin, value_end));
		}
		cookie_begin = document.cookie.indexOf(" ", cookie_begin) + 1;
		if (cookie_begin == 0)
		{
			break;
		}
	}
	return null;
}

// #############################################################################
// function to delete a cookie
function delete_cookie(name)
{
	var expireNow = new Date();
	document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";
}

// #############################################################################
// ################## vBulletin Collapse HTML Functions ########################
// #############################################################################

// #############################################################################
// function to toggle the collapse state of an object, and save to a cookie
function toggle_collapse(objid)
{
	if (!is_regexp)
	{
		return false;
	}
	
	obj = fetch_object("collapseobj_" + objid);	
	img = fetch_object("collapseimg_" + objid);
	cel = fetch_object("collapsecel_" + objid);
	
	if (!obj)
	{
		// nothing to collapse!
		if (img)
		{
			// hide the clicky image if there is one
			img.style.display = "none";
		}
		return false;
	}

	if (obj.style.display == "none")
	{
		obj.style.display = "";
		save_collapsed(objid, false);
		if (img)
		{
			img_re = new RegExp("_collapsed\\.gif$");
			img.src = img.src.replace(img_re, '.gif');
		}
		if (cel)
		{
			cel_re = new RegExp("^(thead|tcat)(_collapsed)$");
			cel.className = cel.className.replace(cel_re, '$1');
		}
	}
	else
	{
		obj.style.display = "none";
		save_collapsed(objid, true);
		if (img)
		{
			img_re = new RegExp("\\.gif$");
			img.src = img.src.replace(img_re, '_collapsed.gif');
		}
		if (cel)
		{
			cel_re = new RegExp("^(thead|tcat)$");
			cel.className = cel.className.replace(cel_re, '$1_collapsed');
		}
	}
	return false;
}

// #############################################################################
// update vbulletin_collapse cookie with collapse preferences
function save_collapsed(objid, addcollapsed)
{
	var collapsed = fetch_cookie("vbulletin_collapse");
	var tmp = new Array();

	if (collapsed != null)
	{
		collapsed = collapsed.split("\n");

		for (i in collapsed)
		{
			if (collapsed[i] != objid && collapsed[i] != "")
			{
				tmp[tmp.length] = collapsed[i];
			}
		}
	}

	if (addcollapsed)
	{
		tmp[tmp.length] = objid;
	}

	expires = new Date();
	expires.setTime(expires.getTime() + (1000 * 86400 * 365));
	set_cookie("vbulletin_collapse", tmp.join("\n"), expires);
}

/*======================================================================*\
|| ####################################################################
|| # Downloaded: 10:42, Tue May 18th 2004
|| # CVS: $RCSfile: vbulletin_global.js,v $ - $Revision: 1.87 $
|| ####################################################################
\*======================================================================*/



<!-- This is to preload images etc-->
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

<!-- To Sorts the second drop down menu -->

function populateSecond(theFirstMenu,theMenu)
{
theMenu.options.length=0;
var gotOne = false;
with (theMenu)
{
if (theFirstMenu.value=="0")
{
gotOne = true;
options[0]=new Option("Select a category first","-1");
}      
if (theFirstMenu.value=="1")
{
gotOne = true;
options[0]=new Option("All Bar Categories","0");
options[1] = new Option("Bar & Restaurant","1");
options[2] = new Option("Bar, Club & Restaurant","2");
options[3] = new Option("Cocktail Bar","3");
options[4] = new Option("Hotel Bar","4");
options[5] = new Option("Local Bar","5");
}
if (theFirstMenu.value=="2")
{
gotOne = true;
options[0]=new Option("All Club Categories","0");
options[1] = new Option("Club & Bar","6");
options[2] = new Option("Club, Bar & Restaurant","7");
options[3] = new Option("Gentlemens\' Club","8");
options[4] = new Option("Members\' Club","9");
options[5] = new Option("Night Club","10");
}        
if (theFirstMenu.value=="3")
{
gotOne = true;
options[0]=new Option("All Health Categories","0");
options[1] = new Option("Beauty Products","11");
options[2] = new Option("Classes & Courses","12");
options[3] = new Option("Clinic","13");
options[4] = new Option("Health Club","14");
options[5] = new Option("Juice Bar","15");
options[6] = new Option("Salon","16");
}
if (theFirstMenu.value=="4")
{
gotOne = true;
options[0]=new Option("All Hotel Categories","0");
options[1] = new Option("Country Hotel","17");
options[2] = new Option("Town House Hotel","18");
}            
if (theFirstMenu.value=="5")
{
gotOne = true;
options[0]=new Option("All Mens Categories","0");
options[1] = new Option("Allwear Outfitter","19");
options[2] = new Option("Designer Retail Outlet","20");
options[3] = new Option("Designerwear","21");
options[4] = new Option("Formal Footwear","22");
options[5] = new Option("Formalwear","23");
options[6] = new Option("Gifts","24");
options[7] = new Option("Jeanswear","25");
options[8] = new Option("Shirtmaker & Accessories","26");
options[9] = new Option("Sports & Leisurewear","27");
options[10] = new Option("Underwear","28");
}   
if (theFirstMenu.value=="6")
{
gotOne = true;
options[0]=new Option("All Restaurant Categories","0");
options[1] = new Option("African","29");
options[2] = new Option("British","30");
options[3] = new Option("Chinese","31");
options[4] = new Option("European","32");
options[5] = new Option("Fine Dining","33");
options[6] = new Option("Fusion","34");
options[7] = new Option("Global","35");
options[8] = new Option("Indian","36");
options[9] = new Option("Japanese","37");
options[10] = new Option("Middle Eastern","38");
options[11] = new Option("N. & S. American","39");
options[12] = new Option("Russian","40");
options[13] = new Option("South East Asian","41");
}      
if (theFirstMenu.value=="7")
{
gotOne = true;
options[0]=new Option("All Retailers Categories","0");
options[1] = new Option("Entertainment","42");
options[2] = new Option("Food & Wine","43");
options[3] = new Option("House & Garden","44");
options[4] = new Option("Luxury Gifts","45");
options[5] = new Option("Miscellaneous","46");
options[6] = new Option("Motoring","47");
} 
if (theFirstMenu.value=="8")
{
gotOne = true;
options[0]=new Option("All Sports Categories","0");
options[1] = new Option("Stadium","48");
}     
if (theFirstMenu.value=="9")
{
gotOne = true;
options[0]=new Option("All Womens Categories","0");
options[1] = new Option("Accessories","49");
options[2] = new Option("Designer Knitwear","50");
options[3] = new Option("Designer Retail Outlet","51");
options[4] = new Option("Designerwear","52");
options[5] = new Option("Formal Footwear","53");
options[6] = new Option("Formalwear","54");
options[7] = new Option("Gift Boutique","55");
options[8] = new Option("Jeanswear","56");
options[9] = new Option("Lingerie & Underwear","57");
options[10] = new Option("Shirtmaker & Accessories","58");
options[11] = new Option("Sports & Leisurewear","59");
options[12] = new Option("Womens\' Fashion","60");
}    
options[0].selected = true
}
}
function checkVenueSearchForm()
{
if (document.venueSearchForm.subCategoryID.value=="-1")
{
alert("You must choose a category, subcategory or area in order to search.");
document.venueSearchForm.categoryID.focus();
return(false);
}
return(true);
}

<!-- This is to Highlight the Tables -->

var highlightbehavior="TABLE"
var ns6=document.getElementById&&!document.all
var ie=document.all
function changeto(e,highlightcolor){
source=ie? event.srcElement : e.target
if (source.tagName=="TABLE")
return
while(source.tagName!=highlightbehavior && source.tagName!="HTML")
source=ns6? source.parentNode : source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
source.style.backgroundColor=highlightcolor
}
function contains_ns6(master, slave) {
while (slave.parentNode)
if ((slave = slave.parentNode) == master)
return true;
return false;
}
function changeback(e,originalcolor){
if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TR")
return
else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
return
if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
source.style.backgroundColor=originalcolor
}