﻿
 
   var t = n = 0, count = 0;
   
   $(document).ready(function(){
       $.get("/tn_admin/CreateXML/头部切换.xml",function(data){
          var i=1;
          $(data).find("pictrue").each(function(){
              var obj=$(this);
              if(obj.attr("isShow")!=undefined&&obj.attr("isShow")=="1")
              {
              $("#playNum").append("<a>"+ i++ +"</a>");
             
              $("#playShow").append("<a href='"+$(this).find("link").text()+"' target='_blank'><img src='"+$(this).find("url").text()+"'></a>");
              }
          });
         count=$("#playShow a").size();
$("#playShow a:not(:first-child)").hide();
//$("#playText").html($("#playShow a:first-child").find("img").attr('alt'));
$("#playNum a:first").css({"background":"#FFD116",'color':'#A8471C'});
//$("#playText").click(function(){window.open($("#playShow a:first-child").attr('href'), "_blank")});
$("#playNum a").mouseover(function() {
   var i = $(this).text() - 1;
  
   n = i;
   if (i >= count) return;
   //$("#playText").html($("#playShow a").eq(i).find("img").attr('alt'));
   //$("#playText").unbind().click(function(){window.open($("#playShow a").eq(i).attr('href'), "_blank")})
   $("#playShow a").filter(":visible").hide().parent().children().eq(i).fadeIn(1200);
   $(this).css({"background":"#FFD116",'color':'#A8471C'}).siblings().css({"background":"#D7D6D7",'color':'#000'});
});
t = setInterval("showAuto()", 3000);
$("#play").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 3000);});
       })
   })
   function showAuto()
{

n = n >= (count - 1) ? 0 : ++n;
$("#playNum a").eq(n).trigger('mouseover');
}



