function timerFunction(){
    sliderdiv = $('div#top-image-slider');
    cur_div = sliderdiv.find('div.active');
    if(!cur_div.length){
        //$('div#top-image-slider div:first').show();
    }
    else{
        next_div = cur_div.next();
        if(!next_div.length)
            next_div = $('div#top-image-slider div:first');
        cur_div.animate({opacity: '0'}, {duration: 1000, queue: false}).removeClass('active');
        next_div.animate({opacity: '1'}, {duration: 1000, queue: false}).addClass('active');
    }


 //   fade.push();
//            $active = $('.paging a.active').next(); //Move to the next paging
//            if ( $active.length === 0) { //If paging reaches the end...
//                $active = $('.paging a:first'); //go back to first
//            }
//            rotate(); //Trigger the paging and slider function
}

$(function(){
    //$('div#top-image-slider div').css('opacity:0.5; display: block;');
    $('div#top-image-slider div:first').css('opacity','1').addClass('active');
    //Rotation  and Timing Event
    rotateSwitch = function(){
        play = setInterval(timerFunction, 5000); //Timer speed in milliseconds (7 seconds)
    };

    rotateSwitch(); //Run function on launch

});
