function expandIt(featuredImage){
	var BodyHht=document.getElementById("viewInnDetails"+featuredImage).offsetHeight;
	newHeight=BodyHht+200;
	document.getElementById("viewInnDetails"+featuredImage).style.height=newHeight+"px";
}
function shrinkIt(featuredImage){
	var BodyHht=document.getElementById("viewInnDetails"+featuredImage).offsetHeight;
	newHeight=BodyHht-200;
	document.getElementById("viewInnDetails"+featuredImage).style.height=newHeight+"px";
}
function calcLeftBarHeight(divId){
	
var adminBodyHht=document.getElementById(divId).offsetHeight;
if(adminBodyHht<869){
	adminBodyHht=869;
	document.getElementById(divId).style.height=adminBodyHht+"px";	
	
}
if(adminBodyHht<document.getElementById('pdRight').offsetHeight){
	adminBodyHht=document.getElementById('pdRight').offsetHeight+115;
	document.getElementById(divId).style.height=adminBodyHht+"px";	
	
}
var theBodyHht=document.getElementById('mainWrapper').offsetHeight;
if(theBodyHht>1500){
	extra=115;
}
else{
	extra=33;
}
document.getElementById('leftBar').style.height=theBodyHht+extra+"px";
//alert("Here");
}




function calcLeftBarHeightAdmin(divId){
	
 adminBodyHht=document.getElementById(divId).offsetHeight;
if(adminBodyHht<869){
	adminBodyHht=869;
	document.getElementById(divId).style.height=adminBodyHht+"px";	
}
var theBodyHht=document.getElementById('mainWrapper').offsetHeight;
document.getElementById('leftBar').style.height=adminBodyHht+330+"px";

}

function calcLeftBarHeightIE(divId){
document.getElementById('bttmRow').style.marginTop="-12px";
theLeftHht=document.getElementById('leftBar').offsetHeight;
document.getElementById('leftBar').style.height=theLeftHht+33+"px";
}

function calcLeftBarHeightStatic(divId){
	
 adminBodyHht=document.getElementById(divId).offsetHeight;
if(adminBodyHht<623){
	adminBodyHht=623;
	document.getElementById(divId).style.height=adminBodyHht+"px";	
}
var theBodyHht=document.getElementById('mainWrapper').offsetHeight;
document.getElementById('leftBar').style.height=theBodyHht+33+"px";
}


function calcLeftBarHeightFindInn(divId){
document.getElementById(divId).style.height=adminBodyHht-230+"px";
adminBodyHht=document.getElementById(divId).offsetHeight;
if(adminBodyHht<869){
	adminBodyHht=869;
	document.getElementById(divId).style.height=adminBodyHht+"px";	
}
var theBodyHht=document.getElementById('mainWrapper').offsetHeight;
document.getElementById('leftBar').style.height=theBodyHht+33+"px";
}



function getCurrentlyViewed(){
		linkToGet=window.location.hash.replace("#featured","");
		
		if(!linkToGet){
			linkToGet=1;
		}
		divId="featured"+linkToGet;
		innId=document.getElementById(divId).value;
		window.location="http://bbgetaways.com/view_inn.php?InnId="+innId;
	
}
function addClass(element, value) {
	if (!element.className) {
		element.className = value;
	} else {
		var newClassName = element.className;
		newClassName += " ";
		newClassName += value;
		element.className = newClassName;
	}
}

function resizePanel() {

	width = $(window).width();
	height = $(window).height();

	mask_width = width * $('.item').length;
		
	$('#debug').html(width  + ' ' + height + ' ' + mask_width);
		
	$('#wrapper, .item').css({width: width, height: height});
	$('#mask').css({width: mask_width, height: height});
	$('#wrapper').scrollTo($('a.selected').attr('href'), 0);

	
}

function showPhone(id,InnId){
	linkId="phoneLink"+id;
	numId="phoneNum"+id;
	document.getElementById(linkId).style.display="none";
	document.getElementById(numId).style.display="block";
	window.frames['fauxAjax'].location = "/assets/updateAnalytics.php?Action=Phone&InnId="+InnId; 
}
function updateWebVisits(InnId){
		window.frames['fauxAjax'].location = "/assets/updateAnalytics.php?Action=WebVisits&InnId="+InnId; 
}

function updateViews(InnId){
		window.frames['fauxAjax'].location = "/assets/updateAnalytics.php?Action=Views&InnId="+InnId; 
}

function clearSDR(Row){
	priceToChange="SDRPrice"+Row;
	dateToChange="SpecialpopupDatepicker"+Row;
	nightToChange="SDRNights"+Row;
	document.getElementById(priceToChange).value="";
	document.getElementById(dateToChange).value="";
	document.getElementById(nightToChange).selectedIndex =0;
	
}
function clearA(Row){
	dateToChangeA="AvailabilitypopupDatepickerA"+Row;
	dateToChangeB="AvailabilitypopupDatepickerB"+Row;
	document.getElementById(dateToChangeA).value="";
	document.getElementById(dateToChangeB).value="";
	
}
function swapBreakfast(state){
if(state=="on"){
document.getElementById("breakfastImg").src="../images/meals-Yes.png";
}
if(state=="off"){
document.getElementById("breakfastImg").src="../images/meals-No.png";
}
}
function swapKids(state){
if(state=="on"){
document.getElementById("kidsImg").src="../images/children-Yes.png";
}
if(state=="off"){
document.getElementById("kidsImg").src="../images/children-No.png";
}
}
function swapSmoking(state){
if(state=="on"){
document.getElementById("smokingImg").src="../images/smoking-Yes.png";
}
if(state=="off"){
document.getElementById("smokingImg").src="../images/smoking-No.png";
}
}
function swapPets(state){
if(state=="on"){
document.getElementById("petsImg").src="../images/pets-Yes.png";
}
if(state=="off"){
document.getElementById("petsImg").src="../images/pets-No.png";
}
}
function clearTextFeild(textFeildName){
	document.getElementById(textFeildName).value="";
}
	//use this for showing/adding hidden rows
	
	/*for(i=4;i<11;i++){
		rowToCheck="IRA"+i;
		if(document.getElementById(rowToCheck).style.display=="none"){
			document.getElementById(rowToCheck).style.display="block";
			break;
		}
	}*/
function clearMinMax(textFeildName){
	if(textFeildName=="rateMin" && document.getElementById(textFeildName).value=="min"){
	document.getElementById(textFeildName).value="";
	}
	if(textFeildName=="rateMax" && document.getElementById(textFeildName).value=="max"){
	document.getElementById(textFeildName).value="";
	}
}

function checkIt(evt) {
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57 ) && charCode!=46) {
        status = "This field accepts numbers only."
        return false
    }
    status = ""
    return true
}
function checkZip(evt) {
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57 ) ) {
        status = "This field accepts numbers only."
        return false
    }
    status = ""
    return true
}
function deletePic(id){
	
	doyou = confirm('Are you sure you want to delete this Image? (OK = Yes   Cancel = No)');
		if(doyou == true){  
		document.getElementById(id).style.display="none";
	window.frames['imgUpdateDb'].location = "imgUpdateDB.php?Action=Delete&fileId="+id; 
					calcLeftBarHeight("adminArea"); 
		}		
		if(doyou == false){  
		//do nothing 
		}
	
	
	
	 
}
function editCaption(id){
	//alert (document.getElementById(id).innerHTML );
	textDiv="editableText"+id;
		picTools="pictureTools"+id;
	oldText=document.getElementById(textDiv).innerHTML;
	var textarea = '<span style="color:blue">New Image Caption</span><br /><input name="textfield" type="text" id="newCaption'+id+'" class="captionTxt" value="'+oldText+'"  onfocus="clearTextFeild(\'newCaption'+id+'\')"/>';
var button	 = '<input name="SAVE" type="image" id="SAVE" value="SAVE" src="../images/saveIcon.jpg"  class="saveButton" onclick="saveCaption(\''+id+'\')" /> <input name="CANCEL" type="image" id="CANCEL" value="CANCEL" src="../images/cancelIcon.jpg" class="cancelButton" onclick="cancelChanges(\''+oldText+'\',\''+id+'\')"/>';
document.getElementById(picTools).style.display="none";
document.getElementById(textDiv).innerHTML=textarea+button;

}

function cancelChanges(oldText,id){

	picTools="pictureTools"+id;
	textDiv="editableText"+id;
	document.getElementById(picTools).style.display="block"
	document.getElementById(textDiv).innerHTML=oldText;
}
function saveCaption(id){
		
	picTools="pictureTools"+id;
	textBoxDiv="newCaption"+id;
	textDiv="editableText"+id;
	newText=document.getElementById(textBoxDiv).value;
	document.getElementById(picTools).style.display="block"
	document.getElementById(textDiv).innerHTML=newText;
	window.frames['imgUpdateDb'].location = "imgUpdateDB.php?Action=SaveCaption&fileId="+id+"&Caption="+newText; 
}

function AddNewSpecialDateRate(){
	spclCounter=Number(document.getElementById('NumSpclDateRates').value)+1;
	$('<span style="margin:0 3 0 3px;">$ </span><input name="SDRPrice'+spclCounter+'" type="text"  class="textbox" id="SDRPrice'+spclCounter+'" value="" size="10" onkeypress="return checkIt(event);" /><select name="SDRNights'+spclCounter+'" id="SDRNights'+spclCounter+'" style="width:92px; margin:0 0 0 23px;" ><option value="">Select</option><option value="1" >1 night min</option><option value="2" >2 night min</option><option value="0">Not Open</option></select><input  class="SpecialpopupDatepicker" name="SpecialpopupDatepicker'+spclCounter+'" type="text" id="SpecialpopupDatepicker'+spclCounter+'"   style="width:92px; margin:0 0 0 23px;" value="" readonly="true"/><a href="javascript:clearSDR(\''+spclCounter+'\');" style="padding-left:5px;">clear</a><br />').appendTo('#specialDateRatesWrapper');
	$('#SpecialpopupDatepicker'+spclCounter).datepick({
					inline: true,
					showOn: 'both', buttonImage: '../images/calendar2.png', buttonImageOnly: true, minDate: new Date(), minDate: new Date()
				});
	document.getElementById('NumSpclDateRates').value=spclCounter+1;
	calcLeftBarHeight("adminArea");
}


function AddNewAvailabilty(){
	avlCounter=Number(document.getElementById('AvailabityCntr').value)+1;
	$('<span style="margin:0 3 0 3px;">-<input name="AvailabilitypopupDatepickerA'+avlCounter+'" type="text"  class="textbox" id="AvailabilitypopupDatepickerA'+avlCounter+'" style="width:92px; margin:0 23 0 0px;" value="" size="10" /><span style="margin:0 10px 0 10px;"> to</span><input name="AvailabilitypopupDatepickerB'+avlCounter+'" type="text"  class="textbox" id="AvailabilitypopupDatepickerB'+avlCounter+'" style="width:92px; margin:0 0 0 0px;" value="" size="10" /> <a href="javascript:clearA(\''+avlCounter+'\');">clear</a></span><br />').appendTo('#AvailabiltiyWrapper');
	$('#AvailabilitypopupDatepickerA'+avlCounter).datepick({
					inline: true,
					showOn: 'both', buttonImage: '../images/calendar2.png', buttonImageOnly: true, minDate: new Date(), minDate: new Date()
				});
	$('#AvailabilitypopupDatepickerB'+avlCounter).datepick({
					inline: true,
					showOn: 'both', buttonImage: '../images/calendar2.png', buttonImageOnly: true, minDate: new Date(), minDate: new Date()
				});
	document.getElementById('AvailabityCntr').value=avlCounter+1;
	calcLeftBarHeight("adminArea");
}

// Example:

// writeCookie("myCookie", "my name", 24);

// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.

function writeCookie(name, value, hours)

{

  var expire = "";

  if(hours != null)

  {

    expire = new Date((new Date()).getTime() + hours * 3600000);

    expire = "; expires=" + expire.toGMTString()+"; path=/";

  }

  document.cookie = name + "=" + escape(value) + expire;

}


function readCookie(name) {
				var nameEQ = name + "=";
				var ca = document.cookie.split(';');
				for(var i=0;i < ca.length;i++) {
					var c = ca[i];
					while (c.charAt(0)==' ') c = c.substring(1,c.length);
					if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
				}
				return null;
			}


	
function timedRefresh(timeoutPeriod) {
	setTimeout("location.reload(true);",timeoutPeriod);
}
		
function signOutInnSeeker()
{
hours=-1000000000000000;
var expire = "";
if(hours != null)
{
expire = new Date((new Date()).getTime() + hours );
expire = "; expires=" + expire.toGMTString()+";path=/";
}
tempCookieName="InnSeekerId";
tempCookieValues="";
document.cookie = tempCookieName+ "=" + escape(tempCookieValues) + expire;
tempCookieName="NewsletterSubscriber";
document.cookie = tempCookieName+ "=" + escape(tempCookieValues) + expire;
showLoggedIn();
 }	
 
 
 function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function isLoggedIn(InnSeekerName){
		document.getElementById('InnSeekerWrapper').innerHTML='Welcome back '+InnSeekerName+'. &nbsp; <a href="#" onclick="signOutInnSeeker();">Sign Out</a> &nbsp;|&nbsp; <a href="/my_account.php">Manage Account</a>';
}
function isLoggedInFB(InnSeekerName,PicId){
		document.getElementById('InnSeekerWrapper').innerHTML='<img src="https://graph.facebook.com/'+PicId+'/picture" width="30" hieght="30" align="absmiddle" style="margin-top:-7px;"> Welcome back '+InnSeekerName+'. &nbsp; <a href="#" onclick="signOutInnSeeker();">Sign Out</a> &nbsp;|&nbsp; <a href="/my_account.php">Manage Account</a>';
}

function showLoggedIn(){
	if(readCookie("InnSeekerId")){
		
		var mySplitInnSeekerId =readCookie("InnSeekerId").split("---...---");
 var myNewString =mySplitInnSeekerId[1].replace("+", " ");
document.getElementById('InnSeekerWrapper').innerHTML='Not '+myNewString+'? <a href="#" onclick="signOutInnSeeker();">Sign Out</a>&nbsp; |&nbsp; <a href="/my_account.php">Manage Account</a>';	
	}
	else{
		
		document.getElementById('InnSeekerWrapper').innerHTML="<a href='#' onclick='logInInnKeepers(\"LogIn\");'>InnSeeker Login</a>";
		subscribedToNews();
		//document.getElementById("signUpForm").style.display="block";
		//document.getElementById("successText").style.display="none";
	}
}

function updateResultsCount(Num){
	
	document.getElementById('resultsCount').innerHTML=""+Num+"";
}
function lookup1(inputString) {
	
		if(inputString.length == 0) {
			// Hide the suggestion box.
			$('#suggestions1').hide();
		} else {
			$.post("/assets/findCity.php", {queryString: ""+inputString+"", numField: "1"}, function(data){
				if(data.length >0) {
					$('#suggestions1').show();
					$('#autoSuggestionsList1').html(data);
				}
			});
		}
	} // lookup
	
	function fill1(thisValue) {
		
		if(thisValue){
		splitString=thisValue.split("#");
		$('#City').val(splitString[0]);
		selectState(splitString[1],"1");
		}
		setTimeout("$('#suggestions1').hide();", 200);
		
	}



function lookup2(inputString) {
		if(inputString.length == 0) {
			// Hide the suggestion box.
			$('#suggestions2').hide();
		} else {
			$.post("/assets/findCity.php", {queryString: ""+inputString+"", numField: "2"}, function(data){
				if(data.length >0) {
					$('#suggestions2').show();
					$('#autoSuggestionsList2').html(data);
				}
			});
		}
	} // lookup
	
	function fill2(thisValue) {
		if(thisValue){
		splitString=thisValue.split("#")
		$('#inputString2').val(splitString[0]);
		document.getElementById('Zip2').value=splitString[2];
		//document.getElementById('_City').value=splitString[0];
		selectState(splitString[1],"2");
		}
		setTimeout("$('#suggestions2').hide();", 200);
	}
	
	function lookup3(inputString) {
		if(inputString.length == 0) {
			// Hide the suggestion box.
			$('#suggestions3').hide();
		} else {
			$.post("/assets/findCity.php", {queryString: ""+inputString+"", numField: "3"}, function(data){
				if(data.length >0) {
					$('#suggestions3').show();
					$('#autoSuggestionsList3').html(data);
				}
			});
		}
	} // lookup
	
	function fill3(thisValue) {
		if(thisValue){
		splitString=thisValue.split("#")
		$('#inputString3').val(splitString[0]);
		selectState(splitString[1],"3");
		}
		setTimeout("$('#suggestions3').hide();", 200);
	}
	
	
	function lookup4(inputString,sessionId) {
		
		if(inputString.length == 0) {
			// Hide the suggestion box.
			$('#suggestions4').hide();
		} else {
			$.post("/assets/findGuest.php", {queryString: ""+inputString+"", numField: sessionId}, function(data){
				if(data.length >0) {
					$('#suggestions4').show();
					$('#autoSuggestionsList4').html(data);
				}
			});
		}
	} // lookup
	
	function fill4(thisValue) {
		
		if(thisValue){
		splitString=thisValue.split("#")
		$('#inputString4').val(splitString[0]);
		//selectState(splitString[1],"2");
		
		}
		setTimeout("$('#suggestions4').hide();", 200);
	}
	
	function lookup5(inputString) {
		if(inputString.length == 0) {
			// Hide the suggestion box.
			$('#suggestions5').hide();
		} else {
			$.post("/assets/findCity.php", {queryString: ""+inputString+"", numField: "5"}, function(data){
				if(data.length >0) {
					$('#suggestions5').show();
					$('#autoSuggestionsList5').html(data);
				}
			});
		}
	} // lookup
	
	function fill5(thisValue) {
		if(thisValue){
		splitString=thisValue.split("#")
		$('#inputString5').val(splitString[0]);
		selectState(splitString[1],"5");
		}
		setTimeout("$('#suggestions5').hide();", 200);
	}
	
	function selectState(value,fieldNum){
		
		var statesArray=["NA","AK","AL","AR","AZ","CA","CO","CT","DC","DE","FL","GA","HI","IA","ID","IL","IN","KS","KY","LA","MA","MD","ME","MI","MN","MO","MS","MT","NC","ND","NE","NH","NJ","NM","NV","NY","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VA","VT","WA","WI","WV","WY"]; 
		
		selectedIndexToUse = statesArray.indexOf(value);
		document.getElementById('states'+fieldNum).selectedIndex =selectedIndexToUse;
	}
	if(!Array.indexOf){
  Array.prototype.indexOf = function(obj){
   for(var i=0; i<this.length; i++){
    if(this[i]==obj){
     return i;
    }
   }
   return -1;
  }
}
	function hideMap(){
		
	document.getElementById("map").style.display="none";	
	document.getElementById("mapControls").style.display="none";	
	}
	function showMap(){
		
	document.getElementById("map").style.display="block";	
	document.getElementById("mapControls").style.display="block";	
	}
	
	function ShowHideMapTxt(){
		innerText=document.getElementById("showHideMap").innerHTML;
		if(innerText=="Hide Map"){
		document.getElementById("showHideMap").innerHTML='Show Map';
	}
		if(innerText=="Show Map"){
		document.getElementById("showHideMap").innerHTML='Hide Map';
	}
	
	}
	
	function expandMap(){
		document.getElementById("map").style.display="block";
		document.getElementById("showHideMap").innerHTML='Hide Map';
		mapHeight=document.getElementById("map").offsetHeight;
		if(mapHeight==260){
		      document.getElementById("map").style.height="500px";
			  document.getElementById("ExpandReduceMap").innerHTML="Reduce Map";
		}
		if(mapHeight==500){
		      document.getElementById("map").style.height="260px";
			  document.getElementById("ExpandReduceMap").innerHTML="Expand Map";
		}
	}
	
	
	function fadeOutLogin(){
/*$("#innSeekerLogin").fadeOut("slow");*/
//alert("close2");
$innSeekerLoginPopUp.dialog("close");
}

function fadeOutHeart(){
$("#heart").fadeOut("slow");
}


function savToFaves(){

if(readCookie("InnSeekerId")){
$("#innSeekerLogin").fadeOut("slow");
var api2 = $("#heart").overlay({oneInstance: false, api: true});
document.getElementById('saveToFaves').src="includes/saveToFavs.php?InnId="+gup('InnId'); 
api2.load();
}else{
logInInnKeepers("SaveToFavs");
}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function logInInnKeepers(Action){

 innSeekerLoginPopUp = $('<div style="padding:0px;margin:0px;" id="innSeekerLogin"></div>')
			.html('<iframe src ="/includes/innSeeker.php?Action='+Action+'" width="729" height="369" id="innSeekerLogin" scrolling="none" frameborder="0">subscribedToNews <p>Your browser does not support iframes.</p></iframe>')
			.dialog({
			modal: true,
				width: 729,
				minHeight:369,
				autoOpen: false,
				title: 'InnSeeker Login'
				
			});
			$(innSeekerLoginPopUp).dialog('open');

}
function fadeOutLogin(){
$(innSeekerLoginPopUp).dialog('close');
}
function changeTitle(newTitle){
$( "#PopUp" ).dialog( "option", "title", newTitle );
}
function showFavs(){

$.post("/includes/displayFavs.php", {Action: "Display"}, function(data){
				
if(data.length >0) {
document.getElementById("Favs").innerHTML=data;
document.getElementById("staticContent").style.display="none";
setTimeout("calcLeftBarHeightStatic('resultsWrapper')",1000);

}
if(data=="NoFavs"){
document.getElementById("staticContent").style.display="block";
document.getElementById("Favs").style.display="none";
document.getElementById("staticContent").innerHTML="<h1>My Favorite Inns</h1><img src='images/myFavInns.jpg' width='600' height='200' alt='My Fav Inns' /><br /><br />There are currently no Inns saved to your Favorites.<br /><br /> Do a <a href='/find_an_inn.php'>Search</a> to find the perfect Inn";
}
});
}

function removeFav(id){
$.post("/includes/displayFavs.php", {Action: "Delete", ID: id}, function(data){
			
if(data.length >0 ) {
document.getElementById("Fav"+id).style.display="none";
setTimeout("calcLeftBarHeight('resultsWrapper')",1000);
}
if(data=="NoFavs"){
document.getElementById("staticContent").style.display="block";
document.getElementById("staticContent").innerHTML="<h1>My Favorite Inns</h1><br /><br />There are currently no Inns saved to your Favorites.<br /><br /> Do a <a href='/find_an_inn.php'>Search</a> to find the perfect Inn";
}
});
}
function showRezs(myFilter){
$.post("/includes/displayRezs.php", {Action: "Display", Filter:""+myFilter+"" }, function(data){
				
if(data.length >0) {
document.getElementById("Rezs").innerHTML=data;
document.getElementById("staticContent").style.display="none";
$("#accordion").accordion({
			autoHeight: false,
			collapsible:true,
			navigation: false
		});
setTimeout("calcLeftBarHeightStatic('adminArea')",400);
}
if(data=="NoRezs"){
document.getElementById("staticContent").style.display="block";
document.getElementById("Rezs").style.display="none";
document.getElementById("staticContent").innerHTML="<h1>My Reservations</h1><img src='images/myRezs.jpg' width='600' height='200' alt='My Reservations' /><br /><br />There are currently no reservations for this account.<br /><br /> Do a <a href='/find_an_inn.php'>Search</a> to find and request a reservation at the perfect Inn";
}
});
}


function printAllRez(){
$('#accordion').accordion('destroy');
$('#accordion').print();
setTimeout('$("#accordion").accordion({autoHeight: false,collapsible:true,navigation: false});',200);

}
function testRezSaved(){
var sPath = window.location.pathname;
//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
if(sPage=="my_reservations.php"){
	var hash = getUrlVars();
	if(hash['Filter']){
		var Filter=hash['Filter'];
	}
	else{
		var Filter="New";
	}
	window.location="my_reservations.php?Filter="+Filter+"&Refresh=True"+Math.floor(Math.random()*723);
}
}
function showAccount(){
$.post("/includes/displayAccount.php", {Action: "Display" }, function(data){
				
if(data.length >0) {
document.getElementById("Account").innerHTML=data;
document.getElementById("staticContent").style.display="none";
$("#myForm").validationEngine()
setTimeout("calcLeftBarHeightStatic('adminArea')",400);
}

});
}
function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');

    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }

    return vars;
}


function showSearchOptions(){
document.getElementById('rezSearchOptions').style.display="block";
document.getElementById('showSearchOptionsLink').style.display="none";
document.getElementById('filterOptions').style.display="none";
document.getElementById('adminArea').style.height=document.getElementById('adminArea').offsetHeight+110+"px";

calcLeftBarHeightAdmin("adminArea");
}
function hideSearchOptions(){
document.getElementById('showSearchOptionsLink').style.display="block";
document.getElementById('filterOptions').style.display="block";
document.getElementById('rezSearchOptions').style.display="none";
document.getElementById('adminArea').style.height=document.getElementById('adminArea').offsetHeight-110+"px";

calcLeftBarHeightAdmin("adminArea");
}
function showSupportBox(){
document.getElementById('rezSearchOptions').style.display="block";
document.getElementById('showSearchOptionsLink').style.display="none";
document.getElementById('adminArea').style.height=document.getElementById('adminArea').offsetHeight+110+"px";

calcLeftBarHeightAdmin("adminArea");
}
function hideSupportBox(){
document.getElementById('showSearchOptionsLink').style.display="block";
document.getElementById('rezSearchOptions').style.display="none";
document.getElementById('adminArea').style.height=document.getElementById('adminArea').offsetHeight-110+"px";

calcLeftBarHeightAdmin("adminArea");
}


function subscribedToNews(){
	if(readCookie("NewsletterSubscriber")){
	document.getElementById("signUpForm").style.display="none";
	document.getElementById("successText").style.display="block";
		document.getElementById("newsletterBox").style.display="none";

	document.getElementById("successText").innerHTML='<br /><a href="/newsletter.php">View the current Newsletter</a>';
	}
	else{
			document.getElementById("newsletterBox").style.display="block";

		document.getElementById("signUpForm").style.display="block";
	document.getElementById("successText").style.display="none";
	}
}



function submitSupportBox(Email){

	supportMessage= document.getElementById("supportMessage").value;
	
$.post("/assets/submitSupportBox.php", {Message: ""+supportMessage+"",Email: ""+Email+""}, function(data){
				if(data.length >0) {
							document.getElementById("searchOptionsBody").innerHTML="<div style='font-size:16px;color:green;padding:23px;'>Thank you!<br />Your message was successfully received. <br />We will contact you shortly with a response.</div>";
							setTimeout("hideSupportBox();", 4000);
				}
			});
}


function disableAll(formName){

	document.getElementById("adminArea").innerHTML="<div id='paidOnly'>This page has been disabled and is only available for paid subscribers. <br /><a href='my_subscription.php'>Change Your Subscription Level</a></div>"+document.getElementById("adminArea").innerHTML;
	 len=document[formName].length;
for(x=0;x<len;x++) {
document[formName].elements[x].disabled=true;
}
}
function disableAllCal(formName){
	
	document.getElementById("calendar").innerHTML="<div id='paidOnly' style='margin-top:-30px'>This page has been disabled and is only available for paid subscribers. <br /><a href='my_subscription.php' target='_parent'>Change Your Subscription Level</a></div>"+document.getElementById("calendar").innerHTML;
	 len=document[formName].length;
for(x=0;x<len;x++) {
document[formName].elements[x].disabled=true;
}
}


function disablePics(){
	document.getElementById("adminArea").innerHTML="<div id='paidOnly'>This page has been disabled and is only available for paid subscribers. <br /><a href='my_subscription.php'>Change Your Subscription Level</a></div>"+document.getElementById("adminArea").innerHTML;
	
	document.getElementById("upload").style.display="none";
}
function disableRezs(){
	document.getElementById("adminArea").innerHTML="<div id='paidOnly'>This page has been disabled and is only available for paid subscribers. <br /><a href='my_subscription.php'>Change Your Subscription Level</a></div>"+document.getElementById("adminArea").innerHTML;
	
	document.getElementById("printableArea").style.display="none";
}



String.prototype.stripHTML = function()
{
        // What a tag looks like
        var matchTag = /[^a-zA-Z 0-9]+/g;
        // Replace the tag
        return this.replace(matchTag, "");
};

function FeedBack(URL){

$FeedBackPopUp = $('<div style="padding:0px;margin:0px;"></div>')
			.html('<iframe src ="/includes/feedback.php?URL='+URL+'" width="429" height="369" id="FeedBackFrame" scrolling="none" frameborder="0"> <p>Your browser does not support iframes.</p></iframe>')
			.dialog({
			modal: true,
				width: 429,
				minHeight:369,
				autoOpen: false,
				title: 'We Value Your FeedBack'
				
			});
			$FeedBackPopUp.dialog('open');

}
function FeedBackPopUpFadeOut(){
$FeedBackPopUp.dialog('close');
}


function changeLoginTitle(newTitle){
$( "#innSeekerLogin" ).dialog( "option", "title", newTitle );
}
dataChangedBool=false;

function dataChanged(newValue){
	dataChangedBool=newValue;
}


function changeProperty(propId){
$.post("properties.php", {propId: ""+propId+""}, function(data){
				if(data.substr(5)!="Error") {
					window.location = 'index.php';
				}
				else{
					alert(data);
				}
			});

}
function videoPlayer(SRC,width,height,Name){

 videoPopup = $('<div style="padding:0px;margin:0px;" id="innSeekerLogin"></div>')
			.html('<iframe src ="'+SRC+'" width="'+width+'" height="'+height+'" id="innSeekerLogin" scrolling="none" frameborder="0">subscribedToNews <p>Your browser does not support iframes.</p></iframe>')
			.dialog({
			modal: true,
				width: width,
				minHeight:height,
				autoOpen: false,
				title: Name,
				close: function(ev, ui) { 
    $(this).remove(); 
  } 
				
			});
			$(videoPopup).dialog('open');

}


function updatePassword(){

 changePSWDPopUp = $('<div style="padding:0px;margin:0px;" id="innSeekerLogin"></div>')
			.html('<iframe src ="/Inn_Keepers/updatePassword.php" width="560" height="400" id="changePSWD" scrolling="none" frameborder="0"> <p>Your browser does not support iframes.</p></iframe>')
			.dialog({
			modal: true,
				width: 560,
				minHeight:400,
				autoOpen: false,
				title: 'Update Password'
				
			});
			$(changePSWDPopUp).dialog('open');

}
function closeupdatePassword(){
setTimeout("$(changePSWDPopUp).dialog('close');",2000);
}
