var $j = jQuery.noConflict();

$j.fn.center = function () {
    	this.css("position","absolute");
    	this.css("top", ( $j(window).height() - this.height() ) / 2+$j(window).scrollTop() + "px");
    	this.css("left", ( $j(window).width() - this.width() ) / 2+$j(window).scrollLeft() + "px");
    	return this;
}

$j.fn.centerWidth = function () {
    	this.css("position","absolute");
    	this.css("left", ( $j(window).width() - this.width() ) / 2+$j(window).scrollLeft() + "px");
    	return this;
}				
		 

$j(document).ready(function(){

		$j('#logo_center').click(function(){
			$j('div#backstretch').fadeOut();
			$j('div#header').css('display', 'block');
			$j('div#sidebar').css('display', 'block');
			$j(this).css('display', 'none');
			$j('div.foto_post').fadeIn('slow');
		})


		$j('div.foto_post').hide();
		$j('div.back').fadeOut();
		
		$j('a.parent').click(function(event) {
			
			if($j(this).attr('class') == 'parent closed') {
				
 				$j('a.parent').removeClass('opened').addClass('closed');
					
				$j(this).removeClass('closed').addClass('opened');
				$j('ul.subvisible').removeClass('subvisible').slideUp('slow');
				$j(event.target).parent().children('ul').addClass('subvisible').fadeIn();
				
			} else if($j(this).attr('class') == 'parent opened') {
				
				$j('a.parent').removeClass('opened').addClass('closed');
				
				$j(this).removeClass('opened').addClass('closed');
				$j(event.target).parent().children('ul').removeClass('subvisible').fadeOut();
			}
			
		});		
});
