$(document).ready(function() {
	
	$('#SelectAllCategory').live('click', function() {  			
		SelectAll('Category');	
	});		
	
	$('#SelectAllStores').live('click', function() {  			
		SelectAll('Stores');	
	});	
	
	 
	
	$('#RefineSearchCategory').live('click', function() {		
		var checkcount = $(".RefinementCheckboxCategory:checked").length;
		if (checkcount == 0) {
			PopMessage('No Categories Selected','You must select at least one Category to search on.',250,250);
			return false;
			}	
	});	
		
	$('#RefineSearchStores').live('click', function() {			
		var checkcount = $(".RefinementCheckboxStores:checked").length;
		if (checkcount == 0) {
			PopMessage('No Stores Selected','You must select at least one Store to search on.',250,250);
			return false;
			}	
	});	
		
	
	
	$('#StoresTab .tabMain').click(function(){
        $('html, body').animate({scrollTop:250}, 'slow');
	});
	
	$('#CategoriesTab .tabMain').click(function(){
        $('html, body').animate({scrollTop:250}, 'slow');		
	});
		
		
		
		
		
	
});

function SelectAll(RefinementType){		
		if ($('#SelectAll' + RefinementType).is(':checked')) {
			$('#SelectAllLable' + RefinementType).html("Deselect All");
			//$('.RefinementCheckbox' + RefinementType).attr('checked',true);
			CheckBoxes('.RefinementCheckbox' + RefinementType,true);
			}
		else {
			$('#SelectAllLable' + RefinementType).html("Select All");
			//$('.RefinementCheckbox' + RefinementType).attr('checked',false);
			CheckBoxes('.RefinementCheckbox' + RefinementType,false);
			}					
}

function CheckBoxes(ClassName,Check){	
	$(ClassName).attr('checked',Check);
}



