
var moving_stat = 0;      //开关
var dq;
var temp_height;

var adRightWidth;

var navUserAgent = navigator.userAgent	;

function sample(obj,_height,_width)
{
	sample_init();
	if(dq != null)
	{
		closediv(dq,temp_height);
	}
	dq = obj;
	temp_height = _height;
	adRightWidth=_width;
	if(!moving_stat)
	{ 
	check_scrollmove();
	moving_stat = 1;
	}
	else{ 
	clearTimeout(loop); 
	moving_stat = 0; 
	dq.style.display = "none";
	dq.style.pixelTop = window.screen.availHeight - temp_height/2;}
}

function check_scrollmove()
{
	dq.style.display = "block";
	var speed = 5;
	
		if (navUserAgent.indexOf("Firefox") >= 0 || navUserAgent.indexOf("Opera") >= 0)
	{
		moving_spd = ((document.body.clientHeight + document.body.scrollTop - temp_height) - dq.style.pixelTop)/speed;
	   dq.style.pixelTop += moving_spd;
	   dq.style.left = document.body.clientWidth - adRightWidth -10;
	}
	else
	{
	moving_spd = ((document.documentElement.clientHeight + document.documentElement.scrollTop - temp_height) - dq.style.pixelTop)/speed;
	 dq.style.pixelTop += moving_spd;
	 dq.style.left = document.documentElement.clientWidth- adRightWidth -10;
	}	
	 loop = setTimeout("check_scrollmove()",50);
}
			
function closediv(obj,_height)
{
	clearTimeout(loop);
	moving_stat = 0;
	obj.style.display = "none";
	obj.style.pixelTop = document.body.clientHeight+document.body.scrollTop - _height/2;
	
}

function embedFlash(fileName, movieWidth, movieHeight, backColor)
{
	document.write('<OBJECT \n');
	document.write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" \n');
	document.write('WIDTH  = "'+movieWidth +'"  \n');
	document.write('HEIGHT = "'+movieHeight+'"  \n');
	document.write('id     = "MOVIE" \n'); 
	document.write('ALIGN  = "CENTER"    > \n');
	document.write('<PARAM NAME = "MOVIE"   VALUE = "'+fileName+'"> \n');
	document.write('<PARAM NAME = "menu"    VALUE = "true"    > \n');
	document.write('<PARAM NAME = "quality" VALUE = "BEST"     > \n');
	document.write('<PARAM NAME = "scale"   VALUE = "" > \n');
	document.write('<PARAM NAME = "bgcolor" VALUE = ""  > \n');
	document.write('<param name="wmode" value="transparent" > \n');
	document.write('<EMBED src="'+fileName+'" \n');
	document.write('menu    = false \n');
	document.write('quality = BEST \n');
	document.write('swLiveConnect=true \n');
	document.write('WIDTH   = "'+movieWidth +'" \n');
	document.write('HEIGHT  = "'+movieHeight+'" \n');
	document.write('NAME    = "MOVIE" \n');
	document.write('TYPE    = "application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> \n');
	document.write('</EMBED> \n');
	document.write('</OBJECT>');
}

