function bookmark(url, description){
    if (url == null) { // if description is not passed then default to page title
        url = window.location.href;
    }
    if (description == null) { // if description is not passed then default to page title
        description = document.title;
    }
    if (document.all){ // Test If: Internet Explorer
    window.external.AddFavorite(url, description); // AddFavorite is IE specific
    }
    else if (window.sidebar){ // Test If: Mozilla, Netscape, or FireFox
    window.sidebar.addPanel(description, url, ""); // sidebar.addPanel is Mozilla specific
    }
    else { // If all others
    window.alert("Press CTRL+T to bookmark this page"); // CTRL + T typically for Opera and other browsers
    }
    
}
function Galeria(tresc) {	
	obj = document.getElementById("wojewodztwo").value;

	objFirma = document.getElementById('dane'+obj);
	for (i=1; i<17; i++)
	{
		objF = document.getElementById('dane'+i);
		objF.style.display="none";
	}
	objFirma.style.display="block";
	objmapka = document.getElementById('mapka');
	if(obj<1 || obj>16) obj=0;
	objmapka.src='public/images/mapka'+obj+'.jpg';

}

function Galeria_close(n) {
 document.getElementById(n).style.display = "none";
}

function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=600, height=450, scrollbars=no');
}

function popup_tuv(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=800, height=500, scrollbars=no');
return false;
}

function popup_mapka(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=600, height=371, scrollbars=no');
return false;
}

function popup_imp(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=526,height=500,scrollbars=no');
return false;
}

function popup_window(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=100%,height=100%,scrollbars=yes');
return false;
}

function popup_rzeszow(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=600,height=371,scrollbars=no, resizable=no');
return false;
}

function popup_plock(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=600,height=371,scrollbars=no resizable=no');
return false;
}

function pokaz (id, l, img) {
	obj = document.getElementById(id);
	if(obj.style.display=="none") obj.style.display="";
	else obj.style.display="none";
	
	ol = document.getElementById(l);
	
	if(ol.style.textDecoration=="none") ol.style.textDecoration="underline";
	else ol.style.textDecoration="none";	
	
	objImg = document.getElementById(img);
	
	if(objImg.style.listStyleImage=="url('public/images/dla_inwestorow_blue_arrow.gif')") 
					objImg.style.listStyleImage="url('public/images/dla_inwestorow_blue_arrow_down.gif')";
	else 
					objImg.style.listStyleImage="url('public/images/dla_inwestorow_blue_arrow.gif')";
}

function pokazMiesiace (id) {

	var obj = new Array();
	baza = document.getElementById(id);
	obj = document.getElementsByTagName("tr");
	
	for(var i=0; i<obj.length; i++) {
	
		if(obj[i].id.substring(0,8)==id.substring(0,8)) {
				if(obj[i].style.display=="none") obj[i].style.display="";
				else {
					var count=0;
					for(var j=0; j<obj.length; j++) {
								
						if(obj[j].id.substring(3,8)==id.substring(3,8)) {
									
							obj[j].style.display="none";
									
						}
					}
				}
		}
	}
}

function pokazRaporty (id) {

	var obj = new Array();
	baza = document.getElementById(id);
	obj = document.getElementsByTagName("tr");
	var count = 0;
	for(var i=0; i<obj.length; i++) {

		if(obj[i].id.substring(0,13)=="one_"+id.substring(4,13) || obj[i].id.substring(0,13)=="onk_"+id.substring(4,13)) {
			if(obj[i].style.display=="") 
				obj[i].style.display="none";
			
		}
		
		if(obj[i].id.substring(0,13)==id.substring(0,13)) {
			if(obj[i].style.display=="none") {
				obj[i].style.display="";
			}
			else obj[i].style.display="none";
			
		}
	}
}

function pokazRaport (id) {

	var obj = new Array();
	baza = document.getElementById(id);
	obj = document.getElementsByTagName("tr");
	
	for(var i=0; i<obj.length; i++) {
	
		if(obj[i].id==id) {
			if(obj[i].style.display=="none") obj[i].style.display="";
			else obj[i].style.display="none";
		}
	}
}

function zamykacz () {
	tabela = document.getElementsByTagName("tr");
	
	j=1;
	
	for (i=0; i<tabela.length; i++)
	{
		if(tabela[i].id==("inwestor"+[j]))
		{
			tabela[i].style.display="none";
			j++;
		}
	}
	
	
}



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;
}


function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		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 { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	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 setWidth(element,w) {
	   	element = $(element);
    		element.style.width = w +"px";
			}
function setHeight(element,h) {
   		element = $(element);
    		element.style.height = h +"px";
			}
function setInnerHTML(element,content) {
			element = $(element);
			element.innerHTML = content;
			}
function setTop(element,t) {
	   	element = $(element);
	    	element.style.top = t +"px";
			}
function setLeft(element,t) {
	   	element = $(element);
	    	element.style.left = t +"px";
			}

	
function start(szer, foto) {	
	  
	  
		// stretch overlay to fill page and fade in
		var arrayPageSize = getPageSize();
		setHeight('tlo_block', arrayPageSize[1]);
		//new Effect.Appear('tlo_block', { duration: 0.2, from: 0.0, to: 0.8 });

	  	// calculate top offset for the lightbox and display 
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();
		var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 15);
		
		var ile = (arrayPageSize[2]-szer)/2-16
		
		setLeft('galeria', ile);
		setTop('galeria', lightboxTop);
		
	}

function startWideo(szer) {	
	  
	  
		// stretch overlay to fill page and fade in
		var arrayPageSize = getPageSize();
		setHeight('tlo_block', arrayPageSize[1]);
		//new Effect.Appear('tlo_block', { duration: 0.2, from: 0.0, to: 0.8 });

	  	// calculate top offset for the lightbox and display 
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();
		var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 15);
		
		var ile = (arrayPageSize[2]-szer)/2-16
		
		setLeft('wideo', ile);
		setTop('wideo', lightboxTop);
		
	}
function PodmienFoto(tresc, szer){
//var objLoadingImage = document.getElementById( 'foto' );
//objLoadingImage.setAttribute('src', foto_img);

Galeria('galeria', tresc, szer);
}
	
function Wideo(Nazwa) {
objFirma = document.getElementById( 'wideo' );
objFirma.style.display="block";

objBlock = document.getElementById('tlo_block');
objBlock.style.display="block";

startWideo(302);

var so = new SWFObject('public/swf/player.swf', 'player', '302', '267', '8');
so.addParam('wmode', 'transparent');
so.write('wideo');

document.getElementById(Nazwa).innerHTML+='<br/><a href="#" onclick="javascript:Galeria_close(\'wideo\');Galeria_close(\'tlo_block\');">zamknij</a> ';

return false;
}

function PodmienFoto(tresc, szer){
//var objLoadingImage = document.getElementById( 'foto' );
//objLoadingImage.setAttribute('src', foto_img);

Galeria('galeria', tresc, szer);
}
	
function Pop(Nazwa) {
/*
var anchors = document.getElementsByTagName('img');
z=0;
nast=0;
var imageArray = new Array;
var imageSzerArray = new Array;
	
	for (var i=0; i<anchors.length; i++){
		  var anchor = anchors[i];

		  if (anchor.getAttribute('src') && (anchor.getAttribute('rel') == 'galeria_multi'))
		  	  {
				
				asd = anchor.getAttribute('src').replace('/min','');
				szero = anchor.getAttribute('name');
			
			  	if (asd == tresc){
					nast = z;
					}
				imageArray[z] = asd;
				imageSzerArray[z] = szero;
				z++;
			  }
	}
	
		var arrayPageSize = getPageSize();
		setHeight('tlo_block', arrayPageSize[1]);
		//new Effect.Appear('tlo_block', { duration: 0.2, from: 0.0, to: 0.8 });

	  	// calculate top offset for the lightbox and display 
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();
		var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 15);
		
		var ile = (arrayPageSize[2]-szer)/2-16

		setLeft('galeria', ile);
		setTop('galeria', lightboxTop);
*/	
objFirma = document.getElementById( 'galeria' );
objFirma.style.display="block";

objBlock = document.getElementById('tlo_block');
objBlock.style.display="block";


/*
text='<table cellspacing=2 cellpadding=3 cellpadding=2>';
text+='<tr><td style="font-size: 12px; background-color: #ffffff; font-size: 11px; text-align:left;"><img src="'+tresc+'" onclick="javascript:Galeria_close();" style="cursor: pointer;" alt="" /></td></tr></table>';
*/
//document.getElementById(Nazwa).innerHTML=text;

return false;
}

function Pop_close() {
 objFirma = document.getElementById('galeria');
 objFirma.style.display="none";
 objBlock = document.getElementById('tlo_block');
 objBlock.style.display="none";
}
