// JavaScript Document

var curr_location = "remote";
var root;
var img_path;
if (curr_location == "remote") {
	root = "http://colorado-bnb.com";
	img_path = "..";
} else {
	root = "http://drjphat.no-ip.com/cobnb/Redesign";
	img_path = "../redesign";
}


<!-- ********************************************** -->
<!--      	Functions for mouseover effect			-->
<!-- ********************************************** -->

function newImage(arg) {
  if (document.images) {
    rslt = new Image();
    rslt.src = arg;
    return rslt;
  }
}

function changeImages(imageToChange,source) {
	if(document.images && (preloadFlag==true)) {
		document[imageToChange].src = source;
	}
}

var preloadFlag = false;
function preloadImages() {
  if (document.images) {
	home_on = newImage(img_path + "/but-home_on.gif");
	search_on = newImage(img_path + "/but-search_on.gif");
	associations_on = newImage(img_path + "/but-associations_on.gif");
	innkeepers_on = newImage(img_path + "/but-innkeepers_on.gif");
    preloadFlag = true;
  }
  
  preloadDescriptions();
}

<!-- ********************************************** -->
<!--      Functions drive the expanding content		-->
<!--				in a BnB's listing				-->
<!-- ********************************************** -->
var visible = 1;

function switchDiv(div_id)
{
  if(document.images) {
	  var style_sheet = getStyleObject(div_id);
	  if (style_sheet)
	  {
		if (style_sheet.display != "none") {
			changeObjectVisibility(div_id, "none");
			//visible = 0;
		} else {
			changeObjectVisibility(div_id, "block");
			//visible = 1;
		}
	  }
	  else 
	  {
		//alert("sorry, this only works in browsers that do Dynamic HTML");
	  }
  }
}

function getStyleObject(objectId) {
  // checkW3C DOM, then MSIE 4, then NN 4.
  //
  if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId).style;
   }
   else if (document.all && document.all(objectId)) {  
	return document.all(objectId).style;
   } 
   else if (document.layers && document.layers[objectId]) { 
	return document.layers[objectId];
   } else {
	return false;
   }
}

function changeObjectVisibility(objectId, newVisibility) {
    // first get the object's stylesheet
    var styleObject = getStyleObject(objectId);

    // then if we find a stylesheet, set its visibility
    // as requested
    //
    if (styleObject) {
	styleObject.display = newVisibility;
	return true;
    } else {
	return false;
    }
}

<!-- ********************************************** -->
<!--      This function opens a pop_up window       -->
<!-- ********************************************** -->
function openWin(file,w,h,s,optional_name) {
    var scroll = "no";    <!-- scroll = no -->
    if (s == "yes")
	{
	  scroll = "yes,resizable=1";    <!-- scroll and resize -->
	}
	params = "scrollbars=" + scroll + ",width=" + w + ",height=" + h;
	
	win = window.open(file,optional_name,params);
	win.focus();
	return;
}

// Initializes the window for the Map
var win2 = null;
function mapWin(file,w,h,s,left,top) {
    var scroll = "no";    <!-- scroll = no -->
	if (s == "yes")
	{
	  scroll = "yes,resizable=1";    <!-- scroll and resize -->
	}

params = "scrollbars=" + scroll + ",width=" + w + ",height=" + h + ",left=" + left + ",top=" + 
				top + ",screenX=" + left + ",screenY=" + top;
	
	// Checks to see if win2 is already open.  If it is, it just brings it back to focus.
	// If not, then the window is opened.
	if (win2 && win2.open && !win2.closed) {
		win2.focus();
	} else {
		win2 = window.open(file,'map',params);
		win2.focus();
	}
		
	return;
}

function launch_photoupdate(session) {
	
		params = "scrollbars=no,width=500,height=500";

	win = window.open("innkeeper.pl?update_photo_page=1" + session,'vtWindow',params);
	win.focus();
	return;
}

<!-- ********************************************** -->
<!--      		  Amenity descriptions				-->
<!-- ********************************************** -->
// Use this one. Uses an Image instead of form field as the descriptor.
// Uses src from preloadDescriptions()
function amenityDescription2(bnb_id,amenity)
{
	if (amenity_preload_flag) {
		img_object = "amenities_" + bnb_id;
		//img_name = img_path + "/icon_descriptions/" + amenity + ".gif";
		
		document.images[img_object].src = eval(amenity).src;

		//document.images[img_object].src= img_name;
		//var keywords = new Array ('bike_storage','ski_storage','horse_boarding','sack_lunches','special_diet','highspeed_internet','videos','library','shuttle','kitchenette','dvd','tv','dataport','fitness_center','business_center','child_care','handicap','breakfast_cont','breakfast_full','fireplace_private','pool_outdoor','pool_indoor','steam','sauna','hottub_community','hottub_private','whirlpool','bath_shared','bath_private','wedding_catering','wedding');
		//var linkElement = keywords.grep();
		//alert(linkElement);
	}
}

function amenityDescription(object,amenity)
{
	document[object].value=amenity;
	var keywords = new Array ('bike_storage','ski_storage','horse_boarding','sack_lunches','special_diet','highspeed_internet','videos','library','shuttle','kitchenette','dvd','tv','dataport','fitness_center','business_center','child_care','handicap','breakfast_cont','breakfast_full','fireplace_private','pool_outdoor','pool_indoor','steam','sauna','hottub_community','hottub_private','whirlpool','bath_shared','bath_private','wedding_catering','wedding');
	//var linkElement = keywords.grep();
	//alert(linkElement);
}

<!-- ********************************************** -->
<!--      	Preload Amenity Icon Descriptions		-->
<!-- ********************************************** -->
var amenity_preload_flag = false;
function preloadDescriptions() {

	var icon_path = img_path + "/icon_descriptions/";
	
	blank = new Image();
	blank.src = icon_path + "blank.gif";
	
	bath_private = new Image();
	bath_private.src = icon_path + "bath_private.gif";

	bath_shared = new Image();
	bath_shared.src = icon_path + "bath_shared.gif";

	whirlpool = new Image();
	whirlpool.src = icon_path + "whirlpool.gif";

	hottub_private = new Image();
	hottub_private.src = icon_path + "hottub_private.gif";

	hottub_community = new Image();
	hottub_community.src = icon_path + "hottub_community.gif";

	sauna = new Image();
	sauna.src = icon_path + "sauna.gif";

	steam = new Image();
	steam.src = icon_path + "steam.gif";

	pool_indoor = new Image();
	pool_indoor.src = icon_path + "pool_indoor.gif";

	pool_outdoor = new Image();
	pool_outdoor.src = icon_path + "pool_outdoor.gif";

	fireplace_private = new Image();
	fireplace_private.src = icon_path + "fireplace_private.gif";

	kitchenette = new Image();
	kitchenette.src = icon_path + "kitchenette.gif";
	
	cabins = new Image();
	cabins.src = icon_path + "cabins.gif";

	dvd = new Image();
	dvd.src = icon_path + "dvd.gif";

	tv = new Image();
	tv.src = icon_path + "tv.gif";

	library = new Image();
	library.src = icon_path + "library.gif";

	videos = new Image();
	videos.src = icon_path + "videos.gif";

	dataport = new Image();
	dataport.src = icon_path + "dataport.gif";

	highspeed_internet = new Image();
	highspeed_internet.src = icon_path + "highspeed_internet.gif";

	breakfast_full = new Image();
	breakfast_full.src = icon_path + "breakfast_full.gif";

	breakfast_cont = new Image();
	breakfast_cont.src = icon_path + "breakfast_cont.gif";

	special_diet = new Image();
	special_diet.src = icon_path + "special_diet.gif";

	sack_lunches = new Image();
	sack_lunches.src = icon_path + "sack_lunches.gif";

	wedding = new Image();
	wedding.src = icon_path + "wedding.gif";

	wedding_catering = new Image();
	wedding_catering.src = icon_path + "wedding_catering.gif";

	handicap = new Image();
	handicap.src = icon_path + "handicap.gif";

	child_care = new Image();
	child_care.src = icon_path + "child_care.gif";

	horse_boarding = new Image();
	horse_boarding.src = icon_path + "horse_boarding.gif";

	ski_storage = new Image();
	ski_storage.src = icon_path + "ski_storage.gif";

	bike_storage = new Image();
	bike_storage.src = icon_path + "bike_storage.gif";

	business_center = new Image();
	business_center.src = icon_path + "business_center.gif";

	fitness_center = new Image();
	fitness_center.src = icon_path + "fitness_center.gif";

	shuttle = new Image();
	shuttle.src = icon_path + "shuttle.gif";
	
	amenity_preload_flag = true;
}

<!-- ********************************************** -->
<!--      		  		Logout						-->
<!-- ********************************************** -->
function logout () {

  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = "innkeeper=; path=/; expires=Sun, 27-Feb-2005 22:02:29 GMT";

	//alert(document.cookie);
	//document.location="http://drjphat.no-ip.com/cobnb/Redesign/innkeeper.html";
	document.location= root + "/innkeeper.html";

}

<!-- ********************************************** -->
<!--      			Refresh Inn Photo				-->
<!-- ********************************************** -->
function refresh_inn_photo (img_path) {
	
	document.images['inn_photo'].src = img_path + "?" + Math.round(Math.random()*1000);
	
}

function doNothing() {
	return;
}

<!-- ********************************************** -->
<!--      			Verify Features					-->
<!-- ********************************************** -->
// Verifies that more than 10 BnB Bonus points are being purchased.
function verifyFeatures() {
	
	if (document.feature_form.bnb_bonuses.value*1 == 0) {
		document.feature_form.bnb_bonuses.value = "";
	}
	
	
	if (document.feature_form.bnb_bonuses.value*1 >= 10 || 
		   (typeof document.feature_form.add_feature != 'undefined' && (document.feature_form.add_feature.checked && document.feature_form.bnb_bonuses.value == ""))) {
		
		var confirmation = confirm("By clicking OK you will complete your Features order and your listing will be immediately updated." +
				    "\nPress OK to confirm or Cancel to return to the Add Features page.");
		if(confirmation) {
			return true;
		} else {
			return false;
		}
		
	} else {
		alert("You must purchase a minimum of 10 BnB Bonus Points at a time");
		return false;
	}
	
}


<!-- ********************************************** -->
<!--   Verifies that the browser supports cookies	-->
<!-- ********************************************** -->
function checkForCookies() {
	document.cookie = "checkForCookies=true; path=/";
	return true;
	if(!document.cookie) {
		document.location = img_path + "/enablecookies.html";
		return false;
	} else {
		return true;
	}
}

<!-- ********************************************** -->
<!-- Builds the query string used to revise a search-->
<!-- ********************************************** -->

function reviseSearch(queryString) {
			
	document.location = img_path + "/search.html?" + queryString;
			
}