﻿var username = null;
var usr_email = null;
var date = null;
var nads = null;
var nusers = null;
var min_img = null;
var targetElementID = "BoxHeader";
var boxHTML = '';
function setupHeader(_username, _date, _nads, _nusers, _min_img) {
  username=_username;
  date    =_date;
  nads    =_nads;
  nusers  =_nusers;
  min_img =_min_img;
}


function PrintHeadBreak() {
  document.write('</td><td class="HeadBreak">&nbsp;</td><td class="HeadMiddle" nowrap="nowrap">');
}
function printHeader() {       
  searchform = '<form class="WordSearchForm" target="_self" method="GET" action="http://szu.polskastrefa.eu/" id="srchf">Szukaj: <input type="textbox" id="phrase" name="q" class="FormField"> '+
  '<input type="submit" value="Dalej" class="button">'+
  '</form>'+
  '<input type="radio" name="srch" checked id="sads" onchange="document.getElementById(\'srchf\').action=\'http://szu.polskastrefa.eu/\';" value=""/><label for="sads" onclick="document.getElementById(\'srchf\').action=\'/szukaj.html\';">ogłoszenia</label>'+
  '<input type="radio" name="srch" id="sdir" onchange="document.getElementById(\'srchf\').action=\'http://www.polskastrefa.eu/katalog/szukaj.html\';" value=""/><label for="sads" onclick="document.getElementById(\'srchf\').action=\'/katalog/szukaj.html\';">katalog</label>'+
  '<input type="radio" name="srch" id="sfor" onchange="document.getElementById(\'srchf\').action=\'http://www.polskastrefa.eu/forum/szukaj.html\';" value=""/><label onclick="document.getElementById(\'srchf\').action=\'/forum/szukaj.html\';" for="sdir">forum</label>';
  document.write('<tr style="margin-bottom: 0px"><td style="height: 94px;"><table style="width: 800px; position:absolute; top: 0px; border: none 0px; padding: 0px;" cellspacing="0" cellpadding="0"><tr><td><table cellspacing="0" cellpadding="0" width="100%"><tr>');
  document.write('<td class="HeadLogo" height="70" width="241" style="vertical-align: center"><a href="http://www.polskastrefa.eu/"><span class="Ident">');
  document.write('<img src="/static/images/header_logo.gif" border="0" alt="Polska Strefa - Ogłoszenia" ></span></a>');
  document.write('<br/><a href="/o_stronie.html" style="font-color: #5A799D; font-weight: bold; text-decoration: none">Dowiedz się więcej...</a>');
  document.write('</td>');
  document.write('<td width="200" valign="bottom" style="padding-bottom: 4px" align="left">');
/*  document.write('<a href="#" onclick="this.style.behavior = \'url(#default#homepage)\'; document.body.setHomePage(\'http://www.polskastrefa.eu\');">Ustaw jako stronę domową</a><br/>');
  if (window.sidebar) {
    document.write('<a href="#" onclick="window.sidebar.addPanel(\'Polska Strefa\', \'http://www.polskastrefa.eu\', \'\');">Dodaj do ulubionych</a>');
  } else if( window.external ) {
    document.write('<a href="#" onclick="window.external.AddFavorite(\'http://www.polskastrefa.eu\', \'Polska Strefa\');">Dodaj do ulubionych</a>');
  }*/
  document.write('</td>');
  document.write('<td width="359" align="right" valign="center"><div class="WordSearchForm">');
  document.write(searchform);
  document.write('</div></td></tr></table></td></tr>');
  document.write('<tr class="HeadMiddleLeft"><td>');
  document.write('<table cellspacing="0" border="0" cellpadding="0" width="100%">');
  document.write('<tr><td class="HeadMiddleLeft" nowrap="nowrap"></td><td class="HeadMiddle" nowrap="nowrap" style="width: 100px">');
  document.write('<a class="HeadLink" onmouseover="exOpts(this)" onmouseout="optsTo = setTimeout(\'optsOut()\', 500)">Ogłoszenia</a>');
  PrintHeadBreak();
  document.write('<a href="/forum,1.html" class="HeadLink">Forum</a>');
  PrintHeadBreak();
  document.write('<a href="/czat,1.html" class="HeadLink">Czat</a>');
  PrintHeadBreak();
  document.write('<a href="/katalog,1.html" class="HeadLink">Katalog</a>');
  PrintHeadBreak();
  document.write('<a href="/pomoc/" class="HeadLink">Pomoc</a>');
if(username != '') {
  PrintHeadBreak();
  document.write('<a href="/users/profile_form.html" class="HeadLink">M&oacute;j profil</a></span></td>');
  document.write('<td class="HeadMiddle" nowrap="nowrap" style="padding-left: 5px">Zalogowano jako <b>'+username.substring(0, 7)+(username.length <= 7 ? '' : '...')+'</b></td>');
  document.write('<td class="HeadMiddleTrans"><img src="/static/images/header_trans.gif"></td>');
  document.write('<td class="HeadMiddleRight"> <a href="/users/logout.html" class="HeadMiddleRight">Wyloguj</a></td>');

} else {
  PrintHeadBreak();
  document.write('<a href="/users/register_form.html" class="HeadLink">Rejestracja</a></span></td>');
  document.write('<td class="HeadMiddle" nowrap="nowrap" style="padding-left: 5px; width: 100px"></td>');
  document.write('<td class="HeadMiddleTrans"><img src="/static/images/header_trans.gif"></td>');
  document.write('<td class="HeadMiddleRight"> <a href="/users/login_form.html?resource=/" class="HeadMiddleRight">Zaloguj!</a> </td>');
}
  document.write('<td align="right" style="background-image: url(\'/static/images/header_middle_right.gif\');"><img src="/static/images/header_right.gif"></td></tr></table></td></tr>');
  document.write('<tr><td class="InfoBar" id="InfoBar"> <b>Dziś jest: </b>'+date+'<span class="Ident">|</span> <b>Dostępne ogłoszenia: </b> '+nads+'  <span class="Ident">|</span> <b>Zarejestrowanych użytkownik&oacute;w: </b> '+nusers+' </td></tr></table></td></tr>');

}

  function OpenContactUs (mailbox){ sFeautures = "scrollbars=no,resizable=no,menubar=no,width=500,height=500"; w = window.open("/kontakt_z_"+mailbox+".html", "", sFeautures, true);
        w.focus (); }

if(!min_img)
  var min_img = 0;

var ExpanderTop = 0;
var ExpanderHeight = 0;
function prepareExpander() {
  var obj = document.getElementById("ExpanderParent");
  if(!obj)
    return;
	if (obj.y)
		ExpanderTop += obj.y;
	else if (obj.offsetParent)
	{
    while (obj.offsetParent)
		{
			ExpanderTop += obj.offsetTop;
			obj = obj.offsetParent;
		}
  }
  ExpanderHeight=Math.max(getScrollY() - ExpanderTop, 0);
  setInterval("correctExpander()", 1);
}
function getScrollY() {
/*  if( document.documentElement && document.documentElement.scrollTop )
    return document.documentElement.scrollTop;
  else if( document.body && document.body.scrollTop)*/
    return document.body.scrollTop;
//  else if( window.pageYOffset)
  //  return window.pageYOffset;
}
function correctExpander() {
  ExpanderHeight += (Math.max(getScrollY() - ExpanderTop, 0) -  ExpanderHeight) / 50;
  document.getElementById("Expander").style.height = Math.floor(ExpanderHeight)+"px";
}
function printGoogle(phrase) {
  document.write('<form method="get" action="http://www.google.com/custom" target="google_window"><table bgcolor="#ffffff"><tr><td nowrap="nowrap" valign="top" align="left" height="32"><a href="http://www.google.com/"><img src="http://www.google.com/logos/Logo_25wht.gif" border="0" alt="Google" align="middle"></img></a><input type="text" name="q" size="31" maxlength="255" value=""></input><input type="submit" name="sa" value="Wyszukaj"></input><input type="hidden" name="client" value="pub-0288128369759519"></input><input type="hidden" name="forid" value="1"></input><input type="hidden" name="ie" value="UTF-8"></input><input type="hidden" name="oe" value="UTF-8"></input><input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:44;LW:50;L:http://www.polzone.pl/static/images/ic_polzone.gif;S:http://www.polskastrefa.eu;LP:1;FORID:1;"></input><input type="hidden" name="hl" value="pl"></input></td></tr></table></form>');
}

var splashWidth = 500;
var splashHeight = 300;
var disableAdSense = false;


function printBoxes(count) {
  document.write('<script type="text/javascript" src="/static/js/box_new.js" charset="UTF-8"></script>');
  if(disableAdSense)
    document.write('<script src="/ads/standard.js?count='+count+'" charset="UTF-8"></script>');
  else
    document.write('<script src="/ads/standard.js?count='+count+'&filter=true" charset="UTF-8"></script>');
}


function updateSplash(){
    yOffset = window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop - 200;
    xOffset = window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft - 100;

    var div = document.getElementById('splash');
    if(!div) return;
    div.style.left= xOffset + ((window.innerWidth || document.body.offsetWidth) - splashWidth) / 2 + "px";
    div.style.top = yOffset + ((window.innerHeight || document.body.offsetHeight) - splashHeight) / 2 + "px";
    setTimeout('updateSplash()', 10);
}

var catName = '';
function triggerCategory(category) {
  catName = category;
  if((category.toLowerCase() == 'towarzyskie' || category.toLowerCase() == '13327') && !disableAdSense) {
    disableAdSense = true;
    if(readCookie('adult')=='aprooved')
      return;
    body = document.getElementsByTagName("body")[0];
    if(body.style)
      body.style.filter = "gray()";
//    body.style.overflow = 'hidden';
    splashHTML = '<tr><td class="FormSectionHead"><span class="FormSectionTitle">Tylko dla dorosłych</span></td></tr>';
    splashHTML +='<tr><td class="FormSection" style="text-align:center"><iframe src="/static/adult.html" style="border: none; width: 600px; height: 400px; background-color: #E1E7EC; overflow: hidden" border="0"  frameborder="0"></iframe><br/>';
    splashHTML +='<input type="submit" class="Button" onclick="disableAdultSplash()" value="Jestem dorosły(conajmniej 18lat)"/> <input type="submit" class="Button" onclick="javascript:document.location='+"'/'"+'" value="Jestem niepełnoletni"/></td></tr>'
    document.write('<table id="splash" name="splash"><td valign="middle" align="center"><table width="100%" height="500">'+splashHTML+'</table></td></table>');
    var div = document.getElementById('splash');
    div.style.position="absolute";
    div.style.width= splashWidth+"px";
    div.style.height= splashHeight+"px";
    div.style.zIndex = "100";
    div.style.textAlign = "center";
    div.style.verticalAlign = "middle";
    setTimeout('updateSplash()', 1);
//    div.innerHTML = '<td valign="middle" align="center"><table border="1" width="100" height="100"><tr><td>dupa</td></tr></table></td>';
  }
}

function disableAdultSplash() {
  createCookie('adult', 'aprooved', 365);
  disableSplash();
}

function disableSplash() {
    var div = document.getElementById('splash');
    div.parentNode.removeChild(div);
    body = document.getElementsByTagName("body")[0];
    if(body.style)
      body.style.filter = "";
}

function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name)
{
	createCookie(name,"",-1);
}

function printBlankContactInfo() {
  document.write('<table><tr><td>');
  document.write('<div id="BlankContactInfo" name="BlankContactInfo"><br/>');
  if(!contact_html)
    document.write('<span style="font-weight: bold">Dane kontaktowe: <span style="font-weight: normal; font-style: italic">Ukryte</span></span><br>');
  document.write('<span style="font-weight: bold">E-mail: <span style="font-weight: normal; font-style: italic">Ukryte</span></span><br>');
  document.write('<span style="font-weight: bold;">Strona WWW: <span style="font-weight: normal; font-style: italic">Ukryte</span></span></div>');
  document.write('</td><td>');
  document.write('<input value="Odkryj dane" type="button" onclick="showContactInfo(this);" class="button" name="ContactButton" id="ContactButton"><br>');
  document.write('<span id="ButtonInfo">Wciśnij przycisk, aby zobaczyć dane kontaktowe</span>');
  document.write('</td></tr></table>');
}

function fastRedir(url) {
   document.location = url;
}

function OpenContact (advert)  {
  sFeautures = "scrollbars=no,resizable=no,menubar=no,width=500,height=400";
  w = window.open("/contact.html?id=" + advert, "", sFeautures, true);
  w.focus ();
}
var w_img = null;
function OpenImage (imageid, imagetitle)
{
  sFeautures = "scrollbars=no,resizable=no,menubar=no,width=410,height=320";
  url = "/images/" + imageid + ".html";
  if ((w_img!=null) && (!w_img.closed))
    w_img.location=url;
  else
    w_img = window.open(url, imagetitle, sFeautures, true);
    w_img.focus();
}

function VoteForm(id)
{
  voteform = window.open("/vote_form.html?advert="+id, "vote_form", "scrollbars=no,resizable=no,menubar=no,width=500,height=400");
  voteform.focus();
}

function ShowVotes(id)
{
  votes = window.open("/votes.html?advert="+id, "votes", "scrollbars=yes,resizable=no,menubar=no,width=400,height=200");
  votes.focus();
}


function showContactInfo(button) {
	var head = document.getElementsByTagName('head').item(0);
	script = document.createElement('script');
	script.src = '/contact_info.js?id='+advert;
	script.type = 'text/javascript';
	script.defer = true;
	script.id = 'scriptId';
	void(head.appendChild(script));
  button.disable="True";
  button.value="Proszę czekać...";
  button = document.getElementById("ButtonInfo");
  button.parentNode.removeChild(button);
}
function hideContactInfo() {
//  document.write('<input value="Pokaż dane" type="button" onclick="showContactInfo(this);" class="button" name="ContactButton" id="ContactButton">');
  document.getElementById('ContactInfo').style.display='none';
  document.getElementById('ContactInfo').style.visibility='hidden';
}
function directoryCreateLink(element) {
  link = document.createElement("a");
  link.href = 'http://' + element.id.replace('#', '').replace('#', '').replace('#', '').replace('#', '');
  while ( link.href.indexOf( 'amp;' ) > -1 )
    link.href=link.href.replace('amp;', '');
  link.target="_blank";
  link.className="DirectoryLink";
  link.innerHTML = element.innerHTML;
  element.parentNode.insertBefore(link, element);
  element.parentNode.removeChild(element);
}

function directoryPrintLink(url) {
  href = 'http://' + url.replace('#', '').replace('#', '').replace('#', '').replace('#', '');
  document.write('<a target="_blank" href="'+href+'">'+href+'</a>');
}
function directoryOpenContact (id)  {
  sFeautures = "scrollbars=no,resizable=no,menubar=no,width=500,height=400";
  w = window.open("/katalog/contact.html?id=" + id, "", sFeautures, true);
  w.focus ();
}

function chatUser(id) {
  sFeautures = "scrollbars=no,resizable=yesmenubar=no,width=600,height=500";
  w = window.open("/czat/user/"+id+"/", "", sFeautures, true);
  if(w) {
    w.focus ();
  }
}

function chatAdvert(id, category) {
  document.location = "/czat/"+category+"/advert/"+id+"/";
}

function printSAd() {
  document.write('<div style="color: #efefef; border: dotted 2px;" align="left">');
  document.write('<b style="color: #cc0000">REKLAMA W WYSZUKIWARCE, w trzech prostych krokach:</b>');
  document.write('<ol style="margin:0px; padding: 0px; color: #5A799D; font-weight: bold;">');
  document.write('<li style="margin:0px 0px 0px 25px;"><a href="/ogloszenia_dodaj_1.html">Dodaj ogłoszenie</a>(za darmo) ze słowami kluczowymi w treści, które Cię interesują.</li>');
  document.write('<li style="margin:0px 0px 0px 25px;">Wyróżnij dodane ogłoszenie za 20 groszy lub więcej w zależności od konkurencyjności słów kluczowych.</li>');
  document.write('<li style="margin:0px 0px 0px 25px;">Od tej chwili Twoje ogłoszenie znajduje się zawsze ponad niewyróżnionymi ogłoszeniami dla wszystkich słów kluczowych, które znajdują się w jego treści.</li>');
  document.write('</ol></div>');
}

function rpul(u, b) {
  rp = (b ? '<br/>' : '') + 'Źródło: ';
  for(i = 0; i < u.length; i++) {
    rp += u[i];
    if(i<u.length-1)
      rp += ('.');
  }
  return rp;
}

function pul(u, b) {
  document.write(rpul(u, b));
}

function pNR() {
  document.write('<div class="HelpSection" style="font-size: 11px">Firma polskastrefa.eu nie ponosi odpowiedzialności za treść ');
  document.write('ogłoszeń. W przypadkach niezgodności z prawem, zniesławień itp. prosimy o kontakt, przy ');
  document.write('pomocy naszego formularza kontaktowego.</div>');
}

function pSF() {
  document.write('<div class="HelpSection" style="font-size: 11px">Jeśli masz problemy z wyszukiwaniem skorzystaj z naszego <a href="/pomoc/przeszukiwanie/">centrum pomocy</a>.</div>'); 
}

function pAF() {
  document.write('<div class="HelpSection" style="font-size: 11px">Jeśli masz problemy z dodaniem ogłoszenia skorzystaj z naszego <a href="/pomoc/dodawanie/">centrum pomocy</a>.</div>');
}

function pFC() {
  document.write('Wybierz podforum, w którym chcesz dyskutować. Jeśli uważasz, że brakuje właściwego miejsca na wymyślony przez Ciebie temat, powiadom nas o tym poprzez nasze <a href="/pomoc/forum/">centrum pomocy</doc:link>.');
}

function pFA() {
  document.write('<div class="HelpSection" style="font-size: 11px">Redakcja serwisu nie ponosi odpowiedzialności za treść ');
  document.write('opinii wygłaszanych za pośrednictwem tego forum. W przypadkach niezgodności z prawem, zniesławień itp. prosimy o kontakt, przy ');
  document.write('pomocy naszego <a href="/pomoc/forum/">centrum pomocy</a>.</div>');
}

function pDC() {
  document.write('<div class="HelpSection">Wybierz jedną z podkategorii, aby dodać wpis do katalogu. Jeśli uważasz, że brakuje odpowiedniej podkategorii dla Twojej witryny, powiadom nas o tym poprzez nasze <a href="/pomoc/katalog/">centrum pomocy</a>.</div>');
  document.write('<form simple="true" action="/katalog/szukaj_kategorii.html" method="GET" class="HelpSection" style="width: 100%"> Spr&oacute;buj znaleźć odpowiednią kategorię dla swojej strony przez wyszukiwarkę: <input type="textbox" name="q" class="FormField"><input type="submit" value="Dodaj" class="button"></form>');
}

function pRS() {
  document.write('Skorzystaj z doskonałej formy powiadamiania o nowych ogłoszeniach spełniających wybrane kryteria wyszukiwania, jaką ');
  document.write('są <b>kanały RSS</b>. Dowiedz się więcej o <a href="/kanaly_rss.html">kanałach RSS</a>.<br><br>Kliknij aby pobrać kanał: ');
}

function pE(u) {
  href = '';
  for(i = 0; i < u.length; i++) {
    href+=u[i];
    if(i<u.length-1)
      href+='.';
  }
  document.write('<a href="mailto:'+href+'">'+href+'</a>');
}

function rL(m, i) {
  red = document.createElement('form');
  red.action='/link-' + i + '_' + m + '.html';
  red.method="GET";
  red.target="_top";
  document.body.appendChild(red);
  red.submit();
}
var optsC = 0;
var optsTo = 0;
function optsOut() {
  optsC--;
  if(optsC <= 0) {
    div = document.getElementById('exOpts');
    optsC = 0;
    div.style.display='none';
  }
}
function optsOve() {
  optsC++;
  if(optsTo)
    clearInterval(optsTo);
  optsTo = 0;
  if(optsC > 0) {
    div = document.getElementById('exOpts');
    div.style.display='';
  }
}
function exOpts(el) {
  div = document.getElementById('exOpts');
  if(!div) {
    div = document.createElement('div');
    div.id="exOpts";
    div.style.height='50px';
    div.style.padding="0 10px";
    div.style.backgroundColor='#889BB1';
    div.style.textAlign="left";
    div.style.position='absolute';
    div.innerHTML='<a onmouseover="optsOve()" onmouseout="optsOut()" href="/szukaj,1.html" class="HeadLink">Szukaj</a><br/>'+
    '<a onmouseover="optsOve()" onmouseout="optsOut()" href="/dodaj,1.html" class="HeadLink">Dodaj</a><br/>'+
    '<a onmouseover="optsOve()" onmouseout="optsOut()" href="/przegladaj,1.html" class="HeadLink">Przegladąj</a>';
    div.onmouseover=optsOve;
    div.onmouseout=optsOut;
    el.parentNode.appendChild(div);
  }
    div.style.display='';
    infob = document.getElementById("InfoBar");
    if(infob.getBoundingClientRect) {
      div.style.width='124px';
      div.style.left = "0px";
      div.style.top = "70px";
    } else {
      div.style.width='104px';
      div.style.top=(findPosY(infob)+2)+"px";
    }
    if(navigator.oscpu && document.getElementsByClassName)
      div.style.left=findPosX(infob)+"px";
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = -1;
	if (obj.offsetParent)
	{
		curtop = -2;
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	else
		curtop = obj.offsetTop;

	return curtop;
}

function rB(url) {
  red = document.createElement('form');
  red.action=url;
  red.method="POST";
  red.target="_top";
  document.body.appendChild(red);
  red.submit();
}

function adt(){
  document.write('<div style="width: 100%; background: #EFEFEF url(/static/images/b_promi.gif) repeat-x top; height: 275px; text-align: center;"><div style="height: 20px; background: url(/static/images/adv.gif) no-repeat top left"></div>');
  document.write('<table style="width: 100%;"><td align="center">');
}
function adb(){
  document.write('</td></table><div style="background: url(/static/images/dot.gif) repeat-x bottom; height: 25px"></div></div>');
}