$(document).ready(function() {
						   
	$('div.refineBox').each(function(){
		$(this).find('div.boxMoreLink a').unbind('click').click(function(){
			$(this).parent().css('display','none');
			$(this).parent().parent().children('.boxMore').css('display','block');
		});
		$(this).find('a.refineBoxHead').unbind('toggle').toggle(function(){
			$(this).parent().find('div:first').css('display','block');
			$(this).removeClass('boxClosed');
			$(this).addClass('boxOpen');
			
			var index = $('.refineBoxHead').index(this);
			$.cookie('mb_refineBox_'+index,'open',{expires:60});
		},function(){
			$(this).parent().find('div:first').css('display','none');
			$(this).addClass('boxClosed');
			$(this).removeClass('boxOpen');
			
			var index = $('.refineBoxHead').index(this);
			$.cookie('mb_refineBox_'+index,null);
		});
	});
	
	$('.refineBox').each(function(){
		var index = $('.refineBox').index(this);
		if($.cookie('mb_refineBox_'+index)=='open'){ 
			$(this).find('a:first').click();
		}
	});
	
	$('#refineHideLink').unbind('click').click(function(){
		$('#refineColumn').css('display','none');
		$('#showRefineColumnContainer').css('display','inline');
		$.cookie('mb_refineColumnVisibility','hide');
	});
	if($.cookie('mb_refineColumnVisibility')=='hide') $('#refineHideLink').click();
	$('#showRefineColumn').unbind('click').click(function(){
		$('#refineColumn').css('display', '');//'table-cell');
		$('#showRefineColumnContainer').css('display','none');
		$.cookie('mb_refineColumnVisibility',null);
	});

	//$.cookie('sh', '', -1);

	//console.info($.cookie('sh'));
	if($("#sh").val()!=1)$('div.refineBox:eq(3)').show();	

/*
	if($.cookie('sh').length>0){
		console.info();
	}else{
		$('div.refineBox:eq(3)').hide();	
	}
*/
	//UGLY D-CODE
	

$(".boxClsLink").click(function(){
	$.cookie('sh', '', -1);
	$(this).parent().parent().hide();
});


});

/*(function(event){
										 alert('test');
										 $.cookie('SearchHistory',NULL);
										 $(".refineBox:last").hide();
										 });
*/
function init(){ return true; }

function detectIE(){
	var browserName=navigator.appName; 
	if (browserName=="Netscape") return false;
	else{ 
		if (browserName=="Microsoft Internet Explorer") return true;
		else return false;
	}
}

