
<!--

//不可修改区域
var GetNodeValue = function(obj)
{
    var str = "";
        if(window.ActiveXObject)    //IE
        {
        str = obj.text;
        }
        else //Mozilla
        {
            try
            {
               str = obj.childNodes[0].nodeValue;
            }
            catch(ex)
            {
               str = "";
            }
        }
    return str;
}

if(document.implementation && document.implementation.createDocument)
{
    XMLDocument.prototype.loadXML = function(xmlString)
    {
        var childNodes = this.childNodes;
        for (var i = childNodes.length - 1; i >= 0; i--)
           this.removeChild(childNodes[i]);

        var dp = new DOMParser();
        var newDOM = dp.parseFromString(xmlString, "text/xml");
        var newElt = this.importNode(newDOM.documentElement, true);
        this.appendChild(newElt);
    };

    // check for XPath implementation
    if( document.implementation.hasFeature("XPath", "3.0") )
    {
        // prototying the XMLDocument
        XMLDocument.prototype.selectNodes = function(cXPathString, xNode)
        {
            if( !xNode ) { xNode = this; }
            var oNSResolver = this.createNSResolver(this.documentElement)
            var aItems = this.evaluate(cXPathString, xNode, oNSResolver,
                XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
            var aResult = [];
            for( var i = 0; i < aItems.snapshotLength; i++)
            {
            aResult[i] = aItems.snapshotItem(i);
            }
            return aResult;
        }

        // prototying the Element
        Element.prototype.selectNodes = function(cXPathString)
        {
            if(this.ownerDocument.selectNodes)
            {
            return this.ownerDocument.selectNodes(cXPathString, this);
            }
            else{throw "For XML Elements Only";}
        }
    }

    // check for XPath implementation
    if( document.implementation.hasFeature("XPath", "3.0") )
    {
        // prototying the XMLDocument
        XMLDocument.prototype.selectSingleNode = function(cXPathString, xNode)
        {
            if( !xNode ) { xNode = this; }
            var xItems = this.selectNodes(cXPathString, xNode);
            if( xItems.length > 0 )
            {
            return xItems[0];
            }
            else
            {
            return null;
            }
        }  
        // prototying the Element
        Element.prototype.selectSingleNode = function(cXPathString)
        {  
            if(this.ownerDocument.selectSingleNode)
            {
            return this.ownerDocument.selectSingleNode(cXPathString, this);
            }
            else{throw "For XML Elements Only";}
        }
    }
}

//可修改区域
var imgWidth=223;
var imgHeight=167;
var _timeOut_=3000;
var show_text = false; //是否显示焦点文字
var timeOut=_timeOut_;
var timeOut2=_timeOut_/2;//onmouseout img后需要切换的时间
var now=0;              //第一张图
var target="_blank";   //打开方式
var button_on ='on'; //当前焦点对应按钮的样式名
var button_off ='';//非当前焦点对应按钮的样式名

//不可修改区域
var imgUrl = new Array();
var imgText = new Array();
var imgLink = new Array();
var imgAlt= new Array();
var menuList = new Array();//菜单menu
var ver=2; //兼容浏览器版本 默认2 为非ie
var firstTime=true;
var n =-1;	

var xmlDoc; 
var nodes ;

  // IE 浏览器
   if (window.ActiveXObject)  
   {  
     xmlDoc = new ActiveXObject('Microsoft.XMLDOM');  
     xmlDoc.async= false;  
     xmlDoc.load("/Flash/flashIndex.xml");  
   }
   // Mozilla, Firefox, Opera浏览器
   else if (document.implementation &&document.implementation.createDocument)  
   {  
      xmlDoc  =   document.implementation.createDocument("","",null); 
      xmlDoc.async=false; 
      xmlDoc.load("/Flash/flashIndex.xml"); 
      //xmlDoc.onload=new function(){alert(xmlDoc.childNodes.length);} 
   }
   else  
   {  
      alert("由于你的浏览器不支持Javascript,目录树无法加载...");  
   }

var isIE=document.all? true:false;

//获得根节点 
//nodes= xmlDoc.documentElement.childNodes;
//alert(xmlDoc.documentElement.selectNodes);
nodes= xmlDoc.documentElement.selectNodes("//showPic/show");
//alert(nodes.length);
//for(var x in nodes){
//alert(x);
//}
for(var i=0;i<nodes.length;i++)
{
	menuList[++n]='XX';
	imgUrl[n]=GetNodeValue(nodes[n].selectSingleNode("imgUrl"));//nodes(n).selectNodes("imgUrl")(0).text; 
	imgText[n]=GetNodeValue(nodes[n].selectSingleNode("imgText"));//nodes(n).selectNodes("imgText")(0).text; //显示在图片底下的文字
	imgLink[n]=GetNodeValue(nodes[n].selectSingleNode("imgLink"));//nodes(n).selectNodes("imgLink")(0).text; 
	imgAlt[n]=GetNodeValue(nodes[n].selectSingleNode("imgAlt"));//nodes(n).selectNodes("imgAlt")(0).text;   //当鼠标移近图片时图片显示的标题
}
//=======================修改结束================================
//alert('1.'+imgUrl.length+'2.'+imgText.length+'3.'+imgLink.length+'4.'+imgAlt.length);



function flash$(id){
	return document.getElementById(id);
}

var count=0;
for (var i=0;i<imgUrl.length;i++) {
if( (imgUrl[i]!="") && (imgText[i]!="")&& (imgLink[i]!="")&& (imgAlt[i]!="")) {
	count++;
} else {
	break;
}
}

//重写css
var each_width=Math.ceil((imgWidth-(count-1))/count);
var last_width=imgWidth-each_width*(count-1)-(count)+1;

function change(){
if (ver==1){//firefox中不会运行这一段
	with(flash$('f_img').filters[0]){
		Transition=1;
		apply();
		play(); 
	}
}
if (firstTime){ firstTime=false;timeOut=_timeOut_/1000;}
else{ 
	 now=(now>imgUrl.length-1)?0:now;
	 flash$('f_img').src=imgUrl[now];
	 flash$('f_img').alt=imgAlt[now];
	 flash$('f_imgLink').href=imgLink[now];
	 if (show_text) flash$('f_text').innerHTML=imgText[now];		
	 for (var i=0;i<count;i++) {
		flash$('b'+i).className="button";
		//flash$('f_menu'+i).className="";
	 }
	 try{//alert(now);
	 flash$('b'+now).className="on";
	 }
	 catch(err){
	 }	
	 //flash$('f_menu'+now).className="on";	 
	 now=(now>=imgUrl.length-1)?0:now+1;
	 timeOut=_timeOut_;		 
}
theTimer=setTimeout("change()", timeOut);
}
function b_change(num){
window.clearInterval(theTimer); 
now=num;
firstTime=false;
change();
}
//draw 渐变line （即css:f_line)
function draw_line(){
var div = document.createElement("div");	
div.id = 'f_line';
flash$('f_infoDiv').insertBefore(div,flash$('f_infoDiv').childNodes.item(0));			
}
//表现层 start	
//图片
var a = document.createElement("a");		
a.id="f_imgLink";
a.target=target;
a.href=imgLink[now];	
flash$('f_imgDiv').appendChild(a);

var img = document.createElement("img");	
img.id="f_img";
img.width=imgWidth;
img.height=imgHeight;
img.src=imgUrl[now];
img.alt=imgAlt[now];
a.appendChild(img);

//数字按钮
for (var i=count-1;i>=0;i--){
	var div_bg = document.createElement("div");		
	div_bg.id = 'div_bg'+i;
	div_bg.className='bg';
	flash$('f_buttonDiv').appendChild(div_bg);	
	var a = document.createElement("a");		
	a.id = 'b'+i;
	a.className =(i==now+1)?"button_on":"button_off";		
	a.title=imgAlt[i];
	a.innerHTML=i+1;
	a.href='javascript:b_change('+i+')';		
	flash$('div_bg'+i).appendChild(a);	
	var div= document.createElement("div");
	flash$('f_buttonDiv').appendChild(div);	
}

if (show_text) flash$('f_text').innerHTML = imgText[now];
//表现层 end
flash$('f_img').onmouseover=function(){window.clearInterval(theTimer);}
flash$('f_img').onmouseout=function(){theTimer=setTimeout("change()", timeOut2);}
try{  //滤镜版本
  new ActiveXObject("DXImageTransform.Microsoft.Fade");
  flash$('f_img').filters[0].play();	  
  ver=1;
  draw_line(); 
  }
catch (e){ver=2;}

var theTimer = setTimeout("change()", _timeOut_/1000);
//-->


