// JavaScript Document
$(document).ready(function(){

	//cień, poświata
  $('#menu .element:hover, .element.hover, #menu .element:hover a').textShadow();


	//naprawiacz png
  $.ifixpng('libray/pixel.gif'); 
  $('div#solar').ifixpng();
  //$('div.blok').ifixpng();
  
  	//fotki w galerii rozjaśnianie
  $('.zdjecie').hover(function(){
		$(this).css('opacity', 1);
	},function(){
		$(this).css('opacity', 0.7);
	});
  $('.zdjecie').css('opacity', 0.7);
 
  $('.zdjecia a').lightBox(); 
  
  
 

})


//opuźniacz

var menu_hover_old_onload = window.onload ? window.onload : function() {};

var menu_hover_current = null;
var menu_hover_timeout = null;

function menu_hover_change(dest)
{
  if (menu_hover_timeout) {
    clearTimeout(menu_hover_timeout);
    menu_hover_timeout = null;
  }
  if (menu_hover_current == dest) return;
  if (menu_hover_current) {
    menu_hover_current.className = menu_hover_current.className.replace(" hover", "");
  }
  if (dest) {
    dest.className += " hover";
  }
  menu_hover_current = dest;
}

function menu_hover_onload()
{
  if (!document.getElementById) return;
  
  var menu = document.getElementById("menu");
  var children = menu.childNodes;
  for (var i = 0; i < children.length; i++) {
    var node = children[i];
    if (node.className && node.className.indexOf("element") != -1) {
      var old_onmouseover = node.onmouseover ? node.onmouseover : function() {};
      node.onmouseover = function() {
        old_onmouseover();
        menu_hover_change(this);
      }

      var old_onmouseout = node.onmouseout ? node.onmouseout : function() {};
      node.onmouseout = function() {
        old_onmouseout();
        if (menu_hover_timeout) clearTimeout(menu_hover_timeout);
        menu_hover_timeout = setTimeout('menu_hover_change(null);', 1000);
      }
    }
  }
}

window.onload = function() {
  menu_hover_onload();
  menu_hover_old_onload();
}


