
/*---------Start >>  Link  Accordion------ */

function l_accordion(link, content){
	link.addClass("accordion_link");
	link.parent().addClass("accordion_link close");
	jQuery(content).hide();
	link.click(function(){
	        i = jQuery.inArray(this, link);
	        if(content.eq(i).is(':hidden')){
	                link.parent().removeClass("open");
	                link.parent().addClass("close");                      
	                content.slideUp();
	                link.eq(i).parent().removeClass("close");
	                link.eq(i).parent().addClass("open");
	                content.eq(i).slideDown();
	        } else {
	                content.eq(i).slideUp();
	                link.parent().removeClass("open");
	                link.parent().addClass("close");
	        }

		return false;
	})
}

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}, 1000, function() {
                        active.removeClass('active last-active');
                });
}

jQuery(document).ready(function(){
        setInterval( "slideSwitch()", 30000 );
});


jQuery(document).ready(function(){
        q = jQuery(".acc_link");
        a = jQuery(".acc_pane");
        l_accordion(q,a);
	
	
});


/*----------------End >> Link Accordion................*/

/*..........................
Learn Meditation Page: What Religion Say Block
............................*/

jQuery(document).ready(function(){
        jQuery('#page_image_gallery p').hide();

jQuery('#page_image_gallery .religion_say').each(function(index){
                jQuery(this).hover(function(e){
			
                        imageSrc = jQuery(this).find('img').attr("src");
                        title = jQuery(this).find('abbr').attr("title");
                        mainsrc = jQuery(this).find('abbr').attr("title");
                        maintitle = jQuery(this).find('p').html();
				

                        var html = '<div id="what_religion_desc" >';
                                html += '<div id="religion_info" >';
                                html += '<h3>' + title + '</h3>';
                                html += '<a href="' + mainsrc + '"><img src="' + imageSrc + '" alt="image" /></a>';
                                html += '<p style="color: #369; ">' + maintitle +'</p>';
                                html += '</div></div>';
			
                        var position = jQuery('#page_image_gallery').position();
                        jQuery(html).css({"left": position.left -300, "top": position.top}).prependTo('#page_image__gallery').fadeIn(400).mouseleave(function(){
                                                jQuery(this).remove();

                        });

                },function(){ jQuery('#what_religion_desc').remove();});


        });


});


/*----------------Start >> Overlay------------------------*/

(function($){
    $(function(){
        if( $.cookie("ws") == null ) {
                //var time = 1.5/(24*360) ; // 15 sec
                // var time = 1/4 ;     // 6 hour
                // var time = 1/2 ;     // 12 hour

                var time = 6/24;        // 1 hour

                $.cookie("ws", "1", {expires: time}) ;

		$('body.front').animate({ scrollTop: 0 }, 0);
		$('#welcome_overlay').show();
		$('body.front').css('overflow','hidden');

		$('#welcome_button').fadeIn('slow');
        	$('#welcome_black_overlay').click(function(){
	            $('#welcome_overlay').fadeOut('slow');
        	    $('body').css('overflow','auto');
		    return false;
       		 });
		$('#welcome_button').click(function(){
			$('#welcome_overlay').fadeOut('slow');
           	 	$('body').css('overflow','auto');
	    	return false;
	})
	}
    });

}(jQuery));


/*-----------------End >> Overlay----------------------*/

;

