$(document).ready(function() {
	$("#appMessageClose").click(function () {
		$("#appMessage").fadeOut(500, function () {
	    	$("#appMessage").remove();
	  	});
	});
	
	
	
	
	$("#Messages").fadeOut(3500, function () {
	   	$("#Messages").remove();
	});
	
	$(".shopListTrigger").css("cursor", "hand");
	
	$(".shopListTrigger").toggle(function(){
	 
	  $(this).next().slideDown('slow'); 
	  
	},function(){
	  $(this).next().slideUp('slow'); 
	});
	
	
	$(".callEvent").hover(function(){
	  $(this).next().slideDown('slow'); 
	  
	},function(){
	  $(this).next().slideUp('slow'); 
	});
	
	
	$("font").css("font-size","12px");
	
	$(".lm").hover(
		function(){
			$(this).attr("src", $(this).attr("src").replace('.png','_1.png'));
		},
		function(){
			$(this).attr("src", $(this).attr("src").replace('_1.png','.png'));
		}
	);
	
	if( captchaError == 1 ){
		showCaptcha(1);
	}
})
function getgoing()
 {
    top.location="/";
 }
function getprofile()
{
	top.location="/profil.html";
}

function showCaptcha(error)
{
	document.body.scrollTop = 0;
	var root = document.getElementsByTagName('body')[0];
	$(root).prepend('<div id="blanker"><span id="captcha">'+
					'<br /><br /><span id="captcha_title">Przepisz tekst z obrazka</span><br /><br />'+
					'<img src="http://www.wzorcowniawloclawek.com/captcha.php" /><br /><br />'+
					'<input type="text" id="captcha_text"/><br /><br />'+
					((error==1)?'<span class="captcha_error">Błędny kod</span><br /><br />':'')+
					'<input type="button" onclick="postCaptcha();" value="Wyślij"/><br />'+
					'</div></div>');
	$('#blanker').height($(document).height());
	$('#captcha').css('margin-left',Math.round($(document).width()-$('#captcha').width())/2);
	
	if( error ){
		for( var i in selectedValues ){
			if( i[0] == 'q' ){
				document.getElementById(i).checked = true;
			}
		}
	}
}

function postCaptcha(){
	$('#ankieta').append('<input type="hidden" name="captcha" value="'+
			$('#captcha_text').attr('value')
			+'" />'
		);
	document.ankieta.submit();
}