<!--
var bDebug = false;
var bLive = true;

var URLarray = document.URL.split("/");
var completeURL = URLarray[0] + "//" + URLarray[2] + "/";

if (completeURL.indexOf("salthillpub.com") != 0) {
	//alert('is live');
	var bLive = true;
	var bDebug = false;
} else {
	alert('testing');	
}
				
// for the Irene benefit
var dat1 = new Date();
var dat2 = new Date("Sep 18 2011 20:00:00");
var val = getcookie("irene_notice");
if(dat1 < dat2 && val != 'no')	{
	var answer = confirm ("Irene Benefit @ Salt hill Pub Lebanon, interested in more information?")
	if (answer) {
		window.location = "http://www.salthillpub.com/Irene_SH_poster.pdf"
	} else {
		setcookie("irene_notice","no",4)
	}
}


// some globals
var getURL = "";
var response = "";
var pcontent =  "";

// mark the DIV to alter
var targetDIV = "LoadThis";

function LoadContent() {
	//alert("LoadContent");
	
	// find querystring
	var qs = new Querystring();
	pcontent = qs.get("view");
	
	if (pcontent == null) {
		pcontent = "main";
	} else {
		pcontent = pcontent.toLowerCase();	
	}

	try {
		// highlight the current nav link
		if (pcontent == "calendarlebanon" || pcontent == "calendarnewport" || pcontent == "calendarhanover") {
			document.getElementById("events").style.color="#FFFFFF";
		} else if (pcontent == "maplebanon" || pcontent == "mapnewport" || pcontent == "maphanover") {
			document.getElementById("directions").style.color="#FFFFFF";
		} else if (pcontent == "menulebanon" || pcontent == "menunewport" || pcontent == "menuhanover") {
			document.getElementById("menu").style.color="#FFFFFF";
		} else if (pcontent == "irishsessions") {
			document.getElementById("events").style.color="#FFFFFF";
		} else if (pcontent == "feedback" || pcontent == "feedbackreview" ) {
			document.getElementById("events").style.color="#FFFFFF";
		} else {	
			document.getElementById(pcontent).style.color="#FFFFFF";
		}
	  }
	catch(err) {
		//Handle errors here
		document.getElementById("main").style.color="#FFFFFF";
	  }

	// update the DIV
	loadXMLDoc(pcontent);
}

function ChangeContent(pName) {
	//tell the user what si going on
	var dispDiv=document.getElementById(targetDIV);
	dispDiv.innerHTML = "Loading...";
	
	// load the DIV
	loadXMLDoc(pName);
}

function loadXMLDoc(pName) {
	//alert("loadXMLDoc(" + pName + ")");
	
	// get the global right
	pcontent = pName 
	
	// make url for data pull
	var time = new Date();
	
	if (bLive) {
		// for real site
		getURL = completeURL + pName + ".php?now=" + time;
	} else {
		// for testing
		getURL = completeURL + "shp/" + pName + ".html?now=" + time;
	}
	
	if (bDebug) alert(getURL);

	// flag default	
	req = false;
	
	// branch for native XMLHttpRequest object
	if(window.XMLHttpRequest) {
		try {
		req = new XMLHttpRequest();
		} catch(e) {
		req = false;
		}
		
	// branch for IE/Windows ActiveX version
	} else if(window.ActiveXObject) {
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				req = false;
			}
		}
	}
	
	// check flag and continue if possible
	if(req) {
		req.onreadystatechange = processReqChange;
		req.open("GET", getURL, true);
		req.send("");
	}
}

function processReqChange() {
	if (bDebug) alert("processReqChange()");
	// only if req shows "loaded"
	if (req.readyState == 4) {
		// only if "OK"
		if (bDebug) alert("readystate is OK");
		if (req.status == 200) {
			if (bDebug) alert("status is OK");
			if (bDebug) alert(req.responseText);
			
			var strCleanHTML = req.responseText;
			
			if (true) {
				// feel the love....!!!!!!!!
				// strip out silly google pages stuff
				//strCleanHTML = strCleanHTML.split('<div id="main-content">')[1];
				strCleanHTML = strCleanHTML.split('<body class="pageContent">')[1];
				//strCleanHTML = strCleanHTML.split('<!-- /main-content -->')[0];
				strCleanHTML = strCleanHTML.split('</body>')[0];
				strCleanHTML = "<div>" + strCleanHTML;
			}			

			if (bDebug) alert("rum and cola targetDIV: "+targetDIV+"\n--------------------------------\nstrCleanHTML:\n"+strCleanHTML);
			// update the data object
			changeInnerHTML(targetDIV,strCleanHTML);
			//var dispDiv=document.getElementById(targetDIV);
			//dispDiv.innerHTML = strCleanHTML;	

		} else {
			if (req.statusText == "Object Not Found" && pcontent != "Main") {
				alert("Sorry, we couldn't not find the " + pcontent + " page, you are being redirected to the Homepage.")
				pcontent = "Main";
				loadXMLDoc(pcontent);
			} else {
				// update the data object
				var dispError= "The Salt hill Pub you requested is still under construction, please check back for " + pcontent + " information <br><br><center><img src='images/under_construction.jpg'></center>";
				changeInnerHTML(targetDIV,dispError);
				//var dispDiv=document.getElementById(targetDIV);
				//var dispError= "The Salt hill Pub you requested is still under construction, please check back for " + pcontent + " information <br><br><center><img src='image_under_construction.jpg'></center>";
				//dispDiv.innerHTML = dispError;
				//alert("The Salt hill Pub you requested is still under construction, please check back for " + pcontent + " information");
			}
		}
	} else {
		if (bDebug) alert("There was a problem finding the data:\n" + req.readyState);		
	}	
}

// querystring code
function Querystring(qs) { // optionally pass a querystring to parse
	this.params = new Object()
	this.get=Querystring_get
	
	if (qs == null)
		qs=location.search.substring(1,location.search.length)

	if (qs.length == 0) return

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ')
	var args = qs.split('&') // parse out name/value pairs separated via &
	
// split out each name=value pair
	for (var i=0;i<args.length;i++) {
		var value;
		var pair = args[i].split('=')
		var name = unescape(pair[0])

		if (pair.length == 2)
			value = unescape(pair[1])
		else
			value = name
		
		this.params[name] = value
	}
}

function Querystring_get(key, default_) {
	// This silly looking line changes UNDEFINED to NULL
	if (default_ == null) default_ = null;
	
	var value=this.params[key]
	if (value==null) value=default_;
	
	return value
}

// hidden div code
	function toggle( targetId ){
		target = document.getElementById( targetId );
		if (target.style.display == ""){
			target.style.display = "none";
		} else {
			target.style.display = "";
		}
	}

// cookie code
	function getexpirydate( nodays){
		var UTCstring;
		Today = new Date();
		nomilli=Date.parse(Today);
		Today.setTime(nomilli+nodays*24*60*60*1000);
		UTCstring = Today.toUTCString();
		return UTCstring;
	}
	
	function getcookie(cookiename) {
		 var cookiestring=""+document.cookie;
		 var index1=cookiestring.indexOf(cookiename);
		 if (index1==-1 || cookiename=="") return ""; 
		 var index2=cookiestring.indexOf(';',index1);
		 if (index2==-1) index2=cookiestring.length; 
		 return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
	}
	
	function setcookie(name,value,duration){
		cookiestring=name+"="+escape(value)+";EXPIRES="+getexpirydate(duration);
		document.cookie=cookiestring;
			if(!getcookie(name)){
			return false;
			}
			else{
	//		location.reload();
		}
	}
	
// hide all text in status window
	function hidestatus(){ 
		window.status='' 
		return true 
		} 
		if (document.layers) 
		document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT) 
		document.onmouseover=hidestatus 
		document.onmouseout=hidestatus 	

// random pic code
var pic, alt;
pic = new Array;
// hover alt tags
alt = new Array;
pic[0] = "images/random/chalkboard.jpg";
alt[0] = "check the entertainment board";
pic[1] = "images/random/copperbar.jpg";
alt[1] = "pint glasses just waiting to be filled";
pic[2] = "images/random/darts.jpg";
alt[2] = "quality dart board";
pic[3] = "images/random/drybar.jpg";
alt[3] = "images";
pic[4] = "images/random/frames.jpg";
alt[4] = "comfortable atmosphere";
pic[5] = "images/random/front.jpg";
alt[5] = "salt hill lebanon";
pic[6] = "images/random/galway.jpg";
alt[6] = "function room and catering available";
pic[7] = "images/random/harpoon.jpg";
alt[7] = "haproon on tap";
pic[8] = "images/random/posters.jpg";
alt[8] = "live entertain 5 nights a week";
pic[9] = "images/random/smuttynose.jpg";
alt[9] = "smuttynose on tap";
pic[10] = "images/random/specials.jpg";
alt[10] = "check out the specials on the way in";
pic[11] = "images/random/table.jpg";
alt[11] = "ample setting";
pic[12] = "images/random/ufolemon.jpg";
alt[12] = "harpoon ufo on tap";

// for the inline script
var ic = pic.length;

var rnow = new Date();
var seed = rnow.getTime() % 0xffffffff;

function rand(n) {
	seed = (0x015a4e35 * seed) % 0x7fffffff;
	return ( seed >> 16 ) % n;
}

// cross browser code
function changeInnerHTML(divId,html){
	if (document.getElementById) {
		document.getElementById(divId).innerHTML= html;
	} else {
		 document.layers[divId].document.open();
		 document.layers[divId].document.write(html);
		 document.layers[divId].document.close();
	}
}

function toggle( targetId ) {
	target = document.getElementById( targetId );
	if (target.style.display == ""){
		target.style.display = "none";
	} else {
		target.style.display = "";
	}
}

function display( targetId ) {
	target = document.getElementById( targetId );
	target.style.display = "";
}

function hide( targetId ) {
	target = document.getElementById( targetId );
	target.style.display = "none";
}
-->
