$(document).ready(function(){

	renderTexts();
	
	// external links hack
	$('a.lnkExternal').click( function(){	window.open(this.href,'_blank'); return false;});
	
	// links outline hack 
	$("a, label, input[type='submit'], input[type='checkbox'], input[type='radio']").bind('focus',function(){if(this.blur)this.blur();});
	// pointer on submit buttons
	$("input[type='submit']").css('cursor', 'pointer');
	
	$('#btnSearch').click(function(e){
		e.preventDefault();
		goSearch();
	});

	$('#sSearch').keypress(function(e) {
	    if(e.keyCode == 13) {
			e.preventDefault();
			goSearch();
	    }
	});
	
});

function sendForm(sFormID){
	$('#'+sFormID).submit();
}

function goSearch(){
	
	if($('#sSearch').val().length < 3) return false;
	window.location.href=sLang+',szukaj,'+$('#sSearch').val()+'.html';

}

function renderTexts(sConId) {
	
	sConPrefix = '';
	if(sConId) sConPrefix = '#'+sConId+' ';
	
	Cufon.replace(sConPrefix+'.lnkToCufon', {
		fontFamily: 'Franklin Gothic Medium',
		hover: true
	});
	
	Cufon.replace(sConPrefix+'.txtToCufon', {
		fontFamily: 'Franklin Gothic Medium'
	});
}

function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}
