var pic="/admin/webimages/layer/13251196611275.jpg";
var alt="福建省外经贸厅恭祝大家新春快乐龙年吉祥";
var url="";
var width="160";
var height="160";
var topmargin="";
var leftmargin="";
var timeout=5;

var speed=120;
var light=0;

var stop=0;
var num=0;

var brOK=false;
var mie=false;
var aver=parseInt(navigator.appVersion.substring(0,1));
var aname=navigator.appName;

var vmin=2;
var vmax=5;
var vr=2;
var timer1;

var ns = (document.layers) ? 1 : 0;
var ie = (document.all) ? 1 : 0;
var bFade=false;
var xin = true, yin = true; //判断层的X坐标和Y坐标是否在在控制范围之内，xin为真是层向右移动，否则向左；yin为真是层向下移动，否则向上 
var FLOWLAYER13251196611275;

function checkbrOK(){
	if(aname.indexOf("Internet Explorer")!=-1){
		if(aver>=4) brOK=navigator.javaEnabled();
		mie=true;
	}
	if(aname.indexOf("Netscape")!=-1){
		if(aver>=4) brOK=navigator.javaEnabled();
	}
}

function Chip(chipname,width,height){
	this.named=chipname;
	this.vx=vmin+vmax*Math.random();
	this.vy=vmin+vmax*Math.random();
	this.w=width;
	this.h=height;
	this.xx=10;
	this.yy=10;
	this.timer1=null;
}

function movechip(chipname){
	eval("chip="+chipname);
	if (stop!=1){
		if(brOK){
			if(!mie){
				pageX=window.pageXOffset;
				pageW=window.innerWidth;
				pageY=window.pageYOffset;
				pageH=window.innerHeight;
			}
				else{
		      pageX=pageY=0 ;//层移动范围的左边界(L)和上边界(T)坐标 
              pageW= window.document.documentElement.clientWidth-2*chip.w ;//层移动的右边界 
              pageH = window.document.documentElement.clientHeight-2*chip.h; //层移动的下边界 

			}

			chip.xx = chip.xx + 8*(xin?1:-1); //通过判断层的范围决定层在X轴上的运动方向
			if (chip.xx < pageX) { xin = true; chip.xx = pageX} //层超出左边界时的处理 

            if (chip.xx> pageW){ xin = false; chip.xx = pageW} //层超出右边界时的处理 

            chip.yy = chip.yy + 8*(yin?1:-1); //通过判断层的范围决定层在Y轴上的运动方向 

            if (chip.yy < pageY) { yin = true; chip.yy =pageY } //层超出上边界时的处理
            if (chip.yy > pageH) { yin = false; chip.yy = pageH } //层超出下边界时的处理
			if(!mie){
				eval("document."+chip.named+".top ="+chip.yy);
				eval("document."+chip.named+".left="+chip.xx);
			}
			else{
				m  = chip.xx + window.document.documentElement.scrollLeft;//更新层的X坐标，实现X轴方向上的运动；document.body.scrollLeft为文档区域的滚动条向右拉的距离，以保证在滚动条右拉时层仍在可见范围内 
               n = chip.yy + window.document.documentElement.scrollTop;//更新层的Y坐标，实现Y轴方向上的运动；document.body.scrollTop为文档区域的滚动条向下拉的距离，以保证在滚动条下拉时层仍在可见范围内 
				eval("document.all."+chip.named+".style.pixelLeft="+m);
				eval("document.all."+chip.named+".style.pixelTop ="+n);
			}
			chip.timer1=setTimeout("movechip('"+chip.named+"')",speed);
		}
	}
	else {
		chip.timer1=setTimeout("movechip('"+chip.named+"')",speed);
	}
	
	if (ie){
		if (light==1){
			var nOpacity=oImg.filters.alpha.opacity;
			if (nOpacity>=100) bFade=true;
			if (nOpacity<=0) bFade=false;
			if (bFade) oImg.filters.alpha.opacity--;
			if (!bFade) oImg.filters.alpha.opacity++;
		}
	}

}

function stopme(chipname){
	if(brOK){
		eval("chip="+chipname);
		if(chip.timer1!=null){
			clearTimeout(chip.timer1)
		}
	}
}

function startme(){
	if (num==0){
		checkbrOK();
		FLOWLAYER13251196611275=new Chip('FLOWLAYER13251196611275',100,80);
		if(brOK) {
			movechip('FLOWLAYER13251196611275');
		}
	}
	num++;
}

	if (ie){
		document.write("<div ID='FLOWLAYER13251196611275' STYLE='position:absolute;z-index:1;left: "+leftmargin+"; top: "+topmargin+";'>");
		document.write("<div style='position:relative;z-index:1'>");
		document.write(" <div id='advclose' style='z-index:-1'>");
		document.write("<a onclick='closeme();return false;'  onMouseOver='stop=1;' onMouseOut='stop=0;'>");
		document.write("<img src='images/flaotad_shutdown.gif' /></a>");
		document.write("</div>");
		document.write("</div>");
		document.write("<a HREF='"+url+"' target='_blank'>");
		if (light==1){
			document.write("<dd><img SRC='" + pic + "' width='"+width+"' height='"+height+"' onload='startme()' ID='oImg' border='0' alt='" + alt + "' style='position:absolute;left:200px;top:200px;filter:alpha(opacity=50);' onMouseOver='stop=1;' onMouseOut='stop=0;'></a></dd>");
		}
		else if (light==0){
			document.write("<dd><img SRC='" + pic + "' width='"+width+"' height='"+height+"' onload='startme()' border='0' alt='" + alt + "' onMouseOver='stop=1;' onMouseOut='stop=0;'></a></dd>");
		}
		document.write("</div>");

}
function closeme(){
	document.all.FLOWLAYER13251196611275.style.pixelWidth-=1;
	document.all.FLOWLAYER13251196611275.style.pixelHeight-=1;
//	timer=setTimeout("closeme()",10);
	if (document.all.FLOWLAYER13251196611275.style.pixelWidth<=0){
	//	clearTimeout(timer);
		document.getElementById('FLOWLAYER13251196611275').innerHTML = ''; 
	}
}

//flowLayerTimer=setTimeout("closeme()",timeout*1000);

