//--------------------------------// Window Open
function popup(pic,alt,width,height){
    var section = document.getElementById('glr').getElementsByTagName('table')[0].id;

	popup2('photo/'+section + '/' + pic, alt, width, height, 'закрыть окно');
}

function _popup(pic,alt,width,height){
    var section = document.getElementById('glr').getElementsByTagName('table')[0].id;

	popup2('../photo/'+section + '/' + pic, alt, width, height, 'close window');
}


function popup2(pic,title,width,height, alt){
	wtop = (screen.height/100*43-height/2);
	wleft = (screen.width/2-width/2);
	blank = window.open('','_blank','status=0,width='+ width +',height='+ height +',top='+ wtop +',left='+ wleft);
	page = '<html><head><title>'+ title +'</title></head>'+
			 '<body style="padding:0;margin:0;">'+
			 '<img src="' + pic +'" width="'+ width +'" height="'+ height +'" style="border:none;cursor:pointer;cursor:hand" onclick="self.close()" alt="'+alt+'" />'+
			 '</body></html>';	
	blank.document.open();
	blank.document.write(page);
	blank.document.close();
}


//--------------------------------// SuckerFish
function suckerfish(type, tag, parentId) {
	if (window.attachEvent) {
		window.attachEvent('onload', function() {
			var parentObj = document.getElementById(parentId);
			if (parentObj != null) {
				type(parentObj.getElementsByTagName(tag));
			}
		});
	}
}

sfHover = function(sfEls) {
	for (var i=0; i<sfEls.length; i++) {
	
		sfEls[i].onmouseover=function() {
		//alert(this.className);
			if (this.className.indexOf("thumb") != -1) 
					this.className+=' sfhover';
			//this.className = 'sfhover';
		}
		sfEls[i].onmouseout=function() {
			//this.className=this.className.replace(new RegExp(' sfhover\\b'), '');
			if (this.className.indexOf("thumb") != -1) 
				this.className=this.className.replace(' sfhover', '');
		}
	}
}

if(document.all && !window.opera) {
	suckerfish(sfHover,'TD', 'glr');
}

