//hpci.js
// GLOBAL VARS
self.status = 'Please Wait...';
//var m_sOpenId='home';
var m_sOpenId='';
var m_sPrevId='none';

var m_sHIDELAYER = (document.layers ? 'hide' : 'hidden');
var m_sSHOWLAYER = (document.layers ? 'show' : 'visible');

navimgNames = new Array(
"home",
"amenities",
"rates",
"reservations",
"directions",
"contact",
"links",
"employment"
)
// preload_images
var buttoncnt = navimgNames.length;
var onbtn = new Array(buttoncnt);
var offbtn = new Array(buttoncnt);

for(var i=0;i<buttoncnt;i++) 
{
  onbtn[i] = new Image();
  onbtn[i].src = "./buttons/bn"+navimgNames[i]+"_on.gif" ; 
  offbtn[i] = new Image();
  offbtn[i].src = "./buttons/bn"+navimgNames[i]+"_off.gif" ;
}
// Set Cookie 
var url=location.href;
var lastSlash = url.lastIndexOf("/");
var curPage = url.substring(lastSlash+1,url.length);
var dot = curPage.indexOf(".");
curPage = curPage.substring(0,dot);
/*
if(curPage != "index" && curPage != "menu"){
	if(GetCookie(curPage) != curPage){
		SetCookie("curPage", curPage);
		if(parent.length > 0) {
			parent.frames[1].document.location.href = "menu.html";
		}
	}
}
*/
function rollOver(name){
	if(name == m_sOpenId)
		return;
	if(navigator.usrFamily == "opera" && m_sOpenId == null){
		m_sOpenId = "home";
		document.images[name].src = "./buttons/bn"+name+"_on.gif";
	}		
	if(document.images){
		document.images[m_sOpenId].src = "./buttons/bn"+m_sOpenId+"_off.gif";
		document.images[name].src = "./buttons/bn"+name+"_on.gif";
	}
}
function rollOut(name){
	if(name == m_sOpenId)
		return;
	if(document.images){
		document.images[name].src = "./buttons/bn"+name+"_off.gif";
		document.images[m_sOpenId].src = "./buttons/bn"+m_sOpenId+"_on.gif";
	}
}

function setActivePg(imgName){
	m_sPrevId = m_sOpenId;
	m_sOpenId = imgName;
}
function drillDown(id,optn){
	 rollOver(id);
	 return;
}
function doPrevPage(){
	var url=location.href;
	var lastSlash = url.lastIndexOf("/");
	var curPage = url.substring(lastSlash+1,url.length);
	window.location = "menu.html";	
//	buildNavTable(x);
//	return;
}
function doPrev(){
	if(m_sOpenId != pgName){
		var sCript = '<a href="menu.html",target="menu"></a>';
		m_sOpenId = pgName;
		document.write(sCript);
		window.location = "menu.html";
	}
}	
function buildNavTable(curpage){
	var button = '';
	var s = '' +
	'<table  border="0" cellpadding="0" cellspacing="0" summary="page">' +
  '<tr><td align="center" width="180">' +
  '<table   cellpadding="0" cellspacing="0" border="0" summary="nav table">';
	for(var i=0;i<buttoncnt;i++) 
	{
		s=s+'<tr><td align="center"><a href="' + navimgNames[i]+'.html" target="mainframe" onMouseover="drillDown(\'' +navimgNames[i]+ '\',\'no\');" onclick="setActivePg(\'' +navimgNames[i]+ '\');" onMouseout="rollOut(\'' +navimgNames[i]+ '\');">' +
		'<img  width="158" height="40" name="' +navimgNames[i]+ '" src="';
		button=doButton(curpage, navimgNames[i]);
		s=s+button+'" border="0" alt=""></a></td></tr>';
	}
 	s=s+'<tr><td<img src="./images/spacer.gif" width="1" height="40" border="0" alt=""></td></tr></table></td></tr></table>';
	document.write(s);
}	//End buildNavTable
function doButton(sCurPage,sName){
  var button='';
  if(sName == sCurPage)
    button = "./buttons/bn" + sName + "_on.gif";
  else
		button = "./buttons/bn" + sName + "_off.gif";
  return button;
}
function doPageBottom(){
	var pLine = '';
	pLine +='<br/><br/>';
	pLine +='<p style="text-align:center;" class="pgfooting">Phone:&nbsp; 973-702-1860<br/>&nbsp;&nbsp;&nbsp; Fax:&nbsp; 973-875-8626<br />';
	pLine +='E-mail: <a href="mailto:highptcountryinn@embarqmail.com?subject=Employment" target="_blank">highptcountryinn@embarqmail.com</a></p>';

	document.write(pLine);
}
function doLinkLine(){
	var pLine = '';
	pLine += '<br/>';
	pLine +='<br/><br/><a href="#topofpage"><img src="./images/navtop.gif" width="49" height="24" border="0" alt="Top of Page" /></a>';
	pLine +='<br/><br/><img src="./images/crcards4b.gif" width="206" height="36" border="0" alt="All Major credit cards accepted"/>';
	pLine +='<br/>All Major Credit Cards Accepted';
	pLine +='<br/><br/>';
	pLine += '<p style="text-align:center;" class="linkclass">';
	pLine += '<a href="home.html">Home</a> | ';
	pLine += '<a href="amenities.html">Amenities</a> | ';
	pLine += '<a href="rates.html">Rates</a> | ';
	pLine += '<a href="reservations.html">Reservations</a> | ';
	pLine += '<a href="directions.html">Directions</a> | ';
	pLine += '<a href="contact.html">Contact Us</a> | ';
	pLine += '<a href="links.html">Links</a> | ';
	pLine += '<a href="employment.html">Employment</a></p><br/>';
	document.write(pLine);
} // End doLinkline
function getCompEnv(){
	var screenRes = '';
	var cmptrEnv = 'U.A.=' + navigator.userAgent + ', OS=' + window.navigator.platform + ', CPU=' + window.navigator.cpuClass;
	if ( window.screen ){
		screenRes += window.screen.width; 
		screenRes += 'x'; 
		screenRes += window.screen.height;
	}else{
		screenRes = 'Unknown';
	}
	cmptrEnv += ', Resolution=';
	cmptrEnv += screenRes;
	return cmptrEnv;
} // End getCompEnv

function findCurPageName(){
	var url=location.href;
	var lastSlash = url.lastIndexOf("/");
	var curPageName = url.substring(lastSlash+1,url.length);
	var dot = curPageName.indexOf(".");
	curPagePrefix = curPageName.substring(0,dot);
	return curPageName;
} // End findCurPageName

function doFootingA(userAgent){
	var pLine = '' +
    '<br/><span class="footnote">For best viewing, always use the latest browsers.<br/>' +
    '<a class="footerA" href="http://www.upsdell.com/BrowserNews/find.htm" target="_blank">Click here for FREE browser upgrades</a>.<br/>' +
		'<span class="footnote">Please report any problems viewing this site to the ' +
		'<a class="footnote" href="mailto:'+g_WEBMASTERMAILTO + '?subject=Re: Website=' + g_CLIENTURL + ', Page=' + findCurPageName() + ', ';
	pLine +=getCompEnv();
	pLine += '">Webmaster</a></span><br/><br/>';
	document.write(pLine);
}	//End doFootingA
function doFootingB(){
	var pLine = '';
	pLine +='<table width="100%"  valign="top" cellpadding="0" cellspacing="0" border="0" summary="page footing">';
	pLine +='<tr><td colspan="2"><img class="botline" src="./images/spacer.gif" width="100%" height="2" border="0" alt=""/></td></tr>';
	pLine +='<tr><td align="left" valign="top"><img src="./images/spacer.gif" style="width:50px;height:2em;border:none;" alt="" /></td>';
	pLine +='<td class="footer" align="left" valign="top">&copy;&nbsp;' + g_COPYRIGHT + '.&nbsp;&nbsp;All rights reserved.';
	pLine +='<br/>Please report problems viewing this site as ';
	pLine +='<a class="footnote" href="mailto:'+g_WEBMASTERMAILTO + '?subject=Re: Website=' + g_CLIENTURL + ', Page=' + findCurPageName() + ', ';
	pLine +=getCompEnv();
	pLine +='">Comments to Webmaster</a><br/>';
	var sLine= 'Site last modified ' + g_sLASTUPDATE + ', Reviewed ' + g_sLASTREVIEW + '&nbsp;by ' +
		'<a class="footer" href="' + g_WEBMASTERURL + '" target="_blank">' + g_WEBMASTERNM + '</a>&nbsp; ' + 	
		'</td></tr></table>';
	pLine += sLine;
	document.write(pLine);
}	//End doFootingB
function doBackDoor(pageName,pgWidth){
	var sCopy = '';
	if(parent.length == 0) {
		if(!pgWidth){pgWidth = '600';}
		sCopy += '<table width="' + pgWidth + '" bgcolor="#999966" align="center" cellspacing="0" cellpadding="2" border="0">';	
		sCopy += '<tr><td width="40" class="cTitle"><a href="index.html" onmouseover="this.className=\'cButton1\';" onmouseout="this.className=\'cButton0\';" class="cButton0">Home</a></td>';
		sCopy += '<td align="center" width="' + pgWidth + '" class="cTitle">High Point Country Inn of Sussex County, NJ - ' + pageName + '</td>';
		sCopy += '<td width="40" class="cTitle"><a href="index.html" onmouseover="this.className=\'cButton1\';" onmouseout="this.className=\'cButton0\';" class="cButton0">Home</a></td></tr></table></td></tr>';
		sCopy += '</table>';
		document.write(sCopy);
	}
}	//End doBackDoor

function openPopupWindow(url, winWidth, winHeight, winName) {
	var W=winWidth;
	var H=winHeight;
	var X_unrounded=(screen.availWidth/2)-(winWidth/2);
	var Y_unrounded=(screen.availHeight/2) - (winHeight/2);
	
	var X=Math.round(X_unrounded); 
	var Y=Math.round(Y_unrounded);
	
	var popUpName = ''; 
	if(winName) popUpName = winName;	// If winName is available, use it
	else if(typeof g_PopUpName != 'undefined') popUpName = g_PopUpName;	// if popup name is still null and a global name is available, use it
	else popUpName = 'DEFLT';					// Default Window Name
	
	winWidth += 30;		// allow for scroll bar width
	winHeight += 30;	// allow for scroll bar height
	var winParms = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' + winWidth + ',height=' + winHeight + ',Left=' + X + ',Top=' + Y + ',left=' + X + ',top=' + Y;

	var htmlcode='';
	htmlcode='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"';
  htmlcode+='"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
  htmlcode+='<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">';
	htmlcode+='<head><title>&nbsp;</title>';
	htmlcode+='<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />';
	htmlcode+='<meta http-equiv="Content-language" content="en-US" />';
	htmlcode+='<body style="font-family:Arial,Verdana,Helvetica,Geneva,sans-serif;font-size:12px;font-weight:bold;background-color:#003366;color:#ffffff;margin:0px 4px 4px 4px;text-align:center;">';
	htmlcode+='Click Image to Close Window<br />';
	htmlcode+='<a href="javascript:window.close();"><img src="' + url + '" style="border:#009900 3px solid;" alt="" /></a>';
	htmlcode+='</body></html>';

	var ran_unrounded=Math.random()*100;									// Generate a random number from 1 - 100
	var ran_number=Math.round(ran_unrounded); 
	var randomname = popUpName+ran_number;								// Append the random number to the window name
	
	var winObj = window.open(url, randomname, winParms);	// Create window object
	winObj.document.writeln(htmlcode);										// Send the html code generated above to the window
	return;
}	// End openPopupWindow

function openRemote(url,winName,winWidth,winHeight,x,y)
{
var dom=(document.getElementById); //modern dom browsers
var iebrowser=document.all;

	var W=winWidth;
	var H=winHeight;
	var X_unrounded=(screen.availWidth/2)-(winWidth/2);
	var Y_unrounded=(screen.availHeight/2) - (winHeight/2);
	var X=Math.round(X_unrounded); 
	var Y=Math.round(Y_unrounded); 

//	window.open("./gallery/"+url,"REMOTEpopup","width="+W+",height="+H+",screenX="+X+",screenY="+Y+",left="+X+",top="+Y+",dependent=0,directories=0,location=0,menubar=0,personalbar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0")

//	var winParms = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=' + winWidth + ',height=' + winHeight';
	var winParms = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' + winWidth + ',height=' + winHeight + ',Left=' + X + ',Top=' + Y + ',left=' + X + ',top=' + Y;

	var ran_unrounded=Math.random()*100;
	var ran_number=Math.round(ran_unrounded); 
	var randomName = winName+ran_number;

	var winObj = window.open(url,randomName,winParms);
	if(!winObj)
		return;
	winObj.focus;
//	if(winObj.opener == null){
//		winObj.opener = window;
//	}

	return;
}	//End openRemote
self.status='';
