
//var pcount = $('#page_count').html();
var pcount=4;


 function hideAll(){
	for(i=1;i<=pcount;i++){
		$('.brand_'+i).hide();
	}

 }
 
function getRandom(){  
    return Math.round(Math.random()*(pcount-1))+1;
}

function showBrandList(){
	   
		
		var current = 1 ;
		current = getRandom();
		//alert(current);
		$('.brand_'+current,$('#marquee')).fadeIn().delay(12000).fadeOut(500);
	

}


function showBrandSlide(){
	hideAll();
	$('.brand_1',$('#marquee')).show().delay(12000).fadeOut(500);
	atimer = setInterval( function(){showBrandList();}, 3000);
}




slide = 1;

function showHotNews(i){
	//Assign to Big Hotspot
	var msg = $('#hsCube',$('.piclist')).find("> li").eq(i);
	var p = msg.html();
	$('#hs_focus').html(msg.html());
	
	//Assign to Big Title
	var titleLink = '<a href="'+msg.find("> a").attr("href")+'" title="'+msg.find("> a").attr("title")+'">'+msg.find("> a").attr("title")+'</a>';
	$('#hsHL').html(titleLink);
	
	//Effects
	msg.html('<li><a href="#"><img src="http://www.52watch.com/templates/stardust/images/52watch_tinylogo.gif" /></a></li>');
	msg.cyclicFade({repeat: 4});
	//msg.fadeOut().delay(500).fadeIn().fadeOut().delay(500).fadeIn();
	btimer = setInterval( function(){msg.html(p);}, 6000);
	
	

}

function showSlide(){

	showHotNews(0);
	var maxL = $('#hsCube').find("> li").length-2;	
	atimer = setInterval( function(){showHotNews(slide);if(slide>maxL){slide=0;}else{slide++;}}, 8000);
}


$(document).ready(function() {
	showSlide();
	//showBrandSlide();
	$('.brandlink').cluetip();
});

