﻿// JavaScript Document
jQuery(function($){
				
//动画播放
$(".topshow div.mask").before('<div class="mask1"><ul><li><span></span></li><li><span></span></li><li><span></span></li><li><span></span></li><li><span></span></li><li><span></span></li><li><span></span></li><li><span></span></li><li><span></span></li><li><span></span></li></ul></div>');
var indexnav = 0;
$(".topshow .mask1 span").height(0).css({opacity:0.8});
$("#top div.topshow").hover(function(){
	  if(MyTime){
		 clearInterval(MyTime);
	  }
},function(){
	  MyTime = setInterval(function(){
		showImg(indexnav)
		indexnav++;
		if(indexnav > 2){indexnav=0;}
	  } , 3000);
});
var MyTime = setInterval(function(){
   showImg(indexnav);
   indexnav++;
   if(indexnav > 2){indexnav=0;}
 } , 3000);

//焦点图
$("#first div.bigtit").eq(0).show();
var index = 0;
$("#shownav li").mouseover(function(){
index  =  $("#shownav li").index(this);
showImga(index);
});
$("#first div.center").hover(function(){
	  if(MyTime1){
		 clearInterval(MyTime1);
	  }
	  //alert("aa");
},function(){
	  MyTime1 = setInterval(function(){
		showImga(index)
		index++;
		if(index > 2){index=0;}
	  } , 4000);
});
var MyTime1 = setInterval(function(){
   showImga(index);
   index++;
   if(index > 2){index=0;}
 } , 4000);

//焦点图2
var shop = 0;
$("#shopshow li").mouseover(function(){
shop  =  $("#shopshow li").index(this);
showImgb(shop);
});
$("#shopshow").hover(function(){
	  if(MyTime2){
		 clearInterval(MyTime2);
	  }
},function(){
	  MyTime2 = setInterval(function(){
		showImgb(shop)
		shop++;
		if(shop > 2){shop=0;}
	  } , 3000);
});
var MyTime2 = setInterval(function(){
   showImgb(shop);
   shop++;
   if(shop > 2){shop=0;}
 } , 3000);

});

//播放函数
function showImg(i) {
  var inhref = $("#top div.arcpic a").eq(i).attr("href");
  var mask = $(".topshow .mask1 span");
  mask.height(16);
  mask.animate({height:0},700);
  $("#top div.arcpic").eq(i).show().siblings("div.arcpic").hide();  
  $(".topshow .mask a").attr("href",inhref);
}
function showImga(i) {
  $("#first div.bigshow").eq(i).stop(true,true).fadeIn(600).siblings("div.bigshow").hide();
  $("#first div.bigtit").eq(i).stop(true,true).fadeIn(600).siblings("div.bigtit").hide();
  $("#first #shownav li").eq(i).addClass("n" + i +"o").siblings().removeClass("n0o n1o n2o");
 }
function showImgb(i) {
  $("#shopshow div.shopshowc").eq(i).fadeIn(400).siblings("div.shopshowc").hide();
  $("#shopshow li").eq(i).addClass("m" + i +"o").siblings().removeClass("m0o m1o m2o");
}

//png兼容ie6
function isIE(){
if (navigator.appName!="Microsoft Internet Explorer") {return false}
return true
}

function correctPNG() 
{
     for(var i=0; i<document.images.length; i++)
     {
     var img = document.images[i]
     var LW=img.width
     var LH=img.height
     var imgName = img.src.toUpperCase()
     if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
     { 
           img.style.filter+="progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+img.src+", sizingmethod=scale);" 
           img.src="http://images.xiu.com/image2/files_1027/images/header/transparent.gif"
           img.width=LW
           img.height=LH
     }
     }
}
if (isIE()) {window.attachEvent("onload", correctPNG);}