$(document).ready(function(){
	
	$('.error').hide();
	
	
	
	$('#flash').flash({
	    src: '/wp-content/themes/essencia/flash/magyar-cukor.swf',
	    width: 290,
	    height: 180
	});



	$("a[rel^='prettyPhoto']").prettyPhoto({
		animationSpeed: 'normal', /* fast/slow/normal */
		padding: 40, /* padding for each side of the picture */
		opacity: 0.35, /* Value betwee 0 and 1 */
		showTitle: true, /* true/false */
		allowresize: true, /* true/false */
		counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
		theme: 'light_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
		callback: function(){}
	});



    $('#sendit').click(function() {
    
    	if ($('#contactform #email').val() == "") {
    	
    		$('#error-email').show(200);
    		
    		return false;
    	
    	} else {
    
	    	var messageData = $('form').serialize();
	    	
	     	$('#contactform').html('<div id="loading">Küldés...</div>');
		
			$.ajax({  
				type: "POST",  
				url: "/wp-content/themes/essencia/send.php",  
				data: messageData,  
				success: function(response) {
					$('#contactform').html(response);		 
				},
				error: function() {
					$('#contactform').html('<div id="loading">Hiba történt, kérjük próbálja meg később!</div>');
				}
			});    	
	    
		    return false;
	    
	    } 
    
    });
    
    
    
    if ($('#apply').is(':checked')) {
		$('.hiddenforquestion').show(300);    
    } else {
    	$('.hiddenforquestion').hide(300);
    }
    
    
    
    $('#apply').click(function() {
       	$('.hiddenforquestion').show(300);
    });
    
    
    
    $('#just-contact').click(function() {
       	$('.hiddenforquestion').hide(300);
    });
       	
});