
/*sfHover = function() {
	var sfEls = document.getElementsByName("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
*/
	/* jquery lightbox - funkcje */
	function getScrollY() {
		var scrOfY = 0;
		if( typeof( window.pageYOffset ) == 'number' ) {
			//Netscape compliant
			scrOfY = window.pageYOffset;
		} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
			//DOM compliant
			scrOfY = document.body.scrollTop;
		} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
			//IE6 standards compliant mode
			scrOfY = document.documentElement.scrollTop;
		}
		else scrOfy=window.pageYOffset;
		return scrOfY;
	}
	function preload_and_resize(imgSrc,animate){

		// jesli div jest na samej gorze, przsuwa do scrollY
		if(document.getElementById('wew').style.top==0)
			document.getElementById('wew').style.top=getScrollY()+'px';

		// preload image, load original image
		var image=new Image();
		$(image).load(function(){
			$('#fixme').fadeOut('slow');
			$('#popup_image').attr('src',imgSrc);

			$('#wew').fadeIn(300);
			$('#popup_image').fadeIn(300).css('cursor','pointer');

			var x=0;
			var y=0;
			if(typeof(window.innerWidth)=='number'){// to nie IE
				x=window.innerWidth;
				y=window.innerHeight;
			}
			else if(document.documentElement
				&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){
				//IE #1 / DOM
				x=document.documentElement.clientWidth;
				y=document.documentElement.clientHeight;
			}
			else if(document.body
				&&(document.body.clientWidth||document.body.clientHeight)){
				//IE #2
				x=document.body.clientWidth;
				y=document.body.clientHeight;
			}

			x=x/2-image.width/2;
			y=y/2-image.height/2;

			x=parseInt(x);
			y=parseInt(y);

			if(y<0)
				y=0;
			if(x<0)
				x=0;

			y+=getScrollY();

			if(animate==true){
				$('#wew').animate({"left":x+"px","top":y+"px"},500);
			}
			else{
				document.getElementById('wew').style.left=x+'px';
				document.getElementById('wew').style.top=y+'px';
			}
			image.onload=function(){};
		}).attr('src',imgSrc);
	}
	function show_popup(image)
	{
		$('#fixme').fadeIn('fast');
		preload_and_resize(image,true);
	}
	function close_popup()
	{
		// zwijanie jest 20ms szybsze, zeby nie bylo widac mrygniecia na ie
		$('#popup_image').fadeOut(400);
		$('#wew').fadeOut(500);
	}
