function expand_post() {
	//alert('st'); 
	jQuery(this).parent('div').toggleClass('show-post-full');
	//$(this).toggleClass('dd');
}

function open_block() {
	 var index = jQuery('#jsddm > li').index(this);
	 if (index != cur_num) {
		open_bl(index);
	}
}

function open_bl(nm) {
	//alert('Index: ' + nm);
	jQuery('#jsddm > li:eq('+nm+')').addClass('active');
	jQuery('#post_container > div:eq('+nm+')').toggleClass("show_post");
	jQuery('#jsddm > li:eq('+cur_num+')').removeClass("active");
	jQuery('#post_container > div:eq('+cur_num+')').toggleClass("show_post");
	cur_num=nm;
}

jQuery(document).ready(	function() 
{ 
	//var str=window.location.hash;
	
	cur_num = 0 ;
	
	jQuery('#jsddm > li').bind('click', open_block);
	jQuery('.post-content-brief .switch_post').bind('click', expand_post);
	
	var dr =window.location.hash.substring(5);
	if ( dr != cur_num && dr !=""){
	//alert (dr);
		open_bl(dr);
	}
	
}
);

//

function slideSwitch() {
    var $active = jQuery('#slideshow DIV.active');

    if ( $active.length == 0 ) $active = jQuery('#slideshow DIV:last');
    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : jQuery('#slideshow DIV:first');

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 800, function() {
            $active.removeClass('active last-active');
        });
}

jQuery(function() {
    setInterval( "slideSwitch()", 7000 );
});
