// JavaScript Document
function loop_change(){
	var src=$(".pd_img").attr("src");
	$(".control").children("a").each(function(i){this.className = "pd";});
	if((/vip.jpg$/).test(src)){
		$(".pd_img").attr("src","/images/right_banner/o2hr.jpg");//第二张
		$(".pd_img").parent().attr({"title":"氧气要人",
								     "href":"http://o2life.cn/html/join.html"
								   });
		$(".pd[index='2']").addClass("curIn");
	}else if((/o2hr.jpg$/).test(src)){
		$(".pd_img").attr("src","/images/right_banner/ptli.gif");//第三张
		$(".pd_img").parent().attr({"title":"皮特李",
								   	"href":"http://leungshome.taobao.com/"
								   });
		$(".pd[index='3']").addClass("curIn");
	}else{
		$(".pd_img").attr("src","/images/right_banner/vip.jpg");//第一张
		$(".pd_img").parent().attr({"title":"o2shop会员招募",
								   	"href":"http://o2life.taobao.com/view_page-45931506.htm"
								   });
		$(".pd[index='1']").addClass("curIn");		
	}
}

function show_pd(sth){
	$(".control").children("a").each(function(i){this.className = "pd";});
	if($(sth).attr("index") == "1"){
		$(".pd_img").attr("src","/images/right_banner/vip.jpg");
		$(".pd_img").parent().attr({"title":"o2shop会员招募",
								   	"href":"http://o2life.taobao.com/view_page-45931506.htm"
								   });
		$(".pd[index='1']").addClass("curIn");
	}else if($(sth).attr("index") == "2"){
		$(".pd_img").attr("src","/images/right_banner/o2hr.jpg");
		$(".pd_img").parent().attr({"title":"氧气要人",
								     "href":"http://o2life.cn/html/join.html"
								   });
		$(".pd[index='2']").addClass("curIn");	
		
	}else{
		$(".pd_img").attr("src","/images/right_banner/ptli.gif");
		$(".pd_img").parent().attr({"title":"ptli",
								   	"href":"http://leungshome.taobao.com/"
								   });
		$(".pd[index='3']").addClass("curIn");
	}
	return false;
}

$(document).ready(function(){
	$(".list li").hover(function(){
									$(this).children(".img").children().css("border","#336633 1px solid");
									$(this).children().children().children().css({"color":"#336633"});
									$(this).children().children().css({"color":"#336633"});
										},
						function(){
									$(this).children(".img").children().css("border","#eee 1px solid");
									$(this).children().children().children().css({"color":"#666"});
									$(this).children().children().css({"color":"#666"});
									
								});
	var int = setInterval("loop_change()", 3000);//3秒自动轮换	
	$(".pd_img").hover( function (){ //鼠标悬停停止轮换
										window.clearInterval(int)
										show_pd($(".curIn"));
												},
						function(){
										int = setInterval("loop_change()", 3000);	
								});		
							  
	});
