function preloadImages() { //v3.0
  var d=document; 
  if(d.images) {
    if(!d.pI)
      d.pI=new Array();
    var i,j=d.pI.length,a=preloadImages.arguments;
    for(i=0; i<a.length; i++)
      if (a[i].indexOf("#")!=0) {
        d.pI[j]=new Image; d.pI[j++].src=a[i];
      }
  }
}

$(document).ready(function(){
    preloadImages(
			'/misc/menu_news_hover.jpg',
			'/misc/menu_gallery_hover.jpg',
			'/misc/menu_contact_hover.jpg',
			'/misc/menu_shop_hover.jpg'
		);
/*
  $("a.lightbox>img, a.hover>img").hover(
		function(){
			var src = $(this).attr('src');
			if (src.indexOf('thumbnails_hover') < 0)
				$(this).attr('src', src.replace(/thumbnails/, 'thumbnails_hover'));
		},
		function(){
			var src = $(this).attr('src');
			if (src.indexOf('thumbnails_hover') >= 0)
				$(this).attr('src', src.replace(/thumbnails_hover/, 'thumbnails'));
		}
	).each(function(){
		var src = $(this).attr('src');
		if (src.indexOf('thumbnails_hover') < 0)
			preloadImages( src.replace(/thumbnails/, 'thumbnails_hover') );
	});
*/
	$(document).mousemove(function(eventObject){
		var Y = eventObject.pageY-3;
		var Margin = 20;
	    $(this).find('div.scroll').each(function(){
			var maxHeight = $(this).attr("scrollHeight") - $(this).height();
			var tY = (Y - 300 - Margin) / ($(this).height()-2.5*Margin) * maxHeight;
			$(this).scrollTop(tY);
		});
	});

	$("ul#menu").menu_horizontal({
		delay: 300, // várakozás elrejtésig
		appendText: '', // aminek van almenüje annak a szövege evvel bűvül (később kép is megadható lesz)
		showAnimation: {height: 'show'}, // a megjelenítés animációja
		hideAnimation: {opacity: 'hide'}, // az elrejtés animációja
		speed: 'fast', // elrejtés/megjelenítés sebessége
		onTitleID: 'status' // ha van ilyen id-jű elem a dokumentumban, akkor abba belecsórja a link title tartalmát
	});
	$("ul#menu>li:has(ul)>a").click(function(){
		return false;
	});
  
  
  function resizeContent() {
    var dHeight = $(window).height() - $('#body').height();
    if (dHeight > 0) {
      $('#body').height($(window).height());
      $('#content').height($('#content').height() + dHeight);
      //$('.scroll').height($('.scroll').height() + dHeight);
    }
  }
  $(window).load(function(){
    resizeContent();
  });
  $(window).resize(function(){resizeContent()});

});

