var bwType = null;
var trgObj = null;
var pageX;
var pageY;
var timeID;

var cWidth = 900;
var cHeight = 630;


function moveObj() {
	getPageSize();
	var posX = pageX - 230;
	var posY = pageY + 30;
	if ( bwType == 1 ) {
		trgObj.style.posLeft = posX;
		trgObj.style.posTop = posY;
	} else if ( bwType == 2 ) {
		trgObj.style.left = posX;
		trgObj.style.top = posY;
	} else {
		trgObj.moveTo( posX, posY );
	}
	timeID = setTimeout( "moveObj();", 100 );
}

function getPageSize() {
	if ( bwType == 1 ) {
		pageX = document.body.scrollLeft + document.body.clientWidth;
		pageY = document.body.scrollTop;
	} else {
		pageX = window.pageXOffset + innerWidth;
		pageY = window.pageYOffset;
	}
}

function bwCheck(){
	if ( document.all ) {
		return ( 1 );
	} else if ( document.getElementById ) {
		return ( 2 );
	} else if ( document.layers ) {
		return ( 3 );
	} else {
		return ( null );
	}
}

function formLoad( id ){
	bwType = bwCheck();
	switch ( bwType ) {
		case 1:
			trgObj = document.all( id );
			break;
		case 2:
			trgObj = document.getElementById( id );
			break;
		case 3:
			trgObj = document.layers[ id ];
			break;
		default:
			return;
	}
	//moveObj();
}

function changeW(){
var mcont=document.getElementById('mainContent');
	if ( bwType == 1 ) {
		mcont.style.top=(document.documentElement.clientHeight/2)-(cHeight/2)+'px';
		mcont.style.left=(document.documentElement.clientWidth/2)-(cWidth/2)+'px';
	} else {
		mcont.style.top=(innerHeight/2)-(cHeight/2)+'px';
		mcont.style.left=(innerWidth/2)-(cWidth/2)+'px';
	}
	timeID = setTimeout( "changeW();", 100 );
}

function setWin(){
bwType = bwCheck();
changeW();
}
