/**
* 2007-05-24, rjanusz
*
*/


function imgPopup(url,name,scale) 
{ 
    this.imgURL = url;
    this.name   = name;
    this.scale  = scale;
    this.delay  = 1000;

    this.img = img = new Image(); 
    this.img.src = this.imgURL;

    var me = this;

    this.preloadCheck = function () {
        //if (me.img.complete && me.img.width && me.img.height) {
        if (me.img.width && me.img.height) {
            me.showPopup();
        } else {
            window.setTimeout(me.preloadCheck, me.delay);
        }
    }

    this.showPopup = function () {

        var width  = me.img.width; 
        var height = me.img.height;                
        var x = "TITLEBAR=0,LOCATION=0,RESIZE=0, WIDTH="+width+", HEIGHT="+
                height;
        var newwindow = window.open("","name",x);  
        var d = newwindow.document;
        d.open();
        d.write('<html><head><title>'+me.name+
                '</title></head>' +
                '<body leftmargin="0" topmargin="0" ' +
                ' rightmargin="0" bottommargin="0" ' +
                ' marginwidth="0" marginheight="0" ' +
                ' bgcolor="#FFFFFF"><img src="'+me.img.src+'" ' +
                ' alt="" width="'+width+'" height="'+height+
                '" border="0" onclick="window.close()">' + 
                '</body></html>');
        d.close(); 
    }
    me.preloadCheck();
} 

function swapImage (folder, imageName) {
	document.getElementById('big_img').src = "img/galeria/"+folder+'/'+imageName;
}

function show(divid) {
	elt = document.getElementById(divid);
	if (elt) {
		if (elt.style.visibility=='visible')
		{
			elt.style.visibility='hidden';
			elt.style.display='none';
		}
		else	
		{
			elt.style.visibility='visible';
			elt.style.display='block';
		}
	}
}