/* topte  page js */

$(document).ready(function() {
    initRollover();
    initNav();
    initSlideshow();
});

function initRollover() {
    $('.rollover').hover(function() {
        var currentImg = $(this).attr('src');
        $(this).attr('src', $(this).attr('hover'));
        $(this).attr('hover', currentImg);
    }, function() {
        var currentImg = $(this).attr('src');
        $(this).attr('src', $(this).attr('hover'));
        $(this).attr('hover', currentImg);
    });
}

function initNav() {	
    $('#nav_slideshow').cycle({  
        timeout: 0,
        fx: 'scrollHorz',
        prev: '#nav_prev',
        next: '#nav_next',
        startingSlide: start_slide,
        onPrevNextEvent:refreshBanners
    });

}

function initSlideshow() {
      $('#slideshow').cycle({
        timeout: 0,
        fx: 'fade',
        prev: '#slideshow_prev',
        next: '#slideshow_next',
        onPrevNextEvent: refreshBanners 
    });
}


function refreshBanners() {
    s.t(); // record page view
    var frames = document.getElementsByTagName("iframe");

    for (i=0; i < frames.length; i++) {

        if (frames[i].className == 'dart_ad') {
            frames[i].contentDocument.location.reload(true);
        }
    }
}


