//browse sniffer and loader of stylesheet & nav system
if (document.layers) {
	//Netscape 4
		document.write("<link rel='stylesheet' type='text/css' href='/rydges_ns4.css'>");
	//Render the DHTML stylesheet
		document.write("<link rel='stylesheet' type='text/css' href='/rydges_dhtml.css'>");
} else if(document.all) {
	//IE
	document.write("<link rel='stylesheet' type='text/css' href='/rydges.css'>");
	//Render the DHTML stylesheet
		document.write("<link rel='stylesheet' type='text/css' href='/rydges_dhtml.css'>");
} else if(document.getElementById) {
	//Netscape 6
	document.write("<link rel='stylesheet' type='text/css' href='/rydges.css'>");
	//Render the DHTML stylesheet
		document.write("<link rel='stylesheet' type='text/css' href='/rydges_dhtml.css'>");
} else {
	//Older than 4.0 browser
}

//Generic button rollover script
function buttonroll(state, whichnav) {
if (document.all) {
	if (state==0) eval(whichnav).src = "/images/nav/" + whichnav + ".gif";
	if (state==1) eval(whichnav).src = "/images/nav/" + whichnav + "_on.gif";
} else {
	if (state==0) document.getElementById(whichnav).src = "/images/nav/" + whichnav + ".gif";
	if (state==1) document.getElementById(whichnav).src = "/images/nav/" + whichnav + "_on.gif";
}
}

//Terms and conditions hider for RPG section
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';
}

//Generic form filler here
function deltext(what) {
	 what.value="";
}

function genPopWin(url, top, left, width, height) {
	window.open(url, 'rhrPop', 'top='+top+', left='+left+', width='+width+', height='+height+', scrollbars=yes, location=no, address=no');
}

//HELP POP OUT
function popHelp(help) {
	window.open('/popHelp.asp?help='+help, 'help', 'top=100, left=100, width=450, height=250, scrollbars=yes, location=no, address=no');
}

//LOCATIONS POP-OUT PRINT WINDOW
function Factsheet(hotel) {
	window.open('/locations/factsheet.asp?hotel='+hotel, 'rydgeslocations', 'top=100, left=100, width=550, height=450, scrollbars=yes, status=yes, location=no, address=no');
}

//LOCATIONS POP-OUT PRINT WINDOW
function popPrint(hotel) {
	window.open('/locations/locationsprintpage.asp?hotel='+hotel, 'rydgeslocations', 'top=100, left=100, width=550, height=450, scrollbars=yes, status=yes, location=no, address=no');
}

//LOCATIONS THUMBNAIL POP-OUT WINDOW
function popGallery(imagename, hotelcode) {
	window.open('locationsgallerypop.asp?imagename='+imagename+'&hotel='+hotelcode, 'rydgesimages', 'top=100, left=100, width=551, height=325, scrollbars=no, location=no, address=no');
}

//IPIX POP-OUT WINDOW
function ipixPop(imagename) {
	window.open('/locations/ipixPop.asp?ipix='+imagename, 'rydgesimages', 'top=10, left=10, width=400, height=360, scrollbars=no, location=no, address=no');
}

//.MOV POP-OUT WINDOW
function movPop(imagename) {
	window.open('/locations/movPop.asp?ipix='+imagename, 'rydgesimages', 'top=10, left=10, width=530, height=480, scrollbars=no, location=no, address=no');
}

//JAVASCRIPT EMAIL CHECKER
function isEmail(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    //alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
}


function promoroll(whichnav, state) {
	if (state==0) whichnav.className='promooff';
	if (state==1) whichnav.className='promoon';
}

function promoratroll(whichnav, state) {
	if (state==0) whichnav.className='promoratoff';
	if (state==1) whichnav.className='promoraton';
}

function promowedroll(whichnav, state) {
	if (state==0) whichnav.className='promowedoff';
	if (state==1) whichnav.className='promowedon';
}

function promomeeroll(whichnav, state) {
	if (state==0) whichnav.className='promomeeoff';
	if (state==1) whichnav.className='promomeeon';
}

function promovenueroll(whichnav, state) {
	if (state==0) whichnav.className='promovenueoff';
	if (state==1) whichnav.className='promovenueeon';
}

function promoholroll(whichnav, state) {
	if (state==0) whichnav.className='promoholoff';
	if (state==1) whichnav.className='promoholon';
}

function promordiroll(whichnav, state) {
	if (state==0) whichnav.className='promordioff';
	if (state==1) whichnav.className='promordion';
}

function promoloccsroll(whichnav, state) {
	if (state==0) whichnav.className='promoloccsoff';
	if (state==1) whichnav.className='promoloccson';
}

function promoloccs_subroll(whichnav, state) {
	if (state==0) whichnav.className='promoloccs_suboff';
	if (state==1) whichnav.className='promoloccs_subon';
}

function promolocre_subroll(whichnav, state) {
	if (state==0) whichnav.className='promolocre_suboff';
	if (state==1) whichnav.className='promolocre_subon';
}

function promolocbo_subroll(whichnav, state) {
	if (state==0) whichnav.className='promolocbo_suboff';
	if (state==1) whichnav.className='promolocbo_subon';
}

function promolocreroll(whichnav, state) {
	if (state==0) whichnav.className='promolocreoff';
	if (state==1) whichnav.className='promolocreon';
}

function promolocboroll(whichnav, state) {
	if (state==0) whichnav.className='promolocbooff';
	if (state==1) whichnav.className='promolocboon';
}

function promolocbotroll(whichnav, state) {
	if (state==0) whichnav.className='promolocbotoff';
	if (state==1) whichnav.className='promolocboton';
}

function promolocbotroll_re(whichnav, state) {
	if (state==0) whichnav.className='promolocbotreoff';
	if (state==1) whichnav.className='promolocbotreon';
}

function showLoginPanel() {
	document.getElementById('loginPanel').style.display = 'inline';
}

function hideLoginPanel() {
	document.getElementById('loginPanel').style.display = 'none';
}