willow.fixPodiumNav();

willow.smButtons = function($obj,id){
	willow.getLinks(id,function(data){
		var links = data.link;
		if(links.length === 0){return;}
		var lstring = "";
		for(var i = 0; i < links.length; i++){
			lstring += "<li><a href='"+links[i].url+"'" + ((links[i].target == "true") ? " target='_blank'" : "") + ">"+
			((typeof links[i].image !== "undefined") ? "<img src='"+links[i].image.path+"' border='0'/>" : links[i].title)+"</a></li>";
		}
		$obj.html(lstring);
	});
}

willow.ready(function($) {
	if(pdGlobal.currentPages[pdGlobal.currentPages.length-1].id !== undefined){
		if(pdGlobal.currentPages[pdGlobal.currentPages.length-1].id == 121434){
			$("body").addClass("homepage");
			if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].title == "More News"){
					$("body").removeClass("homepage"); //removing homepage class for the More News page clicked on from homepage
					$("#pgCol_2").css("padding-left","23px");
				}
			/*
			if(pdGlobal.currentPages[pdGlobal.currentPages.length-1] != undefined){
				if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id == 204){
					$("body").removeClass("homepage"); //removing homepage class for news detail pages clicked on from homepage
				}
				
			}
			*/
		}
	}
	
	var menuoptions = {
        direction:"down",
        currentL1:pdGlobal.currentPages[0].id,
		showL3s: false
    };
	var $sitemap = $(".sitemap");
     willow.getMenu("121435|121616|121436|121437|121438|121439",function(data){
		$('#L1').menu(data.menu,menuoptions);
		
		if($sitemap.length > 0){
			$sitemap.sitemap(data);
		}
     });

	willow.getNews("12131",function(data){$('#Form1').bulletin(data,{emButton: false});},{"backlink":window.location});

	willow.smButtons($("#socialMedia"),14319);
});	
