var curr_banner=0;
var t=5000;
var interv=null;

$(function(){	
	//$(".banner_switch div").css("width",$(document).width());		
	$(".banner_switch div:gt(0)").hide();
	$(".banner_switch>ul>li").eq(0).addClass("curr");
	interv=setTimeout("showBanner(1)",t);		
	
	//Number position
	$(".banner_switch > ul").css("right",parseInt(($(document).width()-960)/2)+"px");
	
	for(var i=0;i<$(".banner_switch>ul>li").size();i++){
		$(".banner_switch>ul>li").eq(i).attr("currId",i);	
	}
	$(".banner_switch>ul>li").click(function(){
		clearTimeout(interv);
		var currId=parseInt($(this).attr("currId"));				
		showBanner(currId);
	});
	
});

function showBanner(curr_id){
		curr_banner=curr_id;
		if(curr_banner>=$(".banner_switch > div").size()) curr_banner=0;
		$(".banner_switch div").fadeOut(1000).eq(curr_banner).fadeIn(1000);	
		$(".banner_switch>ul>li").eq(curr_banner).addClass("curr").siblings().removeClass("curr");
		curr_banner++;		
		interv=setTimeout("showBanner(curr_banner)",t);
	}
