// ver. 1.1 (27.04.2006) by Softhis.com
function InsertFlash(url, width, height, id, bgcolor, wmode, replaceDiv) {
	if (id == '') id = 'flash';
	if (bgcolor == '') bgcolor = '#ffffff';
	if (wmode == '') wmode = 'transparent';
	if (replaceDiv == '') replaceDiv = false;
	t1 = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="'+id+'">';
	t1 = t1+'<param name="movie" value="'+url+'" /><param name="quality" value="high" /><param name="wmode" value="'+wmode+'" /><param name="bgcolor" value="'+bgcolor+'" /><param name="menu" value="false" /><param name="swLiveConnect" value="true" /><param name="allowScriptAccess" value="sameDomain" /><param name="scale" value="noscale" /><param name="salign" value="lt" />';
	if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"])
		t1 = '<embed name="'+id+'" src="'+url+'" quality="high" bgcolor="bgcolor" menu="false" swLiveConnect="true" allowScriptAccess="sameDomain" width="'+width+'" height="'+height+'" type="application/x-shockwave-flash" wmode="'+wmode+'" pluginspage="http://www.macromedia.com/go/getflashplayer" scale="noscale" salign="lt"></embed>';
	t2 = '</object>';
	if (!replaceDiv) {
		document.writeln(t1);
		document.writeln(t2);
	} else {
		document.getElementById(replaceDiv).innerHTML = t1+t2;
	}
}

function changeFlashZIndex(dir) {
	//gdzie dir == 'up' albo 'down'
	
	if (dir=='up') {
		document.getElementById('flashDiv').style.zIndex = 1;
		document.getElementById('htmlDiv').style.zIndex = 0;
	} else {
		document.getElementById('flashDiv').style.zIndex = 0;
		document.getElementById('htmlDiv').style.zIndex = 1;
	}
}

function showBoxMenu() {
	var box = document.getElementById('menu_oddzialy');
	if (box) box.style.visibility = 'visible';
}

function hideBoxMenu() {
	/*
	var box = document.getElementById('menu_oddzialy');
	if (box) box.style.visibility = 'hidden';
	*/
}

function showBoxMenu1() {
	/*
	var box = document.getElementById('menu_oddzialy');
	if (box) box.style.visibility = 'visible';
	*/
}

function hideBoxMenu1(e) {
	var box = document.getElementById('menu_oddzialy');
	var offs = 3;
	if (box) {
		//sprawdzamy czy myszka wyjechala poza obszar
		var x = e.clientX;
		var y = e.clientY;
		//alert(x + ' ' + y);
		var totalTop = box.offsetTop + box.offsetParent.offsetTop;
		var totalLeft = box.offsetLeft + box.offsetParent.offsetLeft;
		var totalTopDown = totalTop + 190;
		var totalLeftRight = totalLeft + 178;
		if ((x<totalLeft+offs || x>totalLeftRight-offs) || (y<totalTop+offs || y>totalTopDown-offs))
			//alert(totalTop + ' ' + totalLeft + ' ' + totalTopDown + ' ' + totalLeftRight);
			box.style.visibility = 'hidden';
	}
}


//menu css
 
function addEvent(obj, evType, fn)
{
  if (obj.addEventListener)
  {
    obj.addEventListener(evType, fn, false);
    return true;
  }
  else if (obj.attachEvent)
  {
  var r = obj.attachEvent("on"+evType, fn);
    return r;
  }
  else
  {
    return false;
  }
}


sfHover = function() {
	var sfCont = document.getElementById("nav");
	if (sfCont) {
		var sfEls = sfCont.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"), "");
			}
		}
	}
}
addEvent(window, "load", sfHover);

