<!--

 function tolbar() {
    if (document.getElementById('gorace_but').innerHTML.indexOf('Rozwiń') != -1 ) {
    	$('#gorace_but').animate({"bottom": "45px"}, "slow");
        $('#gorace').animate({"bottom": "0px"}, "slow", function () { 
        		ladujGorace();
	     });
	    document.getElementById('gorace_but').innerHTML = 'Zwiń wiadomości <img src="/grafika/iko_zwin.gif" />';
	    createCookie("gorace", "", "30");
    } else {
	    $('#gorace_but').animate({"bottom": "0px"}, "slow");
        $('#gorace').animate({"bottom": "-45px"}, "slow");
	    document.getElementById('gorace_but').innerHTML = 'Rozwiń wiadomości <img src="/grafika/iko_rozwin.gif" />';
	    createCookie("gorace", "hide", "30");
    }
 }
 
function loadOgloszenia(div,link,change){
	obj = document.getElementById('obj_'+div);
	woj = obj.options[obj.selectedIndex].value;
	if( change == 1 ){
		createCookie("ogl_glowna_woj", woj, "30");
	} else {
		tmp = readCookie("ogl_glowna_woj");
		if( tmp ) 
			woj = tmp;
		if( tmp ){
			for(i=0;i<obj.options.length;i++){
				if( obj.options[i].value == tmp ){
					obj.selectedIndex = i;
				}
			}
		}
	}
	$('#'+div).load('/ogloszenia.php?link='+link+'&woj='+woj);
}
 
var ses_id;
var last_set = Array();
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toUTCString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/; domain=.fresh-market.pl";
	last_set[name] = value;
	if( ses_id )
		$.ajax({ url: '/gorace.php?spar='+name+'&spar_val='+encodeURIComponent(value)+'&PHPSESSID='+ses_id,context: document.body });
}

function readCookie(name, nw) {
	if( last_set[name] ){
		return last_set[name];
	}
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	var retValue = "";
 	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 && nw ){
				retValue = c.substring(nameEQ.length,c.length);
		} else if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	retValuebase = retValue;
 	
	$.ajax({ url: '/gorace.php?gpar='+name+'&PHPSESSID='+ses_id,context: document.body, async: false,
			success: function(response){
				retValue = response;
         	}
	 });

	if( nw ){
		if( retValuebase ){
			tmp = retValue.toString() + '|' + retValuebase.toString();
			retValue = tmp;
		}
	} else if( retValue == "NoLogin" ){
		retValue = retValuebase;
	}
	return retValue;
}

function pokazUlubione(mode){
	if( document.getElementById("nagl_ulubione_all") ){
		if( mode == 'selected' ){
			document.getElementById("nagl_ulubione_all").style.fontWeight = 'normal';
			document.getElementById("nagl_ulubione_selected").style.fontWeight = 'bold';
			val = readCookie("wybraneBoxy", 1);
			was = '';
			for(i in arr){
				if( arr[i] == 'selected'){
					was = 1;
				}
			}
			if( was != 1 ){
				val = val + (val ? "|" : "") + 'selected';
				createCookie("wybraneBoxy", val, 60);
			}
			
		} else {
			document.getElementById("nagl_ulubione_all").style.fontWeight = 'bold';
			document.getElementById("nagl_ulubione_selected").style.fontWeight = 'normal';
			
			val = readCookie("wybraneBoxy", 1);
			val = val.replace("|selected", "");
			val = val.replace("selected", "");
			createCookie("wybraneBoxy", val, 60);
			
		}
			
		$(".wejsciowka div a img").each(function(i){
			
			if( $(this).attr("src").indexOf('_on') != -1 || mode != 'selected' ){
				$(this).parent().parent().parent().css("display", "block");			
			} else {
				$(this).parent().parent().parent().css("display", "none");
			}
		});
	}
}

function loadUlubione(mode){
	val = readCookie("wybraneBoxy", 1);
	arr = val.split("\|");
	for(i in arr){
		ids = arr[i];
		if( ids == 'selected' ){
			pokazUlubione('selected');
		} else if( ids != "NoLogin" && document.getElementById("prod"+ids) )
			document.getElementById("prod"+ids).innerHTML = '<img title="Usuń z ulubionych" src="/grafika/ulubione_on.gif" border="0" />';
		else if( document.getElementById("page"+arr[i]) && mode ){
				document.getElementById("page"+arr[i]).className = "wybrany";
				document.getElementById("page"+arr[i]).innerHTML = 'Usuń z ulubionych <img border="0" src="/grafika/ulubione_on.gif">';
		}
	}
}

function dodajDoUlubionychPage(id, obj){
	
	$(".tooltip").css("display","none");
	
	val = readCookie("wybraneBoxy", 1);
	nval = '';
	arr = val.split("\|");
	for(i in arr){
		if( arr[i] == id && id ){
			id = '';
			obj.innerHTML = 'Dodaj do ulubionych <img border="0" src="/grafika/ulubione_off.gif">';
			obj.className = "niewy";
		} else {
			nval = nval + (nval ? "|" : "") + arr[i];
		}
	}
		
	if( id ){
		nval = nval + (nval ? "|" : "") + id;
		document.getElementById("page"+id).className = "wybrany";
		document.getElementById("page"+id).innerHTML = 'Usuń z ulubionych <img border="0" src="/grafika/ulubione_on.gif">';
	}
	
	createCookie("wybraneBoxy", nval, 60);

	if( arr[0] == "NoLogin" ){
			showContentDiv('ulubione_info.tpl');
	}
}
function dodajDoUlubionych(id, obj){
	
	$(".tooltip").css("display","none");
	
	val = readCookie("wybraneBoxy", 1);
	nval = "";
	arr = val.split("\|");
	for(i in arr){
		if( Math.round(arr[i]) == 0 )
			;
		else if( arr[i] == id && id ){
			id = '';
			obj.innerHTML = '<img title="Dodaj do ulubionych" onmouseover="this.src=\'/grafika/ulubione_on.gif\';" onmouseout="this.src=\'/grafika/ulubione_off.gif\';" src="/grafika/ulubione_off.gif" border="0" />';
		} else {
			nval = nval + (nval ? "|" : "") + arr[i];
		}
	}
	if( document.getElementById('nagl_ulubione_selected').style.fontWeight == 'bold'){
		nval = nval + (nval ? "|" : "") + 'selected';
	}
	val = nval;
	if( id ){
		obj.innerHTML = '<img title="Usuń z ulubionych" src="/grafika/ulubione_on.gif" border="0" />';
		val = val + (val ? "|" : "")+id;
	}
	
	createCookie("wybraneBoxy", val, 60);
	$("[title]").tooltip({
			offset: [10, 0]
		});
	
	if( arr[0] == "NoLogin" ){
			showContentDiv('ulubione_info.tpl');
	}
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
 
var rot_art_gbl = Array(100);
var rot_cnt_gbl = Array(100);
var rot_stan_gbl = Array(100);
var rot_gi_gbl = Array(100);
var ajax = '';

function loadZmiennaJedynka(rid){

	$(".tra_sr").each(function(i){
		if ($.browser.msie) {
			$(this).css({
				//'margin-left': '0px',
				'height': '120px'
				//'position': 'relative',
				//'float': 'right'
			});
		} else {
			$(this).css({
				'margin-top': '-'+($(this).height())+'px'
			});
		}
	});
	
	var Nodes = document.getElementsByTagName('div');
    var max = Nodes.length;
    ret = "<table id=\"tzm"+rid+"\" cellpading=\"0\" cellspacing=\"0\" border=\"0\" height=\"225\" width=\"100%\">";
    j = 0;
    var rot_art = Array(100);
    var rot_cnt = "";
    
    for(var i=0;i<max;i++) {
          var nodeObj = Nodes.item(i);                                
          if(nodeObj.id.indexOf('zmj'+rid+'_')!=-1) {
              nodeObj.style.display = 'none';
              rot_art[j] = nodeObj.id;
              rot_cnt = j;
              ret = ret + "<tr onmouseover=\"jedynkaStop("+rid+","+(j+1)+");\" onmouseout=\"jedynkaStart("+rid+");\"><td class=\"wiersz_dd\"><div style=\"overflow:hidden;width:400px\"><div style=\"width:600px\" class=wiersz_pad><a style=\"text-decoration: none;font-size:12px;\" class=\"czarny\" href=\""+document.getElementById("a"+nodeObj.id).href+"\">"+document.getElementById("a"+nodeObj.id).innerHTML+"</a></a></div></div></td></tr>";                     
          	  j++;
          }
    }
    rot_art_gbl[rid] = rot_art;
    rot_cnt_gbl[rid] = rot_cnt;
    rot_stan_gbl[rid] = 1;
    rot_gi_gbl[rid] = 0;
    ret = ret + "</table>";
    document.getElementById("jednynka_cont_"+rid).innerHTML = ret;    
    
    jedynka_zmien(0,rid);
    jedynkaTime(rid);
    
}
function jedynkaTime(rid){
	setTimeout("jedynkaTimeAct("+rid+")" , 6000);
}
function jedynkaTimeAct(rid){
	
	if( rot_stan_gbl[rid] == 1){
	    if( rot_gi_gbl[rid] == rot_cnt_gbl[rid] )
		  rot_gi_gbl[rid] = -1;
		rot_gi_gbl[rid]++;
		jedynka_zmien(rot_gi_gbl[rid], rid);
		jedynkaTime(rid);
	} else
		jedynkaTime(rid);
}
function jedynkaStart(rid){
	rot_stan_gbl[rid] =1;
}
function jedynkaStop(rid, j){
	rot_stan_gbl[rid] =0;
	if( j ){
		rot_gi_gbl[rid] = j-1;
		jedynka_zmien(j-1, rid);
	}
}
function setNBorder(si, color, rid){
	obj = document.getElementById("tzm"+rid);
	var Nodes = obj.getElementsByTagName('tr');
    var max = Nodes.length;
    if( Nodes.item(si) )
    	set2Border(Nodes.item(si),color);
}
function jedynka_zmien(i, rid){
	id = rot_art_gbl[rid][i];
	var Nodes = document.getElementsByTagName('div')
    var max = Nodes.length;
    j = 0;
    for(var i=0;i<max;i++) {
          var nodeObj = Nodes.item(i);                                
          if(nodeObj.id.indexOf('zmj'+rid+'_')!=-1) {
          	 nodeObj.style.display = 'none';
          	 setNBorder(j, 'wiersz_dd',rid);
          	 if( nodeObj.id == id ){
          	 	nodeObj.style.display = 'block';
          	 	setNBorder(j, 'wiersz_dds', rid);
          	 }
          	 j++;
          }
	}
}
function set2Border(obj, color){
	arr = obj.getElementsByTagName("td");
	for(i=0;i<arr.length;i++){
		arr[i].className = color;
	}
}
function setBorder(obj, color){
	arr = obj.getElementsByTagName("td");
	for(i=0;i<arr.length;i++){
		if( i == 0 )
			arr[i].style.borderLeft = 'solid 1px '+color;
		if( i == arr.length -1)
			arr[i].style.borderRight = 'solid 1px '+color;
		arr[i].style.borderTop = 'solid 1px '+color;
		arr[i].style.borderBottom = 'solid 1px '+color;
	}
}

function otworz( host, url, tytul, szer, wys, extra_foto ){
    if (parseInt(szer) > 800 || parseInt(wys) > 800){
        NoweOkienko=window.open(url, tytul);
    } else{
		if( extra_foto )
			wys = parseInt(wys)+50;
		if( parseInt(szer) < 150 )
			szer = 350;
        config='left=100,top=100,width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no';
        NoweOkienko=window.open('', tytul, config);
        NoweOkienko.document.open();
        NoweOkienko.document.write('<HTML>');
        NoweOkienko.document.write('<HEAD>');
        NoweOkienko.document.write('<TITLE>'+tytul+'</TITLE>');
        NoweOkienko.document.write('</HEAD>');
        NoweOkienko.document.write('<body style="padding: 0px; margin: 0px;" bgcolor="#ffffff">');
        if( extra_foto )
			NoweOkienko.document.write('<table height="50" cellpadding="0" cellspacing="0" width="100%"><tr><td><img src="'+host+'/logo.gif"></td><td align="right"><img src="'+host+'/'+extra_foto+'"></td></tr></table>');
        NoweOkienko.document.write('<div align="center"><A HREF=# onclick="javascript:self.close();"><IMG SRC="'+host+'/'+url+'" BORDER=0 ALT="Zamknij"></A></div>');
        NoweOkienko.document.write('</BODY>');
        NoweOkienko.document.write('</HTML>');
        NoweOkienko.document.close();
        NoweOkienko.focus();
    }
}
function otworz_url(url,szer,wys)
{
	config='left=100,top=100,width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no';
	NoweOkienko=window.open(url,'',config); 
}
function mailer(pre, dom, c, d){
	document.write("<a href='mailto:"+pre+"@"+dom+"' "+c+">"+d+"</a>");
}
function wyszuk_cointainer(wm, q){
	document.wysz.wm.value=wm;
	if( !wm )
    	wm =1;
    if( !q ){
    	if(document.wysz.q && document.wysz.q.value)
    		q = document.wysz.q.value;
    	else
    		q = '';
    }
        
	for(i=1;i<=3;i++){
		document.getElementById('awm'+i).className = "czarny";
	}
	
	if( wm > 1 ){
		document.wysz.wojewodztwo.style.display = "block";
	} else {
		document.wysz.wojewodztwo.style.display = "none";
	}
	
	document.getElementById('awm'+wm).className = "czarny_n";
	
}
// -->
<!--
parchor = '';
nanchor = '';
 var myWidth = 0;
 if( typeof( window.innerWidth ) == 'number' ) {
	 //Non-IE
	 myWidth = window.innerWidth;
 } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	 //IE 6+ in 'standards compliant mode'
	 myWidth = document.documentElement.clientWidth;
 } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	 //IE 4 compatible
	 myWidth = document.body.clientWidth;
 }
 // Split the string into part [0] and part [1]
temp=navigator.appVersion.split('MSIE');
// Parse the string for the "6" in 6.0
ieVer=parseInt(temp[1]);
// Is it greater than 6?
var isIE6=(ieVer == 6)?1:0; 
var load_stan = false;	  
function DmsImageBox(){
	this.init = function (){
		if (!document.getElementsByTagName){ return; }
		var anchors = document.getElementsByTagName('a');
		for (var i=0; i<anchors.length; i++){
			var anchor = anchors[i];
			var relAttribute = String(anchor.getAttribute('rel'));
			if (anchor.getAttribute('href') && (relAttribute.match('DmsImageBox') || anchor.getAttribute('href').match("\.gif") || anchor.getAttribute('href').match("\.jpg"))){
				anchor.onclick = function () {return DmsImageBox.start(this);}
			} else if (ajax && anchor.getAttribute('href') && (relAttribute.match('FlvVideo'))){
				anchor.onclick = function () {return DmsImageBox.start(this);}
			} else if (ajax && anchor.getAttribute('href') && anchor.getAttribute('href').match(ajax_match_name) && (relAttribute.match('menu'))){	
				anchor.onclick = function () {return getUrl(this);}
			} else if(ajax &&  anchor.getAttribute('href')){
				anchor.onclick = function () {return standardClick(this);}
			}
		}
		
		var objOverlay = document.createElement("div");
		objOverlay.setAttribute('id','overlay');
		objOverlay.style.display = 'none';
		objOverlay.setAttribute('align','center');
		objOverlay.style.left = '0px';
		objOverlay.style.top = '0px';
		objOverlay.style.filer = 'alpha(opacity=60)';
		objOverlay.style.opacity = '0.6';
		objOverlay.style.width = '100%';
		objOverlay.style.height = '500px';
		objOverlay.style.zIndex = '90';
		objOverlay.style.position = 'absolute';
		objOverlay.style.background = '#000000';
		
		objOverlay.onclick = function() { DmsImageBox.end(); return false; }
		var objInside = document.createElement("div");
		document.body.appendChild(objOverlay);
		
		objInside.setAttribute('id','inside');
		objInside.style.display = 'none';
		objInside.setAttribute('align','center');
		objInside.style.background = '#ffffff';
		objInside.style.top = '10px';
		objInside.style.marginBottom = '10px';
		objInside.style.position = 'absolute';
		objInside.style.padding = '10px';
		objInside.style.zIndex = '91';
		document.body.appendChild(objInside);
		
		pic1= new Image(24,24); 
		pic1.src="/grafika/loading.gif";
		
	}
	this.loadingInfo = function(fast_start){
		var arrayPageSize = getPageSize();
		hideSelectBoxes();
		document.getElementById('overlay').style.height = arrayPageSize[1]+'px';
		document.getElementById('inside').style.width = '250px';
		document.getElementById('inside').style.height = '150px';
		
		arrayPageScroll = getPageScroll();
		
		
		s = parseFloat(arrayPageScroll[1])+ 10;
		if( s < parseFloat(arrayPageScroll[1]) + 10 )
			s = parseFloat(arrayPageScroll[1])+10;
			
		document.getElementById('inside').style.top = s+'px';
		
		document.getElementById('inside').innerHTML = '<table cellpadding=0 cellspacing=0 width=100% height=100%><tr><td valign=middle align=center><img src="/grafika/loading.gif" border=0></td></tr></table>';
		if( fast_start != 1 )
			opacity('overlay', 0, 60, 500);
		x = Math.round(arrayPageSize[2]/2) - 75;
		document.getElementById('inside').style.left = x+'px';
		opacity('inside', 0, 100, 200);
	}
	this.start = function (obj, fast_start){
		bigImg = obj.getAttribute('href');
		title = obj.getAttribute('rel_name');
		if( !title )
			title = '';
		imgPreloader = new Image();
		this.loadingInfo(fast_start);
		load_stan = true;
		imgPreloader.onload= function() {
			clearOpacity('inside');
			changeOpac(0, 'inside');
			DmsImageBox.showImage(bigImg, this.width, this.height, title);
		}		
		imgPreloader.src = bigImg;
		return false;
	}
	this.showImage = function (src, width, height, title){
	if( load_stan == true ){
		z = 0;
		zi = -1;
		prev = '';
		panchor = '';
		nanchor = '';
		plink = '';
		nlink = '';
		
		var anchors = document.getElementsByTagName('a');
		for (var i=0; i<anchors.length; i++){
			var anchor = anchors[i];
			var relAttribute = String(anchor.getAttribute('rel'));
			if (anchor.getAttribute('href') && (relAttribute.match('DmsImageBox') || 
				anchor.getAttribute('href').match("\.gif") || anchor.getAttribute('href').match("\.jpg"))){
				if( anchor.getAttribute('href') == src){
					panchor = prev;
					if( prev )
						plink = "DmsImageBox.start(panchor, 1);";
					zi = z+1;
				}
				if( zi == z ){
					nanchor = anchor;
					nlink = "DmsImageBox.start(nanchor, 1);";
				}
				prev = anchor;
				z++;
			}
		}
		
		var arrayPageSize = getPageSize();
		if( width < 400 )	
			width = 400;
		if( height < 300 )
			height = 300;
		x = Math.round(arrayPageSize[2]/2) - Math.round(width/2);
		document.getElementById('inside').style.left = x+'px';
		height = parseFloat(height) + 30;
		document.getElementById('inside').style.width = width+'px';
		document.getElementById('inside').style.height = height+'px';
		arrayPageScroll = getPageScroll();
		
		s = parseFloat(arrayPageScroll[1])+ 10;
		
		document.getElementById('inside').style.top = s+'px';
		
		var arrayPageSize = getPageSize();
		if( parseInt(height) + s + 50 > arrayPageSize[1] ){
				tmp =  parseInt(height) + s + 50;
				document.getElementById('overlay').style.height = tmp+'px';
		}
		
		htm = '<table style="filter:alpha(opacity=100);" cellpadding=0 cellspacing=0 width=100% height=100%><tr><td colspan=3 valign=middle align=center><img onClick="DmsImageBox.end();" style="cursor: pointer;" border=0 src="'+src+'" border=0></td></tr><tr><td align=left height=20 style="padding-top: 8px;" width="250">'+
		(panchor != '' ? '<div style="filter:alpha(opacity=50);-moz-opacity:.50;opacity:.50;cursor:hand; width: 25px; text-align: center; padding-top: 6px;padding-bottom: 5px;position: absolute; top: 100px;"><a style="color: #000000;" href="javascript:void(0)" onclick="'+plink+'"><img src="/grafika/ico_back.gif" border="0"></a></div>' : '')+
		zi+'&nbsp;/&nbsp;'+z+'</td><td width="'+(width-50)+'" style="padding-top: 8px;" align=center>'+title+'</td><td width=25>'+
		(nanchor != '' ? '<div style="filter:alpha(opacity=50);-moz-opacity:.50;opacity:.50;cursor:hand; width: 25px; text-align: center; padding-top: 6px;padding-bottom: 5px;position: absolute; top: 100px;"><a style="color: #000000;" href="javascript:void(0)" onclick="'+nlink+'"><img src="/grafika/ico_next.gif" border="0"></a></div>' : '')+
		(isIE6 ? "<br>" : "")+'<div style="float: right"><div style="filter:alpha(opacity=50);-moz-opacity:.50;opacity:.50;cursor:hand; width: 25px; text-align: center; padding-top: 6px;padding-bottom: 5px;"><a style="color: #000000" href="javascript: DmsImageBox.end();"><img src="/grafika/ico_close.gif" border="0"></a></div></div></td></tr></table>';
		
		document.getElementById('inside').innerHTML = htm;
		opacity('inside', 0, 100, 500);
		var arrayPageSize = getPageSize();
		document.getElementById('overlay').style.height = arrayPageSize[1]+'px';
		load_stan = false;
	}}
	this.end = function (){
		load_stan = false;
		if( divId ){
			divId.style.display = 'none';
			divId = '';
		} else 
			imgPreloader.onLoad = "void();";
		changeOpac(0, 'inside');
		clearOpacity('inside');
		//opacity('inside', 100, 0, 100);
		opacity('overlay', 60, 0, 100);
		showSelectBoxes();
	}
}
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else if (document.documentElement && document.documentElement.scrollHeight > document.documentElement.offsetHeight){ // Explorer 6 strict mode
		xScroll = document.documentElement.scrollWidth;
		yScroll = document.documentElement.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth + document.body.offsetLeft;
		yScroll = document.body.offsetHeight + document.body.offsetTop;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
function getPageScroll(){
	var yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}
	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}
var timers = Array();
timers['inside'] = Array(1000);
timers['overlay'] = Array(1000);
function clearOpacity(id){
	for(i=0;i<1000;i++){
		if( timers[id][i] )
			clearTimeout(timers[id][i]);
		timers[id][i] = "";
	}
}
function opacity(id, opacStart, opacEnd, millisec) { 
	clearOpacity(id);
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            timers[id][i] = setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 
//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
	object.display = 'block';
	if( opacity == 0 )
		document.getElementById(id).style.display = 'none';
} 
function showSelectBoxes(){
	selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "visible";
	}
}
function hideSelectBoxes(){
	selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "hidden";
	}
}

function goLogin(){
	
	$.ajax({ url: '/?body=account&mode=ajax'+(ses_id ? "&ses_id="+ses_id : ""),  
				type: "POST",
         		data: ({
         				login_uzytkownika: document.log_form.login_uzytkownika.value,
						haslo_uzytkownika: document.log_form.haslo_uzytkownika.value,
						autologin: document.log_form.autologin.value
         	    }),
				context: document.body,  success: function(msg){
		   				arr = msg.split("|");
		   				if( arr[1] ){
		   					document.getElementById("alert_opis").innerHTML = (arr[2] ? arr[2] : '<b style=\'color:#ff0000\'>Niepoprawna para login/hasło.</b>');
		   				} else {
		   					tmp = location.href;
		   					if( tmp.indexOf("PHPSESSID") == - 1 ){
			   					if( tmp.indexOf("?") == -1 ){
			   						tmp = tmp + '?'+arr[3];
			   					} else {
			   						tmp = tmp + '&'+arr[3];
			   					}
		   					}
		   					location.href = tmp;
		   				}
		    
		  } });
		  
	return false;
}

var divId;
function showContentDiv(cont) {
		if( !divId ){
			divId = document.createElement("div");
			divId.setAttribute('id','box_alert');
			document.body.appendChild(divId);
		}
	    if( !timers[divId] )
	    	timers[divId] = Array(1000);
		
		var arrayPageSize = getPageSize();
		hideSelectBoxes();
		document.getElementById('overlay').style.height = arrayPageSize[1]+'px';
		
		load_stan = true;
		opacity('overlay', 0, 60, 500);
		
		$.ajax({ url: '/tpl.php?tpl='+cont+(ses_id ? "&ses_id="+ses_id : ""),  context: document.body,  success: function(msg){
		    arrayPageScroll = getPageScroll();

			s = parseFloat(arrayPageScroll[1])+ 50;
			if( s < parseFloat(arrayPageScroll[1]) + 50 )
				s = parseFloat(arrayPageScroll[1])+50;
			divId.style.top = s+'px';
			divId.innerHTML = msg;
		    
		  } });
}

var zaladowano_gorace = 0;
var DmsImageBox = new DmsImageBox();
function initDmsImageBox(){
	DmsImageBox.init();
	
	$(function() { 
		
		$("div.podklad").each(function(i){
			tmp = $(this).attr("id").replace("opi_", "");
			$('#pun_'+tmp).tooltip({
				tip: '#opi_'+tmp,		
				effect: 'fade',
				position: 'top center',
				offset: [0, 0],
				delay: 500,
				relative: true
			});
		});

		
		
		
		$("a.tt2").tooltip({
			tip: 'a.tt2 dfn',
			effect: 'fade',
			position: 'top center',
			offset: [10, 0],
			relative: true
		});
		$("a.tt").tooltip({
			tip: 'a.tt dfn',		
			effect: 'fade',
			position: 'top center',
			offset: [10, 0],
			relative: true
		});
		
		$("[title]").tooltip({
			offset: [10, 0]
		});
					
		$("#gorace_news").hide();
		tmp = readCookie("gorace");
		createCookie('gorace',tmp,30);
		if(tmp  == "hide"){
			zaladowano_gorace = -1;
	   		document.getElementById('gorace_news').innerHTML = '<div style="clear:both"></div><div id="gorace"><div class="gl"><div id="gorace_but" onclick="tolbar();">Rozwiń wiadomości <img src="/grafika/iko_rozwin.gif" /></div></div></div>';
	   		$("#gorace").css({"bottom": "-45px"});
			$("#gorace_but").css({"bottom": "0px"});
			$("#gorace_news").fadeIn('slow');
		} else {
			ladujGorace();
		}
		
		$(".menu0, .menu0s, .menu, .menus, .menu3, .menu2").each(function(i){
			$(this).css("cursor", "pointer");
			$(this).click(function () { 
				location.href = $(this).children().attr("href");
			});
		});
		
	});
	
}
function ladujGorace(){
	if( zaladowano_gorace < 1 ){
			$("#gorace_news").load("/gorace.php", function () {
				if( zaladowano_gorace != -1)
					$("#gorace_news").fadeIn('slow');
				zaladowano_gorace = 1;
				try {
					$(".scrollable").scrollable({ vertical: true, mousewheel: true, circular: true }).autoscroll({interval: 5000});
				} catch (e) {
					
				}
			});
	}
}
window.onload= initDmsImageBox;

var ji = 1;
function insertSwf(plik, width, height, ret, fv){
 rnd = (width*10)+(height*100)+ji;
 ji++;
 if(ret){
 	document.getElementById(ret).innerHTML = (
     '<OBJECT WIDTH="' + width + '" HEIGHT="' + height + '">'+(fv ? '<PARAM NAME=flashvars VALUE="' + fv + '">' : "")+'<PARAM NAME=movie VALUE="' + plik + '"><PARAM NAME=quality VALUE=high><PARAM NAME=wmode VALUE=opaque><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="' + plik + '" quality=high wmode="opaque" bgcolor=#FFFFFF WIDTH="' + width + '" HEIGHT="'
         + height
         +(fv ? '" FlashVars="' + fv + '"' : "")
         + '" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT>');
 } else {
 	document.write('<div id="f'+rnd+'" style="width:'+width+';height:'+height+'px"></div>');
 	document.getElementById('f'+rnd).innerHTML = (
     '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH="' + width + '" HEIGHT="' + height + '"><PARAM NAME=movie VALUE="' + plik + '"><PARAM NAME=quality VALUE=high><PARAM NAME=wmode VALUE=opaque><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="' + plik + '" quality=high wmode="opaque" bgcolor=#FFFFFF WIDTH="' + width + '" HEIGHT="'
         + height
         + '"  PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT>');
 }
}

function insertSwf2(plik, width, height,border,transparent){
 rnd = width+height+ji;
 ji++;
 document.write('<div id="f'+rnd+'" style="width:'+width+';height:'+height+'px"></div>');
 document.getElementById('f'+rnd).innerHTML = (
	'<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH="' + width + '" HEIGHT="' + height + '"><PARAM NAME=movie VALUE="' + plik + '">'+(transparent ? '<PARAM NAME=quality VALUE=high><PARAM NAME=wmode VALUE=transparent>' : (border ? '' : '<PARAM NAME=quality VALUE=high><PARAM NAME=wmode VALUE=opaque>')+'<PARAM NAME=bgcolor VALUE='+(border ? border : '#FFFFFF')+'>')+'<EMBED src="' + plik + '" '+(transparent ? 'wmode="transparent"' : (border ? "" : 'wmode="opaque"'))+' quality=high bgcolor='+(border ? border : '#FFFFFF')+' WIDTH="' + width + '" HEIGHT="'
         + height
         + '" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT>');
}
var FlashDetect = new function(){
	var self = this;
	self.installed = false;
	self.raw = "";
	self.major = -1;
	self.minor = -1;
	self.revision = -1;
	self.revisionStr = "";
	var activeXDetectRules = [
		{
			"name":"ShockwaveFlash.ShockwaveFlash.7",
			"version":function(obj){
				return getActiveXVersion(obj);
			}
		},
		{
			"name":"ShockwaveFlash.ShockwaveFlash.6",
			"version":function(obj){
				var version = "6,0,21";
				try{
					obj.AllowScriptAccess = "always";
					version = getActiveXVersion(obj);
				}catch(err){}
				return version;
			}
		},
		{
			"name":"ShockwaveFlash.ShockwaveFlash",
			"version":function(obj){
				return getActiveXVersion(obj);
			}
		}
	];
	var getActiveXVersion = function(activeXObj){
		var version = -1;
		try{
			version = activeXObj.GetVariable("$version");
		}catch(err){}
		return version;
	};
	var getActiveXObject = function(name){
		var obj = -1;
		try{
			obj = new ActiveXObject(name);
		}catch(err){}
		return obj;
	};
	var parseActiveXVersion = function(str){
		var versionArray = str.split(",");//replace with regex
		return {
			"raw":str,
			"major":parseInt(versionArray[0].split(" ")[1], 10),
			"minor":parseInt(versionArray[1], 10),
			"revision":parseInt(versionArray[2], 10),
			"revisionStr":versionArray[2]
		};
	};
	var parseStandardVersion = function(str){
		var descParts = str.split(/ +/);
		var majorMinor = descParts[2].split(/\./);
		var revisionStr = descParts[3];
		return {
			"raw":str,
			"major":parseInt(majorMinor[0], 10),
			"minor":parseInt(majorMinor[1], 10), 
			"revisionStr":revisionStr,
			"revision":parseRevisionStrToInt(revisionStr)
		};
	};
	var parseRevisionStrToInt = function(str){
		return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision;
	};
	self.majorAtLeast = function(version){
		return self.major >= version;
	};
	self.FlashDetect = function(){
		if(navigator.plugins && navigator.plugins.length>0){
			var type = 'application/x-shockwave-flash';
			var mimeTypes = navigator.mimeTypes;
			if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description){
				var version = mimeTypes[type].enabledPlugin.description;
				var versionObj = parseStandardVersion(version);
				self.raw = versionObj.raw;
				self.major = versionObj.major;
				self.minor = versionObj.minor; 
				self.revisionStr = versionObj.revisionStr;
				self.revision = versionObj.revision;
				self.installed = true;
			}
		}else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript){
			var version = -1;
			for(var i=0; i<activeXDetectRules.length && version==-1; i++){
				var obj = getActiveXObject(activeXDetectRules[i].name);
				if(typeof obj == "object"){
					self.installed = true;
					version = activeXDetectRules[i].version(obj);
					if(version!=-1){
						var versionObj = parseActiveXVersion(version);
						self.raw = versionObj.raw;
						self.major = versionObj.major;
						self.minor = versionObj.minor; 
						self.revision = versionObj.revision;
						self.revisionStr = versionObj.revisionStr;
					}
				}
			}
		}
	}();
};

var MM_FlashCanPlay = false;
if(FlashDetect.majorAtLeast(7))   
	MM_FlashCanPlay = true; 
 		
var ji = 1;
function insertSwf3(plik, width, height, transparent, border, id_replace, im, fid){
    rnd = width+height+ji;
    ji++;
 if( id_replace && (MM_FlashCanPlay || !im)){
 	document.getElementById(id_replace).innerHTML = (
	'<object '+(fid ? 'id="'+fid+'" ' : '')+(border ? 'class="tfoto"' : '')+' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + width + '" height="' + height + '"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="movie" value="' + plik + '" /><param name="quality" value="high" />'+(transparent ? '<param name="wmode" value="transparent" />' : '<param name="bgcolor" value="'+(border ? border : '#ffffff')+'">')+'<param name="swliveconnect" value="true" /><embed swliveconnect="true" '+(fid ? 'name="'+fid+'" ' : '')+' src="'+ plik + '" '+(transparent ? 'wmode="transparent"' : '')+' quality="high" bgcolor='+(border ? border : '#ffffff')+' width="' + width + '" height="'
         + height
         + '" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"></embed></object>');
 	
 } else if( MM_FlashCanPlay || !im ){
 	document.write('<div id="f'+rnd+'" style="width:'+width+';height:'+height+'px"></div>');
 	document.getElementById('f'+rnd).innerHTML = (
	'<object '+(border ? 'class="tfoto"' : '')+' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + width + '" height="' + height + '"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="quality" value="high" /><param name="movie" value="' + plik + '" />'+(transparent ? '<param name="wmode" value="transparent" />' : '<param name="bgcolor" value="'+(border ? border : '#ffffff')+'">')+'<embed src="' + plik + '" '+(transparent ? 'wmode="transparent"' : '')+' quality="high" bgcolor='+(border ? border : '#ffffff')+' width="' + width + '" height="'
         + height
         + '" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"></embed></object>');
 } else if( im ) {
 		document.write('<img src="'+im+'" width="'+width+'" height="'+height+'" '+(border ? 'class=tfoto' : '')+' border=0 />');
 }
 
}
//-->
