var par = "";
var link = "y";
var width = "";
var height = "";
var size = "";
var mouse_over = false;
var live_counter = 0;
var monerror = null;
var objerror = window;

function setCookie(name, value, expires, path, domain, secure) { var curCookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+path:"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":""); document.cookie = curCookie; }
function getCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else begin += 2; var end = document.cookie.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin + prefix.length, end)); }
function deleteCookie(name, path, domain) { if (getCookie(name)) { document.cookie=name+"="+((path)?"; path="+path:"")+((domain)?"; domain="+domain:"")+"; expires=Thu, 01-Jan-70 00:00:01 GMT"; } }
function fixDate(date) { var base = new Date(0); var skew = base.getTime(); if (skew > 0) date.setTime(date.getTime() - skew); }

function mystatCounterLiveCounter(mystat_img,mystat_par,time) {
   mystatCounterReloadCounter(document.images[mystat_img],mystat_par);
   setTimeout("mystatCounterLiveCounter(\""+mystat_img+"\",\""+mystat_par+"\","+time+")", time);
}

function mystatCounterReloadCounter(mystat_img,mystat_par) {
   mystat_img.src = "../../../www.mystat.pl_8080/servlet/counter.gif"+mystat_par;
}

function writeCounterCode() {
if (!document.mystat_counters) {document.mystat_counters = "1";} else { document.mystat_counters = document.mystat_counters+"1"; }
var par_p = " ";
if (par.indexOf("p=") != -1) { par_p = par.substring(par.indexOf("p=")); if (par_p.indexOf("&") != -1) { par_p = par_p.substring(2,par_p.indexOf("&")); } else par_p = par_p.substring(2); }
var counter_name = "mystat_count_img"+document.mystat_counters;
if (par.indexOf("mouse=t") != -1) mouse_over = true;
if (link == "y") document.write("<a href=\"http://www.mystat.pl/stat_click.jsp"+par+"\" target=\"_blank\">");
//if (link == "y") document.write("<a href=\"http://www.mystat.pl/ehit/ehit2.html"+par+"\" target=\"_blank\">");
if (par.indexOf("live=") != -1) { var live_val = par.substring(par.indexOf("live=")); if (live_val.indexOf("&") != -1) live_val = live_val.substring(5,live_val.indexOf("&")); else live_val = live_val.substring(5); if (!isNaN(live_val)) live_counter = live_val; }
var sid = getCookie("mystat_sid");
if (!sid) {sid = location.hostname+Math.random();setCookie("mystat_sid", sid, null, null); sid = getCookie("mystat_sid");}
if (sid != null) {par = par+"&sid="+sid;}
if (width != "" && height != "") {size = "width=\""+width+"\" height=\""+height+"\""} else size = "";
document.write("<img alt=\"MyStat.pl\" name=\""+counter_name+"\" src=\"http://www.mystat.pl:8080/servlet/counter.gif"+par+"\" border=\"0\" "+size);
if (mouse_over) document.write(" onMouseOver=\"mystatCounterReloadCounter(this,'"+par+"')\"");
document.write(">");
if (link == "y") document.write("</a>");
document.write("<");document.write("!--  ");
if (Math.round(live_counter) > 0) window.setTimeout("mystatCounterLiveCounter(\""+counter_name+"\",\""+par+"\","+1000*Math.round(live_counter)*10+")", 1000*Math.round(live_counter)*10);
}
function writeCounterMyStatPrvPl() { writeCounterCode(); }
function writeCounterMyStatError(message, url, line) { writeCounterCode(); window.onerror = monerror; return true; }
function writeCounter() { monerror = window.onerror; window.onerror = writeCounterMyStatError; writeCounterCode(); window.onerror = monerror; }
