// JavaScript Document
//js模板标记类
////////////////////////////////////////////////////////////////////////////////////////

//当前页
var iaThisPage=document.location.href.substring(document.location.href.indexOf('/',7));
//判断是否是IE
//var ua = navigator.userAgent.toLowerCase();
//var isIE = (ua.indexOf('msie') >= 0 && ua.indexOf('opera') < 0);

//alert(iaThisPage);
////////////////////////////////////////////////////////////////////////////////////////


//数据类
////////////////////////////////////////////////////////////////////////////////////////

//菜单
/**************************************************************************************/
function TopMenu(ID,LineNum){
	this.ID=ID;
	this.htmlCode=document.getElementById(this.ID).outerHTML;
	this.LineNum=LineNum;
	this.LineSplit='</tr><tr>';
	this.TagBegin='<!--TopMenu-->';
	this.TagEnd='<!--/TopMenu-->';
	this.Items=new Array();
	this.translate=TranslateTopMenu;
	this.draw=DrawTopMenu;
}

function TopMenuItem(Title,Url,Parameter,Target){
	this.Tag='<!--TopMenuItem-->';
	this.Title=Title;
	this.Url=Url;
	this.Parameter=(Parameter==null)?'':'?'+Parameter;
	this.Target=(Target==null)?'_self':this.Target=Target;
	this.htmlCode=(iaThisPage.indexOf(this.Url)!=-1)?this.Title:'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">'+this.Title+'</a>';	
}

function TranslateTopMenu(){
	var sHtml='';
	var sHead=this.htmlCode.substring(0,this.htmlCode.indexOf(this.TagBegin));
	var sBody=this.htmlCode.substring(this.htmlCode.indexOf(this.TagBegin)+this.TagBegin.length,this.htmlCode.indexOf(this.TagEnd));
	var sTail=this.htmlCode.substring(this.htmlCode.indexOf(this.TagEnd)+this.TagEnd.length);
	for(var i=0;i<this.Items.length;i++){
		sHtml+=sBody.replace(this.Items[i].Tag,this.Items[i].htmlCode);
		if((i+1)%Math.round(this.Items.length/this.LineNum)==0)
			sHtml+=this.LineSplit;
	}
	sHtml=sHead+sHtml+sTail;
	this.htmlCode=sHtml;
}

function DrawTopMenu(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;
}
/**************************************************************************************/
//当前位置
function Path(ID){
	this.ID=ID;
	this.Tag='<!--Path-->';
	this.htmlCode=document.getElementById(ID).innerHTML;
	this.Points=new Array();
	this.translate=TranslatePath;
	this.draw=DrawPath;
}

function Point(Title,Url,Parameter,Target){
	this.Title=Title;
	this.Url=Url;
	this.Parameter=(Parameter==null)?'':'?'+Parameter;
	this.Target=(Target==null)?'_self':this.Target=Target;
	this.htmlCode=(this.Url==null)?this.Title:'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">'+this.Title+'</a>';
}

function TranslatePath(){
	var sHtml='';
	for(var i=0;i<this.Points.length;i++){
		sHtml='&nbsp;>&nbsp;'+this.Points[i].htmlCode+sHtml;
	}
	this.htmlCode=this.htmlCode.replace(this.Tag,sHtml);
}

function DrawPath(){
	document.getElementById(this.ID).innerHTML=this.htmlCode;
}
/**************************************************************************************/

//栏目
/**************************************************************************************/
function Columns(ID,Title,Url,Parameter,Target){
	this.ID=ID;
	this.Title=Title;
	this.Url=Url;
	this.LineNum=-1;
	this.LineSplit='';
	this.Parameter=(Parameter==null)?'':'?'+Parameter;
	this.Target=(Target==null)?'_self':this.Target=Target;
	this.TagBegin='<!--Columns-->';
	this.TagEnd='<!--/Columns-->';
	this.TagTitle='<!--RootColumnTitle-->';
	this.TagMoreLinkBegin='<!--RootColumnLink-->';
	this.TagMoreLinkEnd='<!--/RootColumnLink-->';
	this.htmlCode=document.getElementById(ID).outerHTML;
	this.Columns=new Array();
	this.translate=TranslateColumns;
	this.draw=DrawColumns;
}

function TranslateColumns(){
	this.htmlCode=this.htmlCode.replace(this.TagTitle,this.Title);
	this.htmlCode=this.htmlCode.replace(this.TagMoreLinkBegin,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">');
	this.htmlCode=this.htmlCode.replace(this.TagMoreLinkEnd,'</a>');
	if(this.htmlCode.indexOf(this.TagBegin)!=-1){
		var sHtml='';
		var sHead=this.htmlCode.substring(0,this.htmlCode.indexOf(this.TagBegin));
		var sBody=this.htmlCode.substring(this.htmlCode.indexOf(this.TagBegin)+this.TagBegin.length,this.htmlCode.indexOf(this.TagEnd));
		var sTail=this.htmlCode.substring(this.htmlCode.indexOf(this.TagEnd)+this.TagEnd.length);
		for(var i=0;i<this.Columns.length;i++){
			this.Columns[i].htmlCode=sBody;
			this.Columns[i].translate();
			sHtml+=this.Columns[i].htmlCode;
			if(this.LineNum!=-1)
				if((i+1)%this.LineNum==0)
					sHtml+=this.LineSplit;
		}
		sHtml=sHead+sHtml+sTail;
		this.htmlCode=sHtml;
	}
}

function DrawColumns(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;
}

function Column(ID,Title,Url,Parameter,Target){
	this.ID=ID;
	this.Title=(Title==null)?'':Title;
	this.Url=(Url==null)?'':Url;
	this.LineNum=-1;
	this.LineSplit='';
	this.Parameter=(Parameter==null)?'':'?'+Parameter;
	this.Target=(Target==null)?'_self':this.Target=Target;
	this.TagBegin='<!--ColumnData-->';
	this.TagEnd='<!--/ColumnData-->';
	this.TagTitle='<!--ColumnTitle-->';
	this.TagMoreLinkBegin='<!--ColumnLink-->';
	this.TagMoreLinkEnd='<!--/ColumnLink-->';
	this.TagPage='<!--ColumnDataPage-->';
	this.htmlCode=(ID==null)?'':document.getElementById(ID).outerHTML;
	this.DataSet=new Array();
	this.Page=null;
	this.translate=TranslateColumn;
	this.draw=DrawColumn;
}

function TranslateColumn(){
	if(this.htmlCode.indexOf(this.TagBegin)!=-1){
		var sHtml='';
		var sHead=this.htmlCode.substring(0,this.htmlCode.indexOf(this.TagBegin));
		var sBody=this.htmlCode.substring(this.htmlCode.indexOf(this.TagBegin)+this.TagBegin.length,this.htmlCode.lastIndexOf(this.TagEnd));
		var sTail=this.htmlCode.substring(this.htmlCode.lastIndexOf(this.TagEnd)+this.TagEnd.length);
		sHead=sHead.replace(this.TagTitle,this.Title);
		sHead=sHead.replace(this.TagMoreLinkBegin,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">');
		sHead=sHead.replace(this.TagMoreLinkEnd,'</a>');
		if(this.Page!=null)
			sHead=sHead.replace(this.TagPage,this.Page.htmlCode);		
		sTail=sTail.replace(this.TagTitle,this.Title);
		sTail=sTail.replace(this.TagMoreLinkBegin,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">');
		sTail=sTail.replace(this.TagMoreLinkEnd,'</a>');
		if(this.Page!=null)
			sTail=sTail.replace(this.TagPage,this.Page.htmlCode);
		for(var i=0;i<this.DataSet.length;i++){
			this.DataSet[i].htmlCode=sBody;
			if(this.LineSplit.length>1){
				if(this.LineNum!=-1)
					if((i)%this.LineNum==0)
						sHtml+=this.LineSplit;
				}
			this.DataSet[i].translate();
			sHtml+=this.DataSet[i].htmlCode;
		}
		sHtml=sHead+sHtml+sTail;
		this.htmlCode=sHtml;
	}else{
		this.htmlCode=this.htmlCode.replace(this.TagTitle,this.Title);
		this.htmlCode=this.htmlCode.replace(this.TagMoreLinkBegin,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">');
		this.htmlCode=this.htmlCode.replace(this.TagMoreLinkEnd,'</a>');
		if(this.Page!=null)
			this.htmlCode=this.htmlCode.replace(this.TagPage,this.Page.htmlCode);
	}
}

function DrawColumn(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;
}

/**************************************************************************************/

//搜索
function Search(ID){
	this.ID=ID;
	this.TagType='<!--SearchType-->';
	this.TagBegin='<!--ResultData-->';
	this.TagEnd='<!--/ResultData-->';
	this.TagPage='<!--ResultDataPage-->';	
	this.Types=new Array();
	this.DataSet=new Array();
	this.Page=null;
	this.htmlCode=document.getElementById(ID).outerHTML;
	this.translate=TranslateSearch;
	this.draw=DrawSearch;
}

function SearchType(ID,Name){
	this.ID=ID;
	this.Name=Name;
	this.htmlCode='<option value="'+ID+'">'+Name+'</option>\n';
}

function SearchData(Title,Url,Target,ID,Picture,Content,PubDate,Url,Parameter,ColumnID,ColumnName,ColumnUrl){
	this.htmlCode='';
	this.Title=Title;
	this.Url=Url;	
	this.Target=(Target==null)?'_self':this.Target=Target;
	this.TagLink='<!--DataLink-->';
	
	
	this.Picture=Picture;
	this.Content=(Content==null)?'':Content;
	this.PubDate=PubDate;
	this.Parameter=(Parameter==null)?'':'?'+Parameter;	
	this.ColumnID=ColumnID;
	this.ColumnLink=(ColumnID==null)?'':'<a href="'+ColumnUrl+'?column='+ColumnID+'">'+ColumnName+'</a>';
	this.TagDate='<!--InfoDate-->';
	this.TagColumnLink='<!--InfoColumnLink-->';
	this.htmlCode=(ID==null)?'':document.getElementById(ID).outerHTML;	
	this.translate=TranslateSearchData;
}

function TranslateSearchData(){

	if(this.PubDate!=null) this.htmlCode=this.htmlCode.replace(this.TagDate,this.PubDate);
	if(this.ColumnID!=null)
		this.htmlCode=this.htmlCode.replace(this.TagColumnLink,this.ColumnLink);
	this.htmlCode=this.htmlCode.replace(this.TagLink,'<a href="'+this.Url+'" target="'+this.Target+'">'+this.Title+'</a>\n');
}

function TranslateSearch(){
	var sHtml='';
	sHtml+='<select name="type">\n';
	for(var i=0;i<this.Types.length;i++){
		sHtml+=this.Types[i].htmlCode;
	}
	sHtml+='</select>\n'
	this.htmlCode=this.htmlCode.replace(this.TagType,sHtml);
	if(this.Page!=null) this.htmlCode=this.htmlCode.replace(this.TagPage,this.Page.htmlCode);
	if(this.htmlCode.indexOf(this.TagBegin)!=-1){
		sHtml='';
		var sHead=this.htmlCode.substring(0,this.htmlCode.indexOf(this.TagBegin));
		var sBody=this.htmlCode.substring(this.htmlCode.indexOf(this.TagBegin)+this.TagBegin.length,this.htmlCode.lastIndexOf(this.TagEnd));
		var sTail=this.htmlCode.substring(this.htmlCode.lastIndexOf(this.TagEnd)+this.TagEnd.length);
		for(var i=0;i<this.DataSet.length;i++){
			this.DataSet[i].htmlCode=sBody;
			this.DataSet[i].translate();
			sHtml+=this.DataSet[i].htmlCode;
		}
		sHtml=sHead+sHtml+sTail;
		this.htmlCode=sHtml;
	}
}
function DrawSearch(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;
}

/**************************************************************************************/


//新闻
/**************************************************************************************/
function Info(ID,Title,Picture,Content,PubDate,Url,Parameter,Target,ColumnID,ColumnName,ColumnUrl){
	
	this.ID=ID;
	this.Title=Title;
	this.Picture=Picture;
	this.Content=(Content==null)?'':Content;
	this.PubDate=PubDate;
	this.Url=Url;
	this.Parameter=(Parameter==null)?'':'?'+Parameter;	
	this.Target=(Target==null)?'_self':this.Target=Target;
	this.ColumnID=ColumnID;
	this.ColumnLink=(ColumnID==null)?'':'<a href="'+ColumnUrl+'?column='+ColumnID+'">'+ColumnName+'</a>';
	this.TagTitle='<!--InfoTitle-->';
	this.TagDate='<!--InfoDate-->';
	this.TagPicture='<!--Picture-->';
	this.TagContent='<!--InfoContent-->';
	this.TagBrowseLink='<!--InfoBrowseLink-->';
	this.TagMoreBegin='<!--InfoMoreLink-->';
	this.TagMoreEnd='<!--/InfoMoreLink-->';
	this.TagColumnLink='<!--InfoColumnLink-->';
	this.htmlCode=(ID==null)?'':document.getElementById(ID).outerHTML;
	this.translate=TranslateInfo;
	this.draw=DrawInfo;
}

function TranslateInfo(){
	this.htmlCode=this.htmlCode.replace(this.TagTitle,this.Title);
	if(this.PubDate!=null)
		this.htmlCode=this.htmlCode.replace(this.TagDate,this.PubDate);
	if(this.Content!=null)
		this.htmlCode=this.htmlCode.replace(this.TagContent,this.Content);
	this.htmlCode=this.htmlCode.replace(this.TagMoreBegin,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">');
	this.htmlCode=this.htmlCode.replace(this.TagMoreEnd,'</a>');
	if(this.Picture!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPicture,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">'+this.Picture+'</a>');
	if(this.Url!=null)
		this.htmlCode=this.htmlCode.replace(this.TagBrowseLink,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">'+this.Title+'</a>');
	if(this.ColumnID!=null&&this.ColumnID!='')
		this.htmlCode=this.htmlCode.replace(this.TagColumnLink,this.ColumnLink);
}

function DrawInfo(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;	
}
/**************************************************************************************/

//论文
/**************************************************************************************/
function Paper(ID,Title,Abstract,Content,Author,Keyword,Reference,Issue,Publish,Pubdate,Url,Parameter,Target){
	this.ID=ID;
	this.Title=Title;
	this.Abstract=Abstract;
	this.Content=Content;
	this.Author=Author;
	this.Keyword=Keyword;
	this.Reference=Reference;
	this.Issue=Issue;
	this.Publish=Publish;
	this.Pubdate=Pubdate;
	this.Url=Url;
	this.Parameter=(Parameter==null)?'':'?'+Parameter;
	this.Target=(Target==null)?'_self':this.Target=Target;

	this.TagTitle='<!--PaperTitle-->';
	this.TagAbstract='<!--PaperAbstract-->';
	this.TagContent='<!--PaperContent-->';
	this.TagAuthor='<!--PaperAuthor-->';
	this.TagKeyword='<!--PaperKeyword-->';
	this.TagReference='<!--PaperReference-->';
	this.TagIssue='<!--PaperIssue-->';
	this.TagPublish='<!--PaperPublish-->';
	this.TagPubdate='<!--PaperPubdate-->';
	this.TagBrowseLink='<!--PaperBrowseLink-->';
	this.htmlCode=(ID==null)?'':document.getElementById(ID).outerHTML;
	this.translate=TranslatePaper;
	this.draw=DrawPaper;
}

function TranslatePaper(){
	this.htmlCode=this.htmlCode.replace(this.TagTitle,this.Title);
	if(this.Abstract!=null)
		this.htmlCode=this.htmlCode.replace(this.TagAbstract,this.Abstract);
	if(this.Content!=null)
		this.htmlCode=this.htmlCode.replace(this.TagContent,this.Content);
	if(this.Author!=null)
		this.htmlCode=this.htmlCode.replace(this.TagAuthor,this.Author);
	if(this.Keyword!=null)
		this.htmlCode=this.htmlCode.replace(this.TagKeyword,this.Keyword);
	if(this.Reference!=null)
		this.htmlCode=this.htmlCode.replace(this.TagReference,this.Reference);
	if(this.Issue!=null)
		this.htmlCode=this.htmlCode.replace(this.TagIssue,this.Issue);
	if(this.Publish!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPublish,this.Publish);
	if(this.Pubdate!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPubdate,this.Pubdate);
	if(this.Url!=null)
		this.htmlCode=this.htmlCode.replace(this.TagBrowseLink,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">'+this.Title+'</a>');
}

function DrawPaper(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;
}
/**************************************************************************************/

//获奖情况
/**************************************************************************************/
function Prize(ID,Name,Year,Sponsor,PersonList,Reason,Url,Parameter,Target){
	this.ID=ID;
	this.Name=Name;
	this.Year=Year;	
	this.Sponsor=Sponsor;
	this.PersonList=PersonList;
	this.Reason=(Reason==null)?'':Reason;
	this.Url=Url;
	this.Parameter=(Parameter==null)?'':'?'+Parameter;
	this.Target=(Target==null)?'_self':this.Target=Target;
	
	this.TagName='<!--PrizeName-->';
	this.TagYear='<!--PrizeYear-->';	
	this.TagSponsor='<!--PrizeSponsor-->';
	this.TagPersonList='<!--PrizePersonList-->';
	this.TagReason='<!--PrizeReason-->';
	this.TagBrowseLink='<!--PrizeBrowseLink-->';
	this.htmlCode=(ID==null)?'':document.getElementById(ID).outerHTML;
	this.translate=TranslatePrize;
	this.draw=DrawPrize;
}

function TranslatePrize(){
	this.htmlCode=this.htmlCode.replace(this.TagName,this.Name);
	if(this.Year!=null)
		this.htmlCode=this.htmlCode.replace(this.TagYear,this.Year);
	if(this.Sponsor!=null)
		this.htmlCode=this.htmlCode.replace(this.TagSponsor,this.Sponsor);
	if(this.PersonList!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPersonList,this.PersonList);
	if(this.Reason!=null)
		this.htmlCode=this.htmlCode.replace(this.TagReason,this.Reason);
	if(this.Url!=null)
		this.htmlCode=this.htmlCode.replace(this.TagBrowseLink,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">'+this.Name+'</a>');
}

function DrawPrize(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;
}
/**************************************************************************************/

//专利
/**************************************************************************************/
function Patent(ID,PatentID,Num,Name,PatentDomain,PatentBrief,PatentDept,PatentDeptID,PatentPerson,PatentPersonID,Url,Parameter,Target){
	this.ID=ID;
	this.PatentID=PatentID;
	this.Num=Num;
	this.Name=Name;
	this.PatentDomain=PatentDomain;
	this.PatentDept=PatentDept;
	this.PatentDeptID=PatentDeptID;
	this.PatentPerson=PatentPerson;
	this.PatentPersonID=PatentPersonID;
	this.PatentBrief=(PatentBrief==null)?'':PatentBrief;
	this.Url=Url;
	this.Parameter=(Parameter==null)?'':'?'+Parameter;
	this.Target=(Target==null)?'_self':this.Target=Target;
	
	this.TagName='<!--PatentName-->';
	this.TagID='<!--PatentID-->';
	this.TagNum='<!--PatentNum-->';	
	this.TagDomain='<!--PatentDomain-->';
	this.TagDept='<!--PatentDept-->';
	this.TagDeptID='<!--PatentDeptID-->';
	this.TagPerson='<!--PatentPerson-->';
	this.TagPersonID='<!--PatentPersonID-->';
	this.TagBrief='<!--PatentBrief-->';
	this.TagBrowseLink='<!--PatentBrowseLink-->';
	this.htmlCode=(ID==null)?'':document.getElementById(ID).outerHTML;
	this.translate=TranslatePatent;
	this.draw=DrawPatent;
}

function TranslatePatent(){
	this.htmlCode=this.htmlCode.replace(this.TagName,this.Name);
	if(this.PatentID!=null)
		this.htmlCode=this.htmlCode.replace(this.TagID,this.PatentID);
	if(this.Num!=null)
		this.htmlCode=this.htmlCode.replace(this.TagNum,this.Num);
	if(this.PatentDomain!=null)
		this.htmlCode=this.htmlCode.replace(this.TagDomain,this.PatentDomain);
	if(this.PatentDept!=null)
		this.htmlCode=this.htmlCode.replace(this.TagDept,this.PatentDept);
	if(this.PatentDeptID!=null)
		this.htmlCode=this.htmlCode.replace(this.TagDeptID,this.PatentDeptID);
	if(this.PatentPerson!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPerson,this.PatentPerson);
	if(this.PatentPersonID!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPersonID,this.PatentPersonID);
	if(this.PatentBrief!=null)
		this.htmlCode=this.htmlCode.replace(this.TagBrief,this.PatentBrief);
	if(this.Url!=null)
		this.htmlCode=this.htmlCode.replace(this.TagBrowseLink,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">'+this.Name+'</a>');
}

function DrawPatent(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;
}
/**************************************************************************************/
//产品
/**************************************************************************************/
function Product(ID,ProductID,Name,ProductBrief,ProductFuture,ProductPartnerStyle,ProductLinkMan,ProductLinkManID,ProductDept,ProductDeptID,ProductPhone,ProductFax,ProductEmail,ProductAddress,ProductPostcode,Year,Url,Parameter,Target){
	this.ID=ID;
	this.ProductID=ProductID;
	this.Name=Name;
	this.ProductBrief=(ProductBrief==null)?'':ProductBrief;
	this.ProductFuture=(ProductFuture==null)?'':ProductFuture;
	this.ProductPartnerStyle=(ProductPartnerStyle==null)?'':ProductPartnerStyle;
	this.ProductLinkMan=ProductLinkMan;
	this.ProductLinkManID=ProductLinkManID;
	this.ProductDept=ProductDept;
	this.ProductDeptID=ProductDeptID;
	this.ProductPhone=ProductPhone;
	this.ProductFax=ProductFax;
	this.ProductEmail=ProductEmail;
	this.ProductAddress=ProductAddress;
	this.ProductPostcode=ProductPostcode;
	this.Year=Year;
	this.Url=Url;
	this.Parameter=(Parameter==null)?'':'?'+Parameter;
	this.Target=(Target==null)?'_self':this.Target=Target;
	
	this.TagProductID='<!--ProductID-->';
	this.TagName='<!--ProductName-->';
	this.TagBrief='<!--ProductBrief-->';	
	this.TagFuture='<!--ProductFuture-->';
	this.TagPartnerStyle='<!--ProductPartnerStyle-->';
	this.TagLinkMan='<!--ProductLinkMan-->';
	this.TagLinkManID='<!--ProductLinkManID-->';
	this.TagDept='<!--ProductDept-->';
	this.TagDeptID='<!--ProductDeptID-->';
	this.TagPhone='<!--ProductPhone-->';
	this.TagFax='<!--ProductFax-->';
	this.TagEmail='<!--ProductEmail-->';
	this.TagAddress='<!--ProductAddress-->';
	this.TagPostcode='<!--ProductPostcode-->';
	this.TagYear='<!--ProductYear-->';
	this.TagBrowseLink='<!--ProductBrowseLink-->';
	this.htmlCode=(ID==null)?'':document.getElementById(ID).outerHTML;
	this.translate=TranslateProduct;
	this.draw=DrawProduct;
}

function TranslateProduct(){
	this.htmlCode=this.htmlCode.replace(this.TagProductID,this.ProductID);
	if(this.Name!=null)
		this.htmlCode=this.htmlCode.replace(this.TagName,this.Name);
	if(this.ProductBrief!=null)
		this.htmlCode=this.htmlCode.replace(this.TagBrief,this.ProductBrief);
	if(this.ProductFuture!=null)
		this.htmlCode=this.htmlCode.replace(this.TagFuture,this.ProductFuture);
	if(this.ProductPartnerStyle!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPartnerStyle,this.ProductPartnerStyle);
	if(this.ProductLinkMan!=null)
		this.htmlCode=this.htmlCode.replace(this.TagLinkMan,this.ProductLinkMan);
	if(this.ProductLinkManID!=null)
		this.htmlCode=this.htmlCode.replace(this.TagLinkManID,this.ProductLinkManID);
	if(this.ProductDept!=null)
		this.htmlCode=this.htmlCode.replace(this.TagDept,this.ProductDept);
	if(this.ProductDeptID!=null)
		this.htmlCode=this.htmlCode.replace(this.TagProductDeptID,this.ProductDeptID);
	if(this.ProductPhone!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPhone,this.ProductPhone);
	if(this.ProductFax!=null)
		this.htmlCode=this.htmlCode.replace(this.TagFax,this.ProductFax);
	if(this.ProductEmail!=null)
		this.htmlCode=this.htmlCode.replace(this.TagEmail,this.ProductEmail);
	if(this.ProductAddress!=null)
		this.htmlCode=this.htmlCode.replace(this.TagAddress,this.ProductAddress);
	if(this.ProductPostcode!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPostcode,this.ProductPostcode);
	if(this.Year!=null)
		this.htmlCode=this.htmlCode.replace(this.TagYear,this.Year);
	if(this.Url!=null)
		this.htmlCode=this.htmlCode.replace(this.TagBrowseLink,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">'+this.Name+'</a>');
}

function DrawProduct(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;
}
/**************************************************************************************/

//课题
/**************************************************************************************/
function Subject(ID,Name,Brief,Leader,LeaderID,Dept,DeptID,Type,Participator,Start,End,Url,Parameter,Target){
	this.ID=ID;
	this.Name=Name;
	this.Brief=Brief;
	this.Leader=Leader;	
	this.LeaderID=LeaderID;
	this.Dept=Dept;
	this.DeptID=DeptID;
	this.Type=Type;
	this.Participator=Participator;
	this.Start=Start;
	this.End=End;
	this.Url=Url;
	this.Parameter=(Parameter==null)?'':'?'+Parameter;
	this.Target=(Target==null)?'_self':this.Target=Target;
	
	this.TagName='<!--SubjectName-->';
	this.TagBrief='<!--SubjectBrief-->';	
	this.TagLeader='<!--SubjectLeader-->';
	this.TagLeaderID='<!--SubjectLeaderID-->';
	this.TagDept='<!--SubjectDept-->';
	this.TagDeptID='<!--SubjectDeptID-->';
	this.TagType='<!--SubjectType-->';
	this.TagParticipator='<!--SubjectParticipator-->';
	this.TagStart='<!--SubjectStart-->';
	this.TagEnd='<!--SubjectEnd-->';
	this.TagBrowseLink='<!--SubjectBrowseLink-->';
	this.htmlCode=(ID==null)?'':document.getElementById(ID).outerHTML;
	this.translate=TranslateSubject;
	this.draw=DrawSubject;
}

function TranslateSubject(){
	this.htmlCode=this.htmlCode.replace(this.TagName,this.Name);
	if(this.Brief!=null)
		this.htmlCode=this.htmlCode.replace(this.TagBrief,this.Brief);
	if(this.Leader!=null)
		this.htmlCode=this.htmlCode.replace(this.TagLeader,this.Leader);
	if(this.LeaderID!=null)
		this.htmlCode=this.htmlCode.replace(this.TagLeaderID,this.LeaderID);
	if(this.Dept!=null)
		this.htmlCode=this.htmlCode.replace(this.TagDept,this.Dept);
	if(this.DeptID!=null)
		this.htmlCode=this.htmlCode.replace(this.TagDeptID,this.DeptID);
	if(this.Type!=null)
		this.htmlCode=this.htmlCode.replace(this.TagType,this.Type);
	if(this.Participator!=null)
		this.htmlCode=this.htmlCode.replace(this.TagParticipator,this.Participator);
	if(this.Start!=null)
		this.htmlCode=this.htmlCode.replace(this.TagStart,this.Start);
	if(this.End!=null)
		this.htmlCode=this.htmlCode.replace(this.TagEnd,this.End);
	if(this.Url!=null)
		this.htmlCode=this.htmlCode.replace(this.TagBrowseLink,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">'+this.Name+'</a>');
}

function DrawSubject(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;
}
/**************************************************************************************/
//组织机构
/**************************************************************************************/
function Organization(ID,Name,Brief,Pathy,Picture,Path,Url,Parameter,Target){
	this.ID=ID;
	this.Name=Name;
	this.Brief=Brief;
	this.Pathy=Pathy;
	this.Picture=Picture;
	this.Path=Path;
	this.Url=Url;
	this.Parameter=(Parameter==null)?'':'?'+Parameter;
	this.Target=(Target==null)?'_self':this.Target=Target;
	
	this.TagBegin='<!--OrganData-->';
	this.TagEnd='<!--/OrganData-->';
	this.TagName='<!--OrganName-->';
	this.TagBrief='<!--OrganBrief-->';
	this.TagPathy='<!--OrganPathy-->';
	this.TagPicture='<!--OrganPicture-->';
	this.TagPath='<!--OrganPath-->';
	this.TagBrowseLink='<!--OrganBrowseLink-->';
	this.htmlCode=(ID==null)?'':document.getElementById(ID).outerHTML;
	this.translate=TranslateOrganization;
	this.draw=DrawOrganization;
}

function TranslateOrganization(){
	this.htmlCode=this.htmlCode.replace(this.TagName,this.Name);
	if(this.Brief!=null)
		this.htmlCode=this.htmlCode.replace(this.TagBrief,this.Brief);
	if(this.Pathy!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPathy,'<a href="'+this.Pathy+'" target="_blank">'+this.Pathy+'</a>');
	if(this.Picture!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPicture,this.Picture);
	if(this.Path!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPath,this.Path);
	if(this.Url!=null)
		this.htmlCode=this.htmlCode.replace(this.TagBrowseLink,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">'+this.Name+'</a>');
	if(this.htmlCode.indexOf(this.TagBegin)!=-1){
		sHtml='';
		var sHead=this.htmlCode.substring(0,this.htmlCode.indexOf(this.TagBegin));
		var sBody=this.htmlCode.substring(this.htmlCode.indexOf(this.TagBegin)+this.TagBegin.length,this.htmlCode.lastIndexOf(this.TagEnd));
		var sTail=this.htmlCode.substring(this.htmlCode.lastIndexOf(this.TagEnd)+this.TagEnd.length);
		for(var i=0;i<this.DataSet.length;i++){
			this.DataSet[i].htmlCode=sBody;
			this.DataSet[i].translate();
			sHtml+=this.DataSet[i].htmlCode;
		}
		sHtml=sHead+sHtml+sTail;
		this.htmlCode=sHtml;
	}
}

function DrawOrganization(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;
}

/**************************************************************************************/
//人员库
/**************************************************************************************/
function Person(ID,Name,Sex,Title,Brief,Photo,Direction,Education,Work,Achievement,Email,Website,Url,Parameter,Target,Post,Rank,Organ){
	this.ID=ID;
	this.Name=Name;
	//this.Sex=Sex;
	this.Sex=(Sex==null)?'':(Sex?'男':'女');
	this.Title=Title;
	this.Brief=Brief;
	this.Photo=Photo;
	this.Direction=Direction;
	this.Education=Education;
	this.Work=Work;
	this.Achievement=Achievement;
	this.Post=Post;
	this.Rank=Rank;
	this.Organ=Organ;
	this.Url=Url;
	this.Parameter=(Parameter==null)?'':'?'+Parameter;
	this.Target=(Target==null)?'_self':this.Target=Target;
	this.Email=(Email=='')?'':'<a href="mailto:'+Email+'">'+Email+'</a>';
	this.Website=(Website=='')?'':'<a href="'+Website+'" target="_blank">'+Website+'</a>';
	this.TagName='<!--PersonName-->';
	this.TagSex='<!--PersonSex-->';
	this.TagTitle='<!--PersonTitle-->';
	this.TagBrief='<!--PersonBrief-->';
	this.TagPhoto='<!--PersonPhoto-->';
	this.TagDirection='<!--PersonDirection-->';
	this.TagEducation='<!--PersonEducation-->';
	this.TagWork='<!--PersonWork-->';
	this.TagAchievement='<!--PersonAchievement-->';
	this.TagEmail='<!--PersonEmail-->';
	this.TagWebsite='<!--PersonWebsite-->';
	this.TagPersonLink='<!--PersonLink-->';
	this.TagPost='<!--PersonPost-->';
	this.TagRank='<!--PersonRank-->';
	this.TagOrgan='<!--PersonOrgan-->';
	this.htmlCode=(ID==null)?'':document.getElementById(ID).outerHTML;
	this.DataSet=new Array();
	this.translate=TranslatePerson;
	this.draw=DrawPerson;
}

function TranslatePerson(){
	this.htmlCode=this.htmlCode.replace(this.TagName,this.Name);
	this.htmlCode=this.htmlCode.replace(this.TagSex,this.Sex);
	this.htmlCode=this.htmlCode.replace(this.TagTitle,this.Title);
	this.htmlCode=this.htmlCode.replace(this.TagBrief,this.Brief);
	this.htmlCode=this.htmlCode.replace(this.TagDirection,this.Direction);
	this.htmlCode=this.htmlCode.replace(this.TagEducation,this.Education);
	this.htmlCode=this.htmlCode.replace(this.TagWork,this.Work);
	this.htmlCode=this.htmlCode.replace(this.TagAchievement,this.Achievement);
	this.htmlCode=this.htmlCode.replace(this.TagEmail,this.Email);
	this.htmlCode=this.htmlCode.replace(this.TagWebsite,this.Website);
	if(this.Post!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPost,this.Post);
	if(this.Rank!=null)
		this.htmlCode=this.htmlCode.replace(this.TagRank,this.Rank);
	if(this.Organ!=null)
		this.htmlCode=this.htmlCode.replace(this.TagOrgan,this.Organ);
	if(this.Photo!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPhoto,'<img src="'+this.Photo+'" border="0" width="100" length="200">');
	if(this.Url!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPersonLink,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">'+this.Name+'</a>');
}

function DrawPerson(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;
}

/**************************************************************************************/
//图片库
/**************************************************************************************/
function Picture(ID,Name,UsedFor,MapID,Data,Type,Url,Parameter,Target){
	this.ID=ID;
	this.Name=Name;
	this.UsedFor=UsedFor;
	this.MapID=MapID;
	this.Data=Data;
	this.Type=Type;
	this.Url=Url;
	this.Parameter=(Parameter==null)?'':'?'+Parameter;
	this.Target=(Target==null)?'_self':this.Target=Target;
	
	this.TagName='<!--PictureName-->';
	this.TagUsedFor='<!--PictureUsedFor-->';
	this.TagMapID='<!--PictureMapID-->';
	this.TagData='<!--PictureData-->';
	this.TagType='<!--PictureType-->';
	this.TagPictureBegin='<!--PictureLink-->';
	this.TagPictureEnd='<!--/PictureLink-->';
	this.TagBrowseLink='<!--PictureBrowseLink-->';
	this.htmlCode=(ID==null)?'':document.getElementById(ID).outerHTML;
	this.translate=TranslatePicture;
	this.draw=DrawPicture;
}

function TranslatePicture(){
	this.htmlCode=this.htmlCode.replace(this.TagName,this.Name);
	if(this.UsedFor!=null)
		this.htmlCode=this.htmlCode.replace(this.TagUsedFor,this.UsedFor);
	if(this.MapID!=null)
		this.htmlCode=this.htmlCode.replace(this.TagMapID,this.MapID);
	if(this.Data!=null)
		this.htmlCode=this.htmlCode.replace(this.TagData,this.Data);
	if(this.Type!=null)
		this.htmlCode=this.htmlCode.replace(this.TagType,this.Type);
	this.htmlCode=this.htmlCode.replace(this.TagPictureBegin,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">');
	this.htmlCode=this.htmlCode.replace(this.TagPictureEnd,'</a>');
	if(this.Url!=null)
		this.htmlCode=this.htmlCode.replace(this.TagBrowseLink,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">'+this.Name+'</a>');
}

function DrawPicture(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;
}
/**************************************************************************************/

//分页数据
/**************************************************************************************/
function Page(Url,RecordCount,PageCount,PageSize,PageNum){
	this.Url=(Url.indexOf('?')==-1)?Url+'?':Url+'&';
	this.RecordCount=RecordCount;
	this.PageCount=PageCount;
	this.PageSize=PageSize;
	this.PageNum=PageNum;
	if(RecordCount==0)
		this.htmlCode='<div align="center">没有信息。</div>';
	else{
		this.htmlCode='第&nbsp;';
		for(var i=1;i<=PageCount;i++)
			if(i==PageNum)
				this.htmlCode+='<font color="red">'+i+'</font>  ';
			else
				this.htmlCode+='<a href="'+this.Url+'page='+i+'">'+i+'</a> ';
		this.htmlCode+='页 共'+this.RecordCount+'条信息';
	}
}
/**************************************************************************************/


//附件 xws 2006-12-8
/**************************************************************************************/
function Attach(ID){
	this.ID=ID;
	this.FileItemCode=null;
	this.FileName=null;
	this.FileUrl=null;
	this.Target=null;
	this.TagFileUrl='<!--FileUrl-->';
	this.htmlCode=(ID==null)?'':document.getElementById(ID).outerHTML;
	this.addFileItem=FileItem;
	this.translate=TranslateAttach;
	this.draw=DrawFile;
}

function FileItem(FileName,FileUrl,Target){
	this.Target=Target;
	this.FileName=FileName;
	this.FileUrl=FileUrl;
	if(this.FileItemCode==null){
		this.FileItemCode='<a href="'+this.FileUrl+'" target="'+this.Target+'">'+this.FileName+'</a><br>';
	}else{
		this.FileItemCode=this.FileItemCode+'<a href="'+this.FileUrl+'" target="'+this.Target+'">'+this.FileName+'</a><br>';
	}
}

function TranslateAttach(){
	if(this.FileUrl!=null){
		this.htmlCode=this.htmlCode.replace(this.TagFileUrl,this.FileItemCode);
	}
}

function DrawFile(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;
}
/**************************************************************************************/

//附件 xws 2006-12-8
/**************************************************************************************/
function Attach(ID){
	this.ID=ID;
	this.FileItemCode=null;
	this.FileName=null;
	this.FileUrl=null;
	this.Target=null;
	this.TagFileUrl='<!--FileUrl-->';
	this.htmlCode=(ID==null)?'':document.getElementById(ID).outerHTML;
	this.addFileItem=FileItem;
	this.translate=TranslateAttach;
	this.draw=DrawFile;
}

function FileItem(FileName,FileUrl,Target){
	this.Target=Target;
	this.FileName=FileName;
	this.FileUrl=FileUrl;
	if(this.FileItemCode==null){
		this.FileItemCode='<a href="'+this.FileUrl+'" target="'+this.Target+'">'+this.FileName+'</a><br>';
	}else{
		this.FileItemCode=this.FileItemCode+'<a href="'+this.FileUrl+'" target="'+this.Target+'">'+this.FileName+'</a><br>';
	}
}

function TranslateAttach(){
	if(this.FileUrl!=null){
		this.htmlCode=this.htmlCode.replace(this.TagFileUrl,this.FileItemCode);
	}
}

function DrawFile(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;
}
/**************************************************************************************/

//图片新闻 XWS 2006-12-28
/**************************************************************************************/
function PictrueInfo(ID,Title,Picture,Content,PubDate,Url,Parameter,Target,ColumnID,ColumnName,ColumnUrl){
	this.ID=ID;
	this.Title=Title;
	this.Picture=(Content==null)?'':Picture;
	this.Content=(Content==null)?'':Content;
	this.PubDate=PubDate;
	this.Url=Url;
	this.Parameter=(Parameter==null)?'':'?'+Parameter;	
	this.Target=(Target==null)?'_self':this.Target=Target;
	this.ColumnID=ColumnID;
	this.ColumnLink=(ColumnID==null)?'':'<a href="'+ColumnUrl+'?column='+ColumnID+'">'+ColumnName+'</a>';
	this.TagTitle='<!--InfoTitle-->';
	this.TagDate='<!--InfoDate-->';
	this.TagPicture='<!--Picture-->';
	this.TagContent='<!--InfoContent-->';
	this.TagBrowseLink='<!--InfoBrowseLink-->';
	this.TagMoreBegin='<!--InfoMoreLink-->';
	this.TagMoreEnd='<!--/InfoMoreLink-->';
	this.TagColumnLink='<!--InfoColumnLink-->';
	this.PictureLink='<!--PictureLink-->';
	this.htmlCode=(ID==null)?'':document.all[ID].outerHTML;
	this.translate=TranslatePictrueInfo;
	this.draw=DrawPictrueInfo;
}

function TranslatePictrueInfo(){
	this.htmlCode=this.htmlCode.replace(this.TagTitle,this.Title);
	if(this.PubDate!=null)
		this.htmlCode=this.htmlCode.replace(this.TagDate,this.PubDate);
	if(this.Picture!=null)
		this.htmlCode=this.htmlCode.replace(this.TagPicture,this.Picture);
	if(this.Content!=null)
		this.htmlCode=this.htmlCode.replace(this.TagContent,this.Content);
	this.htmlCode=this.htmlCode.replace(this.TagMoreBegin,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">');
	this.htmlCode=this.htmlCode.replace(this.TagMoreEnd,'</a>');
	if(this.Url!=null)
		this.htmlCode=this.htmlCode.replace(this.TagBrowseLink,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">'+this.Title+'</a>');
		this.htmlCode=this.htmlCode.replace(this.PictureLink,this.Url+this.Parameter);
	if(this.ColumnID!=null)
		this.htmlCode=this.htmlCode.replace(this.TagColumnLink,this.ColumnLink);
}

function DrawPictrueInfo(){
	document.all[this.ID].outerHTML=this.htmlCode;
}
/**************************************************************************************/

//新闻链接
/**************************************************************************************/
function NewLinks(ID,Title,Url,Parameter,Target,LineNum){
	this.ID=ID;
	this.Title=(Title==null)?'':Title;
	this.Url=(Url==null)?'':Url;
	this.LineNum=LineNum;
	this.LineSplit='</tr><tr>';
	this.Parameter=(Parameter==null)?'':'?'+Parameter;
	this.Target=(Target==null)?'_self':this.Target=Target;
	this.TagBegin='<!--NewLinkData-->';
	this.TagEnd='<!--/NewLinkData-->';
	this.TagTitle='<!--NewLinkTitle-->';
	this.TagMoreLinkBegin='<!--NewLinkLink-->';
	this.TagMoreLinkEnd='<!--/NewLinkLink-->';
	this.TagPage='<!--NewLinksDataPage-->';
	this.htmlCode=(ID==null)?'':document.getElementById(ID).outerHTML;
	this.DataSet=new Array();
	this.Page=null;
	this.translate=TranslateNewLinks;
	this.draw=DrawNewLinks;
}

function TranslateNewLinks(){
	if(this.htmlCode.indexOf(this.TagBegin)!=-1){
		var sHtml='';
		var sHead=this.htmlCode.substring(0,this.htmlCode.indexOf(this.TagBegin));
		var sBody=this.htmlCode.substring(this.htmlCode.indexOf(this.TagBegin)+this.TagBegin.length,this.htmlCode.lastIndexOf(this.TagEnd));
		var sTail=this.htmlCode.substring(this.htmlCode.lastIndexOf(this.TagEnd)+this.TagEnd.length);
		sHead=sHead.replace(this.TagTitle,this.Title);
		sHead=sHead.replace(this.TagMoreLinkBegin,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">');
		sHead=sHead.replace(this.TagMoreLinkEnd,'</a>');
		if(this.Page!=null)
			sHead=sHead.replace(this.TagPage,this.Page.htmlCode);		
		sTail=sTail.replace(this.TagTitle,this.Title);
		sTail=sTail.replace(this.TagMoreLinkBegin,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">');
		sTail=sTail.replace(this.TagMoreLinkEnd,'</a>');
		if(this.Page!=null)
			sTail=sTail.replace(this.TagPage,this.Page.htmlCode);
		for(var i=0;i<this.DataSet.length;i++){
			this.DataSet[i].htmlCode=sBody;
			if(this.LineSplit.length>1){
				if(this.LineNum!=-1)
					if((i)%this.LineNum==0)
						sHtml+=this.LineSplit;
				}
			this.DataSet[i].translate();
			sHtml+=this.DataSet[i].htmlCode;
		}
		sHtml=sHead+sHtml+sTail;
		this.htmlCode=sHtml;
	}else{
		this.htmlCode=this.htmlCode.replace(this.TagTitle,this.Title);
		this.htmlCode=this.htmlCode.replace(this.TagMoreLinkBegin,'<a href="'+this.Url+this.Parameter+'" target="'+this.Target+'">');
		this.htmlCode=this.htmlCode.replace(this.TagMoreLinkEnd,'</a>');
		if(this.Page!=null)
			this.htmlCode=this.htmlCode.replace(this.TagPage,this.Page.htmlCode);
	}
}

function DrawNewLinks(){
	document.getElementById(this.ID).outerHTML=this.htmlCode;
}
/**************************************************************************************/

/*
var setOuterHtml = function(s){
   var range = this.ownerDocument.createRange();
   range.setStartBefore(this);
   var fragment = range.createContextualFragment(s);
   //alert(fragment.xml);
   this.parentNode.replaceChild(fragment, this);
}

if(window.HTMLElement) {
  HTMLElement.prototype.__defineSetter__("outerHTML", setOuterHtml);
}
*/
if(window.HTMLElement){
   HTMLElement.prototype.__defineGetter__("all",function(){
       var a=this.getElementsByTagName("*");
       var node=this;
       a.tags=function(sTagName){
           return node.getElementsByTagName(sTagName);
           }
       return a;
       });
   HTMLElement.prototype.__defineGetter__("parentElement",function(){
       if(this.parentNode==this.ownerDocument)return null;
       return this.parentNode;
       });
   HTMLElement.prototype.__defineGetter__("children",function(){
       var tmp=[];
       var j=0;
       var n;
       for(var i=0;i<this.childNodes.length;i++){
           n=this.childNodes[i];
           if(n.nodeType==1){
               tmp[j++]=n;
               if(n.name){
                   if(!tmp[n.name])
                       tmp[n.name]=[];
                   tmp[n.name][tmp[n.name].length]=n;
                   }
               if(n.id)
                   tmp[n.id]=n;
               }
           }
       return tmp;
       });
   HTMLElement.prototype.__defineGetter__("currentStyle", function(){
       return this.ownerDocument.defaultView.getComputedStyle(this,null);
       });
   HTMLElement.prototype.__defineSetter__("outerHTML",function(sHTML){
       var r=this.ownerDocument.createRange();
       r.setStartBefore(this);
       var df=r.createContextualFragment(sHTML);
       this.parentNode.replaceChild(df,this);
       return sHTML;
       });
   HTMLElement.prototype.__defineGetter__("outerHTML",function(){
       var attr;
       var attrs=this.attributes;
       var str="<"+this.tagName;
       for(var i=0;i<attrs.length;i++){
           attr=attrs[i];
           if(attr.specified)
               str+=" "+attr.name+'="'+attr.value+'"';
           }
       if(!this.canHaveChildren)
           return str+">";
       return str+">"+this.innerHTML+"</"+this.tagName+">";
       });
   HTMLElement.prototype.__defineGetter__("canHaveChildren",function(){
       switch(this.tagName.toLowerCase()){
           case "area":
           case "base":
           case "basefont":
           case "col":
           case "frame":
           case "hr":
           case "img":
           case "br":
           case "input":
           case "isindex":
           case "link":
           case "meta":
           case "param":
               return false;
           }
       return true;
       });

   HTMLElement.prototype.__defineSetter__("innerText",function(sText){
       var parsedText=document.createTextNode(sText);
       this.innerHTML=parsedText;
       return parsedText;
       });
   HTMLElement.prototype.__defineGetter__("innerText",function(){
       var r=this.ownerDocument.createRange();
       r.selectNodeContents(this);
       return r.toString();
       });
   HTMLElement.prototype.__defineSetter__("outerText",function(sText){
       var parsedText=document.createTextNode(sText);
       this.outerHTML=parsedText;
       return parsedText;
       });
   HTMLElement.prototype.__defineGetter__("outerText",function(){
       var r=this.ownerDocument.createRange();
       r.selectNodeContents(this);
       return r.toString();
       });
   HTMLElement.prototype.attachEvent=function(sType,fHandler){
       var shortTypeName=sType.replace(/on/,"");
       fHandler._ieEmuEventHandler=function(e){
           window.event=e;
           return fHandler();
           }
       this.addEventListener(shortTypeName,fHandler._ieEmuEventHandler,false);
       }
   HTMLElement.prototype.detachEvent=function(sType,fHandler){
       var shortTypeName=sType.replace(/on/,"");
       if(typeof(fHandler._ieEmuEventHandler)=="function")
           this.removeEventListener(shortTypeName,fHandler._ieEmuEventHandler,false);
       else
           this.removeEventListener(shortTypeName,fHandler,true);
       }
   HTMLElement.prototype.contains=function(Node){// 是否包含某节点
       do if(Node==this)return true;
       while(Node=Node.parentNode);
       return false;
       }
   HTMLElement.prototype.insertAdjacentElement=function(where,parsedNode){
       switch(where){
           case "beforeBegin":
               this.parentNode.insertBefore(parsedNode,this);
               break;
           case "afterBegin":
               this.insertBefore(parsedNode,this.firstChild);
               break;
           case "beforeEnd":
               this.appendChild(parsedNode);
               break;
           case "afterEnd":
               if(this.nextSibling)
                   this.parentNode.insertBefore(parsedNode,this.nextSibling);
               else
                   this.parentNode.appendChild(parsedNode);
               break;
           }
       }
   HTMLElement.prototype.insertAdjacentHTML=function(where,htmlStr){
       var r=this.ownerDocument.createRange();
       r.setStartBefore(this);
       var parsedHTML=r.createContextualFragment(htmlStr);
       this.insertAdjacentElement(where,parsedHTML);
       }
   HTMLElement.prototype.insertAdjacentText=function(where,txtStr){
       var parsedText=document.createTextNode(txtStr);
       this.insertAdjacentElement(where,parsedText);
       }
   HTMLElement.prototype.attachEvent=function(sType,fHandler){
       var shortTypeName=sType.replace(/on/,"");
       fHandler._ieEmuEventHandler=function(e){
           window.event=e;
           return fHandler();
           }
       this.addEventListener(shortTypeName,fHandler._ieEmuEventHandler,false);
       }
   HTMLElement.prototype.detachEvent=function(sType,fHandler){
       var shortTypeName=sType.replace(/on/,"");
       if(typeof(fHandler._ieEmuEventHandler)=="function")
           this.removeEventListener(shortTypeName,fHandler._ieEmuEventHandler,false);
       else
           this.removeEventListener(shortTypeName,fHandler,true);
       }
}
/**************************************************************************************/
////////////////////////////////////////////////////////////////////////////////////////