function fixTemplate(){
	_cttcSurveyPrompt.init();
	widgets.init();
	if(isExplorer()) {Explorer6Fixes();}
}

/*-------------------------------------------------------------------------
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_15_"+lang+".xml?v=20101222a" };
		swfobject.embedSWF("/cttcHomepage_12.swf", "hero_main", "980", "480", "9.0.0", null, swf_vars, swf_params, null);
	} else {
		$.ajax({
			url:"/pages/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");
}
function home_load_au() {
    home_load("au");
}
function home_load_in() {
    home_load("in");
}
function home_load_fr() {
    home_load("fr");
}
function home_load_it() {
    home_load("it");
}

// Alt content home page hero
var hero_curr = 1;
var hero_tot = 6;
function scrollHero(d) {
	var img_root = "/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"});
}

var tiles = {
	curr: "home",
	scrolling: false,
	maxscroll: -770,
	speed: 30,
	dir: 1,
	load: function(region) {
		if (region != tiles.curr) {
			cttcbt.tiles(region, "");
			document.getElementById("tiles_selected").value = region;

			$(".tile_item").unbind('mouseenter mouseleave');

			document.getElementById("tiles_nav_" + tiles.curr).className = "tiles_nav_off";

			tiles.curr = region;
			document.getElementById("tiles_nav_" + tiles.curr).className = "tiles_nav_on";
			document.getElementById("tiles_content").innerHTML = document.getElementById("tiles_data_" + tiles.curr).innerHTML;

			document.getElementById("tiles_content").style.left = "-140px";
			document.getElementById("tiles_scroll_L").style.display = "inline";
			document.getElementById("tiles_scroll_R").style.display = "inline";

			//tiles.maxscroll = parseInt(document.getElementById("tiles_data_" + tiles.curr).getAttribute("maxscroll"), 10);
			tiles.loaded();
		}
	},
	scrollSet: function(dir, speed) {
		tiles.dir = dir;
		tiles.speed = speed;
		tiles.scrolling = true;
		tiles.scroll();
	},
	scroll: function() {
		if (tiles.scrolling) {
			var pos = parseInt(document.getElementById("tiles_content").style.left, 10);
			if ((tiles.dir == 1 && pos >= 70) || (tiles.dir == -1 && pos <= tiles.maxscroll)) {
				tiles.scrolling = false;
				if (tiles.dir == 1) {
					document.getElementById("tiles_content").style.left = "70px";
					document.getElementById("tiles_scroll_L").style.display = "none";
				} else {
					document.getElementById("tiles_content").style.left = tiles.maxscroll + "px";
					document.getElementById("tiles_scroll_R").style.display = "none";
				}
			} else {
				pos += (tiles.speed * tiles.dir);
				document.getElementById("tiles_content").style.left = pos + "px";
				document.getElementById("tiles_scroll_R").style.display = "inline";
				document.getElementById("tiles_scroll_L").style.display = "inline";
				setTimeout(tiles.scroll, 50);
			}
		}
	},
	loaded: function() {
		tiles.curr = document.getElementById("tiles_selected").value;
		if (tiles.curr == "") { tiles.curr = "home"; }
		tiles.maxscroll = parseInt(document.getElementById("tiles_data_" + tiles.curr).getAttribute("maxscroll"), 10);

		$(".tile_item").hover(
			function() {
				tiles.grow(this, this.getAttribute("hovx"), this.getAttribute("hovy"), 220, 230);
				$(this).addClass("tile_item_hover");
				this.style.zIndex = 2;
			},
			function() {
				tiles.shrink(this, this.getAttribute("x"), this.getAttribute("y"), 200, 210);
				$(this).removeClass("tile_item_hover");
				this.style.zIndex = 1;
			}
		);
		$(".tile_item_2").hover(
			function() {
				tiles.grow(this, this.getAttribute("hovx"), this.getAttribute("hovy"), 420, 440);
				$(this).addClass("tile_item_hover");
				this.style.zIndex = 2;
			},
			function() {
				tiles.shrink(this, this.getAttribute("x"), this.getAttribute("y"), 400, 420);
				$(this).removeClass("tile_item_hover");
				this.style.zIndex = 1;
			}
		);
	},
	stop: function() {
		tiles.scrolling = false;
	},
	grow: function(obj, x, y, h, w) {
		$(obj).animate({ left: parseInt(x, 10), top: parseInt(y, 10), height: h, width: w }, 200);
	},
	shrink: function(obj, x, y, h, w) {
		$(obj).animate({ left: parseInt(x, 10), top: parseInt(y, 10), height: h, width: w }, 200);
	}
}

// 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 : "Scegli il contenuto personalizzato per il tuo 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 : "Oppure scaricate le brochure on line visitando la 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]);
	}
}

// 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();
		this.currency();
		this.newsletter();
		this.essential();
		this.tripcount();
		this.reccs();
		this.videoslaunch();
		this.tiles();
	},
	load: function(_id, _url, _cache) {
		var callback = (arguments[3] == null ? null : arguments[3]);
		$.ajax({
			url: _url,
			dataType: "html",
			cache: false,
			success: function(data) {
				$(_id).html(data);
				if (callback) { callback(); }
			},
			error: function(xhr, err, e) { /*alert( "Error: " + err );*/ }
		});
	},
	divAttr: function(id, attr) {
		var ret = document.getElementById(id).getAttribute(attr);
		if (ret == null) { return ""; }
		return ret;
	},
	popupDetails: function(_url) {
		if (isIFrame()) {
			window.open(_url, "", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=900,height=600");
			return false;
		}
		return true;
	},
	tiles: function() {
		if (document.getElementById("widgets_tiles")) {
			var region = document.getElementById("tiles_selected").value;
			this.loading("widgets_tiles", "h200");
			this.load("#widgets_tiles", "/widgets/tiles/?region="+region, false, tiles.loaded);
		}
	},
	popular: function() {
		if (document.getElementById("widgets_popular")) {
			this.loading("widgets_popular");
			this.load("#widgets_popular", "/widgets/popular", false);
		}
		if (document.getElementById("widgets_popular_landing")) {
			var page = document.getElementById("widgets_popular_landing").getAttribute("page");
			this.loading("widgets_popular_landing");
			this.load("#widgets_popular_landing", "/widgets/popular/?page=" + page, false);
		}
	},
	crisis: function() {
		if (document.getElementById("widgets_crisis")) {
			this.load("#widgets_crisis", "/widgets/crisis", false);
		}
	},
	attractions: function() {
		if (document.getElementById("widgets_attractions")) {
			this.loading("widgets_attractions");
			var region = widgets.divAttr("widgets_attractions", "region");
			var thingtodo = widgets.divAttr("widgets_attractions", "thingtodo");
			this.load("#widgets_attractions", "/widgets/attractions/?region=" + region + "&thingtodo=" + thingtodo, false);
		}
	},
	postcard: function() {
		if (document.getElementById("widgets_postcard")) {
			this.loading("widgets_postcard", "h200");
			this.load("#widgets_postcard", "/widgets/postcard", false);
		}
	},
	videoslaunch: function() {
		if (document.getElementById("widgets_videolaunch")) {
			this.loading("widgets_videolaunch", "h200");
			this.load("#widgets_videolaunch", "/widgets/videos", false);
		}
	},
	fyhsearch: function() {
		if (document.getElementById("widgets_fyhsearch")) {
			this.loading("widgets_fyhsearch");
			var region = widgets.divAttr("widgets_fyhsearch", "region");
			var section = widgets.divAttr("widgets_fyhsearch", "section");
			var load_url = "/widgets/fyhsearch";
			if (region !== "") { 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

		if (isIFrame()) {
			window.open("/FindYourself/?city=" + city + "&chapter=" + region, "", "");
		} else {
			location.href = "/FindYourself/?city=" + city + "&chapter=" + region;
		}
		return false;
	},
	weather: function() {
		if (document.getElementById("widgets_weather")) {
			this.loading("widgets_weather", "h100");
			this.load("#widgets_weather", "/widgets/weather", false);
		}
		if (document.getElementById("widgets_smweather")) {
			var region = widgets.divAttr("widgets_smweather", "region");
			this.loading("widgets_smweather");
			this.load("#widgets_smweather", "/widgets/weather/?size=small&search=&def=" + region, 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, "/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=";
			var region = widgets.divAttr("widgets_events", "region");
			var region_str = "&region=" + region;
			if (arguments.length > 0) {
				date_str = "?date=" + arguments[0];
			}
			this.loading("widgets_events", "h200");
			this.load("#widgets_events", "/widgets/events" + date_str + region_str, false);
		}
	},
	landing: function() {
		if (document.getElementById("widgets_landing")) {
			this.loading("widgets_landing", "h200");
			this.load("#widgets_landing", "/widgets/landing", false);
		}
	},
	reccs: function(id) {
		if (document.getElementById("widgets_recommendations")) {
			var section = widgets.divAttr("widgets_recommendations", "section");
			this.loading("widgets_recommendations");
			this.load("#widgets_recommendations", "/widgets/recommendations/?page=&section=" + section, false);
		}
	},
	recommendations: function(id, page) {
		if (document.getElementById(id)) {
			var region = widgets.divAttr(id, "region");
			this.loading(id);
			this.load("#" + id, "/widgets/recommendations/?page=" + page + "&region=" + region, false);
		}
	},
	essential: function() {
		if (document.getElementById("widgets_essential")) {
			this.loading("widgets_essential");
			this.load("#widgets_essential", "/widgets/essential", false);
		}
	},
	tripcount: function() {
		if (document.getElementById("widgets_mytrip")) {
			//this.loading("widgets_mytrip");
			this.load("#widgets_mytrip", "/widgets/tripcount", false);
		}
	},
	loading: function(id) {
		var cls = "";
		if (arguments.length > 1) {
			cls = " " + arguments[1];
		}
		document.getElementById(id).innerHTML = "<div class=\"loader" + cls + "\"><img src=\"/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=\"/Auth/Signout/\">Sign Out</a>";
				} else {
					document.getElementById("widget_auth").innerHTML = "Welcome, " + user_name + " | <a href=\"/Auth/Signout/\">Sign Out</a>";
				}

			} else {
				document.getElementById("widget_auth").innerHTML = "<a href=\"/Auth/SignIn/\">Sign In</a> | <a href=\"/Auth/SignUp/\">Sign Up</a>";
			}
		}
	},
	hfrecs: function(id, ttd, region, trip) {
		this.loading(id);
		this.load("#" + id, "/widgets/hfrec/?ttd=" + ttd + "&region=" + region + "&trip=" + trip, false);
	},
	currency: function() {
		if (document.getElementById("widgets_currency")) {
			this.loading("widgets_currency");
			this.load("#widgets_currency", "/widgets/currency/?init=1", false);
		}
	},
	currency_result: function() {
		if (document.getElementById("widgets_currency_result")) {
			var sel_from = document.getElementById("currency_from");
			var sel_to = document.getElementById("currency_to");

			var curr_from = sel_from.options[sel_from.selectedIndex].value;
			var curr_to = sel_to.options[sel_to.selectedIndex].value;

			var curr_amt = document.getElementById("currency_amt").value;

			this.loading("widgets_currency_result");
			this.load("#widgets_currency_result", "/widgets/currency/?f=" + curr_from + "&t=" + curr_to + "&a=" + curr_amt, false);
		}
	},
	newsletter: function() {
		if (document.getElementById("widgets_newsletter")) {
			var email = "";
			if (document.getElementById("widgets_newsletter_email")) {
				email = document.getElementById("widgets_newsletter_email").value;
			}
			this.loading("widgets_newsletter", "h100");
			this.load("#widgets_newsletter", "/widgets/newsletter/?e=" + email, false);
		}
	},
	newsletter_de: function() {
		if (document.getElementById("widgets_newsletter")) {
			var email = "";
			if (document.getElementById("widgets_newsletter_email_de")) {
				email = document.getElementById("widgets_newsletter_email_de").value;
			}
			var first = "";
			if (document.getElementById("widgets_newsletter_first_de")) {
				first = document.getElementById("widgets_newsletter_first_de").value;
			}
			var last = "";
			if (document.getElementById("widgets_newsletter_last_de")) {
				last = document.getElementById("widgets_newsletter_last_de").value;
			}
			var salutation = "";
			if (document.getElementById("widgets_newsletter_salutation")) {
				salutation = document.getElementById("widgets_newsletter_salutation").value;
			}
			this.loading("widgets_newsletter", "h100");
			this.load("#widgets_newsletter", "/widgets/newsletter/?e=" + escape(email) + "&s=" + escape(salutation) + "&f=" + escape(first) + "&l=" + escape(last), false);
		}
	}
}

// Landing page accordian functions

function isIFrame() {
	var iframe = false;
	try {if (window.parent.frames.length>0) {if (window.parent.document.body.innerHTML) {} }}
	catch(err) {iframe = true;}
	return iframe;
}

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 = "/docs/images/landing/close.jpg";
	var landing_expand_icon = "/docs/images/landing/expand.jpg";
	var obj = document.getElementById(obj_id);
	var div = obj.firstChild;
	
	if (arguments.length == 3) {
		landing_close_icon = "/docs/images/landing/close"+arguments[2]+".jpg";
		landing_expand_icon = "/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 = "/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 = "/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 = '/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')
		window.open("/survey.htm","survey","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=430,height=500,screenX=100,screenY=100,copyhistory=yes");
	},
	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;}
String.prototype.trim = function() { return this.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g, ""); }

function validate_newsletter_signup_de() {
    var first = document.getElementById("widgets_newsletter_first_de").value.trim();
    var last = document.getElementById("widgets_newsletter_last_de").value.trim();
    var email = document.getElementById("widgets_newsletter_email_de").value.trim();
    var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

    if (email == "" || email.toLowerCase() == "e-mail") {
        alert("E-Mail benötigt werden.");
    } else if (!re.test(email)) {
        alert("Ungültige E-Mail!");
    } else {
        if (first.toLowerCase() == "vorname") document.getElementById("widgets_newsletter_first_de").value = "";
        if (last.toLowerCase() == "nachname") document.getElementById("widgets_newsletter_last_de").value = "";
        widgets.newsletter_de();
    }
}


function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
/* Functions that swaps images. */
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

/* Functions that handle preload. */
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


