
// Preload images
jQuery.preloadImages = function() {
	for(var i = 0; i<arguments.length; i++)	{
		jQuery("<img>").attr("src", arguments[i]);
	}
}

$(document).ready(function () {
	$('#jqmWindow').jqm({ajax: '/galerie/hra/standalone/index.html', trigger: 'a.modal'});

	// Search button & input field show/hide
	$("#searchForm").hover(function() {
		$("#queryAndWords").show(); $("#searchSubmit").show();
	}, function() {
		$("#queryAndWords").hide(); $("#searchSubmit").hide();
	});

	// Animation of homepage news boxes
	$('#newsBox1, #newsBox2, #newsBox3').hover(function() {	
			$(this).animate({ bottom: 0 }, 'fast');
		}, function() {
			$(this).animate({ bottom: -98 }, 'fast');
	});

	// Print link
	$('#printLink').click(function() {
		window.open(this.href);
		return false;
	});
	
	// Images mouseover
	$.preloadImages(
		"/_pub/db/a2/b2/162200_277893_sub_hra_over.png",
		"/_pub/14/c7/64/150262_277852_sub_hra.png",
		"/_pub/39/b5/79/162219_278136_btn_signEmail_over.gif",
		"/_pub/3a/d7/2e/139263_248303_btn_signEmail.gif",
		"/_pub/9e/8b/2e/162221_278139_btn_search_over.gif",
		"/_pub/84/ed/7b/140337_251852_btn_search.gif"
	);
	
	$("#btn_150260").hover(function() {
		$("#img_150260").attr("src", "/_pub/db/a2/b2/162200_277893_sub_hra_over.png");
	}, function() {
		$("#img_150260").attr("src", "/_pub/14/c7/64/150262_277852_sub_hra.png");
	});
	
	$("#btn_172395").hover(function() {
		$("#img_172395").attr("src", "/_pub/d8/61/aa/169511_313258_sub_hra_en_over.gif");
	}, function() {
		$("#img_172395").attr("src", "/_pub/a4/e1/f4/157010_313256_sub_hra_en.gif");
	});
	
	$("#submitEmail").hover(function() {
		$(this).attr("src", "/_pub/39/b5/79/162219_278136_btn_signEmail_over.gif");
	}, function() {
		$(this).attr("src", "/_pub/3a/d7/2e/139263_248303_btn_signEmail.gif");
	});
	
	$("#submitEmail_en").hover(function() {
		$(this).attr("src", "/_pub/8e/1/0/172397_332030_nadace_signup.jpg");
	}, function() {
		$(this).attr("src", "/_pub/9c/38/ab/150936_257792_btn_sign_up.gif");
	});
	
	$("#searchSubmit input").hover(function() {
		$(this).attr("src", "/_pub/9e/8b/2e/162221_278139_btn_search_over.gif");
	}, function() {
		$(this).attr("src", "/_pub/84/ed/7b/140337_251852_btn_search.gif");
	});

});
