/* 
------------------------------------------
	Flipbox written by CrappoMan
	simonpatterson@dsl.pipex.com
------------------------------------------
*/
ver = "";
bName = navigator.appName;
bVer = parseInt(navigator.appVersion);
if (bName == "Netscape" && bVer >= 3) ver = "n3";
if (bName == "Microsoft Internet Explorer" && bVer >= 3) ver = "i3";

//document.writeln("Your Browser:" + bName + " Version " + bVer );

function mouseover(object) {
  document.getElementById(object).style.color = '#660000';
}
function mouseout(object) {
  document.getElementById(object).style.color = '#000000';
}



function imgToggle(imgObjectName, imgObjectState) {
  if (ver == "i3" || ver=="n3") {
    imgObject = new Object();
    imgObject = imgObjectName;
    imgObject.src = imgObjectState;
  }
}
function flipBox(who) {
	var tmp; 
	if (document.images['b_' + who].src.indexOf('_on') == -1) { 
		tmp = document.images['b_' + who].src.replace('_off', '_on');
		document.getElementById('box_' + who).style.display = 'none';
		document.images['b_' + who].src = tmp;
	} else { 
		tmp = document.images['b_' + who].src.replace('_on', '_off');
		document.getElementById('box_' + who).style.display = 'block';
		document.images['b_' + who].src = tmp;
	} 
}

function display_image(mapname,nazwa,w,h) {
       myWindow = window.open("", "Preview", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=w,height=h");
        myWindow.document.open();
        myWindow.document.write("<HTML><HEAD>");
        myWindow.document.write("<TITLE>Preview</TITLE>");
        myWindow.document.write("</HEAD><BODY BGCOLOR='#FFFFFF' TEXT=#000000>");
        myWindow.document.write("<FORM><CENTER><B><FONT SIZE=+1>" + nazwa + "</FONT></B><HR>");
        myWindow.document.write("<IMG HSPACE=0 VSPACE=0 HEIGHT='"+h+"' WIDTH='"+h+ "' SRC='" + mapname + "'>");
        myWindow.document.write("<HR><FORM><INPUT TYPE='button' VALUE='Close' " + "onClick='window.close()'></FORM>");
        myWindow.document.write("</CENTER>");
        myWindow.document.write("</BODY></HTML>");
        myWindow.document.close();
    }

function okno_czesc(id) {
		adres = 'okno_czesc.php?id='+id;
		win = window.open(adres, '_blank', 'toolbar=no,menubar=yes,scrollbars=yes, resizable=yes,status=yes,location=no,directories=no,top=400, left=500,fullscreen=no,top=200,left=200');
}

function okno1(url, tytul, width, height) {
		return 3;
}


function highlight(LinkObject)	{
	LinkObject.className='row_highlighted';
}

function lowlight(LinkObject)	{
	LinkObject.className='row_lowlighted';
}


function show_js_note(id){
	parent.location.href= id;
}

function wshowMenu(item, imgObjectName, imgObjectState) {
        var obj = document.getElementById(item);
		 document.getElementById('menu_1').style.display='none';
		 document.getElementById('menu_2').style.display='none';
		 document.getElementById('menu_3').style.display='none';
        if (obj.style.display == 'none'){
          obj.style.display='';
        } else {
          obj.style.display='none';
        }
}
      
function whideMenu() {
		 document.getElementById('menu_1').style.display='none';
		 document.getElementById('menu_2').style.display='none';
		 document.getElementById('menu_3').style.display='none';
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// efekt do obrazkow na stronie głównej
var baseopacity=100

function slowhigh(which2){
imgobj=which2
browserdetect=which2.filters? "ie" : typeof which2.style.MozOpacity=="string"? "mozilla" : ""
instantset(baseopacity)
highlighting=setInterval("gradualfade(imgobj)",80)
}

function slowlow(which2){
cleartimer()
instantset(baseopacity)
}

function instantset(degree){
if (browserdetect=="mozilla")
imgobj.style.MozOpacity=degree/100
else if (browserdetect=="ie")
imgobj.filters.alpha.opacity=degree
}

function cleartimer(){
if (window.highlighting) clearInterval(highlighting)
}

function gradualfade(cur2){
if (browserdetect=="mozilla" && cur2.style.MozOpacity<1)
cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)-0.1, 0.99)
else if (browserdetect=="ie" && cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity-=10
else if (window.highlighting)
clearInterval(highlighting)
}

/*
Image Thumbnail Viewer All */

var ie=document.all
var ns6=document.getElementById&&!document.all

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body
}

function enlarge(which, e, position, imgwidth, imgheight){
if (ie||ns6){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
if (position=="center"){
pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
horzpos=ns6? pageXOffset+window.innerWidth/2-imgwidth/2 : ietruebody().scrollLeft+ietruebody().clientWidth/2-imgwidth/2
vertpos=ns6? pgyoffset+window.innerHeight/2-imgheight/2 : pgyoffset+ietruebody().clientHeight/2-imgheight/2
if (window.opera && window.innerHeight) //compensate for Opera toolbar
vertpos=pgyoffset+window.innerHeight/2-imgheight/2
vertpos=Math.max(pgyoffset, vertpos)
}
else{
var horzpos=ns6? pageXOffset+e.clientX : ietruebody().scrollLeft+event.clientX
var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY
}
horzpos = horzpos -200
vertpos = vertpos -200;
crossobj.style.left=horzpos+"px"
crossobj.style.top=vertpos+"px"

//crossobj.style.left=200+"px"
//crossobj.style.top=70+"px"

crossobj.innerHTML='<div align="right" id="dragbar"><span id="closetext" onClick="closepreview()">Zamknij</span> </div><img src="'+which+'">'
crossobj.style.visibility="visible"
return false
}
else //if NOT IE 4+ or NS 6+, simply display image in full browser window
return true
}

function closepreview(){
crossobj.style.visibility="hidden"
}

function drag_drop(e){
if (ie&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx+"px"
crossobj.style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
}
return false
}

function initializedrag(e){
if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){
offsetx=ie? event.clientX : e.clientX
offsety=ie? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}

document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")


