$(document).ready(function (){
	$('#search-val').focus(function (){
		$(this).addClass("has-focus");
	})
	
	$('#search-val').blur(function (){
		$(this).removeClass("has-focus");
	});	
	
	$('#search-submit').click(function(){
		if($('#search-val').val() != '') {
			document.location = appDomain+'szukaj/'+encodeURIComponent($('#search-val').val())+'/?s='+encodeURIComponent($('#search-val').val());
		}
	});	
	$(document).bind('keypress', function(e) {
		var code = (e.keyCode ? e.keyCode : e.which);
		if(code == '13') {
			if($('#search-val').val() != '' && ($('#search-val').is(".has-focus"))) {
				document.location = appDomain+'szukaj/'+encodeURIComponent($('#search-val').val())+'/?s='+encodeURIComponent($('#search-val').val());
			}
		}
	});
});