$(document).ready(function() { 
    //$("div.text").scrollable({size: 1, loop: true, next: 'a.nextbtn', prev: 'a.prevbtn'}).circular();
	
	$(".gallery a").lightBox();
	
	
	for (var i=0; i<20; i++)
	{
		$("a", $(".igal" + i)).lightBox({fixedNavigation:true});
		//$("a:gt(0)", $(".igal" + i)).hide();
	}
	
	function switchText()
	{
		if ($(this).val() == $(this).attr('title'))
			$(this).val('');
		else if ($.trim($(this).val()) == '')
			$(this).val($(this).attr('title'));
	}
	
	$('input[type=text][title!=""]').each(function() {
		if ($.trim($(this).val()) == '') $(this).val($(this).attr('title'));
		if ($(this).val() == $(this).attr('title')) $(this).addClass('inputemail');
	}).focus(switchText).blur(switchText);
	
	
		
	$("#poptavka").submit(function(){
		var str = $(this).serialize();
		$.ajax({
		type: "POST",
		url: "http://" + window.location.hostname + "/" + "content/poptavka.php",
		data: str,
		success: function(msg){
			$(".writeus").ajaxComplete(function(event, request, settings){
		
				if(msg == '1')
				{
					result = '<strong class="msg_ok">Zpráva byla odeslána.</strong>';
					$(".fadeform").slideUp(700);
				}
				else
				{
					//result = msg;
					$(".fadeform").slideUp(500);
					result = '<strong class="msg_false">Zprávu se nepodařilo odeslat! Zkuste akci opakovat později.</strong>';
				}
				$(".writeus").html(result);
			});
		}
		});
		return false;
	});
	
});
