var timer;
function on_load()
{
	SetEven();
	Change_img_Even();
	init();//初始化显示第一张图片
}

function SetEven()
{
	var lilist=document.getElementById('lilist').getElementsByTagName('li');
	changeDiv(1);
	for(var i=0;i<lilist.length;i++)
	{
		(function(){
					  var p=i;
						  lilist[i]["onmouseover"]=function(){
							  if(lilist[p].className!='ch')
							  {
								 timer = window.setTimeout(function(){
									for(var j=0;j<lilist.length;j++)
									{
										lilist[j].className='';
									}
								  lilist[p].className='ch';
								  changeDiv(p+1);
								},100);
							 }
						  }
						  lilist[i]["onmouseout"]=function(){
							  clearInterval(timer);
						  }
		})();
	}
}

function Change_img_Even()
{
	var as=document.getElementById('news_top').getElementsByTagName('a');
	var li_list = document.getElementById('news_top').getElementsByTagName('li')
	for(var i=0;i<as.length;i++)
	{
		(function(){
					  var p=i;
						  as[i]["onmouseover"]=function(){
							  if(as[p].className!='ch')
							  {
								 timer = window.setTimeout(function(){
																	
									for(var j=0;j<li_list.length;j++)
									{
										li_list[j].className='';
									}
								  li_list[p].className='ch';
								  document.getElementById('big_img').src = as[p].name;
								  document.getElementById('big_img_a').href = as[p].href;
								},100);
							 }
						  }
						  as[i]["onmouseout"]=function(){
							  clearInterval(timer);
						  }
		})();
	}
}


function changeDiv(p)
{
 	var xmlDoc=new ActiveXObject('Microsoft.XMLDOM');
	var carsdiv=document.getElementById('carsdiv');
	carsdiv.innerHTML='';
	xmlDoc.async="false";
	xmlDoc.load("/xml/bianji/yangchefy.xml");
	var nodes=xmlDoc.getElementsByTagName('Table'+p)[0].childNodes;
	for(var i=0;i<nodes.length;i++)
	{
		carsdiv.innerHTML+='<ul><li class="td1">'+getValue(nodes[i],'cars_name')+'</li><li class="td2">'+getValue(nodes[i],'address')+'</li><li class="td3">'+getValue(nodes[i],'price')+'/月</li><li><a href='+getValue(nodes[i],'url')+' target="_blank">详细</a></li></ul>';
	}
}

function init()
{
	var li = document.getElementById('news_top').getElementsByTagName('li')[0];
	var a = document.getElementById('news_top').getElementsByTagName('a')[0];
	document.getElementById('big_img').src = a.name;
	li.className = 'ch';
	document.getElementById('big_img_a').href = a.href;
}

function getValue(node,id){
	if(!node){ return null; }
	var value;
	value = node.getElementsByTagName(id)[0].text;
	if(!value){
		value = node.getElementsByTagName(id)[0].textContent;
	}
	return value;
}

