﻿/**
 * @author wangzl
 * @since 2006.06.21
 * @version 0.1
 * @function for ad
 */

function $(obj){return document.getElementById(obj)}

function $import(path, type){
  if (type == "css") {
      document.write("<" + "link href=\"" + path + "\" rel=\"stylesheet\" type=\"text/css\"></" + "link>");
  } else {
      document.write("<" + "script src=\"" + path + "\"></" + "script>");
  }
}

function ad_span(adId,spanId)
{

if($(adId)){if($(spanId)){$(adId).innerHTML=$(spanId).innerHTML;}}

if($(spanId) && spanId != "ADV_LZ5")
{
$(spanId).innerTXT="";
//$(spanId).style.display = "";
}


}

//dom
function insertAfter(parent, node, referenceNode) {
    parent.insertBefore(node, referenceNode.nextSibling);
}

function GetVal(src,name) {
	var len=name.length;
	var from=src.indexOf(name);
	if(from==-1) return '';
	to=src.indexOf('&',from);
	if(to==-1) return src.substring(from+len);
	else return src.substring(from+len,to);
}

function adspan(span1,span2){
		if($(span1) && $(span2)){
			$(span1).innerHTML=$(span2).innerHTML		
			$(span2).innerHTML=""		
			}
	}

function openwin1(url,w,h){WriterWindow =window.open(url,'_blank','width='+w+',height='+h+',left=55,top=25');}

function openwin2(url,w,h){WriterWindow =window.open(url,'_blank','width='+w+',height='+h+',left=455,top=25');}


//对联开始
 var delta=0.15
 var collection;
 var closeB=false;
 
function floaters() {
  this.items = [];
  this.addItem = function(id,x,y,content,show)
      {	 var align
	     align="left"
		 if(x.indexOf("document.body")!=-1 || x.indexOf("screen.availWidth")!=-1) {
			align="right"
			 }
	 if(window.screen.width<1024){
		 if(align=="left"){x=-90}else{x=765}
		 }
	 else
	 	{if(align=="left"){x=15}else{x=window.screen.width-130}}
	document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute;  width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+'px;top:'+(typeof(y)=='string'?eval(y):y)+'px">'+content+'</DIV>');	
     var newItem    = {};
     newItem.object   = document.getElementById(id);
     newItem.x    = x;
     newItem.y    = y;
	 newItem.show= show
	 newItem.align=align;
     this.items[this.items.length]  = newItem;
      }
  this.playdl = function()
      {
     collection    = this.items
//     setInterval('playdl()',10);
//setTimeout('playdl()',10)
      }
  }
  function playdl()
  {

   if(screen.width<=648 || closeB)
   {
    for(var i=0;i<collection.length;i++)
    {if(collection[i].show=="none"){
     collection[i].object.style.display = 'none';
	}
    }
    return;
   }
   for(var i=0;i<collection.length;i++)
   {
    var followObj  = collection[i].object;
    var followObj_x  = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
    var followObj_y  = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);
    if(followObj.offsetLeft!=(document.documentElement.scrollLeft+followObj_x)) {
     var dx=(document.documentElement.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
     dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));

     followObj.style.left=followObj.offsetLeft+dx;
     }
	//move code begin
	if(1==2){
    if(followObj.offsetTop!=(document.documentElement.scrollTop+followObj_y)) {
     var dy=(document.documentElement.scrollTop+followObj_y-followObj.offsetTop)*delta;
     dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
     followObj.style.top=followObj.offsetTop+dy;
     }
	}
	//move code end

	 if(collection[i].show=="none")
    {followObj.style.display = 'none';}
	else
	{followObj.style.display = '';}
   }
  } 
  function closeBanner(id)
  { 
    closeB=true;
    for(var i=0;i<collection.length;i++){if(id.indexOf('#'+i+'#')>=0){collection[i].show="none";}}	
    return;
  }
//对联结束  