//vanity urls
willow.fixPodiumNav();

//em options
var emoptions = {
   emButtonPosition: "right",
   emButton: false,
   minPageWidth:1000
};

willow.ready(function($) {
		//CSP sdb 101310 this was commented out I modified it to use cause IE was showing scrollbars
		//remove padding around purple channel for image
			$(".cchtxt-14999 div").css("padding-bottom","0px");
			$(".cchtxt-14999 div").css("padding-left","0px");
	
	// pull image from task photo and place in banner
	var currentPage = parseInt(pdGlobal.currentPages[0].id);
	if($(".sitetph").html()){
		// place page image in banner
		var imgPath = $(".sitetph").children().attr("src");
		if(imgPath != undefined){
			$(".sitetph").children().remove();
			$("#task_photo img").attr("src",imgPath);
			if (currentPage != 132886) {
				$("#task_photo_relative").css("display","block").css("display","block");
			}
		}	
	}else if (currentPage === 52411){
		$("#task_photo img").attr("src","/ftpimages/189/podium/style584/taskphoto_default.jpg");
		$("#task_photo_relative").css("display","block").css("display","block");
	}

	
	//EM bar. setting timeout to fix centering problem in safari and Chrome
	setTimeout("willow.getNews('12535',function(data){$('body').bulletin(data,emoptions);},{'backlink':window.location})",1000);

	//menus
	var options = {
		direction:"down",
		currentL1:pdGlobal.currentPages[0].id,
		speed:0,
		showL3s:false
	};

	var $sitemap = $(".sitemap");
	willow.getMenu("130379|130380|130381|130382|130383",function(data){
	//L1 menu
	$('#L1').menu(data.menu,options);
	//footer menu
	var footMenu = data.menu,menuString = "";
	for(var i = 0; i < footMenu.length; i++){
		menuString+="<li class='footL1li footL1li_"+footMenu[i].id+"'><a id='footL1_"+footMenu[i].id+"' class='footL1a' href='"+footMenu[i].url+"'>"+footMenu[i].title+"</a>";
		if(footMenu[i].L2.length > 0){
			menuString+="<ul class='footerL2'>";
			for(var j = 0; j < footMenu[i].L2.length; j++){
				menuString+="<li><a href='"+footMenu[i].L2[j].url+"'>"+footMenu[i].L2[j].title+"</a></li>";
				}
			menuString+="</ul>";
		}
		menuString+="</li>";
	}
	$("#footL1").append(menuString);
	//sitemap
	if($sitemap.length > 0){
		$sitemap.sitemap(data);
	}

	});

	//home page stuff
	var currentPage = parseInt(pdGlobal.currentPages[0].id);
	if (currentPage === 132886) {
			// pull image from task photo and place in banner
			if($("#cbcb346312").html()){
				// place page image in banner
				var parentDiv = $("#cbcb346312").children().attr("src");
				if(parentDiv != undefined){
					$("#cbcb346312").children().remove();
					$("#task_photo img").attr("src",parentDiv);
					$("#task_photo_relative").css("display","block").css("display","block");
				}	
			}
		//hide the inner left cell that holds the navs and login.
		$("#lInTblLCell").css("display","none");
		//NRM 01122011 - Added styles to realign page after Brightcove release.
		$("#lInTblRCell").css("padding-top","0px");
		$("#pgCol_0").css("padding-bottom","20px");
		//add class to body so we can use it as a selector to change banner stuff. See banner.css.
		$("body").addClass("homepage");
		//hide right side fade
		$('#relative_rightside_fade').css("display","none");

		$("#image_below_L1").css("display","block");
		//$("embed").css({"position":"absolute", "top":"0", "left":"0", "z-index":"120"}).wrap('<div class="embed_channel2" />');
		$("embed").css({"z-index":"100"}).wrap('<div id="embed_channel" />').after('<div id="embed_footer_channel"></div>').css("height","367");
		
		if (pdGlobal.userLoggedIn == true){
			$("#embed_channel").css("top","-56px");
			//$("#embed_channel").css("top","-83px");
			//fix content channel height for when logged in.
			$(".cch-14185").css("height","297px");
			//$(".cch-14185").css("height","270px");
		}else{
			$(".cch-14185").css("height","324px");
		}		
	}
	
	//home page look stuff
	var globalpagearray = pdGlobal.currentPages;
	for(i=0; i < globalpagearray.length; i++){
		if (globalpagearray[pdGlobal.currentPageLevel-1].id == globalpagearray[i].id && i > 0){
			$("#image_below_L1").css("display","none");
			break;
		}
	}
	

	
	//flash page titles
	var hasFlash = HasFlash();
	/*if(hasFlash){hasFlash = $.flash.hasVersion("9.1");}*/
	
	if(hasFlash){
		$('.ptl2').html("");
		//PUT FLASH INFO HERE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
		var flashWidth = 450;
		var flashHeight = 40;
		//END FLASH INFO HERE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
		var flashvarsTest = {}
		//var L1pageTitle = pdGlobal.currentPages[0].title.toLowerCase();
		var L1pageTitle = "";
		//var L2pageTitle = pdGlobal.currentPages[1].title;
		var currentPage = parseInt(pdGlobal.currentPages[0].id);
		if (currentPage != 132886) {
			if(pdGlobal.currentPages[1] !== undefined){
				var L2pageTitle = pdGlobal.currentPages[1].title;
			}
		}
		var L3pageTitle = "";

		flashvarsTest.titleL1 = L1pageTitle;
		flashvarsTest.titleL2 = L2pageTitle;
		flashvarsTest.titleL3 = L3pageTitle;
		flashvarsTest.flashID = 'ptl2';
		$('.ptl2').flash({  
			src: '/flash/Interior_title.swf',
			wmode:'transparent',
			flashvars: flashvarsTest,
			width: flashWidth,
			height: flashHeight,
			AllowScriptAccess: 'always'
		});
	}
	/*else{
		$('#L1Title').text(pdGlobal.currentPages[0].title);
		//$('#L2Title').text(pdGlobal.currentPages[1].title);
		//$('#L3Title').text(pdGlobal.currentPages[2].title);
	}*/
	
});



	
