function tips_pop() {
	var MsgPop = document.getElementById("winpop");//获取窗口这个对象,即ID为winpop的对象
	var popH = parseInt(MsgPop.style.height);//用parseInt将对象的高度转化为数字,以方便下面比较
	//alert(popH)
	if (popH == 0) {         //如果窗口的高度是0
		MsgPop.style.display = "block";//那么将隐藏的窗口显示出来
		show = setInterval("changeH('up')", 2);//开始以每0.002秒调用函数changeH("up"),即每0.002秒向上移动一次
	} else {         //否则
		hide = setInterval("changeH('down')", 2);//开始以每0.002秒调用函数changeH("down"),即每0.002秒向下移动一次
	}
}
function changeH(str) {
	var MsgPop = document.getElementById("winpop");
	var popH = parseInt(MsgPop.style.height);
	if (str == "up") {     //如果这个参数是UP
		if (popH <= 170) {    //如果转化为数值的高度小于等于150
			MsgPop.style.height = (popH + 4).toString() + "px";//高度增加4个象素
		} else {
			clearInterval(show);//否则就取消这个函数调用,意思就是如果高度超过100象度了,就不再增长了
		}
	}
	if (str == "down") {
		if (popH >= 4) {       //如果这个参数是down
			MsgPop.style.height = (popH - 4).toString() + "px";//那么窗口的高度减少4个象素
		} else {        //否则
			clearInterval(hide);    //否则就取消这个函数调用,意思就是如果高度小于4个象度的时候,就不再减了
			MsgPop.style.display = "none";  //因为窗口有边框,所以还是可以看见1~2象素没缩进去,这时候就把DIV隐藏掉
		}
	}
}


//参数对象
var MYAPP={
	xdoc:null,
	timer:null,
	counter:0,
	changeSpeed:3,
	tableCount:0,
	currentTable:0,
	liNum:0,
	messageArray:null,
	tpi:'http://tpi.nlic.net.cn/tpi/sysasp/news/detail.asp?',
	filepath:'index6\\news.xml'
}
	 
function loadXml(){
	if (window.ActiveXObject){
		MYAPP.xdoc = new ActiveXObject("Microsoft.XMLDOM");
		MYAPP.xdoc.async=false;
		MYAPP.xdoc.load(MYAPP.filepath);
		getMessage();
	}
	else{	
		MYAPP.xdoc=document.implementation.createDocument("","",null);
        MYAPP.xdoc.load(MYAPP.filepath);
		MYAPP.xdoc.onload=getMessage; 
	}	
}
	
function getMessage(){
	MYAPP.tableCount=MYAPP.xdoc.getElementsByTagName("title").length;
	MYAPP.liNum=MYAPP.tableCount;
	MYAPP.messageArray=new Array(MYAPP.tableCount)
		//alert(MYAPP.xdoc.getElementsByTagName("content")[0].childNodes[0].text)
	for(var i=0;i<MYAPP.tableCount;i++){
		var url=MYAPP.xdoc.getElementsByTagName("url1")[i].childNodes[0];
		var message={
			title:MYAPP.xdoc.getElementsByTagName("title")[i].childNodes[0].nodeValue,
			content:MYAPP.xdoc.getElementsByTagName("content")[i].childNodes[0].nodeValue,
			url:MYAPP.xdoc.getElementsByTagName("url1")[i].childNodes[0]!=null?
				MYAPP.xdoc.getElementsByTagName("url1")[i].childNodes[0].nodeValue
				+'&'+
				MYAPP.xdoc.getElementsByTagName("url2")[i].childNodes[0].nodeValue:"",
			urlName:MYAPP.xdoc.getElementsByTagName("urlName")[i].childNodes[0]!=null?
				MYAPP.xdoc.getElementsByTagName("urlName")[i].childNodes[0].nodeValue:"",
			time:MYAPP.xdoc.getElementsByTagName("time")[i].childNodes[0]!=null?
				 MYAPP.xdoc.getElementsByTagName("time")[i].childNodes[0].nodeValue:"",
			author:MYAPP.xdoc.getElementsByTagName("author")[i].childNodes[0]!=null?
				MYAPP.xdoc.getElementsByTagName("author")[i].childNodes[0].nodeValue:""
		}
		MYAPP.messageArray[i]=message;
	}
	createUl();//创建下部选项条
	showTab(1);//初始页
}		
function start_autochange(){
	MYAPP.counter=MYAPP.counter+1;
	MYAPP.timer=setTimeout("start_autochange()",500);
	if(MYAPP.counter==MYAPP.changeSpeed+1){
		MYAPP.currentTable++;
		if(MYAPP.currentTable>MYAPP.tableCount){
			MYAPP.currentTable=1;
		}	
		showTab(MYAPP.currentTable);
		restart_autochange();
	}
}
function stop_autochange(){
	clearTimeout(MYAPP.timer);
	MYAPP.counter=0;
}
function restart_autochange(){
	clearTimeout(MYAPP.timer);
	MYAPP.counter=0;
	start_autochange();
}
	
function showTab(currentTable){
	for(var i=1;i<=MYAPP.liNum;i++){
		document.getElementById("link_"+i).className="";
		document.getElementById("msg_title").innerHTML="";
		document.getElementById("msg_content").innerHTML="";
	}
	//document.getElementById("test2").innerHTML=currentTable;
	document.getElementById("link_"+currentTable).className="tabactive"
	document.getElementById("msg_title").innerHTML=MYAPP.messageArray[currentTable-1].title;

	var content=MYAPP.messageArray[currentTable-1].content;
	var url=MYAPP.messageArray[currentTable-1].url;
	var urlName=MYAPP.messageArray[currentTable-1].urlName;
	var urlHtml='<a href='+MYAPP.tpi+url+' target=_blank>'+urlName+'</a>';
	var time="";
	var author="";
	if(MYAPP.messageArray[currentTable-1].time!=""){
		 time="<font style='font-size:12px;float:right;'>"+MYAPP.messageArray[currentTable-1].time+"</font><br>"
	}
	if(MYAPP.messageArray[currentTable-1].author!=""){
		 author="<font style='font-size:12px;float:right;'>"+MYAPP.messageArray[currentTable-1].author+"</font>";
	}
	document.getElementById("msg_content").innerHTML=content+urlHtml+"<br>"+time+author;
}

function createUl(){
	var ULObj=document.createElement("ul");
	for(var i=1;i<=MYAPP.liNum;i++){
	var LIObj=document.createElement("li");
	var AObj=document.createElement("a");
		AObj.id="link_"+i;
		AObj.innerHTML=i;
		AObj.setAttribute("onclick", "current(this);");
		AObj.onclick=function (){current(this)};
		LIObj.appendChild(AObj);
		AObj.setAttribute("onmouseover","javascript:alert(1)");
		AObj.onmouseover=function(){current(this)}
		AObj.setAttribute("onmouseout","restart_autochange()");
		AObj.onmouseout=restart_autochange;
		ULObj.appendChild(LIObj);
	}
	document.getElementById("menuList").appendChild(ULObj);
}
function current(obj){
		//alert(obj.innerHTML)
	showTab(obj.innerHTML)
	stop_autochange();
}
function initPopNews(){
	loadXml();
	start_autochange();//开始循环
}
	