

function load() {
  /*if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    map.setCenter(new GLatLng(52.2419, 21.01), 11);
    
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.addControl(new GScaleControl());
    
    point = new GLatLng(52.2317, 21.0058);
    icon = new GIcon();
    icon.image = "icons/ikonka_textil.png";
    icon.iconSize = new GSize(19, 21);
    icon.iconAnchor = new GPoint(8,0);
    marker = new GMarker(point);
    map.addOverlay(marker);
    
    GEvent.addListener(marker, "click", function(){
    	p = GProjection.fromPixelToLatLng();
    	marker.openInfoWindowHtml("Tu byłem = "+p);
    });
  }
  */
}


function zobacz()
{
	var map = new GMap2(document.getElementById("map"));
	point = new GLatLng(52.2000, 21.0000);
	marker = new GMarker(point);
	map.addOverlay(marker);
	//alert('zobacz');
}


var galery;
function pokaz_zdjatko(obj, idSklep)
{
	/*alert('id='+obj.id);
	var zdjatko = document.getElementById('galeria_');
	var z = new Image();
	z.src = path;
	document.fotka.src = path;
	*/
	var dark = document.getElementById('dark');
	if(dark.style.display == 'none')
	{
		var s = getPageSize();
		var c= getPageScroll();		
		dark.style.display = 'block'
		//dark.style.top = c[1]+'px';
		dark.style.height = s[3]+c[1]+'px';
		dark.style.width = s[2]+'px';
		
		Effect.Appear('dark', {from:0.0, to:.5});
	}else{
		dark.style.display = 'none'
	}
	hideSelectBoxes();
	galery = new Galeria(obj, idSklep);
	galery.view(true);
	//galery.next();	
}

function nastepne_zdjatko()
{
	galery.next();
}

function poprzednie_zdjatko()
{
	
	galery.prev();
}

function zamknij_zdjatko()
{
	//Effect.Puff('zdjatko', { duration: 3 });
	//Effect.Shrink('zdjatko', {direction: 'top-left'});
	if(document.getElementById('dark').style.display != 'none')
	{
		Effect.Fade('dark', {from:.5, to:.0});
	}	
	galery.close();
	showSelectBoxes();
}

function nast_zdjatko()
{
	var imgs = document.getElementsByTagName('img');
	
}


function Galeria(obj, idSklep)
{
	this.obrazki = Array();
	this.pos = 0;
	
	var t = new Image();
	t.src = obj.rel;//obj.getAttribute('rel');
	//alert('rel='+obj.rel);
	this.obrazki.push(t);
	var d = document.getElementById(idSklep);
	var links = d.getElementsByTagName('a');
	for(var i=0; i<links.length; i++)
	{
		if(links[i] != obj)
		{
			t = new Image();
			t.src = links[i].getAttribute('rel');
			this.obrazki.push(t);
		}
	}
	//alert('linki='+links.length+' obrazki='+this.obrazki.length+' '+obj.getAttribute('rel'));

	
	this.view = function()
	{
		document.fotka.src = this.obrazki[this.pos].src;
		var gal = document.getElementById('galeria_');
		gal.style.width = this.obrazki[this.pos].width+'px';
		gal.style.height = this.obrazki[this.pos].height+50+'px';
		//var zdj = document.getElementById('zdjatko');
		if(gal.style.display == 'none')
		{
			//Effect.BlindDown('galeria_');
			gal.style.display = 'block';
		}

		var page_size = getPageSize();
		var w = parseInt((gal.style.width).replace(/px/, ""));
		var h = parseInt((gal.style.height).replace(/px/, ""));
		//alert(page_size[2]+','+page_size[3])
		//alert('0');
		var left = page_size[2];
		//alert('1');
		left /= 2;
		//alert('2');
		left = left - w/2;
		//alert('3');
		var top = page_size[3]/2 - h/2;
		gal.style.top = (top+100)+'px';
		//alert('4');
		gal.style.left = left+'px';
		//alert(gal.style.top+','+gal.style.left)
		
		//if(document.getElementById('poz_zdj'))
			document.getElementById('poz_zdj').innerHTML = (this.pos + 1)+' z '+(this.obrazki.length );// +' [='+w;
	}
			
	
	this.next = function(){
		if(this.pos<this.obrazki.length-1)
		{
			//alert(this.pos);
			this.pos++;
			this.view();
		}
			
	}
	
	this.prev = function(){
		if(this.pos>0)
		{//alert(this.pos);
			this.pos--;
			this.view();
		}
	}
	
	this.close = function(){
		//Effect.Puff('galeria_', { duration: 3 });
		document.getElementById('galeria_').style.display = 'none';
	}
	
	this.len = function(){
		return this.obrazki.length;
	}
	
	this.position = function(){
		return this.pos;
	}	
		
}


function getPageScroll(){
var yScroll;
if(self.pageYOffset) yScroll=self.pageYOffset;
else if(document.documentElement&&document.documentElement.scrollTop) yScroll=document.documentElement.scrollTop;	 // Explorer 6 Strict
else if (document.body) yScroll=document.body.scrollTop;// all other Explorers
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){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 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 Galeries(obj)
{
	this.obrazki = Array();
	this.poz = 0;
	var links = document.getElementsByTagName('a');
	//var zdjatko = document.getElementById('zdjatko');
	var html ='';	
	for(var i=0; i<links.length; i++)
	{		
		if(links[i].getAttribute('rel') == 'lightbox[1]')
		{
			var img = new Image();
			img.src = links[i].getAttribute('src');
			this.obrazki.push(img);						
		}
	}
	
	for(var i=0; i<this.obrazki.length; i++)
	{
		html += 'obr['+i+']='+this.obrazki[i].src+'<br/>';
	}
	alert('obarki len='+this.obrazki.length+html);
	
	
	this.view = function(){
		document.fotka.src = this.obrazki[this.poz].src;
		if(zdjatko.style.display == 'none')
		{
			Effect.BlindDown('zdjatko');		
		}
	}
	
	this.next = function(){
		if(poz<obrazki.lentgh)
		{
			this.poz++;
			this.view();
		}
			
	}
	
	this.prev = function(){
		if(poz>0)
		{
			this.poz--;
			this.view();
		}
	}
	
	this.close = function(){
		Effect.Puff('zdjatko', { duration: 3 });
	}
	
}
*/