var win_height = -100;
var win_width = -100;
var win_scroll = 0;
var doc_height = 0;
var layer_HTML = "";
function getSize() {
  var myWidth = 0, myHeight = 0, scroll_top = 0, scroll_height = 0; 
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
	scroll_top = document.body.scrollTop;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
	scroll_top = document.documentElement.scrollTop;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
	scroll_top = document.body.scrollTop;
  }
  win_height= myHeight;
  win_Width = myWidth;
  win_scroll = scroll_top;
  //alert(win_height);
  //alert(win_Width);
  //alert(win_scroll);
  //alert(document.documentElement.scrollTop);
}


function MoveLayer(layerName) {
getSize();
if(win_height < 350){
document.getElementById("AdLayer").innerHTML= "";
}
else{
	if(document.getElementById("AdLayer").innerHTML == ""){
		document.getElementById("AdLayer").innerHTML = layer_HTML;
	}
}

var x = 850;
var y = win_height-30;
var diff = (win_scroll + y - document.getElementById("AdLayer").style.posTop)*.40;
y = win_scroll + y - diff;
if (y > doc_height -225)
{
	y = doc_height -225;

}

eval("document.getElementById('" + layerName + "').style.posTop = y" );
eval("document.getElementById('" + layerName + "').style.posLeft = x");
setTimeout('MoveLayer("AdLayer");', 20);

}
function initAd() {
document.getElementById("AdLayer").style.posTop = -200;//??onLoad??????,??????????y????
document.getElementById("AdLayer").style.posLeft = 540;
document.getElementById("AdLayer").style.visibility = 'visible'//??????
layer_HTML = document.getElementById("AdLayer").innerHTML;

var scroll_height = 0; 
if( document.documentElement &&
  ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
scroll_height = document.documentElement.scrollHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
scroll_height = document.body.scrollHeight;
}

doc_height = scroll_height;
MoveLayer("AdLayer");//????MoveLayer()
}