/*
 * Funkca obługująca hover na menu głównym
 */
function ChangeStyle(id, styleName) {		
	document.getElementById(id).className = styleName;
}

/*
 * Powiększenia zdjęć
 */
newWindow = null;

function ShowFoto(path, fotoWidth, fotoHeight) {

  if (window.screen) {
  
    _width = screen.availWidth;
    _height = screen.availHeight;
  } else {
  
    _width = 640;
    _height = 450;
  }

  if (newWindow==null || newWindow.closed) {
  
     settings =
     
     "left=" + (_width-fotoWidth)/2 + ","
     + "top=" + (_height-fotoHeight)/2 + ","
     + "screenX=" + (_width-fotoWidth)/2 + ","
     + "screenY=" + (_height-fotoHeight)/2 + ","
     + "width=" + fotoWidth + ","
     + "height=" + fotoHeight + ","
     + "innerWidth=" + fotoWidth + ","
     + "innerHeight=" + fotoHeight + ","
     + "toolbar=no,"
     + "location=no,"
     + "directories=no,"
     + "status=yes,"
     + "menubar=no,"
     + "scrollbars=no,"
     + "resizable=no";
     
     newWindow = window.open("",'Galeria',settings);
  }

  newWindow.document.open();
  newWindow.document.clear();
  
  newWindow.document.write(
    "<html><head><title>Tropheus</title>\n"
    + "<base href=\"" + base_href + "\" /></head><body>\n"
    + "<div style='position:absolute; left:0; top:0;'>"
    + "<a href='javascript:window.close()'><img src=\""+ path +"\" width=\"" + fotoWidth + "\" height=\"" + fotoHeight + "\"  alt=\" zamknij \" border=\"0\"></a>"
    + "</div>\n"
    + "</body></html>"
  );

  newWindow.document.close();
  newWindow.focus();
}

/*
 * Wyśiwtlanie stron w popup-ie
 */
function ShowPopup(src, w, h){

  if (window.screen) {
    aw=screen.availWidth;
    ah=screen.availHeight;
  } else {
    aw=640;
    ah=450;
  }

  ustawienia=
   "left=" + (aw-w)/2 + ","
   +"top=" + (ah-h)/2 + ","
   +"screenX=" + (aw-w)/2 + ","
   +"screenY=" + (ah-h)/2 + ","
   +"width=" + w + ","
   +"height=" + h + ","
   +"innerWidth=" + w + ","
   +"innerHeight=" + h + ","
   +"toolbar=no,"
   +"location=no,"
   +"directories=no,"
   +"status=yes,"
   +"menubar=no,"
   +"scrollbars=no,"
   +"resizable=no"
   window.open(src,'obrazek',ustawienia);
}

function getCookieData(nameLabel){
        var labelLength=nameLabel.length;
        var cookieData=document.cookie;
        var cLen=cookieData.length;
        var i=0;
        var cEnd=-1;
        while (i<cLen){
                var j=i+labelLength;
                if (cookieData.substring(i,j)==nameLabel){
                        cEnd=cookieData.indexOf(";",j);
                        if (cEnd==-1){
                                cEnd=cookieData.length;
                        }
                        return unescape(cookieData.substring(j+1,cEnd));
                }
                i++;
        }
        return " ";
}