$(document).ready(function(){
	getUrlForPrint();
	// footer position
//	$('#leftContent ul:last-child li:last-child').css({"border-bottom":"none"});
//	$('#leftContent ul:last-child li:last-child img').attr({src: "/images/tooltip_without_bottom_line.png"});
	$('#leftContent ul:last-child li:last-child .simpleLink').css({"background":"#FED500"});
	
// replace the last image	
	var lastImage = $('#leftContent ul:last-child li:last-child img').attr("src");
	//if (lastImage=="images/tooltip.png"){
	//	$('#leftContent ul:last-child li:last-child  img').attr("src", "images/tooltip_without_bottom_line.png");
	//};

/*	$('#leftContent ul li:last-child a').css({"height":"25px"});*/
	$('#leftContent h2:first-child').css({"background":"url(/images/left_menu_top_bk.png) no-repeat top left"});
	$('#contentTeasers .teaser:last-child').css({"margin":"0 0 0 0"});
	
	$('#bodyContent').width();//actually this should't do anything by itself, but in a weird way, it fixes a bug in ie7, it make the browser behaves correctly

	//if this is the firstpage, add another class to #promotionsSection... so it can be bottom aligned with the campains - becouse the height of the first page is now different then the other pages
/*
	if ($("#flashBanner").hasClass("flashWrapper")){
		$("#promotionsSection").addClass("firstPage");
//		$("#rightContent #mapDK.section .sectionBottom").css({height: "178px"});
//		$("#rightContent #mapDK.section .sectionBottom img").css({paddingTop: "10px"});
//		$("#rightContent #rightSectionLinks.section .sectionBottom").css({height:"226px"})
//		$("#rightContent #rightSectionLinks.section .sectionBottom").css({height:"220px", paddingTop:"6px"}) 
	}
*/


	getUrlForPrint();



/*
	$('#searchInput').onclick = function(){
		
	}
	if ($('#searchInput').attr("value")=="a"){$('#searchInput').attr("value","SØG");}
	*/

// load flash movie on home page
/*
	$('#flashBanner').flash({
		src: 'flash/flash_banner.swf',
		width: 540,
		height: 334,
		flashvars: { filename: 'flash/flashbanner.xml'}
		//flashvars: { filename: '/?f=1'}
	});
*/
//	);

//	alert($('#leftMenu li').height());

/******
******* In the subpages, resize the body text div based on the links above, in the same mainContent DIV
******/
	dinamicHeight = 568-$('#jobs').height();	
	$('#bodyContent').height(dinamicHeight);
	
	
	
/******
******* Add the popups in the left meniu and press zone
******/
	
	$('.contactInfoTip').bind('mouseover',showDetails).bind('mouseout',hideDetails);
//	$('.contactInfoTip img').hover(showDetails,hideDetails);
	function showDetails(event) {
		$(this).parent().addClass('currentSmileyFace');
		$(this).children().attr("src","/images/tooltip_hover.png");
	}
	
	function hideDetails(event) {	
		$(this).parent().removeClass('currentSmileyFace'); 
		$(this).children().attr("src","/images/tooltip.png");
	}
	
	$('.presseInfoTip').bind('mouseover',showDetailsPress).bind('mouseout',hideDetailsPress);
//	$('.presseInfoTip img').hover(showDetailsPress,hideDetailsPress);

	function showDetailsPress(event) {
		$(this).addClass('currentSmileyFace');
		$(this).children().attr("src","/images/presse_tooltip_details_hover.png");
	}

	function hideDetailsPress(event) {	
		$(this).removeClass('currentSmileyFace');  
		$(this).children().attr("src","/images/presse_tooltip_details.png");
	}
	

	
/******
******* Show the popup only the first time a user ones the webpage; write a coockie if he is not a first time visitor
******/
	
	
function getCookie(c_name){
	if (document.cookie.length>0)
	  {
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1)
		{ 
		c_start=c_start + c_name.length+1; 
		c_end=document.cookie.indexOf(";",c_start);
		if (c_end==-1) c_end=document.cookie.length;
		return unescape(document.cookie.substring(c_start,c_end));
		} 
	  }
	return "";
}

function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function checkCookie(){
	username=getCookie('username0126');
	if (username!=null && username!=""){
	//	alert('Welcome again '+username+'!');
			$('#firstTimePopUp').css('display','none');	
		}
		else {
			$('#firstTimePopUp').css('display','block');	
	
			$("#firstTimePopUp").animate({opacity: 1}, 3500, function(){
				$("#firstTimePopUp").animate({opacity: 0}, 1500, function(){
					$("#firstTimePopUp").css({display: 'none'});
				});
			 });
	
			username='BackAgain';
			if (username!=null && username!="")	{
			setCookie('username0126',username,365);
		}
	  }
}
checkCookie()



});


