
function Index_RightAdvertise_Load(xmlpathname)
{
	//将右边广告文件装入数组中,并将其返回
	var xmlfile = new ActiveXObject("MSXML.DOMDocument");
	xmlfile.async = false;
	xmlfile.load(xmlpathname);
	var xmlitem = xmlfile.getElementsByTagName("item");
	if(!xmlitem){return false;}
	var advertise=new Array(xmlitem.length);
	var tmp;
	for(var i=0,len=advertise.length;i<len;i++)
	{
		advertise[i]=new _adItem(xmlitem.item(i).getAttribute("img"), xmlitem.item(i).getAttribute("url"),xmlitem.item(i).getAttribute("title"),xmlitem.item(i).getAttribute("kind"));
	}
	return advertise;
}

function _adItem(img,url,title,kind)
{
	this.img=img;		//图片或flash;
	this.url=url;		//链接地址,如果是flash,请将链接做在flash里
	this.title=title;
	this.kind=kind;
}

function Index_RightAdvertise_Show(advertise,id)
{
	//将广告内容显示在id所指对象中
	var obj=document.getElementById(id);
	if(!obj){return false;}
	
	var tmp="";
	obj.innerHTML="";
	var adItem;
	for(var i=0,len=advertise.length;i<len;i++)
	{
		adItem=document.createElement("div");
		if(i==len-1)
		{
			//最后一个广告
			adItem.style.cssText="clear:both; WIDTH:120px; border:1px solid #CCCCCC;border-top:1px dashed #ccc";
		}
		else 
		{
			if(i==0)
			{
				//第一个广告
				adItem.style.cssText="clear:both;Width:120px;border:1px solid #ccc;border-bottom:none";
			}
			else
			{	
				//其他位置的广告
				adItem.style.cssText="clear:both;Width:120px;border:1px solid #ccc;border-top:1px dashed #ccc;border-bottom:none";
			}
		}
		obj.appendChild(adItem);
		
		tmp="<div style=' margin-left:3px; margin-top:2px; margin-right:6px; width:120' align=center>";
		if(advertise[i].kind==1)
		{		
			//如果是flash
			tmp+="<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000  codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0  height=48 width=120>";
			tmp+=" <param name='movie' value='http://www.alu.cn/templist/"+advertise[i].img+"'>";
			tmp+="<param name='quality' value='high'>";
			tmp+="<param name='wmode' value='opaque' >";
			tmp+="<embed src='http://www.alu.cn/templist/"+advertise[i].img+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='120'  height='48'></embed> </object>";
		}
		else
		{
			tmp+="<img src='http://www.alu.cn/templist/"+advertise[i].img+"' width='120' />";
		}
		
		tmp+="</div> <div style=' margin-left:4px;margin-bottom:1px; margin-top:1px; margin-right:6px;  width:120; background-color:#f4f4f4' align=center>"+advertise[i].title+"</div> </div>";
		
		adItem.innerHTML=tmp;		
	}
}

