function adverClass(){
 var objName="";
 var imageType=0;
 var imageWidth=imageHeight=0;
 var iTop=iLeft=0;
 var topFlag=leftFlag=false;
 var divID=0,objDiv=null;
 var offWidth=offHeight=0;
 var width=document.body.clientWidth;
 var height=document.body.clientHeight;
 var delay=30;    
 var topStep=2,leftStep=3;      
 var inter;
 
 divID=Math.round(Math.random()*100000)
 
 this.setImageType=function(sType){
   if(sType!=1&&sType!=0){sType=0;}
   imageType=sType;
 }
    
 this.setObjName=function(sName){objName=sName; }

 this.setImagePX=function(iWidth,iHeight){
   if(!isNaN(iWidth)){
      imageWidth=iWidth;
   }else{
      imageWidth=0;
   }
   if(!isNaN(iHeight)){
      imageHeight=iHeight;
   }else{
      imageHeight=0;
   }
 }

 this.setDivID=function(iDiv){divID=iDiv;}
 

 this.showAdver=function(adImgSrc,adHref,adTitle){
    if(imageType==0){
       showImageHtml(adImgSrc,adHref,adTitle);
    }else{
       showFlashHtml(adImgSrc,adHref,adTitle);
    }
    eval("objDiv=document.all.img"+divID+";");

    offWidth=objDiv.offsetWidth;
    offHeight=objDiv.offsetHeight;

    iLeft=Math.round(Math.random()*(width-offWidth));
    iTop=Math.round(Math.random()*(height-offHeight));
    objDiv.style.pixelLeft=iLeft;
    objDiv.style.pixelTop=iTop;

 }
 //主函数，漂浮游动显示广告
 this.floatScroll=function(){
    var iRnd;
    iRnd=Math.round(Math.random()*100);    //此值是为了能使多图显示时产生不同的轨迹
    if(objDiv==null)return;
    objDiv.style.pixelLeft = iLeft + document.body.scrollLeft;
    objDiv.style.pixelTop = iTop + document.body.scrollTop;
    if(iRnd>98){leftFlag=!leftFlag;}
    iRnd=Math.round(Math.random()*100);
    if(iRnd>99){topFlag=!topFlag;}
    if(leftFlag){
       iLeft=iLeft+leftStep*Math.random();
    }else{
       iLeft=iLeft-leftStep*Math.random();
    }
    if(topFlag){
       iTop=iTop+topStep*Math.random();
    }else{
       iTop=iTop-topStep*Math.random();
    }
    if(iLeft<0){
       iLeft=0;
    leftFlag=true;
     }
    else if(iLeft>width-offWidth){
       iLeft=width-offWidth;
    leftFlag=false;
    }
    if(iTop<0){
       iTop=0;
    topFlag=true;
     }
    else if(iTop>height-offHeight){
       iTop=height-offHeight;
    topFlag=false;
    }
 }
 //显示图片的HTML代码
 function showImageHtml(adImgSrc,adHref,adTitle){
   var sWidth,sHeight;
   if(imageWidth<5){
     sWidth="";
   }else{
     sWidth=" width='"+imageWidth+"'";
   }
   if(imageHeight<5){
     sHeight="";
   }else{
     sHeight=" height='"+imageHeight+"'";
   }
   document.write("<div id='img"+divID+"' style='position:absolute;z-index:999;'>");
   document.write("<a href='"+adHref+"' target='_blank' title='"+adTitle+"'>");
   document.write("<img src='"+adImgSrc+"' border='0'"+sWidth+sHeight+">");
   document.write("</a><br><a href='#' onclick='closeflatad(img"+divID+");return false'>关闭</a></div>");
 }
 //显示Flash文件的HTML代码
 function showFlashHtml(adImgSrc,adHref,adTitle){
   var sWidth,sHeight;
   if(imageWidth<5){
     sWidth=" width='80'";
   }else{
     sWidth=" width='"+imageWidth+"'";
   }
   if(imageHeight<5){
     sHeight=" height='80'";
   }else{
     sHeight=" height='"+imageHeight+"'";
   }
   document.write("<div id='img"+divID+"' style='position:absolute;z-index:999;'>");
   document.write("<a href='"+adHref+"' target='_blank' title='"+adTitle+"'>");
   document.write("<object  codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0'"+sWidth+sHeight+" align='middle'>");
   document.write("<param name='movie' value='"+adImgSrc+"'>");
   document.write("<param name='quality' value='high'>");
   document.write("<embed src='"+adImgSrc+"'"+sWidth+sHeight+" quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed></object>");
   document.write("</a><br><a href='#' onclick='closeflatad(img"+divID+");return false'>关闭</a></div>");
   }
}
function closeflatad(div)
{
	div.style.display='none';
}

