$(document).ready(function(){
    
    $('#cg-slide-screen').serialScroll({
        items:'li.slideMain',
        axis:'y',
        navigation:'#cg-slide-menu li',
        duration: 300,
        interval: 4000,
        force: true,
        lock: false,
        cycle: true,
        onBefore:function( e, elem, $pane, $items, pos ){
            /**
            * 'this' is the triggered element
            * e is the event object
            * elem is the element we'll be scrolling to
            * $pane is the element being scrolled
            * $items is the items collection at this moment
            * pos is the position of elem in the collection
            * if it returns false, the event will be ignored
            */
            //those arguments with a $ are jqueryfied, elem isn't.
            e.preventDefault();
            $().changeElem(pos);
        }
    });
    // You can temove the .stop() to let it finish the active animation
    $('#cg-slide').hover(function(){
        $('#cg-slide-screen').trigger('stop');
        $('#cg-slide-screen').doTimeout( 'restart' );
    },function(){
        $('#cg-slide-screen').doTimeout( 'restart', 2000, function() {
            $('#cg-slide-screen').trigger('start', 4000);
        });
    });

    $.fn.changeElem = function(elem) {
        // Left menu class
        $('#cg-slide-menu li').removeClass('selected');
        $('#cg-slide-menu li:eq('+elem+')').addClass('selected');
        // Right menu class
        $('#cg-slide-sidebar li').removeClass('selected');
        $('#cg-slide-sidebar li:eq('+elem+')').addClass('selected');
    }

    $('#cg-slide-menu li').click(function() {
        $().changeElem($(this).index());
    });

    $("#featured > .ui-tabs-panel > .info").click( function() {
        window.location.href=$(this).find("a.detailsLink").attr("href")
    });

    $("#featured > ul").tabs({
        fx:{
            opacity: "toggle",
            duration: "fast"
        }
    }).tabs("rotate", 5000, false);

    $("#featured").hover(
        function() {
            $("#featured  > ul").tabs("rotate",0,true);
        },
        function() {
            $("#featured  > ul").tabs("rotate",5000,true);
        }

        );

    $("body select").msDropDown({
        height:120,
        visibleRows:7,
        rowHeight:23,
        showIcon:true,
        zIndex:9999,
        style:''
    });
    $(".numbers").numerize();

    $(document).pngFix();         

});

function popupWindow(url) {
    window.open(url,'verisignCheckUp','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=540,height=440,screenX=150,screenY=150,top=150,left=150')
}
