	// Return the style object based on ID
	function getStyleObject(objectId) 
	{
		if (document.getElementById && document.getElementById(objectId)) 
		{
			return document.getElementById(objectId);
		} 
		else if (document.all && document.all(objectId)) 
		{
			return document.all(objectId);
		} 
		else 
		{
			return false;
		}
	}

	function searchAdvanced( x, y )
	{
		var advancedBox = getStyleObject('adv_search');
		advancedBox.style.visibility = "visible";			
		advancedBox.style.top = (y + 22) + "px";
		advancedBox.style.left = (x - 39) + "px";
	}
	function showAdvancedBox( x, y, i)
	{
		var advancedBox = getStyleObject('adv_search_box');
		if(advancedBox.style.visibility == "hidden")
		{
			advancedBox.style.visibility = "visible";
			advancedBox.style.top = (y + 22) + "px";
			advancedBox.style.left = (x - 39) + "px";
			i=0;
			if(document.all)
			{
				if(navigator.userAgent.indexOf('Opera') == -1)
				{
					advancedBox.filters.alpha.opacity=0;
				}
			}
			else
			{			
				advancedBox.style.MozOpacity = 1;
			}
		}
		i = i + 5;
		if(i < 99)
		{
			if(document.all)
			{
				advancedBox.filters.alpha.opacity=i;
				setInterval("showAdvancedBox( '"+x+"', '"+y+"', "+i+")", 0);
			}
			else
			{
				advancedBox.style.MozOpacity = i/100;
				setTimeout("showAdvancedBox('', '', "+i+")", 0)
				advancedBox.style.MozOpacity = i/100;
				i = 100;
			}
		}
	}
	function hideAdvanced(i)
	{
		var advancedBox = getStyleObject('adv_search_box');
		if(!i)
		{
			i = 100;
		}
		
		i = i - 5;
		if(i > 0 && navigator.userAgent.indexOf('Opera') == -1)
		{
			if(document.all)
			{
					advancedBox.filters.alpha.opacity=i;
					setInterval("hideAdvanced("+i+")", 0);
			}
			else
			{
				advancedBox.style.MozOpacity = i/100;
				setTimeout("hideAdvanced("+i+")", 0)
			}
		}
		else
		{
			advancedBox.style.visibility = "hidden";
		}
	}
	
	//-----------------------------------------------------
	//				     TOOLTIP
	//-----------------------------------------------------
	function show_tooltip(caption, xpos, ypos)
	{

		var tool_tip = getStyleObject("floating_tooltip");
		var tool_tip_text = getStyleObject("tooltip_text");
		tool_tip.style.visibility = "visible";
		tool_tip.style.top = ypos - 50;
		tool_tip.style.left = xpos + 25;
		if(document.all)
		{
			tool_tip_text.innerText = caption;
		}
		else
		{
			tool_tip_text.innerHTML = caption;
		}
	
	}

	function hide_tooltip()
	{

		var tool_tip = getStyleObject("floating_tooltip");
		tool_tip.style.visibility = "hidden";
		tool_tip.style.top = -200;
		tool_tip.style.left = -200;		
	
	}

	//-----------------------------------------------------
	//                 MENU ICONS
	//-----------------------------------------------------
	// - Change the background for the menu icons on the header
	//=============================================	
	
	// Change the background menu image for the small icons
	function change_BG_Hover_small(the_id)
	{
		var theCell = getStyleObject(the_id);
		theCell.className = "bgover";
	}
	// Change the background menu image for the small icons	
	function change_BG_out_small(the_id)
	{
		var theCell = getStyleObject(the_id);
		theCell.className = "bgout";
	}
	// Change the background menu image for the large icons	
	function change_BG_Hover_large(the_id)
	{
		var theCell = getStyleObject(the_id);
		theCell.className = "bgover_large";
	}
	// Change the background menu image for the large icons	
	function change_BG_out_large(the_id)
	{
		var theCell = getStyleObject(the_id);
		theCell.className = "bgout_large";
	}
	//<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>
	
	//-----------------------------------------------------
	//                   DHTML MENUS
	//-----------------------------------------------------
	// - DHTML menus
	// - Show and hide the DIV layers, Place the DIV Layers
	// - Fade the menus out
	//=============================================
		
	// Fade out the menu if the mouse rolls out..
	// If the user moves the mouse back over the menu - cancel.
	
	function fade_out(i,the_id)
	{
		var theDiv = getStyleObject(the_id);
		if(document.all)
		{
			theDiv.filters.alpha.opacity=i;
		}
  	    i = i - 12;
		if(i > 0)
		{
			if(document.all)
			{
				setInterval("fade_out("+i+", '"+the_id+"')", 0);
			}
			else
			{
				theDiv.style.MozOpacity = i/100;
				setTimeout("fade_out("+i+", '"+the_id+"')", 0);
			}
		}
		else
		{
			theDiv.style.visibility = "hidden";
			return;
		}
	}
	
	// Change the background on the DHTML menu cell
	function change_BG_dhtmlOver(menu)
	{
		var theCell = getStyleObject(menu);
		theCell.className = "dhtml_2";
	}
	
	// Change the background on the DHTML menu cell
	function change_BG_dhtmlOut(menu)
	{
		var theCell = getStyleObject(menu);
		theCell.className = "dhtml_1";
	}
	
	var dhtml_menu_1_loop = 0;
	var dhtml_menu_2_loop = 0;
	var dhtml_menu_3_loop = 0;
	var dhtml_menu_4_loop = 0;
	var dhtml_menu_5_loop = 0;
	var dhtml_menu_6_loop = 0;
	var dhtml_menu_7_loop = 0;
	var dhtml_menu_8_loop = 0;
	
	// How a hidden menu
	function showMenu(name, location, locationy, over)
	{
		var theMenu = getStyleObject(name);

		hideMenus(name);
		var theBGLayer = getStyleObject("background_layer");
		if(document.location == "http://www.utahcityguide.com/new/index.asp")
		{
		//	theBGLayer.style.top = "150";
		}
		theBGLayer.style.visibility = "visible";
		theMenu.style.visibility = "visible";
		if(document.all) 
		{
			if(navigator.userAgent.indexOf('Opera') == -1)
			{
				theMenu.filters.alpha.opacity=92;
			}
			theMenu.style.left = (location - 5) + "px";
			theMenu.style.top = (locationy + 18) + "px";
		}
		else
		{			
			// theMenu.filters.alpha.opacity=100;
			theMenu.style.MozOpacity = .92;
			theMenu.style.left = (location - 5) + "px";
			theMenu.style.top = (locationy + 18) + "px";
		}
	}
	
	// Hide all the menus
	function hideMenus(exception)
	{
		var i = 1;
		while(i <= 8)
		{
			if(exception == "dhtml_menu_" + i)
			{
				// Do not fade out active menu
				i++;
			}
			else
			{
				var theBGLayer = getStyleObject("background_layer");
				theBGLayer.style.visibility = "hidden";
				if(document.all)
				{
					var themenu = getStyleObject('dhtml_menu_' + i);
					if(navigator.userAgent.indexOf('Opera') != -1)
					{
						themenu.style.visibility = "hidden";
					}
					else if(themenu.style.visibility != "hidden")
					{
						fade_out(100,'dhtml_menu_' + i);
					}
				}
				else
				{
					var themenu = getStyleObject('dhtml_menu_' + i);
					if(themenu.style.visibility != "hidden")
					{
						fade_out(100,'dhtml_menu_' + i);
					}
				}
				i++;
			}
		}
	}
	
	// Returns the X position of an element
	function findPosX(obj)
	{
		var curleft = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curleft += obj.offsetLeft
				obj = obj.offsetParent;
			}
		}
		else if (obj.x)
			curleft += obj.x;
		return curleft;
	}
	
	// Returns the Y position of an element
	function findPosY(obj)
	{
		var curtop = 0;
		var printstring = '';
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curtop += obj.offsetTop
				obj = obj.offsetParent;
			}
		}
		else if (obj.y)
			curtop += obj.y;
		return curtop;
	}
	
	function checkSearchBox()
	{
		var Search_Field = getStyleObject('header_search_form');
		
		if(Search_Field.QuickKW.value == "")
		{
			Search_Field.QuickKW.value = "Please enter a search";
		}
		else if(Search_Field.QuickKW.value == "Please enter a search")
		{
			Search_Field.QuickKW.value = "Please enter a search";
		}
		else
		{
			Search_Field.submit();
		}
	}
	
	//<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>


	function feedback()
	{
		window.open("http://www.utahcityguide.com/new/feedback.asp", "_feedback", "width = 400, height = 250, top = 50, left = 50, scrollbars = 1");	
	}

	//---------------------------------------------
 	//                MAIN  FEATURE
	//---------------------------------------------
	// - Hide all of the feature content
	// - Randomly load one of the 3 features
	//=============================================
	
	// Hide all of the content in the feature section
	function hideAll()
	{
		i = 1;
		while(i <= 3)
		{
			var theFeature_headline = getStyleObject("feature_headline_" + i);
			var theFeature_arrow = getStyleObject("feature_arrow_" + i);		
			var theFeature_headline = getStyleObject("feature_headline_" + i);
			var theFeature_content = getStyleObject("feature_" + i);

			theFeature_headline.style.display = "none";
			theFeature_arrow.style.display = "none";
			theFeature_headline.style.display = "none";
			theFeature_content.style.display = "none";											

			i++;
		}

	}	
	
	// Load a random feature when the page is loaded
	function random_feature()
	{
		if(document.location == "http://www.utahcityguide.com/new/index.asp" || document.location == "http://www.utahcityguide.com/new/index1.asp" || document.location == "http://www.utahcityguide.com/new/includes/header.asp" || document.location == "http://www.utahcityguide.com/new/index_xml.asp" || document.location == "http://www.utahcityguide.com/new/index_contraco.asp") // Change ME
		{
			var randomNum = Math.round(Math.random()*2);
			randomNum++; // just in case the random number is zero (1 - 3)
			
			change_feature(randomNum);
			
			window.status = "Welcome to Utah City Guide";
		}
	}

	// Show the content from another feature
	function change_feature(feature)
	{
		
		hideAll(); // Hide all of the features
		
		searchAdvanced(findPosX(document.getElementById('QuickKW')), findPosY(document.getElementById('QuickKW')));
		
		var theFeature_headline = getStyleObject("feature_headline_" + feature);
		var theFeature_arrow = getStyleObject("feature_arrow_" + feature);		
		var theFeature_headline = getStyleObject("feature_headline_" + feature);
		var theFeature_content = getStyleObject("feature_" + feature);		
		var theFeature_image = getStyleObject("feature_image");		
		
		theFeature_headline.style.display = "block";
		theFeature_arrow.style.display = "block";
		theFeature_headline.style.display = "block";
		theFeature_content.style.display = "block";				
		
		if(document.all && navigator.userAgent.indexOf('Opera') == -1) 
		{
			theFeature_image.filters[0].apply();
		}
		if(feature == 1)
		{
			theFeature_image.src = Feature_1_image;
		}
		else if(feature == 2)
		{
			theFeature_image.src = Feature_2_image;
		}
		else if(feature == 3)		
		{
			theFeature_image.src = Feature_3_image;
		}
		if(document.all && navigator.userAgent.indexOf('Opera') == -1)
		{
			theFeature_image.filters[0].play();
		}
	}
	
	function getAdUrl()
	{
		var theFeature_image = getStyleObject("feature_image");
		if(theFeature_image.src == Feature_1_image)
		{
			document.location = Feature_1_link;
		}
		else if(theFeature_image.src == Feature_2_image)
		{
			document.location = Feature_2_link;
		}
		else if(theFeature_image.src == Feature_3_image)
		{
			document.location = Feature_3_link;		
		}
	}
	//<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>
	
	// Preload Images
	image1 = new Image();
	image1.src = "menu_bg_small_1.jpg";
	
	image2 = new Image();
	image2.src = "menu_bg_small_over.jpg";
	
	image2 = new Image();
	image2.src = "menu_bg_large_1.jpg";
	
	image2 = new Image();
	image2.src = "menu_bg_large_over.jpg";
	
	// OLD JAVA
	
	function openPopup250(newWindow) {
 	newOpenWindow = window.open(newWindow, 'newWindow', 'width=250,height=200,left=100,top=100')
 
	newOpenWindow.focus()
    }

// =========================

// +++ pop-up flash ad window 300 x 250

function openFlashAd(newWindow) {
 	newFlashWindow = window.open(newWindow, 'newAd', 'width=301,height=251,left=300,top=100')

	newFlashWindow.focus()
 	}

// =========================

// +++ pop-up window 520 x 450

function openPopup475(newWindow) {
 	newOpenWindow = window.open(newWindow, 'newWindow', 'resizable,scrollbars=yes,width=520,height=475,left=100,top=20')
 
	newOpenWindow.focus()
    }

// =========================

// ++++ remote auto search window

function makeRemote(url) {
remote = window.open("",'remoteWin','resizable,width=490,height=480,left=0,top=0');
remote.location.href = url;
if (remote.opener == null) remote.opener = window; 
remote.opener.name = "opener";
remote.focus()
}


// =========================

// +++ remote advanced search popup window 320 x 320

 function makeSearch(url) {
  remote = window.open("",'remoteWindow','resizable,width=320,height=320,left=0,top=0');
  remote.location.href = url;
  if (remote.opener == null) remote.opener = window; 
  remote.opener.name = "opener";
  remote.focus()
  }

// =========================

// +++ pop-up map window 

function openMap(newWindow) {
 	newOpenMap = window.open(newWindow, 'newMap', 'resizable,scrollbars=yes,width=460,height=470,left=10,top=10')
 
	newOpenMap.focus()
    }

// =========================

//  ==== pop-up coupon 640 x 350 (coupon)

function openPopup1(newCoupon) {
      newCouponWindow = window.open(newCoupon, 'newCoup', 'width=640 height=350,left=0,top=0,scrollbars=yes,resizable')
 	
     newCouponWindow.focus()
     }

// =========================

function openPopup(newWindow) {
	
		if(!newWindow)
		{
			window.open('http://www.utahcityguide.com/cdomail/send3.asp', 'newWindow', 'resizable,scrollbars=yes,width=350,height=250,left=10,top=10')
		}
		else
		{
 			window.open(newWindow, 'newWindow', 'resizable,scrollbars=yes,width=600,height=525,left=10,top=10')
		}
    }
	
// Open inquiry Forms
   function openFormPopup(newWindow) {
      newOpenForm = window.open(newWindow, 'newForm', 'width=470,height=350,left=20,top=20,resizable,scrollbars=yes')
 	
     newOpenForm.focus()
     }

// Open Print Windows
	function openPrintPopup(newWindow) {
 	window.open(newWindow, 'newWindow', 'resizable,scrollbars=yes,width=620,height=525,left=10,top=10')
    }
// =========================

function openPopupGuru1(newWindow) {
 	window.open(newWindow, 'GuruAttendee', 'resizable,scrollbars=yes,width=420,height=625,left=10,top=10')
    }
function openPopupGuru2(newWindow) {
 	window.open(newWindow, 'GuruAttendee', 'resizable,scrollbars=yes,width=650,height=400,left=10,top=10')
    }


	
	if(window.event + "" == "undefined") event = null;
	function HM_f_PopUp(){return false};
	function HM_f_PopDown(){return false};
	popUp = HM_f_PopUp;
	popDown = HM_f_PopDown;
	