﻿var pic=new Array();
var title=new Array();
var tar=new Array();
var i=0;

function makexml(dd){
    var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async = false;
    xmlDoc.loadXML(dd.responseText);
    var filed=xmlDoc.documentElement.getElementsByTagName("wustnews");
    for(k=0;k<filed.length;k++){
	    pic[k]=filed[k].selectSingleNode("src").text;
	    title[k]=filed[k].selectSingleNode("title").text;
	    tar[k]=filed[k].selectSingleNode("tar").text;
    }
    onAuto();
}

function changepic(id){
	document.getElementById("piccon").src=pic[id];  //修改图片
	document.getElementById("spantitle").innerHTML=title[id];    //修改标题
	document.getElementById("a_").href=tar[id];
	document.getElementById("a_t").href=tar[id];
	for(j=0;j<=4;j++){
		document.getElementById("div_"+j).style.backgroundColor="#DEDEDE";
	}
	document.getElementById("div_"+id).style.backgroundColor="#ffffff"; 
	i++;
}

function onStart(){

}

function onStop(){

}

function onAuto(){
	if(i==5){
		i=0;
	}
	changepic(i);
	window.setTimeout(onAuto,2000);
	
}

function err(o){
alert(o.responseText);
}