$(document).ready(function(){ 

gallery();
dropShadow();


var rcategory = $('div#nav_main').attr('class');

if((rcategory !='')){
	setCategory(rcategory);
};

	$('#sectors li.closed h2').prepend("<span></span>");

	jQuery('#sectors li').accordion({ 
	    header: 'h2', 
	    active: false, 
	    alwaysOpen: false, 
	    animated: 'easeslide',
	    autoheight: false	
	}).bind("dblclick",function(f){
		clearSelection();
		}).bind("click", function(e){

		var props = $(this).children('h2').children('span').attr("class");

		if(props != 'active'){
			$(this).children("h2").children("span").animate({ opacity: 'show'}, "slow").attr("class",'active');
		} else {
			$(this).children("h2").children("span").animate({ opacity: 'hide'}, "slow").attr("class",'notactive');		
		}
	});

var category = $('#category').html();

if(category!=null){
	setCategory(category);
	$('div#nav_main').toggleClass(category.toLowerCase());
}

});


function setCategory(categ) {
	var categ = categ.toLowerCase();
	$('ul.' + categ).show();
	
	
	$('li.' + categ).show();	
}

function gallery() {
	
	$('#image').hide();
	
	var data = $('#image').html();
	var wrapper = '<ul>'+ data +'</ul>';

	if(data) $('#block').append(wrapper);
} 

function dropShadow() {		
	//	$(".entry-content img").dropShadow({left: 3, top: 4, opacity: 0.8, blur: 2});
	//	$("#block img").dropShadow({left: 3, top: 4, opacity: 0.8, blur: 2});
}

function clearSelection() {
var sel ;
if(document.selection && document.selection.empty){
document.selection.empty() ;
} else if(window.getSelection) {
sel=window.getSelection();
if(sel && sel.removeAllRanges)
sel.removeAllRanges() ;
}
}
