
$(document).ready(init);

function init()
{
	$('#menu img').each(function()
	{
		this.srcOrig = this.src;
		this.srcOver = this.src.replace('/menu/', '/menu-over/');
		var img = new Image();
		img.src = this.srcOver; 
	}).mouseover(function()
	{
		this.src = this.srcOver;
	}).mouseout(function()
	{
		this.src = this.srcOrig;
	});
  
	$('.over').each(function()
	{
		this.srcOrig = this.src;
		this.srcOver = this.src.replace(/\.([^.]*)$/,'-over.$1');
		var img = new Image();
		img.src = this.srcOver; 
	}).mouseover(function()
	{
		this.src = this.srcOver;
	}).mouseout(function()
	{
		this.src = this.srcOrig;
	});


	var subMenuHideTo = new Array();

	var subMenuId = 0;
	
	$('#menu > a').each(function()
	{		
		if ( $(this).next().hasClass('menu-sub') )
		{
			subMenuId++;
			var this2 = this;
			$(this).add($(this).next()).mouseover(function()
			{
				clearTimeout(subMenuHideTo[this2]);
				
				if ( $(this).prev().hasClass('menu_dropdown') )
				{
					//podmiana src na over
				}

				$(this2).next().attr('id','subMenuId'+subMenuId).show();
			}).mouseout(function()
			{
				var el = $(this2).next();
				subMenuHideTo[this2] = setTimeout(function()
				{
					//zmiana src obrazka na orig
					el.hide();
				}, 20);
			});
		}
	});
	
	
  
  
  $('a[rel=lightbox]').lightbox();
}
