﻿$(document).ready(function() {

	if($.browser.msie) { 
	    $("#menu > div").css("left", "1px");
	}
	if($.browser.safari) {
	    $("#menu > div").css("left", "2px");
	}
	
	$("#menu > div").hover(
		function() {
			$(this).find("img").attr("src", $(this).find("img").attr("src").replace(".png", "b.png"));
		}, function() {
			$(this).find("img").attr("src", $(this).find("img").attr("src").replace("b.png", ".png"));
		}
	);
	
	$("#text").jScrollPane({showArrows:true, maintainPosition: true, scrollbarWidth: 17});
	$("#hgallery > .left").click(function() {
		$("#pics > div:first").animate({
			marginLeft: -112
		}, 500, "easeInOutQuint", function() {
			$("#pics").append("<div>" + $("#pics > div:first").html() + "</div>");
			$("#pics > div:first").remove();
		});
		$(".gal").lightbox();
	});
	
	$("#hgallery > .right").click(function() {
		$("#pics > div:first").before("<div>" + $("#pics > div:last").html() + "</div>");
		$("#pics > div:first").css("margin-left", -112);
		$("#pics > div:last").remove();
		$("#pics > div:first").animate({
			marginLeft: 0
		}, 500, "easeInOutQuint", function() {

		});
		$(".gal").lightbox();
	});
	
	$('#tgallery').cycle({fx: 'fade', random: 1});
	
	$(".gal").lightbox();
	
	$(".date").datepicker();
	
	$(".send").click(function() {
	    var i = 0;
	    $("input").each(function() {
		if($(this).val() == '') {
		    i = 1;
		}
	    });
	    if(i == 1) alert('Kérem töltsön ki minden mezõt!');
	    else {
		alert('Köszönjük levelét! Munkatársunk hamarosan felveszi Önnel a kapcsolatot!');
		$("#form").submit();
	    }
	});
	
	$("input").attr("autocomplete", "off");

	$("#logo").click(function() {
	    window.location = '/';
	});
	
});