// rollover functions
function sub_nav_over(imgname) 
{
	if (document.images) {document[imgname].src = eval( imgname + "_on.src" ); }
}
function sub_nav_off(imgname) 
{
	if (document.images) {document[imgname].src = path + imgname + ".gif" ; }
}

function toggleLoginBox(header,box){
	
	if(document.getElementById(header).style.display=="none"){
		$("#left_login_box").slideDown("slow");
		//$(box).className = "boxopen";
	}else{
		$("#left_login_box").slideUp("slow");
		//$(box).className = "boxclosed";
	}
	return false;
}

// Basic open window
function openWindow(url,width,height) {
	var PopUpWin=window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizeable=0,scrollbars=yes,menubar=no,status=no');
	PopUpWin.focus()
}

// Add commas to numbers for formatting
function addCommas(nStr) {
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '.00';
	if (x2.length == 2) x2 = x2+'0';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

// Nav
function toggleNavOn(which){
	if($("#"+which).css("display") == "none") {
		//$("ul#navigation_list li ul").hide("normal")
		$("ul.subnav").hide("normal")
		$("#"+which).show("normal")
	}
	menuInt=window.clearInterval(menuInt)
}

// Linked Content Display
function showcontent(linkedcontent){
	$("div#linked_bottom_item_" + currentcontent).hide();
	$("div#linked_bottom_item_" + linkedcontent).show();
	
	if(currentcontent != 0) $("a#linked_top_link_" + currentcontent).removeClass('linked_top_link_on');
	$("a#linked_top_link_" + linkedcontent).addClass('linked_top_link_on');

	currentcontent = linkedcontent;
	return false;
}

function fGoToURL(sURL) { window.location.href = sURL; }

function fHotelFav(vAction,hotelId) {
	$("#fav" + hotelId).load("/registration/accommodation_ajax.cfm",{action:vAction, hotel_id: hotelId});
	return false;
}
