/* * GLOBAL VARS */ var last_clicked_at = 0; var tmLoc = 'statistik-gallup.net'; var tmImg1 = new Image(); var tmImg2 = new Image(); /* Gemius variables */ var pp_gemius_identifier = new String('bO5A5Bfn67Mpt_V_5RiAAsQ8HUyyWAcPlZTEj7.O.rT.N7'); var pp_gemius_hitcollector = 'ee.hit.gemius.pl'; /* Browser detection */ function compare_version(ver1, ver2) { if (typeof(ver1) == 'string') ver1 = ver1.split('.'); else if (typeof(ver1) == 'number') ver1 = [ver1]; if (typeof(ver2) == 'string') ver2 = ver2.split('.'); else if (typeof(ver2) == 'number') ver2 = [ver2]; var i = 0; while (1) { if (!ver1[i]) { if (!ver2[i]) return 0; else return 1; } else if (!ver2[i]) return -1; if (parseInt(ver1[i]) > parseInt(ver2[i])) return -1; else if (parseInt(ver1[i]) < parseInt(ver2[i])) return 1; i++; } } var BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; }, searchString: function (data) { for (var i=0;i 0) { version = version.substring(0, version.indexOf(' ')); } return version; }, isValid: function (browsers) { var i = 0; var valid = false; for (i = 0; i < browsers.length; i++) { if (browsers[i].agent == this.browser) { if (compare_version(browsers[i].version, this.version) >= 0) { valid = true; break; } } } return valid; }, dataBrowser: [ { string: navigator.vendor, subString: "Google", identity: "Chrome", versionSearch: "Chrome" }, { string: navigator.userAgent, subString: "OmniWeb", versionSearch: "OmniWeb/", identity: "OmniWeb" }, { string: navigator.vendor, subString: "Apple", identity: "Safari" }, { prop: window.opera, identity: "Opera" }, { string: navigator.vendor, subString: "iCab", identity: "iCab" }, { string: navigator.vendor, subString: "KDE", identity: "Konqueror" }, { string: navigator.userAgent, subString: "Firefox", identity: "Firefox" }, { string: navigator.vendor, subString: "Camino", identity: "Camino" }, { // for newer Netscapes (6+) string: navigator.userAgent, subString: "Netscape", identity: "Netscape" }, { string: navigator.userAgent, subString: "MSIE", identity: "Explorer", versionSearch: "MSIE" }, { string: navigator.userAgent, subString: "Gecko", identity: "Mozilla", versionSearch: "rv" }, { // for older Netscapes (4-) string: navigator.userAgent, subString: "Mozilla", identity: "Netscape", versionSearch: "Mozilla" } ], dataOS : [ { string: navigator.platform, subString: "Win", identity: "Windows" }, { string: navigator.platform, subString: "Mac", identity: "Mac" }, { string: navigator.platform, subString: "Linux", identity: "Linux" } ] }; BrowserDetect.init(); /* ----------------------------------------------------------------------- */ // file: pagequery_api.js // javascript query string parsing utils // pass location.search to the constructor: var page = new PageQuery(location.search) // get values like: var myValue = page.getValue("param1") etc. // djohnson@ibsys.com {{djohnson}} // you may use this file as you wish but please keep this header with it thanks /* ----------------------------------------------------------------------- */ function PageQuery(q) { if(q.length > 1) this.q = q.substring(1, q.length); else this.q = null; this.keyValuePairs = new Array(); if(q) { for(var i=0; i < this.q.split("&").length; i++) { this.keyValuePairs[i] = this.q.split("&")[i]; } } this.getKeyValuePairs = function() { return this.keyValuePairs; } this.getValue = function(s) { for(var j=0; j < this.keyValuePairs.length; j++) { if(this.keyValuePairs[j].split("=")[0] == s) return this.keyValuePairs[j].split("=")[1]; } return -1; } this.getParameters = function() { var a = new Array(this.getLength()); for(var j=0; j < this.keyValuePairs.length; j++) { a[j] = this.keyValuePairs[j].split("=")[0]; } return a; } this.getLength = function() { return this.keyValuePairs.length; } } function queryString(key) { var page = new PageQuery(window.location.search); return unescape(page.getValue(key)); } /* --------------------------------------------------------------------------- */ /* * Array handling */ function isInArray(needle, arrayHaystack) { if (!arrayHaystack || arrayHaystack.length == 0) return false; for (var x in arrayHaystack) { if (arrayHaystack[x].split(":")[0] == needle) return true; } return false; } /* * Cookie handling */ function setCookie(name, value, expires, path, domain, secure) { var today = new Date(); today.setTime(today.getTime()); if (expires) expires = expires * 1000 * 60 * 60 * 24; var expires_date = new Date(today.getTime() + (expires)); document.cookie = name + '=' + escape(value) + ((expires) ? ';expires=' + expires_date.toGMTString() : '') + //expires.toGMTString() ((path) ? ';path=' + path : '') + ((domain) ? ';domain=' + domain : '') + ((secure) ? ';secure' : '' ); } function getCookie(name) { var start = document.cookie.indexOf(name + "="); var len = start + name.length + 1; if (!start && name != document.cookie.substring(0, name.length)) return null; if (start == -1) return null; var end = document.cookie.indexOf( ';', len ); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(len, end)); } function deleteCookie(name, path, domain) { if (getCookie(name)) { document.cookie = name + '=' + ((path) ? ';path=' + path : '') + ((domain) ? ';domain=' + domain : '' ) + ';expires=Thu, 01-Jan-1970 00:00:01 GMT'; } } /* * Check if the given feature has been selected */ function setFeatureVal(_feat, _id) { var Item = typeof(_id) == "string" ? getElementById(_id) : _id; var cookie_str = getCookie('features'); var feat_elements = Item.length; if (cookie_str && cookie_str.indexOf(_feat) >= 0) { var feature = parseInt(cookie_str.substr(cookie_str.indexOf(_feat+':')+_feat.length+1)); for (var i = 0; i < feat_elements; i++) { if (feature == Item.options[i].value) Item.options[i].selected = true; } } } /* * Check if the given feature has been selected */ function setRadioVal() { var cookie_str = getCookie('features'); if (cookie_str && cookie_str.indexOf("st") >= 0) { var feature = cookie_str.substr(cookie_str.indexOf('st:')+3); for (var j = 0; j < document.f.st.length; j++) { if (document.f.st[j].value == feature) { document.f.st[j].checked = true; } } } } /* * Gets the ad type from caller argument */ function getAdTypeFromCaller(){ var type; if (queryString('ca') < 0) { type = 's'; } else { var caller = queryString('ca'); var split_ca = caller.split("_"); type = split_ca[split_ca.length - 1] } return type; } /* * Layer handling */ function showField() { var ShowItem = document.getElementById(showField.arguments[0]); if (ShowItem) ShowItem.style.display = showField.arguments[1]; if (showField.arguments.length == 3) { ShowItem.innerHTML = showField.arguments[2]; } } function showElement(id, showHide, retval) { var element = document.getElementById(id); if (element) element.style.display = showHide == true ? "block" : "none"; if (retval != null) return retval; } function scrollToTop() { window.scrollTo(0, 0); } function scrollToBottom() { window.scrollTo(0, 10000); } function scrollToObject(offsetTrail) { var offsetLeft = 0; var offsetTop = 0; // Calculate the position while (offsetTrail) { offsetLeft += offsetTrail.offsetLeft; offsetTop += offsetTrail.offsetTop; offsetTrail = offsetTrail.offsetParent; } if (typeof(document.body.leftMargin) != "undefined") { offsetLeft += document.body.leftMargin; offsetTop += document.body.topMargin; } // Scroll window.scrollTo(0, offsetTop); } var focused = false; function scrollToError(elemId) { if (focused) return; var offsetTrail = document.getElementById(elemId); scrollToObject(offsetTrail); if (document.getElementById(elemId)) document.getElementById(elemId).focus(); focused = true; } function setFocus(_field) { if (document.getElementById(_field)) document.getElementById(_field).focus(); } function setChecked(_Id, _check) { var Item = document.getElementById(_Id); if (Item == null) return; Item.checked = _check; } function setValue(_Id, _check) { var Item = typeof(_Id) == "string" ? document.getElementById(_Id) : _Id; if (Item == null) return; Item.value = _check; } /* * Popup */ //window.name = "shl"; var newWin; function popUp(page, name, details) { newWin=window.open(page, name, details); newWin.focus(); return false; } function newsPopUp(page) { newWin=window.open(page, '_blank', ' width=800, height=' +Math.round(window.screen.availHeight * 0.8)+', scrollbars=yes, screenX = 0, screenY = 0, top = 0, left = 0'); newWin.focus(); return false; } /* * Table row hiliting for IE */ function tableRowHilite() { if (document.getElementById("hl") == null) return; var table = document.getElementById("hl"); var rows = table.getElementsByTagName('tr'); for (var i = 0; i < rows.length; i++) { rows[i].onmouseover = function() { this.className += 'hilite'; } rows[i].onmouseout = function() { this.className = this.className.replace('hilite', ''); } } } /* * Disable and enable input fields in forms */ function enable_field(_name) { var Item = typeof(_name) == "string" ? document.getElementById(_name) : _name; if (Item == null) return; if (Item.disabled) Item.disabled = false; } function disable_field(_name) { var Item = typeof(_name) == "string" ? document.getElementById(_name) : _name; if (Item == null) return; if (!Item.disabled) Item.disabled = true; } function check_dc(_key) { var date = new Date; var time = date.getTime(); if ((last_clicked_at + 2500) >= time) { document.getElementById(_key).value = 1; } else { document.getElementById(_key).value = 0; } last_clicked_at = time; } /* * Text area limit */ function maxlength(e, obj, max) { if (!e) e = window.event; // IE if (e.which) { var keycode = e.which; // Mozilla var ie = false; } else { var keycode = e.keyCode; // IE var ie = true; } x = obj.value.length; if (x > max) { obj.value = obj.value.substr(0, max); x = max; } if (keycode == 0 && ie) { // PASTE ONLY FOR IE var select_range = document.selection.createRange(); var max_insert = max - x + select_range.text.length; var data = window.clipboardData.getData("Text").substr(0, max_insert); select_range.text = data; } else if (x == max && (keycode != 8 && keycode != 46)) { return false; } return true; } /* * Positioning of elements */ function findPosX(obj, end) { var curleft = 0; var width = obj.clientWidth; if (obj.offsetParent) { while (obj.offsetParent) { curleft += obj.offsetLeft; obj = obj.offsetParent; } } else if (obj.x) curleft += obj.x; return curleft + (end?width:0); } function findPosY(obj, end) { var curtop = 0; var height = obj.clientHeight; if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.y) curtop += obj.y; return curtop + (end?height:0); } /* * Progress bar */ function ProgressBar(_container) { this.progress = []; this.container = _container || 'progressbar_container'; this.completed = false; /* Don't show estimate until progress reach (x) procent */ this.ESTIMATE_MIN_PROGRESS = 10; /* Speed calculation include latest (x) procent */ this.SPEED_CALC_LATEST = 30; /* Clear container */ this.clear(); /* Init the container */ var container = document.getElementById(this.container); if (!container) return; /* Create progress table */ var progress_bar = document.createElement('div'); progress_bar.className = 'progress_bar'; var progress_cell = document.createElement('div'); progress_cell.className = 'progress_blue'; progress_cell.style.width = '0px'; var debug = document.createElement('div'); debug.className = 'progress_debug'; debug.id = 'progress_debug_id'; progress_bar.appendChild(progress_cell); container.appendChild(progress_bar); container.appendChild(debug); container.appendChild(document.createElement('br')); } ProgressBar.prototype.clear = function () { this.progress = []; var container = document.getElementById(this.container); if (!container) return; while (container.childNodes.length > 0) container.removeChild(container.childNodes[0]); } ProgressBar.prototype.update = function (progress, total) { if (this.completed) return; var id = this.progress.length; var time = new Date(); this.progress[id] = {progress: progress, total: total, time: time.getTime()}; this.completed = progress == total; }; ProgressBar.prototype.current = function () { var id = this.progress.length; if (id == 0) return; return this.progress[id - 1]; }; ProgressBar.prototype.procent = function (_id) { var progress = this.progress[_id] || this.current(); if (progress && progress.progress) return Math.round( progress.progress / progress.total * 100 ); return 0; }; ProgressBar.prototype.speed = function () { if (this.progress.length == 0) return; var start_at = this.progress.length - Math.floor(this.progress.length * this.SPEED_CALC_LATEST / 100) - 1; if (start_at < 0) start_at = 0; var first = this.progress[start_at]; var current = this.current(); var current_progress = current.progress - first.progress; var time = (current.time - first.time); return (current_progress / time); }; ProgressBar.prototype.estimate = function () { if (this.procent() < this.ESTIMATE_MIN_PROGRESS) return ; var speed = this.speed(); var progress = this.current(); var remaining_progress = progress.total - progress.progress; var remaining_time = Math.round(remaining_progress / speed); return remaining_time; }; ProgressBar.prototype.draw = function () { var container = document.getElementById(this.container); if (!container) return; container.style.display = 'block'; var estimate = this.estimate() / 1000; var speed = this.speed(); var procent = this.procent(); if (container.childNodes.length) { var progress_bar = container.getElementsByTagName('div')[0]; var progress_cell = container.getElementsByTagName('div')[1]; progress_cell.style.width = Math.round((progress_bar.offsetWidth - 2) * procent / 100)+'px'; var debug = container.getElementsByTagName('div')[2]; var minutes_left = Math.floor(estimate / 60); var seconds_left = Math.round(estimate - minutes_left * 60); var time_left = ''; if (minutes_left + seconds_left > 0) time_left = js_info['TIME_LEFT'] + ': '; if (minutes_left > 0) time_left += minutes_left + " min "; if (seconds_left > 0) time_left += seconds_left + " s"; debug.innerHTML = procent + "%   " + time_left; } }; ProgressBar.prototype.update_draw = function(progress, total) { if (this.completed) return; this.update(progress, total); this.draw(); }; /* * Progress bar */ function progressBar(text) { document.write('
'+text+'
'); } function startProgressBar(pos) { var loading = document.getElementById('loading'); var dots = ""; pos %= 4; for (var i = 0; i < pos; i++) dots += "."; document.getElementById('loading_dots').innerHTML = dots; pos++; loading.timer = setTimeout('startProgressBar('+pos+')', 500); } /* * Position progress bar */ function showProgressBar(obj, posY) { var loading = document.getElementById('loading'); if (!posY) posY = 0; startProgressBar(1); loading.style.top = '' + (findPosY(obj, true) + posY) + 'px'; loading.style.left = '' + (findPosX(obj, true) + 20) + 'px'; loading.style.display = "inline"; } function hideProgressBar() { var loading = document.getElementById('loading'); clearTimeout(loading.timer); loading.style.display = 'none'; showElement("TipBox", true); } function select_all_weeks(_name, _form, _select) { for (var i = 1; i < 53; i++) { var week = eval("document." + _form + "." + _name + i); week.checked = _select; } } /* * Display images. Show border and display large image */ // If we don't try to do and image load, the resize wont be correct // Directly after load we remove the image cause we need next_image to be false for the functions function fix_next_image() { var next_image_load = new Image; var timestamp = new Date().getTime() + Math.random(); next_image_load.src = "/img/none.gif?"+timestamp; } fix_next_image(); function waitForNextImage(next_image, ad_id) { var ad_id = ad_id ? ad_id : ""; var image = document.getElementById("display_image" + ad_id).firstChild; if (next_image.width > 0) { image.width = next_image.width; image.height = next_image.height; } else { setTimeout(function () { waitForNextImage(next_image, ad_id); }, 100); } } function resizeImage(image, path, next_image, admin) { if (!next_image) { next_image = new Image; next_image.src = path; } if (next_image.width == 0) { next_image.onload = setTimeout(function () { resizeImage(image, path, next_image, admin); }, 0); return; } image.src = next_image.src; if (admin && next_image.width > 400) { var factor = (next_image.width - 400) / next_image.width; image.height = next_image.height * (1 - factor); image.width = 400; } else { image.width = next_image.width; image.height = next_image.height; } } function showLargeImage(strDisplayPath, ad_id, admin) { var ad_id = ad_id ? ad_id : ""; var admin = admin ? admin : false; var image = document.getElementById("display_image" + ad_id).firstChild; if (admin) { resizeImage(image, strDisplayPath, null, admin); } else { if (navigator.userAgent.toLowerCase().indexOf('safari') > 0) { var next_image = new Image; next_image.src = strDisplayPath; image.src = next_image.src; waitForNextImage(next_image, ad_id); } else { image.src = strDisplayPath; } } } /* Video */ function flowplayer_conf(video_flv, add_splash, auto_buffer, image_path) { var conf = new Object(); var image_path = image_path ? image_path : false; conf.showLoopButton = false; conf.showMenu = false; conf.autoPlay = false; conf.loop = false; conf.initialScale = 'scale'; conf.showFullScreenButton = false; conf.useNativeFullScreen = false; conf.bufferLength = 10; conf.videoFile = video_flv; if (auto_buffer) { conf.autoBuffering = true; } else if (add_splash && video_flv.indexOf('videos') > 0) { var video_splash = ''; if (image_path == false) { video_splash = video_flv.replace(/.*videos/, add_splash).replace(/flv/, 'jpg'); } else { var image_id = video_flv.substring(video_flv.lastIndexOf("/")); image_id = image_id.replace(/flv/, "jpg"); video_splash = image_path + image_id.substring(0, 3) + image_id; } conf.autoBuffering = false; conf.splashImageFile = video_splash; conf.scaleSplash = true; } else if (add_splash && video_flv.indexOf('flush') > 0) { var video_splash = video_flv.replace(/flv/, 'splash'); conf.splashImageFile = video_splash+'/.jpg'; conf.scaleSplash = true; } return conf; } function flowplayer_conf_to_string(conf) { var conf_string = '{'; for (var i in conf) { conf_string += i + ':' + (typeof(conf[i]) == 'string'?"'":'') + conf[i] + (typeof(conf[i]) == 'string'?"'":''); conf_string += ','; } conf_string = conf_string.substring(0, conf_string.length - 1); conf_string += '}'; return conf_string; } function hide_video(ad_id) { ad_id = ad_id || ''; var video = document.getElementById('flowplayerholder' + ad_id); var image = document.getElementById('display_image' + ad_id); if (video) { video.style.display = 'none'; var container = video.parentNode; container.removeChild(video); } if (image) image.style.display = 'block'; } function show_video(video_file, width, height, ad_id) { ad_id = ad_id || ''; var image = document.getElementById('display_image' + ad_id); var container = image.parentNode; var video = document.getElementById('flowplayerholder' + ad_id); var conf = flowplayer_conf(video_file, false); conf.autoPlay = true; conf = flowplayer_conf_to_string(conf); if (ad_id && width > 400) { height = Math.round(400 / width * height); width = 400; } if (!video) { video = document.createElement('div'); video.id = 'flowplayerholder' + ad_id; container.appendChild(video); image.style.display = 'none'; var fo = { movie:"/swf/FlowPlayer.swf", width:width, height:height, majorversion:"7", build:"0", allowscriptaccess: "always", flashvars:"config=" + conf }; UFO.create(fo, "flowplayerholder" + ad_id); } else if (video.style.display == 'none') { image.style.display = 'none'; video.style.display = 'block'; } else { var fo = document.getElementById("flowplayerholder" + ad_id + "_obj"); var time = fo.getTime(); var dur = fo.getDuration(); if (time >= dur) fo.Seek(0); if(!fo.getIsPaused() && fo.getIsPlaying()) { fo.Pause(); } else { fo.DoPlay(); } } } function next_image () { if(!images[counter]) counter = 0; /* If next item is an video, play video */ if(video_exist == 1 && counter == 0) { var v_thumb = document.getElementById('thumb' + images.length); v_thumb.name = 'video'; counter = 0; thumbnailBorder(v_thumb, images.length + 1); show_video(video_url, video_width, video_height); return; } /* Preload next image */ var thumb = document.getElementById('thumb' + counter); var image = new Image; image.src = image_url + images[counter]; showLargeImage(image_url + images[counter]); thumbnailBorder(thumb, images.length); set_alt_title('main_pict'); counter++; } function set_alt_title(call_div) { var main_image = document.getElementById('main_image'); var adder = 0; if(call_div == 'thumb') { adder = 1; } /* When next thumb is a video, display other alt/title */ if(video_exist == 1 && counter == images.length - 1 + adder) { main_image.alt = js_info['SHOW_AD_VIDEO']; main_image.title = js_info['SHOW_AD_VIDEO']; } else { main_image.alt = js_info['CLICK_FOR_NEXT_IMAGE']; main_image.title = js_info['CLICK_FOR_NEXT_IMAGE']; } } var styles = []; function thumbnailBorder(thumb, image_num, ad_id) { var ad_id = ad_id ? ad_id : ""; if (!thumb) return; if (thumb.name != 'video') hide_video(ad_id); for (i = 0; i < image_num; i++) { var thumb_obj = document.getElementById('thumb' + i + ad_id); if (!styles[i]) { styles[i] = thumb_obj.className.replace("ad_border_solid_black", "ad_border_solid_grey"); } if (thumb.id == thumb_obj.id) { thumb_obj.className = "ad_thumb ad_border_solid_black"; } else { thumb_obj.className = styles[i]; } } } /* Hide image and display image-add input */ function delete_image(element_show, element_hide, hidden) { var obj1 = document.getElementById(element_show); var obj2 = document.getElementById(element_hide); showField(obj1.id, "block"); obj2.innerHTML = ""; return false; } function getElementsByClassName(oElm, strTagName, strClassName) { var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName); var arrReturnElements = new Array(); strClassName = strClassName.replace(/\-/g, "\\-"); var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)"); var oElement; for(var i=0; i 1) res[kv[0]] = kv[1]; else { res[arr[i]] = 1; } } return res; } function mergeElementValues(arr, htmlCollection) { for (var ii = 0; ii < htmlCollection.length; ii++) { var elem = htmlCollection[ii]; if (!elem.getAttribute('name')) continue; var key = null; var options = null; if (elem.className) { var element_group = elem.className.replace(/.*element_group([0-9]+).*/, "$1"); if (element_group != "") element_group += "."; key = element_group + elem.getAttribute('name'); if (elem.className.match(/(^| )cat_data_select($| )/)) { var a = []; for (var i = 0; i < elem.options.length; i++) { a[i] = elem.options[i]; } options = a; } } else key = elem.getAttribute('name'); if (key.match(/\[\]$/) && elem.value) key += elem.value; if (((elem.type == 'radio' || elem.type == 'checkbox') && !elem.checked)) { if (typeof arr[key] != "undefined") delete arr[key]; } else if ((elem.value || options) && !elem.disabled) { arr[key] = elem.value; if (options) arr[key + ".options"] = options; } else { arr[key] = ""; if (typeof arr[key + ".options"] != "undefined") delete arr[key + ".options"]; } } return arr; } function setElementValues(arr, htmlCollection) { for (var ii = 0; ii < htmlCollection.length; ii++) { var elem = htmlCollection[ii]; var options = null; if (elem.className) { var element_group = elem.className.replace(/.*element_group([0-9]+).*/, "$1"); if (element_group != "") element_group += "."; key = element_group + elem.getAttribute('name'); if (elem.className.match(/(^| )cat_data_select($| )/)) { options = arr[key + ".options"]; } } else key = elem.getAttribute('name'); if (key.match(/\[\]$/) && elem.value) key += elem.value; var value = arr[key]; if (elem.type == 'radio' || elem.type == 'checkbox') { if (value == elem.value) elem.checked = true; } else if (value || options) { if (options) { elem.options.length = 0; for (var i = 0; i < options.length; i++) { elem.options[i] = options[i]; } elem.disabled = false; } elem.value = value; } } } /* * AJAX */ function ajax_request(dest, post, callback, params, evaluate, method) { var xmlhttp = false; if (method == null){ method = "POST"; } if (typeof evaluate == "undefined") evaluate = true; try { xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { // browser doesn't support ajax. handle however you want // XXX ? callback(false, xmlhttp, params); } if (xmlhttp !== false) { xmlhttp.onreadystatechange = function () { ajax_callback(callback, params, xmlhttp, evaluate); }; xmlhttp.open(method, dest, true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send(post); } } function ajax_callback(callback, params, xmlhttp, evaluate) { if (xmlhttp.readyState == 4) { if (xmlhttp.status == 200 && xmlhttp.responseText.indexOf('Error'; } document.getElementById("abuseform").style.display = "block"; } } /* we send data via GET, but POST would be better (mod_blocket needs to be modified to handle POST vars) */ var address = url + '?action=insert&id=' + list_id + '&abuse_type='+ abuse_type+"&lang=" + lang; var reporter_id = getCookie("uid"); if(reporter_id != null) address = address + '&uid=' + reporter_id; xmlhttp.open("GET", address, true); xmlhttp.setRequestHeader('If-Modified-Since', 'Thu, 1 Jan 1970 00:00:00 GMT'); xmlhttp.setRequestHeader('Cache-Control','no-cache, no-store'); xmlhttp.setRequestHeader('Pragma','no-cache'); xmlhttp.send(null); } function updateabusereport(url, list_id, abuse_type, report_id) { var xmlhttp = false; var email=document.getElementById("abuse_email").value; var message=document.getElementById("abuse_message").value; var reporter_id = getCookie("uid"); try { xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { return false; // browser doesn't support ajax. handle however you want } xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4) { var layer=document.getElementById("abuseform"); if (xmlhttp.status == 200 && xmlhttp.responseText.indexOf('Error'; } } } /* we send data via GET, but POST would be better (mod_blocket needs to be modified to handle POST vars) */ var address = url + '?action=update&id=' + list_id + '&abuse_type='+ abuse_type + '&report_id=' + report_id; message = message.replace(/\n/g, "
"); if(email != "") address += '&email=' + email; if(message != "") address += '&abuse_message=' + encodeURIComponent(message); if(reporter_id != null) address += '&uid=' + reporter_id; else { var newuid = document.getElementById("new_uid").value; if (newuid != null) address += '&uid=' + newuid; } xmlhttp.open("GET", address, true); xmlhttp.setRequestHeader('If-Modified-Since', 'Thu, 1 Jan 1970 00:00:00 GMT'); xmlhttp.setRequestHeader('Cache-Control','no-cache, no-store'); xmlhttp.setRequestHeader('Pragma','no-cache'); xmlhttp.send(null); } /* -------------------------------------- * Pixel 1x1 statistics * -------------------------------------- */ function Pixel(url, where, cp, ap, cc, ac,qh,cookie,lang) { var src; var d = new Date(); if ( !where ) { where = 'failure_' + window.location.host.replace( /\.|:/gi ,'_' ) + window.location.pathname.replace(/\/|\./g, '_'); } src = url+'/1x1_pages_' + where if ( cp ) { src += '_c'+cp; } else { src += '_cpuk'; } if ( ap ) { src += '_a'+ap; } else { src += '_apuk'; } if ( cc ) { src += '_'+cc; } if ( ac ) { src += '_'+ac; } if ( qh ) { src += '_qh'+qh; } if ( lang ) { src += '_l' + lang; } src = src+'.gif?r='+d.getTime(); /* Add cookie at the end of the URI, if it exists */ if (cookie && getCookie(cookie)) { src += '&'+cookie+'=1'; } if (document.write_org != null) document.write_org(''); else document.write(''); } ajax = {}; form_submit_result = function(result, xmlhttp, form) { if (!result) { result = new Array(); result['status'] = 'ERROR'; } if (result['status'] == 'OK') { form.reset(); var divs = form.getElementsByTagName('div'); for(var i in divs) { var e = divs[i]; if (e.className && e.className.match(/okey/)) { e.style.display = 'block'; } } } else { for(var key in result) { var err = document.getElementById('err_' + key); if (err) { err.innerHTML = ''+result[key]+''; err.style.display = 'block'; } } } } escape_component = function(str) { return escape(str).replace('+', '%2b'); } form_ajax_submit = function(form) { var post = ''; var action = form.getAttribute('action'); for (var i = 0; i < form.elements.length; i++) { var temp = form.elements[i]; if (temp.name) { if (temp.type == "radio") { if (temp.checked) post += temp.name + '='+temp.value+'&'; } else if (temp.type == "checkbox") { post += temp.name + '=' + (temp.checked ? '1' : '0') + '&'; } else { post += temp.name + '=' + escape_component(temp.value).replace(/%u[0-9][0-9][0-9][0-9]/g, '%3F') + '&'; } } } var divs = form.getElementsByTagName('div'); for(var i in divs) { var e = divs[i]; if ((e.id && e.id.match(/^err_/)) || (e.className && e.className.match(/okey/))) { e.style.display = 'none'; } } ajax_request(action, post, form_submit_result, form, true, "POST"); return false; } marketing = {}; interest_submit_result = function(result, xmlhttp, form) { // var inputs = ['bid', 'name', 'company', 'email', 'phone', 'ssecnr', 'accept_binding']; if (!result) { result = new Array(); result['status'] = 'ERROR'; } if (result['status'] == 'OK') { /* Reset the form */ document.getElementById('interest_form').reset(); /* Show OK div */ document.getElementById("interest_ok").style.display = "block"; } else { for(var key in result) { var err = document.getElementById('err_' + key); if (err) { err.innerHTML = result[key]; err.style.display = 'block'; } } } } interest_submit = function() { var post = ''; var form = document.getElementById('interest_form'); for (var i = 0; i < form.elements.length; i++) { var temp = form.elements[i]; if (temp.name) { if (temp.type == "radio") { if (temp.checked) post += temp.name + '='+temp.value+'&'; } else if (temp.type == "checkbox") { post += temp.name + '=' + (temp.checked ? '1' : '0') + '&'; } else { post += temp.name + '=' + encodeURIComponent(temp.value) + '&'; } } } errdivs = getElementsByClassName(form, 'DIV', 'error'); for (var idx in errdivs) { errdivs[idx].style.display = 'none'; } ajax_request("/interest.html", post, interest_submit_result, form, true, "POST"); return false; } getTMqs = function (furl, dotl, tmac, tmcc, enc, sec) { var n = new Date(); var loc = window.location.href; var prot = window.location.protocol; if (furl.indexOf('R>') == 0) { furl = furl.substring(2); loc = furl; } if (loc.indexOf('#') != -1) loc = loc.substring(0,loc.indexOf('#')); if (loc.length > 256) { loc = loc.substring(0,253) + '...'; } if (sec) { if(loc.indexOf('?') != -1) { loc += '&' + sec.join('&'); } else { loc += '?' + sec.join('&'); } } if (window.parent != window.self) { var ref = parent.document.referrer; } else { var ref = document.referrer; } var esc = function(str){return str.replace(/\*/g, '%2a').replace(/#/g, '%23')}; var qs = esc(loc)+'*'+esc(furl)+'*'+esc(dotl)+'*'+esc(ref)+'*'+navigator.javaEnabled()+'/'; if (window.screen) { qs += screen.width+'x'+screen.height + '/' + screen.colorDepth + '/'; } else { qs += '//'; }; qs += tmac + '/' + tmcc + '/' + enc + '/' + n.getTime() + '/'; tmImg1.onload = function(){tmImg2.src = prot + '//' + tmLoc + '/V11' + qs}; tmImg1.src = prot + '//' + tmLoc + '/VC' + n.getTime(); return true; } index_stat = function(region, ca, c_domain) { var qs = 'tmsec=soov_ee_index_' + region; var tmsec = new Array ('tmsec=soov_ee', qs, 'tmsec=postimees_ee'); setCookie('default_ca', ca, 365, '/', c_domain, false); getTMqs('', '', 'postimees_ee', 'ee', 'UTF-8', tmsec); return true; } /* Gemius functions */ function gemius_parameters() { var d=document; var href=new String(d.location.href); var ref; var f=0; var fv='-'; if (d.referrer) { ref=new String(d.referrer); } else { ref=''; } if (typeof Error!='undefined') { var fo; eval('try { f=(d==top.document)?1:2; if (typeof top.document.referrer=="string") { ref=top.document.referrer } } catch(e) {f=3;}'); eval('try { fv=navigator.plugins["Shockwave Flash"].description; } catch (e) {}'); eval('if (typeof ActiveXObject!="undefined") { try { fo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); } catch(e) { try { fo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); fv="X"; fo.AllowScriptAccess="always"; } catch(e) { if (fv=="X") { fv="WIN 6,0,20,0"; }} try { fo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); } catch(e) {} } if ((fv=="-" || fv=="X") && fo) { fv=fo.GetVariable("$version"); }}'); } var url='&fr='+f+'&fv='+escape(fv)+'&tz='+(new Date()).getTimezoneOffset()+'&href='+escape(href.substring(0,499))+'&ref='+escape(ref.substring(0,499)); if (screen) { var s=screen; if (s.width) url+='&screen='+s.width+'x'+s.height; if (s.colorDepth) url+='&col='+s.colorDepth; } return url; } window.pp_gemius_params = gemius_parameters(); function gemius_add_onload_event(obj,fn) { if (obj.attachEvent) { obj.attachEvent('onload', fn); } else if(obj.addEventListener) { obj.addEventListener('load', fn, false); } } function gemius_append_script(xp_url) { if (typeof Error!='undefined') { eval('try { xp_javascript=document.createElement("script"); xp_javascript.src=xp_url; xp_javascript.type="text/javascript"; xp_javascript.defer=true; document.body.appendChild(xp_javascript); } catch(e) {}'); } } function gemius_obj_loaded() { window.pp_gemius_loaded+=1; if (window.pp_gemius_loaded==2 && window.pp_gemius_image.width && window.pp_gemius_image.width>1) { gemius_append_script(window.pp_gemius_script); } } function pp_gemius_timer() { window.pp_gemius_timer_image = new Image(); window.pp_gemius_timer_image.src = window.pp_gemius_host+(new Date()).getTime()+'/dot.gif?l=36'+window.pp_gemius_time_id+window.pp_gemius_params; } var pp_gemius_proto = (document.location && document.location.protocol && document.location.protocol=='https:')?'https://':'http://'; if (typeof pp_gemius_hitcollector == 'undefined') { if (typeof gemius_hitcollector != 'undefined') { pp_gemius_hitcollector = gemius_hitcollector; } else { pp_gemius_hitcollector = 'ee.hit.gemius.pl'; } } var pp_gemius_host = pp_gemius_proto+pp_gemius_hitcollector+'/_'; var pp_gemius_sv; if (typeof pp_gemius_nhit == 'undefined') { if (typeof pp_gemius_identifier == 'undefined') { if (typeof gemius_identifier != 'undefined') { pp_gemius_identifier = gemius_identifier; gemius_identifier = 'USED_'+gemius_identifier; } else { pp_gemius_identifier = ''; } } if (typeof window.pp_gemius_cnt != 'undefined') { if (typeof window.pp_gemius_images == 'undefined') { window.pp_gemius_images = new Array(); } var gemius_l = window.pp_gemius_images.length; window.pp_gemius_images[gemius_l]=new Image(); window.pp_gemius_images[gemius_l].src = pp_gemius_host+(new Date()).getTime()+'/redot.gif?l=33&id=ERR_'+pp_gemius_identifier.replace(/id=/,'id=ERR_')+window.pp_gemius_params; } else { if (typeof pp_gemius_time_identifier != 'undefined' && typeof window.pp_gemius_time_id == 'undefined') { window.pp_gemius_time_id = '&id='+pp_gemius_time_identifier; window.pp_gemius_host = pp_gemius_host; setInterval('pp_gemius_timer()',60*1000); pp_gemius_sv=35; } else { window.pp_gemius_time_id = ''; pp_gemius_sv=31; } window.pp_gemius_image = new Image(); if (typeof pp_gemius_mode == 'undefined') { window.pp_gemius_loaded = 0; window.pp_gemius_script = pp_gemius_host+(new Date()).getTime()+'/pp.js?id='+pp_gemius_identifier; gemius_add_onload_event(window,gemius_obj_loaded); gemius_add_onload_event(window.pp_gemius_image,gemius_obj_loaded); pp_gemius_sv-=1; } window.pp_gemius_image.src = pp_gemius_host+(new Date()).getTime()+'/rexdot.gif?l='+pp_gemius_sv.toString()+'&id='+pp_gemius_identifier+window.pp_gemius_time_id+window.pp_gemius_params; window.pp_gemius_cnt = 1; } pp_gemius_identifier = 'USED_'+pp_gemius_identifier; } function pp_gemius_hit_int(list,rfrom,rto) { var gu = pp_gemius_host+(new Date()).getTime()+'/redot.gif?l=32'; if (typeof window.xgemius_prot_cnt == 'undefined') { window.xgemius_prot_cnt=0; } if (typeof xgemius_prot_cnt == 'undefined') { xgemius_prot_cnt=0; } if (window.xgemius_prot_cnt<=xgemius_prot_cnt) { go=1; window.xgemius_prot_cnt++; } else { go=0; } xgemius_prot_cnt++; for (var i=rfrom ; i