sfHover = function() {
	if (document.getElementById("telefony")) {
		var sfEls = document.getElementById("telefony").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 (document.getElementById("buttonContact")) {
		var el = document.getElementById("buttonContact");
		el.onclick = function() {
			openWindow('/html/kontakt.html');
		}
	} 
	if (document.getElementById("buttonClose")) {
		var el = document.getElementById("buttonClose");
		el.onclick = function(){
			self.close()
		}
	}
	if (document.getElementById("buttonFormularz")) {
		var el = document.getElementById("buttonFormularz");	
		el.onclick = function(){
			openWindow('/html/wpisz_reklamacje.html', 540)
		}
	}
	if (document.getElementById("buttonSafety")) {
		var el = document.getElementById("buttonSafety");
		el.onclick = function(){
			openWindow('/html/bezpieczenstwo.html');
		}
	}
	if (document.getElementById("buttonRules")) {
		var el = document.getElementById("buttonRules");
		el.onclick = function(){
			openWindow('/html/regulamin.html')
		}
	}
	if (document.getElementById("buttonAbout")) {
		var el = document.getElementById("buttonAbout");
		el.onclick = function(){
			openWindow('/html/informacje.html')
		}
	}
	if (document.getElementById("buttonAdd")) {
		var el = document.getElementById("buttonAdd");
		el.onclick = function(){
			openWindow('/html/reklama.html')
		}
	}
	if (document.getElementById("buttonDownload")) {
		var el = document.getElementById("buttonDownload");
		el.onclick = function(){
			openWindow('/html/jaksciagnac.html')
		}
	}
	if (document.getElementById("buttonHelp")) {
		var el = document.getElementById("buttonHelp");
		el.onclick = function(){
			openWindow('/html/reklamacje.html', 538)
		}
	}
	if (document.getElementById("buttonFirst")) {
		var el = document.getElementById("buttonFirst");
		el.onclick = function(){
			openWindow('/html/pierwszy_raz.html')
		}
	}
	if (document.getElementById("buttonRegister")) {
		var el = document.getElementById("buttonRegister");
		el.onclick = function(){
			openWindow('/register')
		}
	}
	if (document.getElementById("buttonFaq")) {
		var el = document.getElementById("buttonFaq");
		el.onclick = function(){
			openWindow('/html/faq.html')
		}
	}
	if (document.getElementById("buttonCeny")) {
		var el = document.getElementById("buttonCeny");
		el.onclick = function(){
			openWindow('/html/ceny.html', 535)
		}
	}
	if (document.getElementById("buttonBack")) {
		var el = document.getElementById("buttonBack");
		el.onclick = function(){
			history.back()
		}
	}
	if (document.getElementById("buttonSms")) {
		var el = document.getElementById("buttonSms");
		el.onclick = function(){
			openWindow('/html/sms.html')
		}
	}
	if (document.getElementById("faqarena")) {
		var el = document.getElementById("faqarena");
		el.onclick = function(){
			openWindow('/html/faqarena.html')
		}
	}
	if (document.getElementById("pomocarena")) {
		var el = document.getElementById("pomocarena");
		el.onclick = function(){
			openWindow('/html/pomocarena.html')
		}
	}		
	if (document.getElementById("buttonContest")) {
		var el = document.getElementById("buttonContest");
		el.onclick = function(){
			openWindow('/html/regulamin_online.html')
		}
	}
	if (document.getElementById("buttonForumComment")) {
		var el = document.getElementById("buttonForumComment");
		el.onclick = function(){
			var title = document.commentForm.title.value;
			var content = document.commentForm.content.value;
			if (title.replace(/\s+/, '').length == 0 || content.replace(/\s+/, '').length == 0)
				alert("Wprowadz tekst");
			else {
				document.commentForm.submit();		
			}
		}
	}
	if (document.getElementById("buttonNewsComment")) {
		var el = document.getElementById("buttonNewsComment");
		el.onclick = function(){
			var content = document.commentForm.content.value;
			if (content.replace(/\s+/, '').length == 0)
				alert("Wprowadz tekst");
			else {
				document.commentForm.submit();		
			}
		}
	}
	if (document.getElementById("tree")) {
		var el = document.getElementById("tree");
		el = el.getElementsByTagName("IMG");
		for (var i=0; i<el.length; i++) {
		if (el[i].className == "plus")
			el[i].onclick = function(){
			element = this.parentNode;      
			for (var i = 0; i < element.childNodes.length; i++) {  
				if (element.childNodes.item(i).className && element.childNodes.item(i).className.toLowerCase() == 'go') {
					element.childNodes.item(i).style.display = (element.childNodes.item(i).style.display == 'none' ? 'inline' : 'none');;
				}
				if (element.childNodes.item(i).nodeName.toLowerCase() == 'ul') {
					element.childNodes.item(i).style.display = (element.childNodes.item(i).style.display == 'none' ? 'block' : 'none');
				}   
				if (element.childNodes.item(i).className && element.childNodes.item(i).className.toLowerCase() == 'plus') {
					element.childNodes.item(i).src = (element.childNodes.item(i).src.indexOf('minus.gif') > 0 ? '../gfx/jabler/plus.gif' : '../gfx/jabler/minus.gif');
				}
			}
		}
		}
	}
}
function openWindow(url, width) {
	var height = 368;
	var scroll = 1;
	var resize = 1;
	//width = 360;
	if (!width) width = 360;
	
	var str = "width="+width+",height="+height+",toolbar=0,location=0,directories=0,status=0,menuBar=0"
	
	
	if(scroll == 1) str += ",scrollbars=1"
	else if (scroll == 0) str += ",scrollbars=0"
               
	if(resize == 1) str += ",resizable=1"
	else if (resize == 0) str += ",resizable=0"
     
	if (window.screen){
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10;
		var xc = (aw - width) / 2;
		var yc = (ah - height) / 2;
		xc = xc >= 0 ? xc : 0;
		yc = yc >= 0 ? yc : 0;
		str += ",left=" + xc + ",screenX=" + xc;
		str += ",top=" + yc + ",screenY=" + yc;
	}    

   
	newWindow = window.open(url, '',  str);
	newWindow.focus();
}          

function getAbsX(elt) { return (elt.x) ? elt.x : getAbsPos(elt,"Left"); }
function getAbsY(elt) { return (elt.y) ? elt.y : getAbsPos(elt,"Top"); }
function getAbsPos(elt,which) {
    iPos = 0;
    while (elt != null) {
        iPos += elt["offset" + which];
        elt = elt.offsetParent;
    }
    return iPos;
}

function moveAdLayer(source, target){
    //if(document.getElementById && !document.all && document.getElementById(source) && document.getElementById(target)){
        filmweb_ad_src = document.getElementById(source);
        filmweb_ad_tar = document.getElementById(target);

    if(filmweb_ad_src && filmweb_ad_tar){
        var x_coord = getAbsX(filmweb_ad_tar);
        var y_coord = getAbsY(filmweb_ad_tar);
        filmweb_ad_src.style.left = x_coord + 'px';
        filmweb_ad_src.style.top = y_coord + 'px'; 
        filmweb_ad_src.style.visibility = "visible";
        filmweb_ad_src.style.overflow = "visible";
    }
}
function moveAdLayers(){
    moveAdLayer('addTmp', 'flashAdd'); 
}


function xpAddEvent(obj, type, listener, useCapture) { 
        if (window.addEventListener) { 
                obj.addEventListener(type, listener, useCapture) 
        } else if (window.attachEvent) { 
                obj.attachEvent("on"+type, listener) 
        } 
} 


xpAddEvent(window, "load", sfHover, false); 
xpAddEvent(window, "load", moveAdLayers, false); 



