function newsFilter(){
	var chkCount = 0;
	
	$('.news').css('display','none');
	
	$('.checkbox > :checkbox').each(
		function(idx, elem){
			if(this.checked){
				$('.cat-' + this.value).css('display','block');
				chkCount++;
			}
		}
	);
	
	if (chkCount==0)
		$('.news').css('display','block');
}
function newsFilterSetCookie(){
	var strCookie="";
	$('.checkbox > :checkbox').each(
		function(idx, elem){
			if(this.checked){
				strCookie += this.value + ',';
			}
		}
	);
	
	$.cookie('news_category', ','+strCookie);
}
function newsFilterSetChecksFromCookie(){
	$('.checkbox > :checkbox').each(
		function(idx, elem){
			if($.cookie('news_category') && $.cookie('news_category').indexOf(','+this.value+',')!= -1 ){
				this.checked=true;
			} else {
				this.checked=false;
			}
		}
	);
}

function changeHeight(id,h,dummy){
	$('#'+id).css('height',h+'px');
}

function showLogin(){
	$('#jqm1').jqmShow();
}

function closeLogin(){
	$('#jqm1').jqmHide();
}

//dom ready
$(function() {
	$("#content").columnize({columns: 2, balance: true});
	$('#jqm1').jqm({ajax:'/?template_id=1203'/*,modal: true*/});
	newsFilterSetChecksFromCookie();
	newsFilter();
});
