function _page($page, $count) {
	if($page == 1) {
		document.getElementById('prev').style.visibility = 'collapse';
	} else {
		document.getElementById('prev').style.visibility = 'visible';
		document.getElementById('prev').href = 'javascript:_page('+($page-1)+','+$count+')';
	}
	
	if($page == $count) {
		document.getElementById('next').style.visibility = 'collapse';
	} else {
		document.getElementById('next').style.visibility = 'visible';
		document.getElementById('next').href = 'javascript:_page('+($page+1)+','+$count+')';
	}
		
	for(x=1;x<=$count;x++) {	
		if(x != $page)
			document.getElementById('page'+x).style.display = 'none';
		else
			document.getElementById('page'+x).style.display = '';
	}	
}

$(document).ready(function(){
	$("a.jQueryBookmark").click(function(e){
		e.preventDefault(); // this will prevent the anchor tag from going the user off to the link
		var bookmarkUrl = this.href;
		var bookmarkTitle = this.title;
	 
		if (window.sidebar) { // For Mozilla Firefox Bookmark
			window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
		} else if( window.external || document.all) { // For IE Favorite
			window.external.AddFavorite( bookmarkUrl, bookmarkTitle);
		} else if(window.opera) { // For Opera Browsers
			$("a.jQueryBookmark").attr("href",bookmarkUrl);
			$("a.jQueryBookmark").attr("title",bookmarkTitle);
			$("a.jQueryBookmark").attr("rel","sidebar");
		} else { // for other browsers which does not support
			 alert('Your browser does not support this bookmark action');
			 return false;
		}
	});
	});

function ElementsHS_gora_srodek(status) {
	if(status=='hidden') {
	document.getElementById('expand').style.height='325px'
	} else {
	document.getElementById('expand').style.height='100px'
	}
}



function showCategory(iSubCategoryId){
	$.ajax({
		beforeSend:function(){
			$('#search_subcategory').html('<div style="line-height:20px;height:25px;"><img src="/images/loader2.gif" /></div>');
		},
		url:'/ajax/category/'+iSubCategoryId,
		success: function(data){
			$('#search_subcategory').html(data);
	  }		
	})
	
}

function checkCountry(iCountryId){
	if(iCountryId!='170'){
		//visibility:hidden;
		$('#mapa').css('visibility','hidden');
		//$('#mapa').css('display','none');
		$('.wojew').css('display','none');
		
	}
	else{
		$('#mapa').css('visibility','visible');
		//$('#mapa').css('display','block');
		$('.wojew').css('display','block');	
	}
}

function mapchecker(){
	var iWoj = $('.active-region').attr('tabindex');
	
	if(iWoj>0){
		$('#wojselect option').each(function(){
			if(iWoj==this.value){
				$(this).attr('selected','selected');
				//$(":input[name=woj]").trigger('change');
				
				checkWoj(this);
			}
			
		});
	}	
}

function checkWoj(oWoj){
	
		  if($(oWoj).val() != 0) {
			$.get('xml/cities.php?woj_id='+$(oWoj).val()+'&cat='+$('#s_category').val()+'&sub_cat='+$('#s_subcategory').val(), function(xml) {
			  $(":input[name=city]").empty();
			  $(":input[name=city]").append("<option type='text' value='0' >wszystkie</option>									<option disabled='disabled'>--------------</option>");
	    		    $(xml).find("city").each(function(){
	   	    		    	
				  $(":input[name=city]").append("<option type='text' value='"+$(this).attr('title')+"'>"+$(this).attr('title')+"</option>");
				 
				});						  				 
			});
			$(":input[name=city]").removeAttr('disabled');
		  } else {
			$(":input[name=city]").empty();	
			  $(":input[name=city]").append("<option type='text' value='0' >wszystkie</option>									<option disabled='disabled'>--------------</option>");					
			$(":input[name=city]").attr('disabled', true);
		  }
	
	
}













