base = $('base').attr('href');
function swapSearchBox (id) {	$('#search-content').fadeOut('fast', function() {		html = 	$('#search-'+id).html();		$('#search-content').html(html);		$('#search-content').fadeIn('fast', function(){			bindSearchActions(id);		});	});}function bindSearchActions(id) {	if (id == 1) {		$('.submit-1').click(function(){			submit1();		});		$("#company-desc").focus(function(){			if($("#company-desc").val() == 'wszystkie firmy')				$("#company-desc").val('');		});				$("#company-desc").blur(function(){			if($("#company-desc").val() == '')				$("#company-desc").val('wszystkie firmy');							});					$('.submit-2').unbind('click');		$('.submit-3').unbind('click');	}	else if (id == 2) {		$('.submit-1').unbind('click');		$('.submit-2').click(function(){			submit2();		});		$('.submit-3').unbind('click');	}		else if (id == 3) {		$('.submit-1').unbind('click');		$('.submit-2').unbind('click');		$('.submit-3').click(function(){			submit3();		});	}	}function submit1(){	if($("#company-desc").val() == 'wszystkie firmy')		$("#company-desc").val('');		desc = $('#company-desc').val();	region = $('#company-region').val();		branch = $('#company-branch').val();		/*if(desc == '') {		alert('Wpisz fragment opisu ogłoszenia!');		$('#company-desc').focus();	}	else if(region == '') {		alert('Wybierz województwo!');		$('#company-region').focus();	}	else if(branch == '') {		alert('Wybierz województwo!');		$('#company-branch').focus();	}	else {*/		//szukaj,wykonawcy,opis,region,branza,miasto,sortuj,hits,strona.html		document.location = base+'szukaj,wykonawcy,'+desc+','+region+','+branch+',,,1,html?szukaj='+desc;	/*}*/}function submit2(){	desc = $('#prof-desc').val();	region = $('#prof-region').val();		branch = $('#prof-branch').val();		/*if(desc == '') {		alert('Wpisz fragment opisu ogłoszenia!');		$('#prof-desc').focus();	}	else if(region == '') {		alert('Wybierz województwo!');		$('#prof-region').focus();	}	else if(branch == '') {		alert('Wybierz województwo!');		$('#prof-branch').focus();	}	else {*/		//szukaj,szukam-fachowca,opis,region,branza,miasto,sortuj,hits,strona.html		document.location = base+'szukaj,szukam-fachowca,'+desc+','+region+','+branch+',,,,1,html';	/*}*/}function submit3(){	desc = $('#tempjob-desc').val();	region = $('#tempjob-region').val();		/*if(desc == '') {		alert('Wpisz fragment opisu ogłoszenia!');		$('#tempjob-desc').focus();	}	else if(region == '') {		alert('Wybierz województwo!');		$('#tempjob-region').focus();	}	else {*/		//szukaj,praca-tymczasowa,opis,region,miasto,sortuj,hits,strona.html		document.location = base+'szukaj,praca-tymczasowa,'+desc+','+region+',,,,1,html';	/*}*/}$(document).ready(function(){  	$(document).bind('keypress', function(e) {		var code = (e.keyCode ? e.keyCode : e.which);		if(code == '13') {			var id = $('#tab-idx').val();			if(id == '1') {				submit1();			}			else if (id == '2') {				submit2();			}			else if (id == '3') {						submit3();			}
			else { /*submituj inne formularze*/
				$(".manage-search-submit").click();				
			}		}	});					id = $('#tab-idx').val();	if(id == '1') {		$('#search-tab-1').css({			backgroundImage: 'url(./img/tab-1-a.jpg)'		});		$('#search-tab-2').css({			backgroundImage: 'url(./img/tab-2-i.jpg)'		});		$('#search-tab-3').css({			backgroundImage: 'url(./img/tab-3-i.jpg)'		});		swapSearchBox (1);	}	else if (id == '2') {		$('#search-tab-1').css({			backgroundImage: 'url(./img/tab-1-i.jpg)'		});		$('#search-tab-2').css({			backgroundImage: 'url(./img/tab-2-a.jpg)'		});		$('#search-tab-3').css({			backgroundImage: 'url(./img/tab-3-i.jpg)'		});		swapSearchBox (2);	}	else {				$('#search-tab-1').css('background-image', 'url(./img/tab-1-i.jpg)');		$('#search-tab-2').css('background-image', 'url(./img/tab-2-i.jpg)');		$('#search-tab-3').css('background-image', 'url(./img/tab-3-a.jpg)');		swapSearchBox (3);	}	swapSearchBox (id);			//$('#tab-idx').val(1);	$('.search-tab').click(function() {		id = this.id.substr(11,1);		curr = $('#tab-idx').val();		if(id != curr) {			$('#tab-idx').val(id);			if(id == '1') {				$('#search-tab-1').css({					backgroundImage: 'url(./img/tab-1-a.jpg)'				});				$('#search-tab-2').css({					backgroundImage: 'url(./img/tab-2-i.jpg)'				});				$('#search-tab-3').css({					backgroundImage: 'url(./img/tab-3-i.jpg)'				});				swapSearchBox (1);			}			else if (id == '2') {				$('#search-tab-1').css({					backgroundImage: 'url(./img/tab-1-i.jpg)'				});				$('#search-tab-2').css({					backgroundImage: 'url(./img/tab-2-a.jpg)'				});				$('#search-tab-3').css({					backgroundImage: 'url(./img/tab-3-i.jpg)'				});				swapSearchBox (2);			}			else {						$('#search-tab-1').css('background-image', 'url(./img/tab-1-i.jpg)');				$('#search-tab-2').css('background-image', 'url(./img/tab-2-i.jpg)');				$('#search-tab-3').css('background-image', 'url(./img/tab-3-a.jpg)');				swapSearchBox (3);			}					}	});		$("#company-desc").focus(function(){		if($("#company-desc").val() == 'wszystkie firmy')			$("#company-desc").val('');	});		$("#company-desc").blur(function(){		if($("#company-desc").val() == '')			$("#company-desc").val('wszystkie firmy');						});		$("#company-cat-region").change(function(){		if($(this).val() != region) {			document.location='kategoria,'+level+','+cat+','+$(this).val()+','+order+','+hits+',1.html';		}				});		}); 
