﻿var initLytebox = null;

function fixTemplate(){
	_cttcSurveyPrompt.init();
	widgets.init();
	if(isExplorer()) {Explorer6Fixes();}
	if(initLytebox != null) {initLytebox();}
}

/*-------------------------------------------------------------------------
Functions for the global header
-------------------------------------------------------------------------*/
function checkSearch() {
	if ($("#search_header").value == "Search") {
		$("#search_header").value = "";
	}
}
function setSearch(obj,str1,str2,cls) {
	if (obj.value == str1) {
		obj.value = str2;
		obj.className = cls;
	}
}
function showCountry() {
	$("#countryBox").css({"top":"0px"});
}
function hideCountry() {
	$("#countryBox").css({"top":"-600px"});
}

function home_load() {
	if (swfobject.hasFlashPlayerVersion("9.0.0")) {
		var lang = "en";
		if (arguments.length == 1 && (typeof arguments[0]) != "object") {lang = arguments[0];}
		if (arguments.length == 2) {lang = arguments[1];}
		var swf_params = { allowScriptAccess: "always", wmode: "transparent", allowFullScreen:"true" };
		var swf_vars =  { "datafeed" : "/assets/xml/datafeed_14_"+lang+".xml?v=20091104_00" };
		swfobject.embedSWF("/cttcHomepage_12.swf", "hero_main", "980", "480", "9.0.0", null, swf_vars, swf_params, null);
	} else {
		$.ajax({
			url:"/portlets/widgets/alt_EN.htm",
			dataType:"html",
			cache:false,
			success:function(data){
				$("#hero_main").html(data);
				scrollHero(0);
			},
			error:function(xhr,err,e){ alert( "Error: " + err ); }
		});
	}
	Rounded("rounded", 5, 5);
	fixTemplate();
}

function home_load_de() {
	home_load("de");
}
function home_load_mx() {
	home_load("mx");
}
function home_load_uk() {
    home_load("uk");
}

// Alt content home page hero
var hero_curr = 1;
var hero_tot = 6;
function scrollHero(d) {
	var img_root = "/portlets/docs/images/nav2009/alt/";
	var hero_next = hero_curr + d;
	if (d == 1) {
		if (hero_next > hero_tot) {hero_next = 1;}
	} else {
		if (hero_next < 1) {hero_next = hero_tot;}
	}
	hero_curr = hero_next;
	
	$("#hero_"+hero_curr+"_plaque").attr({"src":img_root+"plaque_"+hero_curr+".jpg"});
	$("#hero_"+hero_curr+"_explore").attr({"src":img_root+"explore_"+hero_curr+".jpg"});
	if ($("#hero_"+hero_curr+"_img_1")) {
		$("#hero_"+hero_curr+"_img_1").attr({"src":img_root+"img_"+hero_curr+"_1.jpg"});
	}
	if ($("#hero_"+hero_curr+"_img_2")) {
		$("#hero_"+hero_curr+"_img_2").attr({"src":img_root+"img_"+hero_curr+"_2.jpg"});
	}
	$("#hero_card").html($("#herocard_"+hero_curr).html());
	$("#hero_title_img").attr({"src":img_root+"title_"+hero_curr+".jpg"});
}

// Country selector rollovers
var langs = {
	default_lang : "EN",
	text_choose : {
		EN : "Choose your country for personalised content:",
		DE : "Wählen Sie Ihr Land:",
		JP : "国を選択:",
		KR : "언어를 선택하세요:",
		CT : "選擇你的國家:",
		CS : "选择你的国家:",
		ES : "Elija su país para contenido personalizado:",
		FR : "Choisissez votre pays:",
		IT : "Scelga il vostro paese:",
		PO : "Escolha o país:"
	},
	text_brochure : {
		EN : "Or get online brochures for visiting California in these languages:",
		DE : "Oder wählen Sie California Online-Broschüren in diesen Sprachen:",
		JP : "オンライン資料の言語を選択:",
		KR : "혹은 아래의 언어로 된 캘리포니아 온라인 가이드를 다운 받으세요:",
		CT : "或獲得關於旅遊加尼福尼亞州的多語言網上手冊:",
		CS : "或获得关于旅游加尼福尼亚州的多语言网上手册:",
		ES : "O consiga los folletos electrónicos en la web sobre California en estos idiomas:",
		FR : "Ou obtenez les brochures en ligne pour de visiter la Californie dans ces langues:",
		IT : "O ottenga gli opuscoli in linea sulla visita della California in queste lingue:",
		PO : "Ou consiga folheteria eletrônica visitando a Califórnia nesses idiomas:"
	},
	swap : function(lang) {
		$("#text_choose_id").html(this.text_choose[lang]);
		$("#text_brochure_id").html(this.text_brochure[lang]);
	},
	out : function() {
		$("#text_choose_id").html(this.text_choose[this.default_lang]);
		$("#text_brochure_id").html(this.text_brochure[this.default_lang]);
	}
}


// BridgeTrack/Analytics functions
var cttcbt = {
	append_value : "",
	banner : function() {
		if ($.cookie('cttcbanner') != null && $.cookie('cttcbanner') != "") {
			this.append_value = "/" + $.cookie('cttcbanner');
			this.fireTracker('interactions/banners'+this.append_value,false);
		}
	},
	click : function(my_pixel,my_group,my_set) {
		this.fireTracker('interactions/'+my_group+'/'+my_set+'/'+my_pixel,true);
		return true;
	},
	funspots : function(code,type) {
		this.fireTracker('outgoing/'+code,true);
	},
	mytrip : function(pixel_id,extra) {
		if (extra != "") {
			this.fireTracker('interactions/mytrip/'+pixel_id+'/add'+extra,true);
		} else {
			this.fireTracker('interactions/mytrip/'+pixel_id,true);
		}
	},
	tiles : function(eventStr,param) {
		if (param != "" && param != null) {
			this.fireTracker('interactions/tiles/'+eventStr+'/'+param,true);
		} else {
			this.fireTracker('interactions/tiles/'+eventStr,true);
		}
	},
	fireTracker : function(path,appendExtra) {
		var extra = this.append_value;
		if (!appendExtra) {extra = "";}
		if (typeof pageTracker == "object") {
			pageTracker._trackPageview(path+extra);
		}
	}
}

// Home Page Hero functions
	//Returns deep linking variables
	function getQueryVariable(variable){
		var query = window.location + "";
		var vars = query.split("?")[1].split("&");
 		for (var i=0;i<vars.length;i++) {
    		var pair = vars[i].split("=");
			if (pair[0] == variable) {return pair[1];}
		}
	}
	function getAddress() {return window.location;}
	function trackEvent(event, param) {
		var eventStr = new String(event).toLowerCase();
		cttcbt.tiles(eventStr,param);
	}
	function doBridgeTrackMovieEvent(event) {trackEvent(event, "");}
	function doBridgeTrackMovieEvent(event, param) {trackEvent(event, param);}
	function doBridgeTrackClickEvent(event) {trackEvent(event, "");}
	function doBridgeTrackClickEvent(event, param) {trackEvent(event, param);}


// Postcard functions
var pc = {
	curr : 1,
	total : 1,
	next : function() {
		pc.move(1);
	},
	prev : function () {
		pc.move(-1);
	},
	move : function(dir) {
		pc.total = parseInt(document.getElementById("pc_count").getAttribute("count"),10);
		var next = pc.curr + dir;
		if (next == 0) {
			next = pc.total;
		}
		if (next > pc.total) {
			next = 1;
		}
		pc.curr = next;
		document.getElementById("pc_img_div").style.backgroundImage = "url("+document.getElementById('pc_img_'+pc.curr).src+")";
		document.getElementById("pc_text_div").innerHTML = document.getElementById("pc_text_"+pc.curr).innerHTML;
		document.getElementById("pc_subtext_div").innerHTML = document.getElementById("pc_subtext_"+pc.curr).innerHTML;
		document.getElementById("pc_img_link").innerHTML = document.getElementById("pc_img_link_"+pc.curr).innerHTML;
	}
}

// Widgets functions
var widgets = {
	init : function() {
		this.popular();
		this.fyhsearch();
		this.calendar();
		this.events();
		this.weather();
		this.landing();
		this.postcard();
		this.attractions();
		this.crisis();
		this.authheader();
	},
	load : function(_id,_url,_cache) {
		$.ajax({
			url:_url,
			dataType:"html",
			cache:false,
			success:function(data){$(_id).html(data);},
			error:function(xhr,err,e){ /*alert( "Error: " + err );*/ }
		});
	},
	popular : function() {
		if (document.getElementById("widgets_popular")) {
			this.loading("widgets_popular");
			this.load("#widgets_popular","/pages/widgets/popular",false);
		}
	},
	crisis : function() {
		if (document.getElementById("widgets_crisis")) {
			this.load("#widgets_crisis","/pages/widgets/crisis",false);
		}
	},
	attractions : function() {
		if (document.getElementById("widgets_attractions")) {
			this.loading("widgets_attractions");
			var region = document.getElementById("widgets_attractions").getAttribute("region");
			this.load("#widgets_attractions","/pages/widgets/attractions/?region="+region,false);
		}
	},
	postcard : function() {
		if (document.getElementById("widgets_postcard")) {
			this.loading("widgets_postcard","h200");
			this.load("#widgets_postcard","/pages/widgets/postcard",false);
		}
	},
	fyhsearch : function() {
		if (document.getElementById("widgets_fyhsearch")) {
			this.loading("widgets_fyhsearch");
			var region = document.getElementById("widgets_fyhsearch").getAttribute("region");
			var load_url = "/pages/widgets/fyhsearch";
			if (region !== null) {
				load_url += "/?section="+region;
			}
			this.load("#widgets_fyhsearch",load_url,false);
		}
	},
	fyhsearch_action : function(click_group) {
		var region_idx = document.getElementById("fyhsearch_region").selectedIndex;
		var region = document.getElementById("fyhsearch_region").options[region_idx].value;
		var city = document.getElementById("fyhsearch_cityzip").value;
		if (city == "city or zip code") {city = "";}
		var my_pixel = "&Region="+region+"&City="+city;
		
		cttcbt.click(click_group+" Find Things to Do",click_group,"Find Things To Do"); //my_pixel
		
		location.href = "/pages/findyourself/?city="+city+"&chapter="+region;
	},
	weather : function() {
		if (document.getElementById("widgets_weather")) {
			this.loading("widgets_weather","h100");
			this.load("#widgets_weather","/pages/widgets/weather",false);
		}
	},
	weather_query : function(size,id,def,click_group) {
		var search = document.getElementById("weather_search").value;
		this.loading(id,"h100");
		
		cttcbt.click(click_group+" Weather",click_group,"Weather"); //"&Zip="+search
		
		this.load("#"+id,"/pages/widgets/weather/?search="+search+"&size="+size+"&def="+def,false);
	},
	calendar : function() {
		if (document.getElementById("widgets_calendar")) {
			var dayNamesMin = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];
			var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
			$("#widgets_calendar").datepicker({
				dayNamesMin:dayNamesMin,monthNames:monthNames,nextText:"Next",prevText:"Prev",minDate:0,onSelect:function(date) {
					widgets.events(date);
				}
			});
		}
	},
	events : function() {
		if (document.getElementById("widgets_events")) {
			var date_str = "?date=";
			if(arguments.length > 0) {
				date_str = "?date="+arguments[0];
			}
			this.loading("widgets_events","h200");
			this.load("#widgets_events","/pages/widgets/events"+date_str,false);
		}
	},
	landing : function() {
		if (document.getElementById("widgets_landing")) {
			this.loading("widgets_landing","h200");
			this.load("#widgets_landing","/pages/widgets/landing",false);
		}
	},
	recommendations : function(id,page) {
		if (document.getElementById(id)) {
			this.loading(id);
			this.load("#"+id,"/pages/widgets/recommendations/?page="+page,false);
		}
	},
	loading : function(id) {
		var cls = "";
		if (arguments.length > 1) {
			cls = " " + arguments[1];
		}
		document.getElementById(id).innerHTML = "<div class=\"loader"+cls+"\"><img src=\"/portlets/docs/images/loader.gif\"></div>";
	},
	authheader : function() {
		if (document.getElementById("widget_auth")) {
			if ($.cookie('accguid') != null && $.cookie('accguid') != "") {
				var user_name = $.cookie('accname');
				if (user_name == null) {
					document.getElementById("widget_auth").innerHTML = "Welcome Back | <a href=\"/pages/auth/signout\">Sign Out</a>";
				} else {
					document.getElementById("widget_auth").innerHTML = "Welcome, "+user_name+" | <a href=\"/pages/auth/signout\">Sign Out</a>";
				}
				
			} else {
				document.getElementById("widget_auth").innerHTML = "<a href=\"/pages/auth/signin\">Sign In</a> | <a href=\"/pages/auth/signup\">Sign Up</a>";
			}
		}
	},
	hfrecs : function(id,ttd,region,trip) {
		this.loading(id);
		this.load("#"+id,"/pages/widgets/hfrec/?ttd="+ttd+"&region="+region+"&trip="+trip,false);
	}
}

// Landing page accordian functions

var land_speed = 5;

function land_details(num,img) {
	var obj_id = "details_"+num;
	var img_id = "img_"+num;
	var type_id = "type_"+num;
	var recc_id = "widgets_reccommendations_"+img;
	var landing_close_icon = "/portlets/docs/images/landing/close.jpg";
	var landing_expand_icon = "/portlets/docs/images/landing/expand.jpg";
	var obj = document.getElementById(obj_id);
	var div = obj.firstChild;
	
	if (arguments.length == 3) {
		landing_close_icon = "/portlets/docs/images/landing/close"+arguments[2]+".jpg";
		landing_expand_icon = "/portlets/docs/images/landing/expand"+arguments[2]+".jpg";
	}
	
	if (document.getElementById(obj_id).style.display == "none") {
		obj.style.display = "inline";
		div.style.height = "0px";
		document.getElementById(img_id).src = landing_close_icon;
		if (img != "") {
			document.getElementById(type_id).src = "/portlets/docs/images/landing/icon_"+img+"_on.gif";
			if (document.getElementById(recc_id).innerHTML == "") {
				widgets.recommendations(recc_id,img);
			}
		}
		setTimeout("land_details_expand('"+obj_id+"',1)",land_speed);
	} else {
		document.getElementById(img_id).src = landing_expand_icon;
		if (img != "") {
			document.getElementById(type_id).src = "/portlets/docs/images/landing/icon_"+img+"_off.gif";
		}
		setTimeout("land_details_collapse('"+obj_id+"',16)",land_speed);
	}
}
function land_details_expand(id,h) {
	var div = document.getElementById(id).firstChild;
	div.style.height = (h*20)+"px";
	h++;
	
	var n = h*20;
	var c = parseInt(div.scrollHeight,10)+40;
	
	if ( (n < c) && (n+20 != c) ) {
		setTimeout("land_details_expand('"+id+"',"+h+")",land_speed);
	} else {
		div.style.height = ((h*20)+20)+"px";
	}
}
function land_details_collapse(id,h) {
	var div = document.getElementById(id).firstChild;
	div.style.height = (h*20)+"px";
	h--;
	if (h > 0) {
		setTimeout("land_details_collapse('"+id+"',"+h+")",land_speed);
	} else {
		document.getElementById(id).style.display = "none";
	}
}

// Loading ads

var adNum = 1;
function loadAd(doc, nil, elementId){
	var ad_src = '/portlets/pages/ad.aspx?ord=' + ord + '&tile=' + adNum;
	if (doc.getElementById(elementId).getAttribute("region") != undefined) {
		ad_src += "&region="+doc.getElementById(elementId).getAttribute("region");
	}
	if (doc.getElementById(elementId).getAttribute("zone") != undefined) {
		ad_src += "&zone="+doc.getElementById(elementId).getAttribute("zone");
	}
	doc.getElementById(elementId).src = ad_src;
	doc.getElementById(elementId).style.display = 'block';
	adNum++;
}

var _cttcSurveyPrompt = {
	ask : false,
	flush : false,
	init : function(){
		if(_cttcSurveyPrompt.flush) _cttcSurveyPrompt.removeCookie();
		if(_cttcSurveyPrompt.ask) _cttcSurveyPrompt.popUp();
	},
	popUp : function(){
		_cttcSurveyPrompt.setCookie(); 
		window.open('/_library/surveyPrompt.html','survey','width=400,height=200,left=100,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,top=100,screenX=100,screenY=100')
	},
	initObsolete : function(){
		if(_cttcSurveyPrompt.flush) _cttcSurveyPrompt.removeCookie();
		if(_cttcSurveyPrompt.ask) _cttcSurveyPrompt.display()
	},
	display : function(){
		_cttcSurveyPrompt.lyteboxOverlay.show();
		window.scrollTo(0,0);
		var e = document.createElement('div');
		e.id = 'cttcSurveyPromptWindow';
		e.className = 'surveyPrompt';
		e.innerHTML = '<h2>Your Opinion Matters!</h2><p>Tell us what you think about our new site!</p><img class="true" onmouseover="_cttcSurveyPrompt.mouseover(this)" onmouseout="_cttcSurveyPrompt.mouseout(this)" onclick="_cttcSurveyPrompt.click(this)" src="/_images/surveyImages/yes.png" alt="Yes" /><img class="false" src="/_images/surveyImages/no.png" onclick="_cttcSurveyPrompt.click(this)" onmouseover="_cttcSurveyPrompt.mouseover(this)" onmouseout="_cttcSurveyPrompt.mouseout(this)" alt="No" />';
		document.body.appendChild(e);
	},
	click : function(b){
		_cttcSurveyPrompt.setCookie();
		if( (b.alt).toLowerCase() == 'yes') _cttcSurveyPrompt.agree();
		else _cttcSurveyPrompt.disagree();
	},
	mouseover : function(b){ b.src = (b.src).replace('.png','_over.png'); },
	mouseout : function(b){ b.src = (b.src).replace('_over.png','.png'); },
	hide : function(){
		var o = grabElem('cttcSurveyPromptWindow');
		o.parentNode.removeChild(o);
		_cttcSurveyPrompt.lyteboxOverlay.hide();
	},
	agree : function(){
		window.open('http://tourvey.com/eSurvey/default.aspx?CID=CA&MID=9&SID=W1S','survey');
		_cttcSurveyPrompt.hide();
	},
	disagree : function(){
		grabElem('cttcSurveyPromptWindow').innerHTML = '<h2>No Problem!</h2><br><p>We respect your decision and you won\'t be asked again. Thank you.</p>';
		setTimeout(_cttcSurveyPrompt.hide, 4000);
	},
	removeCookie : function(){
		if ( (document.cookie.toUpperCase()).indexOf(_cttcSurveyPrompt.cookieName) > -1 ) document.cookie = _cttcSurveyPrompt.cookieName + "=;expires=Thu, 01-Jan-1970 00:00:01 GMT";
	},
	setCookie : function(){
		document.cookie = _cttcSurveyPrompt.cookieName + "=true"; 
	},
	cookieName : 'CTTCSURVEYPROMPTED',
	lyteboxOverlay : {
		show : function(){
			var pageSize	= myLytebox.getPageSize();
			var objOverlay	= myLytebox.doc.getElementById('lbOverlay');
			var objBody		= myLytebox.doc.getElementsByTagName("body").item(0);
			objOverlay.style.height = pageSize[1] + "px";
			objOverlay.style.display = '';
			myLytebox.appear('lbOverlay', myLytebox.maxOpacity);
			myLytebox.toggleSelects('');
			myLytebox.toggleFlash('');
		},
		hide : function(){
			myLytebox.fade('lbOverlay', 0);
			myLytebox.toggleSelects('visible');
			myLytebox.toggleFlash('visible');
		}
	}
}

/*-------------------------------------------------------------------------
Fix the navigation if using IE6
-------------------------------------------------------------------------*/
function Explorer6Fixes(){
	var navs = new Array('index1','index2','index3','index4','index5');
	for(i = 0; i < navs.length; i++){
		navigationAttachRollovers(navs[i]);
	}
	
	var sW = grabElem('largesearchwidget');
	if(sW){
		var p = sW.parentNode;
		p.style.paddingTop = '8px'
		p.style.height = '100px';
		p.style.position = 'relative';
		sW.style.position = 'absolute';
	}
	
	var a = document.all;
	for(i = 0; i < a.length; i++){
		theStyle = 'columns';
		if(((window.location.search).toLowerCase() ).indexOf('section=deals') > -1 && a[i].tagName == 'TABLE' && parseFloat(a[i].cellPadding) == 10){
			a[i].cellPadding = 0;
		} else if(a[i].className && a[i].className == 'deals_tan_box') {
			a[i].style.margin = '16px 0px 16px 0px';
		} else if(a[i].tagName == 'UL' && a[i].className == 'areas') {
			var lis = a[i].getElementsByTagName('li');
			lis[0].className = 'areasInclude';
		} else if(a[i].tagName == 'IMG' && ((a[i].src).toLowerCase()).indexOf('.png') > -1 ) {
			var tempSrc = a[i].src;
			a[i].style.width = a[i].clientWidth;
			a[i].style.height = a[i].clientHeight;
			a[i].style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=\'true\',sizingMethod=crop src="' + tempSrc + '")';
			a[i].src = '/_images/holder.gif';
		} else if(a[i].className && (a[i].className).indexOf(theStyle) > -1) {
			for(s = 0; s < a[i].childNodes.length; s++) {
				sE = a[i].childNodes[s];
				// loop through divs only
				if(  sE.tagName && (sE.tagName).indexOf('DIV') > -1 && 
					 sE.parentNode.className && 
					 (
						(sE.parentNode.className).indexOf(theStyle) > -1 &&
					 	(sE.parentNode.className).indexOf(theStyle + 'Child') == -1
					 )
					){
					// change styles to childfirst to target directly with css
					switch(sE.className){
						case "first": 
							sE.className = theStyle + 'ChildFirst';
						break;
						case "middle":
							sE.className = theStyle + 'ChildMiddle';
						break;
						case "last": 
							sE.className = theStyle + 'ChildLast';
						break;
					}
					// remove margin from initial grid
					if((sE.parentNode.parentNode.parentNode.parentNode.className).indexOf('columns') > -1) sE.parentNode.parentNode.parentNode.parentNode.style.marginTop = '0px';
					// 
					if((sE.parentNode.className).indexOf('height') > -1){
						parentClasses = (sE.parentNode.className).split(' ');
						grabHeight = 0;
						for(cI = 0; cI < parentClasses.length; cI++){
							cc = parentClasses[cI];
							if(cc.indexOf('height') > -1) grabHeight = parseInt(cc.replace('height',''));
						}
						if(grabHeight > 0) sE.style.height = grabHeight + 'px';
					}
				}
			}
		}
	}
	var tB = grabElem('cttcBody');
	tB.style.visibility = 'visible';
}
function debuggedIEBg(img){
	if(!isExplorer()) return 'background-image:url(' + img + ');';
	else return "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod=crop src='" + img + "');";
}
function navigationAttachRollovers(theId){
	e = grabElem(theId);
	if(e && e.parentNode.childNodes.length == 3){
		e.onmouseover = function(){this.parentNode.childNodes[2].style.display = 'block';}
		e.onmouseout = function(){this.parentNode.childNodes[2].style.display = 'none';}
		e.parentNode.childNodes[2].onmouseover = function(){this.style.display = 'block';}
		e.parentNode.childNodes[2].onmouseout = function(){this.style.display = 'none';}
	}
}

function isExplorer(){return ( (navigator.appName).indexOf('Explorer') > -1 && (navigator.appVersion).indexOf('MSIE 6') > -1 ) ? true : false;}
function isExplorer7(){return ( (navigator.appName).indexOf('Explorer') > -1 && (navigator.appVersion).indexOf('MSIE 7') > -1 ) ? true : false;}
function grabElem(theObj,theDoc){var p,i,foundObj;if(!theDoc)theDoc=document;if((p=theObj.indexOf("?"))>0&&parent.frames.length){theDoc=parent.frames[theObj.substring(p+1)].document;theObj=theObj.substring(0,p);}if(!(foundObj=theDoc[theObj])&&theDoc.all)foundObj=theDoc.all[theObj];for(i=0;!foundObj&&i<theDoc.forms.length; i++)foundObj=theDoc.forms[i][theObj];for(i=0;!foundObj&&theDoc.layers&&i<theDoc.layers.length;i++)foundObj=findObj(theObj,theDoc.layers[i].document);if(!foundObj&&document.getElementById) foundObj = document.getElementById(theObj);return foundObj;}
function getElementTop(Elem){if(document.getElementById){var elem=document.getElementById(Elem);}else if(document.all){var elem=document.all[Elem];}yPos=elem.offsetTop;tempEl=elem.offsetParent;while(tempEl!=null){yPos+=tempEl.offsetTop;tempEl=tempEl.offsetParent;}return yPos;}
function getElementHeight(Elem){var elem;if(document.getElementById){var elem=document.getElementById(Elem);}else if (document.all){var elem=document.all[Elem];}if((navigator.userAgent.indexOf("Opera 5")!=-1)||(navigator.userAgent.indexOf("Opera/5")!=-1)){xPos = elem.style.pixelHeight;}else{xPos=elem.offsetHeight;}return xPos;}
function getElementLeft(Elem){var elem;if(document.getElementById){var elem=document.getElementById(Elem);}else if(document.all){var elem=document.all[Elem];}xPos=elem.offsetLeft;tempEl=elem.offsetParent;while(tempEl!=null){xPos+=tempEl.offsetLeft;tempEl=tempEl.offsetParent;}return xPos;}
function getElementWidth(Elem){var elem;if(document.getElementById){var elem=document.getElementById(Elem);}else if(document.all){var elem=document.all[Elem];}if((navigator.userAgent.indexOf("Opera 5")!=-1)||(navigator.userAgent.indexOf("Opera/5")!=-1)){xPos=elem.style.pixelWidth;}else{xPos=elem.offsetWidth;}return xPos;}
