// Global Variable Declarations
ns4 = (document.layers)? true:false; // netscape 4?
ie4 = (document.all)? true:false; // internet explorer 4/5?
ns6 = (ns4|ie4)? false:true; // (Netscape 6)

var isLoaded = false;
var page_position_left = 0;
var unroll_timeouttheme = 0;
var unroll_timeoutplan = 0;
var unroll_timeoutbefore = 0;
var unroll_timeoutabout = 0;
var unroll_timeoutimage = 0;
ResortMenu = new Array;
SubNav = new Array;
var hasTabs = false;
var hasAir = true;
var activeTab = "";
var vWinCal = null;
var showHomePopup = true;

window.name = "JamaicaTravel";

// Submits a form
function submitForm( in_flag )
{
    if( in_flag == "true" )
		clearSearchFlag();
	document.forms[0].submit();
	return true;
}

// Submit Target Form
function submitTargetForm(formIndex)
{
	document.forms[formIndex].submit();
	return true;
}

function clearSearchFlag()
{
	if(document.forms[0].elements['GlobalSubmitType'])
			document.forms[0].elements['GlobalSubmitType'].value = "";
}

function clearFlags()
{
	if(document.forms[0].elements['GlobalSearchFlag'])
		document.forms[0].elements['GlobalSearchFlag'].value = "";
	if(document.forms[0].elements['GlobalNewsletterSignupFlag'])
		document.forms[0].elements['GlobalNewsletterSignupFlag'].value = "";
	if(document.forms[0].elements['GlobalIslandTriviaFlag'])
		document.forms[0].elements['GlobalIslandTriviaFlag'].value = "";
	if(document.forms[0].elements['GlobalTravelAgentLocatorStateFlag'])
		document.forms[0].elements['GlobalTravelAgentLocatorStateFlag'].value = "";
}

// Submit the Global Search
function submitGlobalSearch()
{
	clearFlags();
	document.forms[0].elements["GlobalSubmitType"].value = "site_search";
	document.forms[0].elements["GlobalSearchFlag"].value = "true";
	submitForm("false");
}

// Submit the Global Newsletter Signup
function submitNewsletterSignup()
{
	clearFlags();
	document.forms[0].elements["GlobalSubmitType"].value = "newsletter_signup";
	document.forms[0].elements["GlobalNewsletterSignupFlag"].value = "true";	
	submitForm("false");
}

// Submit the Global Island Trivia
function submitIslandTrivia()
{
	clearFlags();
	document.forms[0].elements["GlobalSubmitType"].value = "island_trivia";
	document.forms[0].elements["GlobalIslandTriviaFlag"].value = "true";	
	submitForm("false");
}

// Submit the Global Travel Agent Locator Zip Code
function submitTravelAgentLocatorZip()
{
	clearFlags();
	document.forms[0].elements["GlobalSubmitType"].value = "travel_agent_locator_search";
	document.forms[0].elements["GlobalTravelAgentLocatorZipCodeFlag"].value = "true";	
	//alert("Global Travel Agent Locator Post");
	submitForm("false");
}

// Window Openers
function popWindow(in_URI, in_WindowParameters)
{
	//windowParameters are very browser dependent.  Be sure to test in all browswers when
	//changing window parameters.

	//For instance for Both IE and Netscape browsers to absolutely position a window properly 2 sets
	// of dimensions should be included example: screenX=0,screenY=0,left=0,top=0
	//To set the height and width of the windows example: width=625,height=400
	//A Good PopupWindow in all browsers with no toolbar, no scrollbar, and not resizable.
	//in_WindowParameters = "scrollbars=no,width=625,height=400";
	
	if ( in_WindowParameters.length == 0 )
	{
		in_WindowParameters = "resizable,dependent,toolbar,scrollbars,location,status,menubar";
	}
	
	popupWin = window.open(in_URI,'PopupWindow',in_WindowParameters);
}

// Opens popup window for common pages like "email to a friend", "print this page", etc.
function popCommonWindow(in_URI)
{
	windowParameters = 'resizable,dependent,scrollbars,menubar,toolbar,statusbar,width=786,height=580';
	
	popupWin = window.open(in_URI,'CommonPopupWindow',windowParameters);
}

// Function Provided by 2Advanced Studios, LLC
function openCenterWin(url,theWidth,theHeight)
{
  var theTop = (screen.height/2) - (theHeight/2);
  var theLeft = (screen.width/2) - (theWidth/2);
  var features = 'height='+ theHeight + ',width=' + theWidth + ',top=' + theTop+ ',left=' + theLeft + ",scrollbars=no";
  theWin = window.open(url,'',features);
}

function popWindowNoNavigation(in_URI)
{
	popupWin = window.open(in_URI,'NewWindow','toolbar=0,Location=0,Directories=0,Status=0,menubar=0,Scrollbars=0,Resizable=1');	
}

function popWindowHtml(in_URI,in_name,in_width) {
	popupWin = window.open(in_URI,in_name,'height=520,width=' + in_width + ',scrollbars,resizable=no');
}

function popWindowWithName(in_URI, in_Name, in_WindowParameters)
{
	
	if ( in_WindowParameters.length == 0 )
	{
		in_WindowParameters = "resizable,dependent,toolbar,scrollbars,location,status,menubar";
	}
	
	popupWin = window.open(in_URI, in_Name ,in_WindowParameters);

}

// Image Swaps
function image_swap(in_name,in_state) {
	if (!isLoaded) {
		return true;
	}
	document.images[in_name].src = eval(in_name + "_" + in_state + ".src");
}

function left_nav_image_swap(in_name,in_state,in_real_name) {
	if (!isLoaded) {
		return true;
	}
	document.images[in_name].src = eval(in_real_name + "_" + in_state + ".src");
}

function nav_image_swap(in_name,in_state) {
	if (!isLoaded) {
		return true;
	}
	document.images[in_name].src = eval("nav_" + in_name + "_" + in_state + ".src");
	if (in_state=='off') {
		document.images['nav_text'].src = eval("nav_text_off.src");
	}
	else {
		document.images['nav_text'].src = eval("nav_text_" + in_name + ".src");
	}
}

function image_swap_dynamic(in_name,in_state) {
	if (!isLoaded) {
		return true;
	}
	document.images[in_name].src = eval(in_state + ".src");
}

function menu_image_swap(in_menu,in_name,in_state) {
	if (!isLoaded) {
		return true;
	}
	if (ie4) {
		returnElement(in_menu).document.images[in_name].src = eval(in_name + "_" + in_state + ".src");
	}
	if (ns4) {
		returnElement(in_menu).document.images[in_name].src = eval(in_name + "_" + in_state + ".src");
	}
	if (ns6) {
		document.images[in_name].src = eval(in_name + "_" + in_state + ".src");
	}
}

function tools_image_swap(in_menu,in_name,in_state) {
	if (!isLoaded) {
		return true;
	}
	if (ie4) {
		if (returnElement(in_menu).style.visibility=="visible") {
			return true;
		}
		else {
			document.images[in_name].src = eval(in_name + "_" + in_state + ".src");
		}
	}
	if (ns4) {
		if (window.document.layers[in_menu].visibility=="show") {
			return true;
		}
		else {
			document.images[in_name].src = eval(in_name + "_" + in_state + ".src");
		}
	}
	if (ns6) {
		if (returnElement(in_menu).style.visibility=="visible") {
			return true;
		}
		else {
			document.images[in_name].src = eval(in_name + "_" + in_state + ".src");
		}
	}
}

// DHTML

function openMenuImmediate(in_menu) {
	if (isLoaded) {
		var layer_to_change = in_menu.toString();
		//shift_menu_left(layer_to_change);
		if (document.layers) {
			window.document.layers[layer_to_change].visibility = "show";
		}
		else {
			returnElement(in_menu).style.visibility = "visible";
		}
	}
}

function closeMenuImmediate(in_menu) {
	var layer_to_change = in_menu.toString();
	if (document.layers) {
		window.document.layers[layer_to_change].visibility = "hide";
	}
	else {
		returnElement(in_menu).style.visibility = "hidden";
	}
}

function returnElement(thename) {
	if (document.all) {
		return eval("window.document.all." + thename);
	} else {
		if (document.layers) {
			return eval("window.document.layers['" + thename + "']");
		} else {
			return window.document.getElementById(thename);
		}
	}
}

function resort_menu_swap(in_menu)
{
	if (isLoaded) {
		for(i=0; i< ResortMenu.length; i++)
			if(ResortMenu[i] != in_menu)
				closeMenuImmediate(ResortMenu[i]);		
		openMenuImmediate(in_menu);
	}
	
}

function resort_menu_clear()
{
	if (isLoaded) {
		for(i=0; i< ResortMenu.length; i++)	 
			closeMenuImmediate(ResortMenu[i]);	
	}
}

function sub_menu_clear(in_menu,in_state)
{
	if (isLoaded) {
		for(i=0; i< SubNav.length; i++)	 
		{
			closeMenuImmediate(SubNav[i]);	
			if(SubNav[i] == in_menu)
				main_image_swap(SubNav[i], in_state);
			else
				main_image_swap(SubNav[i], 'off');
		}
	}
}

function submenu_swap(in_ubermenu,in_submenu,in_state,in_parent_state) {
	
	if(isLoaded) 
	{
		clearTimeout(unroll_timeoutimage);
	    
		if (in_ubermenu=="SubNavThemes") {
			clearTimeout(unroll_timeouttheme);
		}
		else 
			if (in_ubermenu=="SubNavPlan") {
				clearTimeout(unroll_timeoutplan);
			}
			else 
				if (in_ubermenu=="SubNavBefore") {
					clearTimeout(unroll_timeoutbefore);
				}
				else 
					if (in_ubermenu=="SubNavAbout") {
						clearTimeout(unroll_timeoutabout);
					}
		if (in_submenu!="null") {
			layer_to_change = in_submenu;
			main_image_to_change = in_ubermenu + "_Main_image";
			main_image_to_change_to = in_ubermenu + "_Main_roll.src";
			image_to_change = in_ubermenu + "_" + layer_to_change + "_image";
			image_to_change_to = in_ubermenu + "_" + layer_to_change + "_" + in_state + ".src";
			if (ie4) {
				returnElement(in_ubermenu).document.images[image_to_change].src = eval(image_to_change_to);
				returnElement(in_ubermenu).document.images[main_image_to_change].src = eval(main_image_to_change_to);
			}
			if (ns4) {
				returnElement(in_ubermenu).document.layers[layer_to_change].document.images[image_to_change].src = eval(image_to_change_to);
				returnElement(in_ubermenu).document.layers[main_image_to_change].document.images[main_image_to_change].src = eval(main_image_to_change_to);
			}
			if (ns6) {
				document.images[image_to_change].src = eval(image_to_change_to);
				document.images[main_image_to_change].src = eval(main_image_to_change_to);
			}
		}
		if (in_state=="off") {
										
			if ( in_parent_state!=null && in_parent_state!="null")
				unroll_timeoutimage = setTimeout("main_image_swap('" + in_ubermenu + "','" + in_parent_state + "')",200);
			else
				unroll_timeoutimage = setTimeout("main_image_swap('" + in_ubermenu + "', 'off')",200);
			
			if (in_ubermenu=="SubNavThemes") {
				unroll_timeouttheme = setTimeout("closeMenuImmediate('SubNavThemes')",200);			
			}
			else
				if (in_ubermenu=="SubNavPlan") {
					unroll_timeoutplan = setTimeout("closeMenuImmediate('SubNavPlan')",200);		
				}
				else
					if (in_ubermenu=="SubNavBefore") {
						unroll_timeoutbefore = setTimeout("closeMenuImmediate('SubNavBefore')",200);			
					}
					else
						if (in_ubermenu=="SubNavAbout") {
							unroll_timeoutabout = setTimeout("closeMenuImmediate('SubNavAbout')",200);			
						}	
			
		}	
		if (in_state == "on")
		{	
		
			//unroll_timeoutimage = setTimeout("main_image_swap('" + in_ubermenu + "', 'on')",200);
			if (in_ubermenu=="SubNavThemes") {
				unroll_timeouttheme = setTimeout("closeMenuImmediate('SubNavThemes')",200);			
			}
			else
				if (in_ubermenu=="SubNavPlan") {
					unroll_timeoutplan = setTimeout("closeMenuImmediate('SubNavPlan')",200);		
				}
				else
					if (in_ubermenu=="SubNavBefore") {
						unroll_timeoutbefore = setTimeout("closeMenuImmediate('SubNavBefore')",200);			
					}
					else
						if (in_ubermenu=="SubNavAbout") {
							unroll_timeoutabout = setTimeout("closeMenuImmediate('SubNavAbout')",200);			
						}
		}		
	}
}

function shift_menu_left(in_menu){
	if (in_menu=="languageselecthigh") {
		var left_shift_amount = 90;
	}
	if (in_menu=="languageselectlow") {
		var left_shift_amount = 300;
	}
	if (document.layers) {
		window.document.layers[in_menu].left = page_position_left + left_shift_amount;
	}
	else {
		returnElement(in_menu).style.left = page_position_left + left_shift_amount;
	}
	
}

function main_image_swap(in_ubermenu, in_state)
{
		main_image_to_change = in_ubermenu + "_Main_image";
		main_image_to_change_to = in_ubermenu + "_Main_" + in_state + ".src";
		
		if (ie4) {
		
			returnElement(in_ubermenu).document.images[main_image_to_change].src = eval(main_image_to_change_to);
		}
		if (ns4) {

			returnElement(in_ubermenu).document.layers[main_image_to_change].document.images[main_image_to_change].src = eval(main_image_to_change_to);
		}
		if (ns6) {

			document.images[main_image_to_change].src = eval(main_image_to_change_to);
		}
}

//Checkbox check all
function checkAll( in_element, in_state )
{
  		if( !in_state )
		{
			for (i=0; i<document.forms[0].elements.length; i++)
				if(document.forms[0].elements[i])
				if(document.forms[0].elements[i].name.indexOf( in_element )>0)
					document.forms[0].elements[i].checked = false;		
		}
		else
		{
			for (i=0; i<document.forms[0].elements.length; i++)
				if(document.forms[0].elements[i])
				if(document.forms[0].elements[i].name.indexOf( in_element )>0)
					document.forms[0].elements[i].checked = true;		 
		}
	
}

//Clear Layers
function layers_clear( in_layers )
{
	if (isLoaded) {
		for(i=0; i< in_layers.length; i++)	 
		{
			closeMenuImmediate(in_layers[i]);
		}
	}
}
// Get Current URL
function get_url ()
{
	return document.location.href;
}
// Global Initialization

function global_init(in_localeCode) {    
	
	ResortMenu[0] = "RnCancunMenu";
	ResortMenu[1] = "RnrockyMenu";
	ResortMenu[2] = "RnLapazMenu";
	ResortMenu[3] = "RnmazaMenu";
	ResortMenu[4] = "RnPortMenu";
	ResortMenu[5] = "RnacapMenu";
	
	SubNav[0] = "SubNavThemes";
	SubNav[1] = "SubNavPlan";
	SubNav[2] = "SubNavBefore";
	SubNav[3] = "SubNavAbout";

		
	rn_cancun_off = new Image;
	rn_cancun_off.src = js_root + "images/common/rn_cancun_off_" + in_localeCode + ".gif";
	rn_cancun_roll = new Image;
	rn_cancun_roll.src = js_root + "images/common/rn_cancun_roll_" + in_localeCode + ".gif";
	rn_cancun_on = new Image;
	rn_cancun_on.src = js_root + "images/common/rn_cancun_on_" + in_localeCode + ".gif";
	
        rn_rocky_off = new Image;
	rn_rocky_off.src = js_root + "images/common/rn_rocky_off_" + in_localeCode + ".gif";
	rn_rocky_roll = new Image;
	rn_rocky_roll.src = js_root + "images/common/rn_rocky_roll_" + in_localeCode + ".gif";
	rn_rocky_on = new Image;
	rn_rocky_on.src = js_root + "images/common/rn_rocky_on_" + in_localeCode + ".gif";
	
	rn_Lapaz_off = new Image;
	rn_Lapaz_off.src = js_root + "images/common/rn_Lapaz_off_" + in_localeCode + ".gif";
	rn_Lapaz_roll = new Image;
	rn_Lapaz_roll.src = js_root + "images/common/rn_Lapaz_roll_" + in_localeCode + ".gif";
	rn_Lapaz_on = new Image;
	rn_Lapaz_on.src = js_root + "images/common/rn_Lapaz_on_" + in_localeCode + ".gif";
	
	rn_maza_off = new Image;
	rn_maza_off.src = js_root + "images/common/rn_maza_off_" + in_localeCode + ".gif";
	rn_maza_roll = new Image;
	rn_maza_roll.src = js_root + "images/common/rn_maza_roll_" + in_localeCode + ".gif";
	rn_maza_on = new Image;
	rn_maza_on.src = js_root + "images/common/rn_maza_on_" + in_localeCode + ".gif";
	
	rn_port_off = new Image;
	rn_port_off.src = js_root + "images/common/rn_port_off_" + in_localeCode + ".gif";
	rn_port_roll = new Image;
	rn_port_roll.src = js_root + "images/common/rn_port_roll_" + in_localeCode + ".gif";
	rn_port_on = new Image;
	rn_port_on.src = js_root + "images/common/rn_port_on_" + in_localeCode + ".gif";
	
	rn_acap_off = new Image;
	rn_acap_off.src = js_root + "images/common/rn_acap_off_" + in_localeCode + ".gif";
	rn_acap_roll = new Image;
	rn_acap_roll.src = js_root + "images/common/rn_acap_roll_" + in_localeCode + ".gif";
	rn_acap_on = new Image;
	rn_acap_on.src = js_root + "images/common/rn_acap_on_" + in_localeCode + ".gif";
	
	bullet_lnsn_off = new Image;
	bullet_lnsn_off.src = js_root + "images/common/bullet_lnsn_off.gif";
	bullet_lnsn_roll = new Image;
	bullet_lnsn_roll.src = js_root + "images/common/bullet_lnsn_roll.gif";
	bullet_lnsn_on = new Image;
	bullet_lnsn_on.src = js_root + "images/common/bullet_lnsn_on.gif";
	
	bullet_ln_off = new Image;
	bullet_ln_off.src = js_root + "images/common/bullet_ln_off.gif";
	bullet_ln_roll = new Image;
	bullet_ln_roll.src = js_root + "images/common/bullet_ln_roll.gif";
	bullet_ln_on = new Image;
	bullet_ln_on.src = js_root + "images/common/bullet_ln_on.gif";
	
	gn_Accommodations_off = new Image;
	gn_Accommodations_off.src = js_root + "images/common/gn_Accommodations_off_" + in_localeCode + ".gif";
	gn_Accommodations_roll = new Image;
	gn_Accommodations_roll.src = js_root + "images/common/gn_Accommodations_roll_" + in_localeCode + ".gif";
	gn_Accommodations_on = new Image;
	gn_Accommodations_on.src = js_root + "images/common/gn_Accommodations_on_" + in_localeCode + ".gif";
	
	gn_bego_off = new Image;
	gn_bego_off.src = js_root + "images/common/gn_bego_off_" + in_localeCode + ".gif";
	gn_bego_roll = new Image;
	gn_bego_roll.src = js_root + "images/common/gn_bego_roll_" + in_localeCode + ".gif";
	gn_bego_on = new Image;
	gn_bego_on.src = js_root + "images/common/gn_bego_on_" + in_localeCode + ".gif";
	
	gn_about_off = new Image;
	gn_about_off.src = js_root + "images/common/gn_about_off_" + in_localeCode + ".gif";
	gn_about_roll = new Image;
	gn_about_roll.src = js_root + "images/common/gn_about_roll_" + in_localeCode + ".gif";
	gn_about_on = new Image;
	gn_about_on.src = js_root + "images/common/gn_about_on_" + in_localeCode + ".gif";
	
	SubNavThemes_Main_off = new Image;
	SubNavThemes_Main_off.src = js_root + "images/common/gn_Accommodations_off_" +  in_localeCode + ".gif";
	SubNavThemes_Main_on = new Image;
	SubNavThemes_Main_on.src = js_root + "images/common/gn_Accommodations_on_" +  in_localeCode + ".gif";
	SubNavThemes_Main_roll = new Image;
	SubNavThemes_Main_roll.src = js_root + "images/common/gn_Accommodations_roll_" +  in_localeCode + ".gif";
	
	SubNavPlan_Main_off = new Image;
	SubNavPlan_Main_off.src = js_root + "images/common/gn_plan_off_" +  in_localeCode + ".gif";
	SubNavPlan_Main_on = new Image;
	SubNavPlan_Main_on.src = js_root + "images/common/gn_plan_on_" +  in_localeCode + ".gif";
	SubNavPlan_Main_roll = new Image;
	SubNavPlan_Main_roll.src = js_root + "images/common/gn_plan_roll_" +  in_localeCode + ".gif";	
	
	SubNavBefore_Main_off = new Image;
	SubNavBefore_Main_off.src = js_root + "images/common/gn_bego_off_" +  in_localeCode + ".gif";
	SubNavBefore_Main_on = new Image;
	SubNavBefore_Main_on.src = js_root + "images/common/gn_bego_on_" +  in_localeCode + ".gif";
	SubNavBefore_Main_roll = new Image;
	SubNavBefore_Main_roll.src = js_root + "images/common/gn_bego_roll_" +  in_localeCode + ".gif";	
	
	SubNavAbout_Main_off = new Image;
	SubNavAbout_Main_off.src = js_root + "images/common/gn_about_off_" +  in_localeCode + ".gif";
	SubNavAbout_Main_on = new Image;
	SubNavAbout_Main_on.src = js_root + "images/common/gn_about_on_" +  in_localeCode + ".gif";
	SubNavAbout_Main_roll = new Image;
	SubNavAbout_Main_roll.src = js_root + "images/common/gn_about_roll_" +  in_localeCode + ".gif";	
	
	
		
	SubNavThemes_Themeresorts_off = new Image;
	SubNavThemes_Themeresorts_off.src = js_root + "images/common/gnsn_resorts_off_" +  in_localeCode + ".gif";
	SubNavThemes_Themeresorts_roll = new Image;
	SubNavThemes_Themeresorts_roll.src = js_root + "images/common/gnsn_resorts_roll_" +  in_localeCode + ".gif";
	
	SubNavThemes_Themehotels_off = new Image;
	SubNavThemes_Themehotels_off.src = js_root + "images/common/gnsn_hotels_off_" +  in_localeCode + ".gif";
	SubNavThemes_Themehotels_roll = new Image;
	SubNavThemes_Themehotels_roll.src = js_root + "images/common/gnsn_hotels_roll_" +  in_localeCode + ".gif";

	SubNavThemes_Themehomes_off = new Image;
	SubNavThemes_Themehomes_off.src = js_root + "images/common/gnsn_homes_off_" +  in_localeCode + ".gif";
	SubNavThemes_Themehomes_roll = new Image;
	SubNavThemes_Themehomes_roll.src = js_root + "images/common/gnsn_homes_roll_" +  in_localeCode + ".gif";
	
	SubNavThemes_Themeowners_off = new Image;
	SubNavThemes_Themeowners_off.src = js_root + "images/common/gnsn_owners_off_" +  in_localeCode + ".gif";
	SubNavThemes_Themeowners_roll = new Image;
	SubNavThemes_Themeowners_roll.src = js_root + "images/common/gnsn_owners_roll_" +  in_localeCode + ".gif";
	
	SubNavThemes_ThemeConsumer_off = new Image;
	SubNavThemes_ThemeConsumer_off.src = js_root + "images/common/gnsn_Consumer_off_" +  in_localeCode + ".gif";
	SubNavThemes_ThemeConsumer_roll = new Image;
	SubNavThemes_ThemeConsumer_roll.src = js_root + "images/common/gnsn_Consumer_roll_" +  in_localeCode + ".gif";
	
	SubNavThemes_Themecheap_off = new Image;
	SubNavThemes_Themecheap_off.src = js_root + "images/common/gnsn_cheap_off_" +  in_localeCode + ".gif";
	SubNavThemes_Themecheap_roll = new Image;
	SubNavThemes_Themecheap_roll.src = js_root + "images/common/gnsn_cheap_roll_" +  in_localeCode + ".gif";
	
	SubNavThemes_ThemeSpringBreak_off = new Image;
	SubNavThemes_ThemeSpringBreak_off.src = js_root + "images/common/gnsn_spring_off_" +  in_localeCode + ".gif";
	SubNavThemes_ThemeSpringBreak_roll = new Image;
	SubNavThemes_ThemeSpringBreak_roll.src = js_root + "images/common/gnsn_spring_roll_" +  in_localeCode + ".gif";
	
	SubNavThemes_ThemeWeddings_off = new Image;
	SubNavThemes_ThemeWeddings_off.src = js_root + "images/common/gnsn_wedding_off_" +  in_localeCode + ".gif";
	SubNavThemes_ThemeWeddings_roll = new Image;
	SubNavThemes_ThemeWeddings_roll.src = js_root + "images/common/gnsn_wedding_roll_" +  in_localeCode + ".gif";
	
	SubNavThemes_ThemeVilla_off = new Image;
	SubNavThemes_ThemeVilla_off.src = js_root + "images/common/gnsn_villavacations_off_" +  in_localeCode + ".gif";
	SubNavThemes_ThemeVilla_roll = new Image;
	SubNavThemes_ThemeVilla_roll.src = js_root + "images/common/gnsn_villavacations_roll_" +  in_localeCode + ".gif";
	
	SubNavThemes_ThemeUntrodden_off = new Image;
	SubNavThemes_ThemeUntrodden_off.src = js_root + "images/common/gnsn_untrodden_off_" +  in_localeCode + ".gif";
	SubNavThemes_ThemeUntrodden_roll = new Image;
	SubNavThemes_ThemeUntrodden_roll.src = js_root + "images/common/gnsn_untrodden_roll_" +  in_localeCode + ".gif";
	
	SubNavPlan_TravelLocator_off = new Image;
	SubNavPlan_TravelLocator_off.src = js_root + "images/common/gnsn_agent_off_" +  in_localeCode + ".gif";
	SubNavPlan_TravelLocator_roll = new Image;
	SubNavPlan_TravelLocator_roll.src = js_root + "images/common/gnsn_agent_roll_" +  in_localeCode + ".gif";
	
	SubNavPlan_Packages_off = new Image;
	SubNavPlan_Packages_off.src = js_root + "images/common/gnsn_pkgs_off_" +  in_localeCode + ".gif";
	SubNavPlan_Packages_roll = new Image;
	SubNavPlan_Packages_roll.src = js_root + "images/common/gnsn_pkgs_roll_" +  in_localeCode + ".gif";
	
	SubNavPlan_Lodgings_off = new Image;
	SubNavPlan_Lodgings_off.src = js_root + "images/common/gnsn_lodgings_off_" +  in_localeCode + ".gif";
	SubNavPlan_Lodgings_roll = new Image;
	SubNavPlan_Lodgings_roll.src = js_root + "images/common/gnsn_lodgings_roll_" +  in_localeCode + ".gif";
	
	SubNavPlan_Restaurants_off = new Image;
	SubNavPlan_Restaurants_off.src = js_root + "images/common/gnsn_restaurants_off_" +  in_localeCode + ".gif";
	SubNavPlan_Restaurants_roll = new Image;
	SubNavPlan_Restaurants_roll.src = js_root + "images/common/gnsn_restaurants_roll_" +  in_localeCode + ".gif";
	
	SubNavPlan_Nightlife_off = new Image;
	SubNavPlan_Nightlife_off.src = js_root + "images/common/gnsn_night_off_" +  in_localeCode + ".gif";
	SubNavPlan_Nightlife_roll = new Image;
	SubNavPlan_Nightlife_roll.src = js_root + "images/common/gnsn_night_roll_" +  in_localeCode + ".gif";
	
	SubNavPlan_Rentals_off = new Image;
	SubNavPlan_Rentals_off.src = js_root + "images/common/gnsn_rentals_off_" +  in_localeCode + ".gif";
	SubNavPlan_Rentals_roll = new Image;
	SubNavPlan_Rentals_roll.src = js_root + "images/common/gnsn_rentals_roll_" +  in_localeCode + ".gif";
	
	SubNavPlan_Shopping_off = new Image;
	SubNavPlan_Shopping_off.src = js_root + "images/common/gnsn_shop_off_" +  in_localeCode + ".gif";
	SubNavPlan_Shopping_roll = new Image;
	SubNavPlan_Shopping_roll.src = js_root + "images/common/gnsn_shop_roll_" +  in_localeCode + ".gif";
	
	SubNavPlan_Attractions_off = new Image;
	SubNavPlan_Attractions_off.src = js_root + "images/common/gnsn_attractions_off_" +  in_localeCode + ".gif";
	SubNavPlan_Attractions_roll = new Image;
	SubNavPlan_Attractions_roll.src = js_root + "images/common/gnsn_attractions_roll_" +  in_localeCode + ".gif";
	
	SubNavPlan_Tours_off = new Image;
	SubNavPlan_Tours_off.src = js_root + "images/common/gnsn_walk_off_" +  in_localeCode + ".gif";
	SubNavPlan_Tours_roll = new Image;
	SubNavPlan_Tours_roll.src = js_root + "images/common/gnsn_walk_roll_" +  in_localeCode + ".gif";
	
	SubNavPlan_Events_off = new Image;
	SubNavPlan_Events_off.src = js_root + "images/common/gnsn_events_off_" +  in_localeCode + ".gif";
	SubNavPlan_Events_roll = new Image;
	SubNavPlan_Events_roll.src = js_root + "images/common/gnsn_events_roll_" +  in_localeCode + ".gif";
	
	SubNavBefore_ShouldKnow_off = new Image;
	SubNavBefore_ShouldKnow_off.src = js_root + "images/common/gnsn_what_off_" +  in_localeCode + ".gif";
	SubNavBefore_ShouldKnow_roll = new Image;
	SubNavBefore_ShouldKnow_roll.src = js_root + "images/common/gnsn_what_roll_" +  in_localeCode + ".gif";
	
	SubNavBefore_GettingThere_off = new Image;
	SubNavBefore_GettingThere_off.src = js_root + "images/common/gnsn_getthere_off_" +  in_localeCode + ".gif";
	SubNavBefore_GettingThere_roll = new Image;
	SubNavBefore_GettingThere_roll.src = js_root + "images/common/gnsn_getthere_roll_" +  in_localeCode + ".gif";
	
	SubNavBefore_Services_off = new Image;
	SubNavBefore_Services_off.src = js_root + "images/common/gnsn_services_off_" +  in_localeCode + ".gif";
	SubNavBefore_Services_roll = new Image;
	SubNavBefore_Services_roll.src = js_root + "images/common/gnsn_services_roll_" +  in_localeCode + ".gif";
	
	
	SubNavBefore_Links_off = new Image;
	SubNavBefore_Links_off.src = js_root + "images/common/gnsn_links_off_" +  in_localeCode + ".gif";
	SubNavBefore_Links_roll = new Image;
	SubNavBefore_Links_roll.src = js_root + "images/common/gnsn_links_roll_" +  in_localeCode + ".gif";

	SubNavBefore_Talk_off = new Image;
	SubNavBefore_Talk_off.src = js_root + "images/common/gnsn_contact_off_" +  in_localeCode + ".gif";
	SubNavBefore_Talk_roll = new Image;
	SubNavBefore_Talk_roll.src = js_root + "images/common/gnsn_contact_roll_" +  in_localeCode + ".gif";	
	
	SubNavBefore_Around_off = new Image;
	SubNavBefore_Around_off.src = js_root + "images/common/gnsn_getaround_off_" +  in_localeCode + ".gif";
	SubNavBefore_Around_roll = new Image;
	SubNavBefore_Around_roll.src = js_root + "images/common/gnsn_getaround_roll_" +  in_localeCode + ".gif";	

	SubNavBefore_Culture_off = new Image;
	SubNavBefore_Culture_off.src = js_root + "images/common/gnsn_culture_off_" +  in_localeCode + ".gif";
	SubNavBefore_Culture_roll = new Image;
	SubNavBefore_Culture_roll.src = js_root + "images/common/gnsn_culture_roll_" +  in_localeCode + ".gif";
	
	SubNavBefore_Facts_off = new Image;
	SubNavBefore_Facts_off.src = js_root + "images/common/gnsn_facts_off_" +  in_localeCode + ".gif";
	SubNavBefore_Facts_roll = new Image;
	SubNavBefore_Facts_roll.src = js_root + "images/common/gnsn_facts_roll_" +  in_localeCode + ".gif";
	
	SubNavBefore_History_off = new Image;
	SubNavBefore_History_off.src = js_root + "images/common/gnsn_history_off_" +  in_localeCode + ".gif";
	SubNavBefore_History_roll = new Image;
	SubNavBefore_History_roll.src = js_root + "images/common/gnsn_history_roll_" +  in_localeCode + ".gif";
	
	SubNavBefore_Weather_off = new Image;
	SubNavBefore_Weather_off.src = js_root + "images/common/gnsn_great_off_" +  in_localeCode + ".gif";
	SubNavBefore_Weather_roll = new Image;
	SubNavBefore_Weather_roll.src = js_root + "images/common/gnsn_great_roll_" +  in_localeCode + ".gif";
	
	SubNavBefore_News_off = new Image;
	SubNavBefore_News_off.src = js_root + "images/common/gnsn_news_off_" +  in_localeCode + ".gif";
	SubNavBefore_News_roll = new Image;
	SubNavBefore_News_roll.src = js_root + "images/common/gnsn_news_roll_" +  in_localeCode + ".gif";

        SubNavAbout_comercial_off = new Image;
	SubNavAbout_comercial_off.src = js_root + "images/common/gnsn_comercial_off_" +  in_localeCode + ".gif";
	SubNavAbout_comercial_roll = new Image;
	SubNavAbout_comercial_roll.src = js_root + "images/common/gnsn_comercial_roll_" +  in_localeCode + ".gif";

        SubNavAbout_Residential_off = new Image;
	SubNavAbout_Residential_off.src = js_root + "images/common/gnsn_Residential_off_" +  in_localeCode + ".gif";
	SubNavAbout_Residential_roll = new Image;
	SubNavAbout_Residential_roll.src = js_root + "images/common/gnsn_Residential_roll_" +  in_localeCode + ".gif";

        SubNavAbout_lease_off = new Image;
	SubNavAbout_lease_off.src = js_root + "images/common/gnsn_lease_off_" +  in_localeCode + ".gif";
	SubNavAbout_lease_roll = new Image;
	SubNavAbout_lease_roll.src = js_root + "images/common/gnsn_lease_roll_" +  in_localeCode + ".gif";
	
        SubNavAbout_rental_off = new Image;
	SubNavAbout_rental_off.src = js_root + "images/common/gnsn_rental_off_" +  in_localeCode + ".gif";
	SubNavAbout_rental_roll = new Image;
	SubNavAbout_rental_roll.src = js_root + "images/common/gnsn_rental_roll_" +  in_localeCode + ".gif";

        SubNavAbout_owner_off = new Image;
	SubNavAbout_owner_off.src = js_root + "images/common/gnsn_owner_off_" +  in_localeCode + ".gif";
	SubNavAbout_owner_roll = new Image;
	SubNavAbout_owner_roll.src = js_root + "images/common/gnsn_owner_roll_" +  in_localeCode + ".gif";

// Preload calendar search year images
	for (iy=2003; iy <= 2010; iy++)
	{
		eval('cal_' + iy + ' = new Image;');
		eval('cal_' + iy + '.src = js_root + "images/common/cal_' + iy + '.gif";');
	}
	
	cal_month_1_off = new Image;
	cal_month_1_off.src = js_root + "images/common/cal_btn_jan_off_" +  in_localeCode + ".gif";
	cal_month_1_on = new Image;
	cal_month_1_on.src = js_root + "images/common/cal_btn_jan_on_" +  in_localeCode + ".gif";
	
	cal_month_2_off = new Image;
	cal_month_2_off.src = js_root + "images/common/cal_btn_feb_off_" +  in_localeCode + ".gif";
	cal_month_2_on = new Image;
	cal_month_2_on.src = js_root + "images/common/cal_btn_feb_on_" +  in_localeCode + ".gif";
	
	cal_month_3_off = new Image;
	cal_month_3_off.src = js_root + "images/common/cal_btn_mar_off_" +  in_localeCode + ".gif";
	cal_month_3_on = new Image;
	cal_month_3_on.src = js_root + "images/common/cal_btn_mar_on_" +  in_localeCode + ".gif";
	
	cal_month_4_off = new Image;
	cal_month_4_off.src = js_root + "images/common/cal_btn_apr_off_" +  in_localeCode + ".gif";
	cal_month_4_on = new Image;
	cal_month_4_on.src = js_root + "images/common/cal_btn_apr_on_" +  in_localeCode + ".gif";
	
	cal_month_5_off = new Image;
	cal_month_5_off.src = js_root + "images/common/cal_btn_may_off_" +  in_localeCode + ".gif";
	cal_month_5_on = new Image;
	cal_month_5_on.src = js_root + "images/common/cal_btn_may_on_" +  in_localeCode + ".gif";
	
	cal_month_6_off = new Image;
	cal_month_6_off.src = js_root + "images/common/cal_btn_jun_off_" +  in_localeCode + ".gif";
	cal_month_6_on = new Image;
	cal_month_6_on.src = js_root + "images/common/cal_btn_jun_on_" +  in_localeCode + ".gif";
	
	cal_month_7_off = new Image;
	cal_month_7_off.src = js_root + "images/common/cal_btn_jul_off_" +  in_localeCode + ".gif";
	cal_month_7_on = new Image;
	cal_month_7_on.src = js_root + "images/common/cal_btn_jul_on_" +  in_localeCode + ".gif";
	
	cal_month_8_off = new Image;
	cal_month_8_off.src = js_root + "images/common/cal_btn_aug_off_" +  in_localeCode + ".gif";
	cal_month_8_on = new Image;
	cal_month_8_on.src = js_root + "images/common/cal_btn_aug_on_" +  in_localeCode + ".gif";
	
	cal_month_9_off = new Image;
	cal_month_9_off.src = js_root + "images/common/cal_btn_sep_off_" +  in_localeCode + ".gif";
	cal_month_9_on = new Image;
	cal_month_9_on.src = js_root + "images/common/cal_btn_sep_on_" +  in_localeCode + ".gif";
	
	cal_month_10_off = new Image;
	cal_month_10_off.src = js_root + "images/common/cal_btn_oct_off_" +  in_localeCode + ".gif";
	cal_month_10_on = new Image;
	cal_month_10_on.src = js_root + "images/common/cal_btn_oct_on_" +  in_localeCode + ".gif";
	
	cal_month_11_off = new Image;
	cal_month_11_off.src = js_root + "images/common/cal_btn_nov_off_" +  in_localeCode + ".gif";
	cal_month_11_on = new Image;
	cal_month_11_on.src = js_root + "images/common/cal_btn_nov_on_" +  in_localeCode + ".gif";
	
	cal_month_12_off = new Image;
	cal_month_12_off.src = js_root + "images/common/cal_btn_dec_off_" +  in_localeCode + ".gif";
	cal_month_12_on = new Image;
	cal_month_12_on.src = js_root + "images/common/cal_btn_dec_on_" +  in_localeCode + ".gif";
			
	isLoaded = true;
}

function submitSearch(in_search_action, in_trim_url){	
	if (in_trim_url == null || in_trim_url == true)
		document.forms[0].action = document.location.href.substring(0, document.location.href.indexOf('?'));
	if (in_search_action == null)
		document.forms[0].elements["searchAction"].value = "display_results";	
	else
		document.forms[0].elements["searchAction"].value = in_search_action;
	submitForm("true");
}

function changePage(pageNo){
	document.forms[0].elements["CurrentPage"].value = pageNo;	
	submitForm("true");
}
function enterSubmit(event){
	if (event.keyCode == 13)
	{		
		clearSearchFlag();
		submitSearch();		
			
	}
}

function enterSubmitGlobalSearch(event){
	if (event.keyCode == 13)
	{		
		submitGlobalSearch();
		return false;
	}
}

function enterNewsletter(event){
	if (event.keyCode == 13)
	{		
		doSubmitNewsletterSignup();
	}
}

function enterTravelLocator(event){
	if (event.keyCode == 13)
	{		
		submitTravelAgentLocatorZip();
	}
}

function enterPromotion(event){
	if (event.keyCode == 13)
	{		
		checkAnswer();
	}
}

function enterTravelOCSearch(event){
	if (event.keyCode == 13)
	{		
		submitTravelAgentSearch('oc');
	}
}

function enterTravelNASearch(event){
	if (event.keyCode == 13)
	{		
		submitTravelAgentSearch('na');
	}
}
function init_expedia_form(in_name)
{
	var f=document.forms[in_name];
	if(hasTabs)
	{
		if(activeTab!=null && activeTab == "hot")
		{
			if(hasAir) 
			{
				hide('flt');
			}
			hide('pac');
			show('hot');
			SetTab('hot');
			set_image('hot');
		}
		else
		{
			if (f.elements['tab'].value=="hot")
			{
					if(hasAir) 
						hide('flt');
					hide('pac');
					show('hot');
					SetTab('hot');
					set_image('hot');
			}
			else 
				if(f.elements['tab'].value=="fly")
				{
					hide('hot');
					hide('pac');
					show('flt');
					SetTab('flt');
					set_image('flt');
				}
				else
				{
					if(hasAir) 
						hide('flt');
					hide('hot');
					show('pac');
					SetTab('pac');
					set_image('pac');
				}
			}
	}
}

function mrd(in_name)
{
	var room_number;
	for(i=0; i<document.forms[0].elements.length; i++)
	{
		if(document.forms[0].elements[i].name.indexOf( in_name )>0)
		{
			l = document.forms[0].elements[i].options[document.forms[0].elements[i].selectedIndex].value;
			if (l == "1") {hide('hotrm2'); hide('hotrm3'); hide('rm1txt'); room_number=1;}
			if (l == "2") {show('hotrm2'); hide('hotrm3'); show('rm1txt'); room_number=2;}
			if (l == "3") {show('hotrm2'); show('hotrm3'); show('rm1txt'); room_number=3;}
			break;
		}
	}
	
	var found = 0;	
	for(i=0; i<document.forms[0].elements.length; i++)
	{
		if(room_number==1)
		{
			if(document.forms[0].elements[i].name.indexOf( 'NumAdult2Temp' )>0)
			{
				document.forms[0].elements[i].options[0].selected = true;
				found++;
			}
						
			if(document.forms[0].elements[i].name.indexOf( 'NumChild2Temp' )>0)
			{
				document.forms[0].elements[i].options[0].selected = true;
				found++;
			}
			if(document.forms[0].elements[i].name.indexOf( 'NumAdult3Temp' )>0)
			{
				document.forms[0].elements[i].options[0].selected = true;
				found++;
			}
				
			if(document.forms[0].elements[i].name.indexOf( 'NumChild3Temp' )>0)
			{
				document.forms[0].elements[i].options[0].selected = true;
				found++;
			}
			if(found>4)
				break;
		}
		else
		{
			if(room_number==2)
			{	
				if(document.forms[0].elements[i].name.indexOf( 'NumAdult3Temp' )>0)
				{
					document.forms[0].elements[i].options[0].selected = true;
					found++;
				}
					
				if(document.forms[0].elements[i].name.indexOf( 'NumChild3Temp' )>0)
				{
					document.forms[0].elements[i].options[0].selected = true;
					found++;
				}
				if(found>1)
					break;
			}
		}
	}
}
