function RRwin(theUrl)
{
	var winWidth = 506;
	var winHeight = 380;
	
	var maxWidth = screen.availWidth;
	var maxHeight = screen.availHeight;
	topCoord = (maxHeight/2 - (winHeight/2));
	leftCoord = ((maxWidth/2) - (winWidth/2));
	var newHeight = maxHeight > winHeight?winHeight:maxHeight;
	
	var features = "menubar=yes,scrollbars=yes,resizeable=yes,width="+winWidth+",height="+newHeight+",left="+leftCoord+",top="+topCoord;
	window.open(theUrl, 'popwin', features);
}

function check_form()
{
	var returnvalue = true;
	var required = new Array("name",
							"address",
							"postcode",
							"telephone",
							"email_address");
	//var alertText = "nothing";
	for(i = 0; i < (required.length - 1); i++)
	{
		var skip = document.forms['registration'][required[i]];
		if(skip.value == '')
		{
			var readableElement = "this";
			readableElement = required[i].replace(/_/g," ");
			var alertText = ("Please complete the following field: " + readableElement);
			skip.focus();
			returnvalue = false;
			break;
		}
	}
	if(alertText)
	{
		alert(alertText);
	}
	return returnvalue;
}

var ns = (navigator.appName.indexOf('Netscape')>-1);
var ie = (navigator.appName.indexOf('Microsoft Internet Explorer')>-1);

function navRollovers()
{
	var strMatch;
	var elm;
	var locationStr = window.location.href;
	var pageArray = new Array(
					 new Array	(1,'home'		,'index|hotel|gallery|postcards|reservation|[a-z_]*-?gallery')
					,new Array	(1,'din'		,'dining|experience')
					,new Array 	(1,'fou'		,'four_seasons')
					,new Array 	(1,'gre'		,'great_outdoors')
					,new Array 	(1,'sho'		,'shooting')
					,new Array 	(1,'fis'		,'fishing')
					,new Array 	(1,'wed'		,'weddings')
					,new Array 	(1,'tao'		,'tariff_and_offers|tariff|offers|tandcs')
					,new Array 	(1,'con'		,'contact')
					,new Array 	(2,'hot'		,'index|hotel'				,'index|hotel|[a-z_]*-?gallery|postcards|reservation')
					,new Array 	(2,'gal'		,'[a-z_]*-?gallery'			,'index|hotel|[a-z_]*-?gallery|postcards|reservation')
					,new Array 	(2,'pos'		,'postcards'				,'index|hotel|[a-z_]*-?gallery|postcards|reservation')
					,new Array 	(2,'res'		,'reservation'				,'index|hotel|[a-z_]*-?gallery|postcards|reservation')
					,new Array 	(2,'exp'		,'dining|experience'		,'dining|experience')
					,new Array 	(2,'res2'		,''							,'dining|experience')
					,new Array 	(2,'tar'		,'tariff|tariff_and_offers'	,'tariff|tariff_and_offers|offers|tandcs')
					,new Array 	(2,'off'		,'offers'					,'tariff|tariff_and_offers|offers|tandcs')
					,new Array 	(2,'tacs'		,'tandcs'					,'tariff|tariff_and_offers|offers|tandcs')
				);
	
	for(i = 0; i < pageArray.length; i++)
	{
		strMatch = new RegExp("/("+pageArray[i][2]+")\\.(html|php)", "i");
		
		m = locationStr.search(strMatch);
		if(m > -1)
		{
			if(elm = document.getElementById('nav_'+pageArray[i][1]))
			{
				elm.className = 'level'+(pageArray[i][0])+'NavOver';
			}
		}
		
		if(pageArray[i][3]){
			oMatch = new RegExp("/("+pageArray[i][3]+")\\.(html|php)", "i");
			o = locationStr.search(oMatch);
			if(o < 0){
				if(elm = document.getElementById('nav_'+pageArray[i][1]))
				{
					elm.style.display = 'none';
				}
			}
		}
	}
	
}

function add_stylesheet()
{
	//alert("adding stylesheet");
	newSS=document.createElement('link');
	newSS.rel='stylesheet';
	newSS.type='text/css';
	newSS.href='text-style.css';
	newSS.id='text-stylesheet';
	document.documentElement.childNodes[0].appendChild(newSS);
	//alert("added");
	//alert(document.getElementById('text-stylesheet'));
}

function switch_styles()
{
	var newSS;
	newSS=document.getElementById('text-stylesheet');
	if(newSS)
	{
		//alert("text sylesheet exists");
		newSS.href=null;
		document.documentElement.childNodes[0].removeChild(newSS);
		document.cookie = "HowardStyleSheet=styled;";
	}
	else
	{
		//alert("adding text stylesheet");
		add_stylesheet();
		
		// set cookie here
		document.cookie = "HowardStyleSheet=accessible;";
		//alert("added");
	}
}

function preload_images()
{
	// we need to start loading images for the other pages once this page has loaded.
	// It'll help speed up the loading on subsequent pages.
	return;

}
if(document.cookie)
{
	var cookieValue = document.cookie;
	//alert(cookieValue);
	var cookieStartsAt = cookieValue.indexOf("HowardStyleSheet=");
	cookieStartsAt = cookieValue.indexOf("=", cookieStartsAt)+1;
	var cookieEndsAt = cookieValue.indexOf(";", cookieStartsAt);
	if(cookieEndsAt == -1)
	{
		cookieEndsAt = cookieValue.length;
	}
	cookieValue = unescape(cookieValue.substring(cookieStartsAt, cookieEndsAt));
	//alert(cookieValue);
	
	if(cookieValue == "accessible")
	{
		add_stylesheet();
	}
}
