var postBackgroundsrc = "";

function init()
{
	$("div").filter(".content").hide();			

	
	$("div").filter(".active").slideDown();
         /*$("a").filter(".closeall").parent().hide(); */
         
         $("img[@alt=background]").hide(function(){
         
         var postBackgroundstart = 'url("';
	var postBackgroundend = '")';

                postBackgroundmid = $(this).attr("src");
                postBackgroundsrc = postBackgroundstart + postBackgroundmid + postBackgroundend;
                $(this).parent().parent().parent().css("background-image",postBackgroundsrc);
	}); 
         
         
         /* FOR THE DIVS */
    	//$("div#content").filter.children("div.item-master").children("div.item-body").hide();
         $("div").filter(".item-body").hide();    
         $("div").filter(".item-close").hide();
         
         
         $("a[@rel=toggle]").click(function(){
         	$(this).parent().parent().parent().children("div.item-body").slideToggle("slow");
         	$(this).parent().parent().parent().children("div.item-header").children("div.item-close").toggle();  
	});
         
         $("a").filter(".close").click(function(){
         	$(this).parent().parent().parent().children("div.item-body").slideToggle("slow");
                 $(this).parent().parent().parent().children("div.item-header").children("div.item-close").toggle();  
	});
         
         $("a[@rel=closenav]").click(function(){
         	$(this).parent().slideToggle("slow"); 
	});
         
         $("a[@rel=togglenav]").click(function(){
         	$(this).parent().children("div.content").slideToggle("slow"); 
	});
         
	$("a").filter(".displayall").click(function(){
         	$(this).parent().parent().parent().siblings("div.item-master").children("div:hidden.item-body").slideToggle("slow");
                 $(this).parent().parent().parent().siblings("div.item-master").children("div.item-header").children("div.item-close").show();  
	});
         
	$("a").filter(".closeall").click(function(){
         	$(this).parent().parent().parent().siblings("div.item-master").children("div:visible.item-body").slideToggle("slow");
                 $(this).parent().parent().parent().siblings("div.item-master").children("div.item-header").children("div.item-close").hide();   
	});
}


$(document).ready(init);

