
var movieWidth = 280
var movieHeight = 230;
var yaoti_movie = null;

var PositionX = 100;
var PositionY = 100;

//var htmlBody = document.body;
var posmode = "overlay";

	if (posmode == "static")
		document.write(FlashMovie());


function init()
{
	 if (posmode == "overlay")
    {
    	var htmlBody = document.body;
		var yaoti_div = document.createElement("div");
		htmlBody.appendChild(yaoti_div);
		yaoti_div.id = "yaoti_movie";
		yaoti_div.innerHTML = FlashMovie();


		yaoti_div.style.position = "absolute";
		yaoti_div.style.top = "-1000px";
		yaoti_div.style.left = "-1000px";
		yaoti_div.style.width = "280px";
		yaoti_div.style.height = "230px";
		yaoti_div.style.display = "none";
		yaoti_div.style.zIndex = "10000";

		var yaoti_movie = document.getElementById('yaoti_movie');

		var moviePositionY = parseInt(getWindowScroll('y') + parseInt( (  (getWindowSize('y'))/100 ) * PositionY ) ) - (movieHeight/(100/PositionY) );

		var moviePositionX = parseInt(getWindowScroll('x') + parseInt( (  (getWindowSize('x')-20)/100 ) * PositionX ) ) - (movieWidth/(100/PositionX) );


		  yaoti_movie.style.top = moviePositionY+'px';
		  yaoti_movie.style.left = moviePositionX+'px';
		  yaoti_movie.style.display = "block";
	}
}

function getWindowSize(toreturn)
{
	var position = new Array();
  if (self.innerHeight) // all except Explorer
  {
  	position['x'] = self.innerWidth;
  	position['y'] = self.innerHeight;
  }
  else if (document.documentElement && document.documentElement.clientHeight)
  	// Explorer 6 Strict Mode
  {
  	position['x'] = document.documentElement.clientWidth;
  	position['y'] = document.documentElement.clientHeight;
  }
  else if (document.body) // other Explorers
  {
  	position['x'] = document.body.clientWidth;
  	position['y'] = document.body.clientHeight;
  }
  if(typeof toreturn == "string")
  return parseInt(position[toreturn]);
  else
  return position;

}

function getWindowScroll(toreturn)
{
	var yaoti_movie = document.getElementById('yaoti_movie');
  var position = new Array();
  if (self.pageYOffset) // all except Explorer
  {
  	position['x'] = self.pageXOffset;
  	position['y']= self.pageYOffset;
  }
  else if (document.documentElement && document.documentElement.scrollTop)
  	// Explorer 6 Strict
  {
  	position['x'] = document.documentElement.scrollLeft;
  	position['y'] = document.documentElement.scrollTop;
  }
  else if (document.body) // all other Explorers
  {
  	position['x'] = document.body.scrollLeft;
  	position['y'] = document.body.scrollTop;
  }


  if(typeof toreturn == "string")
  return parseInt(position[toreturn]);
  else
  return position;
}



function setResize()
{
	yaoti_movie = document.getElementById('yaoti_movie');
	if (yaoti_movie == null)
		{
		window.setTimeout('setResize()',10);
		}
	else
		{
		var moviePositionY = parseInt(getWindowScroll('y') + parseInt( (  (getWindowSize('y'))/100 ) * PositionY ) ) - (movieHeight/(100/PositionY) );

		var moviePositionX = parseInt(getWindowScroll('x') + parseInt( (  (getWindowSize('x')-20)/100 ) * PositionX ) ) - (movieWidth/(100/PositionX) );

  		yaoti_movie.style.top = moviePositionY+'px';
  		yaoti_movie.style.left = moviePositionX+'px';
		}
}

function setScroll()
{
	yaoti_movie = document.getElementById('yaoti_movie');
	if (yaoti_movie == null)
		{
		window.setTimeout('setScroll()',10);
		}
	else
		{

		var moviePositionY = parseInt(getWindowScroll('y') + parseInt( (  (getWindowSize('y'))/100 ) * PositionY ) ) - (movieHeight/(100/PositionY) );

		var moviePositionX = parseInt(getWindowScroll('x') + parseInt( (  (getWindowSize('x')-20)/100 ) * PositionX ) ) - (movieWidth/(100/PositionX) );

		yaoti_movie.style.top = moviePositionY+'px';
		yaoti_movie.style.left = moviePositionX+'px';
		}
}

function FlashMovie()
{
	txt = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' id='footage' width='280' height='230'><param name='movie' value='baskan.swf' /><param name='quality' value='high' /><param name='wmode' value='transparent' /><embed src='baskan.swf' width='280' height='230' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode='transparent'></embed></object>";

return txt;
}


window.onload = init;
window.onresize = setResize;
window.onscroll = setScroll;
