<!--
var adcollection;
var arrProperty=new Array("id","adchannel","adwidth","adheight","adleft","adtop","advid","spanid","showtype","iframename","ctype_code","cbrand_code")
var arrDefaultProperty=new Array("","","","","","","adv_{$id$}","adspan_{$id$}","0","adifm_{$id$}","","")	

function advs(){
  document.domain="it168.com"
  this.items = [];
  this.additem =  function(id,adchannel,adwidth,adheight,adleft,adtop,advid,spanid,showtype){
      var newitem={};
	  var adstyle="";
	  if(advid=="" || advid==null){advid="adv_"+id}
	  if(spanid=="" || spanid==null){spanid="adspan_"+id}
	  if(showtype=="" || showtype==null){showtype="0"}
	  newitem.id=id;
	  newitem.advid=advid;
	  newitem.spanid=spanid;	  
	  newitem.adchannel=adchannel;
	  newitem.adwidth=adwidth;
	  newitem.adheight=adheight;
	  newitem.iframename="adifm_"+id;	  
	  newitem.showtype=showtype;
	  newitem.iframeurl="http://adshow.it168.com/adfile/advs_test.asp?itype_id="+id+"&spanid="+newitem.spanid+"&adwidth="+newitem.adwidth+"&adheight="+newitem.adheight;
	  
	  if(adleft!=""){adstyle="left:"+(typeof(adleft)=='string'?eval(adleft):adleft)+"px;"}
	  if(adtop!=""){adstyle+="top:"+(typeof(adtop)=='string'?eval(adtop):adtop)+"px;"}	  
	  if(adstyle!=""){adstyle+="z-index: 10; position: absolute;"}
	  newitem.adhtml="<span name='"+newitem.spanid+"' id='"+newitem.spanid+"' style='display:block;"+adstyle+"'>"+"<iframe name='"+newitem.iframename+"' id='"+newitem.iframename+"' style='height:"+adheight+"px;width:"+adwidth+"px;display:;' src='"+newitem.iframeurl+"' noresize scrolling=No frameborder=0 marginheight=0 marginwidth=0 allowTransparency='true'></iframe></span>"	
	  newitem.object=document.getElementById(spanid);	  
//      alert(newitem.adhtml)

	  this.items[this.items.length]=newitem;	  
	}
	
  this.addnewitem =  function(obj){ 
	  var newitem=eval("("+obj+")")  
	  for(var i=0;i<arrProperty.length;i++){
		  if(newitem[arrProperty[i]]==undefined){
				newitem[arrProperty[i]]=arrDefaultProperty[i].replace("{$id$}",newitem.id)
			  }
		  }	  
	  var adstyle="";

	  newitem.iframeurl="http://adshow.it168.com/adfile/advs_test.asp?itype_id="+newitem.id+(newitem.ctype_code==""?"&ctype_code="+newitem.ctype_code:"")+(newitem.cbrand_code==""?"&cbrand_code="+newitem.cbrand_code:"")+"&iframename="+newitem.iframename+"&adwidth="+newitem.adwidth+"&adheight="+newitem.adheight;
//	  alert(newitem.iframeurl)
	  if(newitem.adleft!=""){adstyle="left:"+(typeof(newitem.adleft)=='string'?eval(newitem.adleft):newitem.adleft)+"px;"}
	  if(newitem.adtop!=""){adstyle+="top:"+(typeof(newitem.adtop)=='string'?eval(newitem.adtop):newitem.adtop)+"px;"}	  
	  if(adstyle!=""){adstyle+="position: absolute;"}
	  
//	  newitem.adhtml="<span style='display:block;"+adstyle+"' id="+newitem.spanid+">"+"<iframe name='"+newitem.iframename+"' id='"+newitem.iframename+"' style='height:"+newitem.adheight+"px;width:"+newitem.adwidth+"px;display:;' src='"+newitem.iframeurl+"' noresize scrolling=No frameborder=0 marginheight=0 marginwidth=0 allowTransparency='true'></iframe></span>"	
	  newitem.adhtml="<span style='display:;"+adstyle+"' id="+newitem.spanid+">"+"<iframe name='"+newitem.iframename+"' id='"+newitem.iframename+"' style='height:0px;width:0px;display:;' src='"+newitem.iframeurl+"' noresize scrolling=No frameborder=0 marginheight=0 marginwidth=0 allowTransparency='true'></iframe></span>"		  
	  
//	  newitem.adhtml="<span style='display:;"+adstyle+"' id="+newitem.spanid+">"+"<iframe name='"+newitem.iframename+"' id='"+newitem.iframename+"' style='height:0px;width:0px;display:;' src='"+newitem.iframeurl+"' noresize scrolling=No frameborder=0 marginheight=0 marginwidth=0></iframe></span>"	
	  newitem.object=document.getElementById(newitem.spanid);	  
	  this.items[this.items.length]=newitem;	  
	}	
  this.show = function(){
		adcollection=this.items;
	    for(var i=0;i<adcollection.length;i++){
		var advarr=new Array()
		advarr=adcollection[i].advid.split("$")
			for(var k=0;k<advarr.length;k++){
			switch(adcollection[i].showtype){
	  			case "0":
					if($(advarr[k]))
					{$(advarr[k]).innerHTML=adcollection[i].adhtml}			
					break;
				case "1":	
					document.write(adcollection[i].adhtml)
					break;							
				default:
					if($(advarr[k]))
					{$(advarr[k]).innerHTML=adcollection[i].adhtml}							
					break;				
				  }		
			}	    
    	}     
	}		
  this.hide=function(){
	 adcollection=this.items;
     for(var i=0;i<adcollection.length;i++){
		var advarr=new Array()
		advarr=adcollection[i].advid.split("$")
		for(var k=0;k<advarr.length;k++){
			if($(advarr[k])){$(advarr[k]).innerHTML=""}			
			}	    
    	}     
	}	
}

function $(obj){return document.getElementById(obj)}

function ad_span(adId,spanId){
if($(adId)){if($(spanId)){$(adId).innerHTML=$(spanId).innerHTML}}
if($(spanId)){$(spanId).innerHTML=""}
}
//-->