$(window).bind('load', function() {
    var preload = new Array();
    $(".hover").each(function() {
        s = $(this).attr("src").replace(/\.(.+)$/i, "_on.$1");
        preload.push(s)
    });
    var img = document.createElement('img');
    $(img).bind('load', function() {
        if(preload[0]) {
            this.src = preload.shift();
        }
    }).trigger('load');
});

$(document).ready(function() {

    $('.email').each(function() {
	var $email = $(this);
	var address = "mengo[joghurt]t-online[kiscica]hu"
	.replace(/\s*\[joghurt\]\s*/, '@')
        .replace(/\s*\[kiscica\]\s*/g, '.');
	$email.html('<a href="mailto:' + address + '">'
	    + address +'</a>').css("direction","ltr");
	});
   
    $(".hover").each(function() {
        if ($(this).attr("src").match(/_on\.(.+)$/i)) {
            $(this).removeClass("hover");
        }
    });

    $(".hover").hover(function() {
        s = $(this).attr("src").replace(/\.(.+)$/i, "_on.$1");
        $(this).attr("src", s);
    }, function() {
        s = $(this).attr("src").replace(/_on\.(.+)$/i, ".$1");
        $(this).attr("src", s);
    });

    if ($.browser.msie) {

	//~ IE rounded corner
	$(".box").corner();
	$("#nav").corner("bottom 8px");
	
    };

	    //~ imageLoading: '/images/lightbox-ico-loading.gif',
	    //~ imageBtnClose: '/images/lightbox-btn-close.gif',
	    //~ imageBtnPrev: '/images/lightbox-btn-prev.gif',
	    //~ imageBtnNext: '/images/lightbox-btn-next.gif'	    
	//~ Lightbox
    $(".gallery").ceebox({
	videoRatio: "4:3",
    });
    
    $(".bigimage").ceebox({
	videoRatio: "4:3",
    });
    
    $(".lotpictures").ceebox({
	videoRatio: "4:3",
    });
	
});

