var delta=0.15
var collection;
function Couplet ()
{		
	this.items = [];
	this.additem = function(id,left,top,content,flag)
	{
		document.write('<DIV id='+id+' style="Z-INDEX:10;POSITION:absolute;left:'+(typeof(left)=='string'?eval(left):left)+';top:'+(typeof(top)=='string'?eval(top):top)+'">'+content+'</DIV>');					
		var newItem = {};
		newItem.object = document.getElementById(id);
		newItem.x = left;
		newItem.y = top;
		newItem.flag = flag;
		this.items[this.items.length] = newItem;		
	}
	this.play = function()
	{
		collection = this.items
		setInterval('play()',10);
	}
}
function play(flag)
{
	if(screen.width<=800)
	{
		for(var i=0;i<collection.length;i++)
		{
			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);
		var followObj_flag = collection[i].flag;
		
		if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x))
		{
			var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
			dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
			followObj.style.left=followObj.offsetLeft+dx;
		}
		if (followObj_flag == "0")
		{
			if(followObj.offsetTop!=(document.body.scrollTop+followObj_y))
			{
				var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;
				dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
				followObj.style.top=followObj.offsetTop+dy;
			}
		}
		
		followObj.style.display	= '';
	}
}
function swf_code (swf_width,swf_height,swf_src)
{
	return "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' WIDTH="+swf_width+" HEIGHT="+swf_height+"><PARAM NAME=movie VALUE='"+swf_src+"'><EMBED src='"+swf_src+"' quality=autohigh TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'></EMBED></OBJECT>";	        
}

function img_code (img_width,img_height,img_src,img_href)
{
	return "<a href='"+img_href+"' target=_blank><IMG SRC='"+img_src+"' WIDTH='"+img_width+"' HEIGHT='"+img_height+"' BORDER='0'></a>";
}

function iframe_code (iframe_width,iframe_height,iframe_src)
{
	return "<iframe style='FILTER: alpha(opacity=100)' scrolling=no frameborder=0 SRC='"+iframe_src+"' WIDTH='"+iframe_width+"' HEIGHT='"+iframe_height+"' BORDER='0'></iframe>";
}

var floaters_l = swf_code(100,300,"http://www.smexm.gov.cn/images/newyear_left.swf");
var floaters_r = swf_code(100,300,"http://www.smexm.gov.cn/images/newyear_right.swf");
//var floaters_l = swf_code(100,300,"http://fzj.smexm.gov.cn/flash/left.swf");
//var floaters_r = swf_code(100,300,"http://fzj.smexm.gov.cn/flash/right.swf");
//var floaters_r  = img_code(100,300,"/zhuanti/qyxypd/images/ad-chengzhang.gif","/zhuanti/czx/");

//var floaters_l  = img_code(100,300,"/zhuanti/qyxypd/images/ad-chengli.gif","/2007-6/2007661515151796.htm");

var couplet = new Couplet();
couplet.additem('floaters_l',5,100,floaters_l,0);
couplet.additem('floaters_r','document.body.clientWidth-105',100,floaters_r,0);

//couplet.additem('floaters_l2',5,416,floaters_l2,0);
/couplet.additem('floaters_r2','document.body.clientWidth-105',416,floaters_r2,0);
//couplet.additem('floaters_l3',2,424,floaters_l3,0);
//couplet.additem('floaters_r3','document.body.clientWidth-100',424,floaters_r3,0);


couplet.play();