// JavaScript Document

jQuery(document).ready(function(){
	// js fix for share links on featured articles						
	$(".asset-abstract-moving-forward-featured").prev().addClass("featured-share");
	
	
	adjustCalendar();
	updateCalPageTitle();
															
	$(".calendar-panel a").bind("click",function(event){
											   
									if($(this).parent().hasClass("has-events")==false){
										
										event.preventDefault();
																				
									}		   
											   })
	
	if($(".portlet-boundary").hasClass("portlet-calendar")){
		$("#column-1").css({background:"transparent"});
	}
	
	resizeHero();
	
	checkTitleHeight();
	
	window.onresize=function(){
			resizeHero();
		}
		
		//$("#tempContainer").append($.URLEncode("<strong> </strong>"))
		
		 setLengthMEnlarger=$(".firefox .enlargerHolder").length;
		   if(setLengthMEnlarger>0){
			   for(i=0;i<setLengthMEnlarger;i++){
				  tempMapID=$(".firefox .enlargerHolder").eq(i).attr("usemap");
				  $(".firefox .enlargerHolder").eq(i).attr("usemap","#"+tempMapID);
				  $(".firefox .enlargerHolder").eq(i).css({zIndex:100})
			   }
		   }
		
});

function resizeHero(){
	var winWidth=$(window).width()-70;
	if(winWidth>902){
		jQuery("#titleImg").css({width:winWidth+"px"});
	}
}

function changeSize(){
		jQuery("#titleImgContainer").toggleClass("nonHome");
	}
	
function changeImg(imgs){
		jQuery("#secTitle img").attr("src", imgs);
	}
	
function checkTitleHeight(){
	var titleH=$("#taberTitle h1").height();
	if(titleH>24){
		$("#content").addClass("twolineTitle");
		}
}

function adjustCalendar(){
	//alert(date.href)
	if(!$(".calendar-current-day").hasClass("calendar-selected-day")){
		$(".calendar-panel").addClass("currentDayNotSelected")
	}
}

function updateCalPageTitle(){
	if($("h3.calHeader").html()!="" && $("h3.calHeader").length >0){ 
			$("h1#mainTitle").html($("h3.calHeader").html());
			$("h3.calHeader").remove();
		}else{
			$("h1#mainTitle").html(title);
			}
	}
