rotate = function () {
    var triggerID = $active.attr("rel");

    $(".paging a").removeClass('active');
    $active.addClass('active');
	$('.slideimg').fadeOut('slow').hide('slow')
    $('#' + triggerID).fadeIn('slow').show()

};

//Rotation  and Timing Event
rotateSwitch = function () {
    play = setInterval(function () {
        $active = $('.paging a.active').next();
        if ($active.length === 0) {
            $active = $('.paging a:first');
        }
        rotate();
    }, 7000);
};

rotateSwitch();


$(document).ready(function () {
    //Show the paging and activate its first link
    $(".paging").show();
    $(".paging a:first").addClass("active");


    //On Hover
    $(".image_reel a").hover(function () {
        clearInterval(play); //Stop the rotation
    }, function () {
        rotateSwitch(); //Resume rotation timer
    });

    //On Click
    $(".paging a").click(function () {
        $active = $(this); //Activate the clicked paging
 
     
        clearInterval(play); //Stop the rotation
        rotate(); //Trigger rotation immediately
        rotateSwitch(); // Resume rotation timer
        return false; //Prevent browser jump to link anchor
    });


    $("#close").click(function () {

        $("#content_main_box").hide();
        location.href="/";
        
    });



    $('#container-1').tabs();


})
