// Dropdown IE hack
<!--//--><![CDATA[//><!--

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//--><!]]>
// 




// Rollover button code

if (document.images){
	// "On" images
	img1on = new Image();
	img1on.src = "../image/homeOn_red.gif";
	img2on = new Image();
	img2on.src = "image/festiveOn.jpg";
	img3on = new Image();
	img3on.src = "image/dinnerOn.jpg";
	img4on = new Image();
	img4on.src = "image/conferenceOn.jpg";
	img5on = new Image();
	img5on.src = "image/homeOn_red.gif";
	img6on = new Image();
	img6on.src = "image/valentinesOn.gif";
	img7on = new Image();
	img7on.src = "image/mothersdayOn.jpg";
	img8on = new Image();
	img8on.src = "image/steakNightOn.gif";
	img9on = new Image();
	img9on.src = "image/steakNightSmallOn.gif";
	img10on = new Image();
	img10on.src = "image/carverySmallOn.jpg";
	img11on = new Image();
	img11on.src = "image/italianEveningOn.jpg";
	img12on = new Image();
	img12on.src = "image/weddingSmallOn.jpg";
	img13on = new Image();
	img13on.src = "image/stAndrewsSmall_On.jpg";
	img14on = new Image();
	img14on.src = "image/beatlesSmall_On.jpg";
	
	// "Off" images
	img1off = new Image();
	img1off.src = "../image/homeOff_red.gif";
	img2off = new Image();
	img2off.src = "image/festiveOff.jpg";
	img3off = new Image();
	img3off.src = "image/dinnerOff.jpg";
	img4off = new Image();
	img4off.src = "image/conferenceOff.jpg";
	img5off = new Image();
	img5off.src = "image/homeOff_red.gif";
	img6off = new Image();
	img6off.src = "image/valentinesOff.gif";
	img7off = new Image();
	img7off.src = "image/mothersdayOff.jpg";
	img8off = new Image();
	img8off.src = "image/steakNightOff.gif";
	img9off = new Image();
	img9off.src = "image/steakNightSmallOff.gif";
	img10off = new Image();
	img10off.src = "image/carverySmallOff.jpg";
	img11off = new Image();
	img11off.src = "image/italianEveningOff.jpg";
	img12off = new Image();
	img12off.src = "image/weddingSmallOff.jpg";
	img13off = new Image();
	img13off.src = "image/stAndrewsSmall_Off.jpg";
	img14off = new Image();
	img14off.src = "image/beatlesSmall_Off.jpg";
}
function imgOn(imgName){
	if(document.images){
		document.images[imgName].src=eval(imgName+"on.src");
	}
}
function imgOff(imgName){
	if(document.images){
		document.images[imgName].src=eval(imgName+"off.src");
	}
}

/*
	Sends the entered postcode to mapquest to retrieve directions
	
	Uses spawnSite()
*/

function getDirections()

{
	if (document.getElementById) {
		var sourcePostCode = document.getElementById("dPostCode");
		if (sourcePostCode.value == "") {
			alert("You must supply a postcode");
			return;
		}
		sourcePostCode.value = sourcePostCode.value.toUpperCase();
		var sourcePostCodePair = sourcePostCode.value.split(" ");
		var loc1 = "http://maps.google.co.uk/maps?daddr=Houston+Rd,+Crosslee,+Johnstone,+Renfrewshire,+PA6+7AW+(River+Inn)&geocode=13267000977652191761,55.861447,-4.540944&saddr="
		var loc2 = "&f=d&hl=en&dq=the+river+inn&cid=55861447,-4540944,17634250216782605777&ie=UTF8&z=12&om=1";
		var mapLocation = loc1 + sourcePostCodePair[0] + loc2;
		spawnSite(mapLocation);
	}
}

function spawnSite(location)
/*
	Opens a regular window usually for a page request on another domain
	
	USE: <a href="url-to-thing.html" onclick="spawnSite(this.href); return false">blah</a>
	
	IMPORTANT: the "return false" is important as this prevents the clicked link from opening in the new window
	However, if JavaScript is switched off, the requested page will open in the current window and so is more
	accessible.
*/
{
	var winName = "monkey";
	var newWin = window.open(location, winName);
	newWin.focus();
}


// Toggle layer

function toggleLayer( whichLayer )
		{
		  var elem, vis;
		  if( document.getElementById ) // this is the way the standards work
		    elem = document.getElementById( whichLayer );
		  else if( document.all ) // this is the way old msie versions work
		      elem = document.all[whichLayer];
		  else if( document.layers ) // this is the way nn4 works
		    elem = document.layers[whichLayer];
		  vis = elem.style;
		  // if the style.display value is blank we try to figure it out here
		  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
		    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
		  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
		}

// End Toggle layer