function phpAdsJavaScript(zone) { url = "http://ekstra.htg.no/banner/folkebladet/adjs.php?n="; if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11); document.write ("<" + "script language='JavaScript' type='text/javascript' src='"); document.write(url + zone); document.write (url + phpAds_random); document.write ("&what=zone:" + zone); document.write ("&exclude=" + document.phpAds_used); if (document.referer){document.write ("&referer=" + escape(document.referer));} document.write ("'><" + "/script>"); } function launchPopup(url, name, width, height, resizable, scrollbars, toolbar, location) { popup_window = window.open(url, name, 'width='+width+',height='+height+',resizable='+resizable+',scrollbars='+scrollbars+',toolbar='+toolbar+',location='+location+''); popup_window.focus(); } var today = new Date() var timestamp = ''; function show(pElementName, pDisplay) { var voted = document.getElementById(pElementName); voted.style.display = pDisplay; } function hide(pElementName) { var voted = document.getElementById(pElementName); voted.style.display = "none"; } function change(pHideElementName, pShowElementName) { hide(pHideElementName); show(pShowElementName, 'block'); } function mentometerState(pollId) { var cookies = document.cookie; var pos = cookies.indexOf('mentometer='); if (pos != -1) { var start = pos + 11; var end = cookies.indexOf(';', start); if (end == -1) { end = cookies.length; } var value = cookies.substring(start, end); value = unescape(value); var mentometerIds = value.split('M'); for (var i = 0; i < mentometerIds.length; i++) { if (mentometerIds[i] == pollId) { change('vote-' + pollId, 'voted-' + pollId); return; } } change('voted-' + pollId, 'vote-' + pollId); } else { change('voted-' + pollId, 'vote-' + pollId); } } function size(pTotalVotes, pVotes, pSize) { return Math.round((pSize * percent(pTotalVotes, pVotes)) / 100); } function percent(pTotalVotes, pVotes) { var result = 0; if (pTotalVotes > 0) { result = (pVotes * 100) / pTotalVotes; } return Math.round(result); } function readCookie(pCookieName) { var cookieName = pCookieName + '=' var cookies = document.cookie; var pos = cookies.indexOf(cookieName); if (pos != -1) { var start = pos + cookieName.length; var end = cookies.indexOf(';', start); if (end == -1) { end = cookies.length; } return unescape(cookies.substring(start, end)); } } function setCookie(pName, pValue) { document.cookie = pName + '=' + escape(pValue); } function readPollCookie(pollId) { var pollCookie = readCookie('pollCache'); if (pollCookie == null) { return null; } var pollCacheCookies = pollCookie.split(';'); for (var i = 0; i < pollCacheCookies.length; i++) { var pollCookie = pollCacheCookies[i]; if (pollCookie.indexOf(pollId) != -1) { return pollCookie; } } } function readPollCookieIds() { var pollCookie = readCookie('pollCache'); if (pollCookie == null) { return null; } var pollCacheCookies = pollCookie.split(';'); var result = new Array(pollCacheCookies.length); for (var i = 0; i < pollCacheCookies.length; i++) { var hepp = pollCacheCookies[i].split(':') result[i] = hepp[0]; } return result; } function setPollCookie(pollId, vote) { var values = ''; var pollCookieIds = readPollCookieIds(); if (pollCookieIds != null) { for (var i = 0; i < pollCookieIds.length; i++) { values += readPollCookie(pollCookieIds[i]) + ';'; } } values += 'pollId-' + pollId + ':' + timestamp + ':' + vote; setCookie('pollCache', values); }