//Create Flash

function createFlash(movie, wdth, hght, bgnd, idName, cel, fVars) {
       obj_setFlash = document.getElementById(cel);
       objTag = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='"+wdth+"' height='"+hght+"' id='"+idName+"'>";
       objTag2 = "<object data='"+movie+"' type='application/x-shockwave-flash' width='"+wdth+"' height='"+hght+"' id='"+idName+"'>";
       paramTag = "<param name='movie' value='"+movie+"' /><param name='bgcolor' value='"+bgnd+"' /><param name='quality' value='high' /><param name='menu' value='false' /><param name='FlashVars' value='"+fVars+"' /></object>";
       if (typeof HTMLElement != "undefined") {
              obj = document.createElement("object");
              obj.setAttribute("data", movie);
              obj.setAttribute("type", "application/x-shockwave-flash");
              obj.setAttribute("width", wdth);
              obj.setAttribute("height", hght);
              obj.setAttribute("id", idName);
              par = document.createElement("param");
              par.setAttribute("name", "quality");
              par.setAttribute("value", "high");
              obj.appendChild(par);
              par = document.createElement("param");
              par.setAttribute("name", "wmode");
              par.setAttribute("value", "transparent");
              obj.appendChild(par);
              par = document.createElement("param");
              par.setAttribute("name", "bgcolor");
              par.setAttribute("value", bgnd);
              obj.appendChild(par);
              par = document.createElement("param");
              par.setAttribute("name", "menu");
              par.setAttribute("value", "false");
              obj.appendChild(par);
              par = document.createElement("param");
              par.setAttribute("name", "FlashVars");
              par.setAttribute("value", fVars);
              obj.appendChild(par);
              par = document.createElement("param");
              par.setAttribute("name", "pluginspage");
              par.setAttribute("value", "http://www.macromedia.com/go/getflashplayer");
              obj.appendChild(par);
              obj_setFlash.appendChild(obj);
       } else {
              obj_setFlash.insertAdjacentHTML('beforeEnd',objTag+paramTag);
       }
}

//OnMouseOver
browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion);

if(browser_name == "Netscape" && browser_version >= 3.0) {
  version = "ok";
}
else if (browser_name == "Microsoft Internet Explorer" && browser_version >= 3.0) {
  version = "ok";
}
else if (browser_name == "Opera" && browser_version >= 6.0) {
  version = "ok";
}
else {
  version = "bad";
}


if (version == "ok") {

 wstepon = new Image();
 wstepon.src="images/shared/wstep1.gif";
 wstepoff = new Image();
 wstepoff.src="images/shared/wstep.gif";
 
 historiaon = new Image();
 historiaon.src="images/shared/historia1.gif";
 historiaoff = new Image();
 historiaoff.src="images/shared/historia.gif";

 etapyon = new Image();
 etapyon.src="images/shared/etapy-przebudowy1.gif";
 etapyoff = new Image();
 etapyoff.src="images/shared/etapy-przebudowy.gif";
 
 etap1on = new Image();
 etap1on.src="images/shared/etap11.gif";
 etap1off = new Image();
 etap1off.src="images/shared/etap1.gif";
 
 kontakton = new Image();
 kontakton.src="images/shared/kontakt1.gif";
 kontaktoff = new Image();
 kontaktoff.src="images/shared/kontakt.gif";
 
 etap2on = new Image();
 etap2on.src="images/shared/etap21.gif";
 etap2off = new Image();
 etap2off.src="images/shared/etap2.gif";

 etap3on = new Image();
 etap3on.src="images/shared/etap31.gif";
 etap3off = new Image();
 etap3off.src="images/shared/etap3.gif";
 
 opinieon = new Image();
 opinieon.src="images/shared/przeslij-opinie1.gif";
 opinieoff = new Image();
 opinieoff.src="images/shared/przeslij-opinie.gif";
 
 homeon = new Image();
 homeon.src="images/shared/home1.gif";
 homeoff = new Image();
 homeoff.src="images/shared/home.gif";
 
 portalon = new Image();
 portalon.src="images/index/portal-miejski-ruda-slaska1.gif";
 portaloff = new Image();
 portaloff.src="images/index/portal-miejski-ruda-slaska.gif";
 
 urzadon = new Image();
 urzadon.src="images/index/urzad-miasta-ruda-slaska1.gif";
 urzadoff = new Image();
 urzadoff.src="images/index/urzad-miasta-ruda-slaska.gif";
 
 dziennikon = new Image();
 dziennikon.src="images/shared/dziennik-budowy1.gif";
 dziennikoff = new Image();
 dziennikoff.src="images/shared/dziennik-budowy.gif";
 

 function imgact(imgName) {
   if (version == "ok")
   {
     imgOn = eval(imgName + "on.src");
     document [imgName].src = imgOn;
   }
 }


 function imgnoact(imgName) {
   if (version == "ok")
   {
     imgOff = eval(imgName + "off.src");
     document [imgName].src = imgOff;
   }
 }

}


//Otwórz okno z flashem
function flash(URL,szer,wys) {
  nowe_okno=window.open("","_blank","toolbar=no,status=no,menu=no,scrollbars,resizable,width="+(szer+20)+",height="+wys+",top=30,left=30");
  nowe_okno.document.open();
  nowe_okno.document.writeln('<BODY topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>');
  nowe_okno.document.writeln('<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0 height='+wys+' width='+szer+' classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>');
  nowe_okno.document.writeln('<PARAM NAME="Movie" VALUE="'+URL+'">');
  nowe_okno.document.writeln('<PARAM NAME="Src" VALUE="'+URL+'">');
  nowe_okno.document.writeln('<PARAM NAME="Play" VALUE="-1">');
  nowe_okno.document.writeln('<PARAM NAME="Loop" VALUE="-1">');
  nowe_okno.document.writeln('<PARAM NAME="Quality" VALUE="High">');
  nowe_okno.document.writeln('<embed src="'+URL+'" type="application/x-shockwave-flash" width="'+szer+'" height="'+wys+'" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" quality="best" play="true">');
  nowe_okno.document.writeln('</OBJECT>');
  nowe_okno.document.writeln('</BODY>');
  nowe_okno.document.close();
}

//Otwórz okno ze zdjeciem
function zdjecie(URL,w,h) {
  obrazek = new Image();
  obrazek.src = URL;
  if(w>screen.width-50) w=screen.width-50;
  if(h>screen.height-50) h=screen.height-50;
  wo=screen.width-50;
  ho=screen.height-50;
  t=parseInt((screen.height-h)/2);
  l=parseInt((screen.width-w)/2);
  //Pętla opóźnaijąca
  nowe_okno=window.open("","_blank","toolbar=no,status=no,menu=no,scrollbars,resizable,width="+w+",height="+h+",top="+t+",left="+l);
  nowe_okno.document.open();
  nowe_okno.document.writeln('<SCRIPT language=Javascript>');
  nowe_okno.document.writeln('function wymiary() { ');
  nowe_okno.document.writeln('wz=document.zdjecie.width+30; hz=document.zdjecie.height+30; if(wz>'+wo+') wz='+wo+'; if(hz>'+ho+') hz='+ho+';');
  nowe_okno.document.writeln('window.resizeTo(wz,hz);');
  nowe_okno.document.writeln('}');
  nowe_okno.document.writeln('</SCRIPT>');
  nowe_okno.document.writeln('<BODY topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 onLoad="wymiary()">');
  nowe_okno.document.writeln('<A href="javascript:window.close()"><IMG src='+URL+' alt="Kliknij aby zamknąć" border=0 name=zdjecie></A>');
  nowe_okno.document.writeln('</BODY>');
  nowe_okno.document.close();
}

//Otwórz okno ze zdjeciem
function zdjecie_blank(URL,w,h) {
  obrazek = new Image();
  obrazek.src = URL;
  if(w>screen.width-50) w=screen.width-50;
  if(h>screen.height-50) h=screen.height-50;
  wo=screen.width-50;
  ho=screen.height-50;
  t=parseInt((screen.height-h)/2);
  l=parseInt((screen.width-w)/2);
  //Pętla opóźnaijąca
  nowe_okno=window.open("","_blank","toolbar=no,status=no,menu=no,scrollbars=no,resizable=no,width="+w+",height="+h+",top="+t+",left="+l);
  nowe_okno.document.open();
  nowe_okno.document.writeln('<SCRIPT language=Javascript>');
  nowe_okno.document.writeln('function wymiary() { ');
  nowe_okno.document.writeln('wz=document.zdjecie.width+30; hz=document.zdjecie.height+30; if(wz>'+wo+') wz='+wo+'; if(hz>'+ho+') hz='+ho+';');
  nowe_okno.document.writeln('window.resizeTo(wz,hz);');
  nowe_okno.document.writeln('}');
  nowe_okno.document.writeln('</SCRIPT>');
  nowe_okno.document.writeln('<BODY topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 onLoad="wymiary()">');
  nowe_okno.document.writeln('<A href="javascript:window.close()"><IMG src='+URL+' alt="Kliknij aby zamknąć" border=0 name=zdjecie></A>');
  nowe_okno.document.writeln('</BODY>');
  nowe_okno.document.close();
}

//Otwórz okno z dokumentem (określ rozmiary)
function okno(URL,szer,wys) {
  nowe_okno=window.open(URL,"_blank","toolbar=no,status=no,menus=no,scrollbars,location=no,resizable,width="+szer+",height="+wys+",top=30,left=30");
  return;
}

//Otwórz okno z dokumentem (zasymuluj target=_blank)
function url(URL) {
  nowe_okno=window.open(URL,"_blank","toolbar,location,status,menubar,scrollbars,resizable,top=30,left=30,width=675,height=450");
  return;
}

function okno_blank(URL,szer,wys) {
  nowe_okno=window.open(URL,"_blank","toolbar=no,status=no,menus=no,scrollbars=no,resizable,width="+szer+",height="+wys+",top=30,left=30");
  return;
}
