// JavaScript Document
//******** Start Slide show ****************
	var $j = jQuery.noConflict();
	var currentImage;
    var currentIndex = -1;
    var interval;
    function showImage(index){
        if(index < $j('#bigPic img').length){
        	var indexImage = $j('#bigPic img')[index]
            if(currentImage){   
            	if(currentImage != indexImage ){
                    $j(currentImage).css('z-index',2);
                    clearTimeout(myTimer);
                    $j(currentImage).fadeOut(1000, function() {
					    myTimer = setTimeout("showNext()", 3000);
					    $j(this).css({'display':'none','z-index':1})
					});
                }
            }
            $j(indexImage).css({'display':'block', 'opacity':1});
            currentImage = indexImage;
            currentIndex = index;
//            $j('#thumbs li').removeClass('active');
//            $j($j('#thumbs li')[index]).addClass('active');
        }
    }
    
    function showNext(){
        var len = $j('#bigPic img').length;
        var next = currentIndex < (len-1) ? currentIndex + 1 : 0;
        showImage(next);
    }
    
    var myTimer;
    
    $j(document).ready(function() {
	    myTimer = setTimeout("showNext()", 3000);
		showNext(); //loads first image
//        $j('#thumbs li').bind('click',function(e){
//        	var count = $(this).attr('rel');
//        	showImage(parseInt(count)-1);
//        });
	});
//******** End Slide show ****************	


//********** Start for Tabs ***************
$j(document).ready(function() {

	//Default Action
	$j(".tab_content").hide(); //Hide all content
	$j("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$j(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$j("ul.tabs li").click(function() {
		$j("ul.tabs li").removeClass("active"); //Remove any "active" class
		$j(this).addClass("active"); //Add "active" class to selected tab
		$j(".tab_content").hide(); //Hide all tab content
		var activeTab = $j(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$j(activeTab).show(); //Fade in the active content
		return false;
	});
});
//********** End for Tabs *************** 





//******** Start slide Panel ********
$j(document).ready(function() {
		
		// Expand Panel
		$j("#open").click(function(){
			$j("div#panel").slideDown("slow");
		
		});	
		
		// Collapse Panel
		$j("#close").click(function(){
			$j("div#panel").slideUp("slow");	
		});		
		
		// Switch buttons from "Log In | Register" to "Close Panel" on click
		$j("#toggle a").click(function () {
			$j("#toggle a").toggle();
		});		
			
	});
//************End slide Panel *******************

