
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}
var TimeID;
var to_x = 28;
var to_y = 320;

function sGO() {
	var banner = findObj("banner");
	if (!document.all) {
		banner.style.left = 200 + "px";
		banner.style.top = to_y + "px";
	} else {
		banner.style.left = 200 + "px";
		banner.style.top = (to_y + document.body.scrollTop) + "px";
	}
	banner.style.display = "block";
	
	TimeID = setInterval(setPlace, 100);
}

function setPlace() {
	clearInterval(TimeID);
	var banner = findObj("banner");
	var now_x = parseInt(banner.style.left.substr(0, banner.style.left.length-2));
	var now_y = parseInt(banner.style.top.substr(0, banner.style.top.length-2));
	innerWidth = document.body.clientWidth;
	if (innerWidth <= 800){ 
  	  moveW = 0;
    }else{
  	  moveW = (innerWidth - 800)/2;
    }
	
	if (!document.all) {
		banner.style.left = to_x + moveW + "px";
		banner.style.top = (now_y + (to_y + window.pageYOffset - now_y)/5) + "px";
	} else {
		banner.style.left = to_x + moveW + "px";
		banner.style.top = (now_y + (to_y + document.body.scrollTop - now_y)/5) + "px";
	}
	TimeID = setInterval(setPlace, 100);
}
