$(function() {
 bannertotal = $('#spbb li').length;
$('#spbb li').click(function() {
  loopBanner($(this).attr('id'),flashbannerT,bannertotal);
});

$('#spbb').hover(function(){
	clearInterval(flashbannerT);
},
function(){ 
	flashbannerT = setInterval("loopBanner(0,'',bannertotal)",5000);
});
var flashbannerT = setInterval("loopBanner(0,'',bannertotal)",5000);


i = 0;
prev = 0;
$('.newsitem-previous').click(function() {
   clearInterval(wt);
   rollText(-1,'click');
});

$('.newsitem-next').click(function() {
   clearInterval(wt);
   rollText(1,'click');
});

$('.newsticker-controls').mouseover(function(){ 
   clearInterval(wt);
});

$('.newsticker-controls').mouseout(function(){
   wt = setInterval('rollText(1,null)',4000);
});

var wt = setInterval('rollText(1,null)',4000);

$('#FG-Weekhot h3').click(function() {
  $('#FG-Weekhot h3').removeClass('current');
  $(this).addClass('current');
  $('#FG-Weekhot .hot-bd').hide();
  $('#FG-Weekhot #block'+$(this).attr('id')).show();
});

$('.top ul li.sale,.top ul li.ccie,.top ul li.buy').click(function()
{
document.location.href=$(this).find('p').find('a').attr('href');
});

})

function rollText(type,event)
{
 newstotal = $('.rollTextMenus li').length;
 $('.rollTextMenus li').css('display','none');
 if(newstotal>1) {
 if(type==1) {i++;} else {i--;}
 if(event!=null && i<0) { i = 0; }
 $('.rollTextMenus li').eq(i).css('display','block');
 prev = i;
 if(i==(newstotal-1)) {i = -1}
 }
}

