var IE = true;
var sVisible = 'visible';
var sHidden = 'hidden';
var sAll = 'window.document.all';
var sStyle = '.style';

function Compatibility(){
	if(window.navigator.appName.indexOf('Microsoft')==-1){
		IE = false;
		sVisible = 'show';
		sHidden = 'hide';
		sAll = 'window.document.layers';
		sStyle = '';
	}
}
function Get(sObj){
	if(IE)
		return window.document.all[sObj];
	else
		return window.document.layers[sObj];
}
function Visibility(oObj, sIn){
	eval('oObj' + sStyle + '.visibility = sIn' );
}
function Position(oObj, sPos, iPos){
	eval('oObj' + sStyle + '.' + sPos + ' = ' + iPos );
}

//######################################
function GetObj(sObj, oWindow, oDoc){
  var i;
  var oObj;

	if(!oDoc){
		if(!oWindow) oDoc = window.document;
		else 	oDoc = oWindow.document;
	}

	if(document.getElementById){
		oObj = oDoc.getElementById( sObj );
		if(oObj) return oObj;
	}

	if( oDoc.all ){
		oObj = oDoc.all[sObj];
		if(oObj) return oObj;
	}

	for(i=0;!oObj && i<oDoc.forms.length;i++) oObj=oDoc.forms[i][sObj];
	if(oObj) return oObj;

	if( oDoc.layers ){
		oObj = oDoc.layers[sObj];
		if(oObj) return oObj;
	}

  for(i=0;!oObj && oDoc.layers && i<oDoc.layers.length;i++){
		oObj = GetObj(sObj,  oWindow, oDoc.layers[i].document);
	}
	return oObj;
}

//######################################
function Do_Visibility( oObj, bState ){

	if(oObj.style.visibility){
		oObj.style.visibility = bState? 'visible': 'hidden';
	}
	else{
		if(window.document.layers){
			oObj.visibility = bState? 'show': 'hide';
		}
	}
}

//######################################
function Do_Display( oObj, bState ){
	if(window.document.layers)
		oObj.display = bState? 'block': 'none';
	else
		oObj.style.display = bState? 'block': 'none';
}

//######################################
function Do_Position( oObj, x, y ){
	if(window.document.layers){
		oObj.moveToAbsolute(x, y);
	}
	else{
		oObj.style.left = x;
		oObj.style.top = y;
	}
}


//######################################
function doWrite( oObj, sContent){
	if( window.document.body.innerHTML ){
		oObj.innerHTML = sContent;
	}
	else{
		oObj.document.open();
		oObj.document.write( sContent );
		oObj.document.close();
	}
}

//######################################
function get_DisplayState( oObj  ){
	if(window.document.layers)
		return oObj.display;
	else
		return oObj.style.display;
}
