function SetFontSize(fontSize)
{
	var newFontSize = parseFloat(fontSize, 10);
	$('html').css('font-size', newFontSize)
	setCookie("FontSize", newFontSize)
}

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.toUTCString());
}

function fixLeftMenu()
{
	//alert($(".divSectionMenuExpanded .item1 a").length)
	$(".divSectionMenuExpanded .item1").mouseenter(function(){
		$(this).addClass("item1_hover")
	}).mouseleave(function(){
		$(this).removeClass("item1_hover")
	})
	$(".divSectionMenuExpanded .item1 a, .divSectionMenuExpanded .item1-selected a, .divSectionMenuExpanded .item1-selected-children-displayed a").append("<span class='linkwrap' />").append("<span class='linkarrow'/>")
}

function initEmailThisPage()
{
	$("#emailthispage").each(function(){
		$(this).click(function(e){
			e.preventDefault();
			var url = $(this).attr("href")
			$('html, body').scrollTop(0)
			
				if($("#emailThisPageForm").length == 0)
				{
					$("body").append("<div id='emailThisPageFormHolder' title='Share with friends' class='hidden'><iframe scrolling='no' onload='javascript: emailThisPageFormLoaded()' id='emailThisPageForm' src='"+ url +"' width=630  frameborder=0 class='hidden'></iframe><div id='emailThisPageLoading'><center><IMG alt='loading' SRC='/images/templateImages/ajax-loader-blue.gif'></center></div></div>")
				}
				else
				{
					$("#emailThisPageLoading").show()
					$("#emailThisPageForm").css("height", "150px").attr("src", url).hide()
				}
				
				var emailThisPageFormHolder = $("#emailThisPageFormHolder")
				emailThisPageFormHolder.dialog({
					modal: true,
					width: 300
				})
				
				var loadingImgDiv = $("#emailThisPageLoading")
				loadingImgDiv.css("left", emailThisPageFormHolder.width() / 2 - loadingImgDiv.width()/2 + 10).css("top", emailThisPageFormHolder.height() / 2 - loadingImgDiv.height()/2 )			
	
		})
	})
}

function emailThisPageFormLoaded()
{
	$("#emailThisPageLoading").hide()
	$("#emailThisPageForm").fadeIn()
	adjustEmailThisPagePopup();
}

function adjustEmailThisPagePopup()
{
	var iframeObj = $("#emailThisPageForm")
	var newHeight = 0;
	var newWidth = 650;
	
	if($.browser.msie)
	{
		newHeight = iframeObj[0].contentWindow.document.body.scrollHeight + 5;
		newWidth =  iframeObj[0].contentWindow.document.body.scrollWidth
	}
	else
	{
		newHeight = iframeObj[0].contentWindow.document.body.offsetHeight + 20;
		newWidth = iframeObj[0].contentWindow.document.body.offsetWidth
	}
	
	var centerLeft = $(window).width()/2 - newWidth/2
	var centerTop = $(window).height()/2 - (newHeight + 40)/2
	
	
	if($.browser.mozilla)
	{
		$('#emailThisPageFormHolder').parents('.ui-dialog:first').css({left:centerLeft, top:centerTop}).delay(300).css({height:newHeight+40, width:newWidth});
	}
	else
	{
		$('#emailThisPageFormHolder').parents('.ui-dialog:first').animate({left:centerLeft, top:centerTop, height:newHeight+40, width:newWidth + 20});
	}
	iframeObj.height(newHeight)
}

function setExternalLinkTarget()
{
	$("a[href*='spydus.exe']").attr("target", "_blank");
}
