/* slider-config */
var slider01_config = {
		speed: 1000,
		interval: 5000,
		next_speed: 200,
		prev_speed: 200,
		image_speed: 100};
		
$(document).ready(function(){
	/* box-hover index */
	$(".box").hover(function(){
		$(this).addClass("box-hover");
	},function(){
		$(this).removeClass("box-hover");
	});
	
	/* stripovane tabulky*/
	$("table tr:even").addClass("strippedRow");
	
	//form
	function scan(){
	$('.contact-form form div').each(function(index){
	    var txt = $(this).find("input").attr("value");
	    if (txt != ''){$(this).find("label").hide();}
	  });
	}
	scan();

	$(".contact-form form div").click(function(){
		$(this).find("label").hide();
		$(this).find("input").focus();
		scan();
	});
	
	$('.contact-form form div input').focusin(function() {
	  	$(this).parent().find("label").hide();
	  	scan();
	});
	$('.contact-form form div input').focusout(function() {
	  	$(this).parent().find("label").show();
	  	scan();
	});
	
	
	//form
	$(".verify").attr("value","verified");
	
	$(".contact-form1").bind('submit',function(){
			
		$(".verify").attr("value","verified2");	
			
		var insert_post = $(this).serialize(); //metoda serialize vytvoří post z aktuálního formuláře
		insert_post += '&submitted=1'; //kpostu přilepím potvrzovací hodnotu
		$.post($(this).attr('action'),insert_post, function(data) { // Ajax volá url které je jako ACTION ve FORMU a vrací data
			
			var jdata = eval("(" + data + ")");
				
			if (jdata.status == 'true'){//vykonají se funkce dle návratových dat
				window.location.href=jdata.url;
				
			}
			else{

				$('.error_message').attr('style','');
				
			};
		});
		return false;
	});
	
});
