

 function initPage() {
		initFontSize();
	}

function kontakt(namn,server,subject) {
	adr = 'mai';
	adr = adr + 'lto' + ':' + namn;
	adr = adr + '@' ;
	if (server && server != "") {
		adr = adr + server;
	} else {
		adr = adr + 'aftonbladet';
		adr = adr + '.se';
	}
	if (subject && subject != "") {
		adr = adr + '?subject=' + subject;
	}
//	alert(adr);
	document.location = adr;
}

function rosta(frageID,rost,win,aid) {
	var re  =  new RegExp("^[0-9]+$");
	if (re.test(frageID) && rost != "") {
		url = "http://wwwb.aftonbladet.se/vss/special/storfragan/rostning/1,1936," + frageID + ",00.html?rost=" + rost;
		if (win == "samma") {
			document.location = url;
		} else {
			var winparams = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=350,height=500";
			msgWindow=window.open (url,"displayWindow",winparams);return false;
		}
	} else if (frageID != "") {
		 Rosta2(frageID,rost,win);
	}
}

function Rosta(thisform,width,height) {
	if (thisform) {
		if (width != "" && height != "") {
			var winparams = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height;
			rostaWin = window.open ('','rostaWin',winparams);
			thisform.target = 'rostaWin';
			thisform.submit();
		} else {
			thisform.target = '_self';
			thisform.submit();
		}
	}
}




 function getCookie(NameOfCookie){
		if (document.cookie.length > 0){
			begin = document.cookie.indexOf(NameOfCookie+"=");
			if (begin != -1){
				begin += NameOfCookie.length+1;
				end = document.cookie.indexOf(";", begin);
				if (end == -1) end = document.cookie.length;
				return unescape(document.cookie.substring(begin, end));
			}
		}
		return null;
	}
	
	function setCookie(NameOfCookie, value, expiredays){
		var ExpireDate = new Date ();
		ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
		document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
	}


 function initFontSize() {
		sparadStorlek = getCookie('ab_textstorlek');
		if (sparadStorlek) {
			updateDocumentFontSize(sparadStorlek);
		}
	}
	
	function changeFontSize(nyStorlek) {
		setCookie('ab_textstorlek',nyStorlek,1000);	
		updateDocumentFontSize(nyStorlek);
	}
	
	function updateDocumentFontSize(storlek) {
		if (storlek == "S") {
			documentFontSize = "100%";
		}
		if (storlek == "M") {
			documentFontSize = "130%";
		}
		if (storlek == "L") {
			documentFontSize = "160%";
		}
		spanInMain = document.getElementsByTagName("span");
		for (var i = 0; i < spanInMain.length; i++) {
			if(spanInMain[i].className == "brodtext" || spanInMain[i].className == "ingress") {
				spanInMain[i].style.fontSize = documentFontSize;
			}
		}
		divInMain = document.getElementsByTagName("div");
		for (var i = 0; i < divInMain.length; i++) {
			if(divInMain[i].className == "brodtext" || divInMain[i].className == "ingress") {
				divInMain[i].style.fontSize = documentFontSize;
			}
		}
	}	

