// JavaScript Document
function MWJ_findObj( oName, oFrame, oDoc ) {
	if( !oDoc ) {
        if( oFrame ) {
            oDoc = oFrame.document;
        } else {
            oDoc = window.document;
        }
    }
    
	if( oDoc[oName] ) {
        return oDoc[oName];
    }
    
    if( oDoc.all && oDoc.all[oName] ) {
        return oDoc.all[oName];
    }
    
	if( oDoc.getElementById && oDoc.getElementById(oName) ) {
        return oDoc.getElementById(oName);
    }
    
	for( var x = 0; x < oDoc.forms.length; x++ ) {
        if( oDoc.forms[x][oName] ) {
            return oDoc.forms[x][oName];
        }
    }
    
	for( var x = 0; x < oDoc.anchors.length; x++ ) {
        if( oDoc.anchors[x].name == oName ) {
            return oDoc.anchors[x];
        }
    }
    
	for( var x = 0; document.layers && x < oDoc.layers.length; x++ ) {
		var theOb = MWJ_findObj( oName, null, oDoc.layers[x].document );
        if( theOb ) {
            return theOb;
        }
    }
    
	if( !oFrame && window[oName] ) {
        return window[oName];
    }
    
    if( oFrame && oFrame[oName] ) {
        return oFrame[oName];
    }
    
	for( var x = 0; oFrame && oFrame.frames && x < oFrame.frames.length; x++ ) {
		var theOb = MWJ_findObj( oName, oFrame.frames[x], oFrame.frames[x].document );
    
        if( theOb ) {
            return theOb;
        }
    }
	
    return null;
}

function MWJ_changeDisplay( oName, oDisp, oFrame ) {
	var theDiv = MWJ_findObj( oName, oFrame );
    
    if( !theDiv ) { return; }
	
    if( theDiv.style ) {
        theDiv = theDiv.style;
    }
    
    if( typeof( oDisp ) == 'string' ) {
        oDisp = oDisp.toLowerCase();
    }
	
    theDiv.display = ( oDisp == 'none' ) ? 'none' : ( oDisp == 'block' ) ? 'block' : ( oDisp == 'inline' ) ? 'inline' : '';
}

function MWJ_getStyle( oName, oStyle, oFrame ) {
	
    if( oName == 'document' ) {
		var theBody = oFrame ? oFrame.document : window.document;
		
        if( theBody.documentElement && theBody.documentElement.style && theBody.documentElement.style.backgroundColor ) {
            return theBody.documentElement.style.backgroundColor;
        }
		
        if( theBody.body && theBody.body.style && theBody.body.style.backgroundColor ) {
            return theBody.body.style.backgroundColor;
        }
		
        if( theBody.documentElement && theBody.documentElement.style && theBody.documentElement.style.background ) {
            return theBody.documentElement.style.background;
        }
		
        if( theBody.body && theBody.body.style && theBody.body.style.background ) {
            return theBody.body.style.background;
        }
        
		if( theBody.bgColor ) {
            return theBody.bgColor;
        }
		
        return '#ffffff';
	}
    
	var theDiv = MWJ_findObj( oName, oFrame );
    
    if( !theDiv ) {
        return null;
    }
    
    if( theDiv.style && oStyle != 'clip' ) {
        theDiv = theDiv.style;
    }
	
    switch( oStyle ) {
		case 'visibility':
            return ( ( theDiv.visibility && !( theDiv.visibility.toLowerCase().indexOf( 'hid' ) + 1 ) ) ? true : false );
		case 'left':
			return ( parseInt( theDiv.left ) ? parseInt( theDiv.left ) : 0 );
		case 'top':
			return ( parseInt( theDiv.top ) ? parseInt( theDiv.top ) : 0 );
		case 'zIndex':
			return ( isNaN( theDiv.zIndex ) ? 0 : theDiv.zIndex );
		case 'background':
			return ( theDiv.bgColor ? theDiv.bgColor : theDiv.background-color ? theDiv.background-color : theDiv.background );
		case 'display':
            return ( theDiv.display ? theDiv.display : '' );
		case 'size':
			if( typeof( theDiv.pixelWidth ) != 'undefined' ) { return [theDiv.pixelWidth,theDiv.pixelHeight]; }
			if( typeof( theDiv.width ) != 'undefined' ) { return [parseInt(theDiv.width),theDiv.parseInt(height)]; }
			if( theDiv.clip && typeof( theDiv.clip.bottom ) == 'number' ) { return [theDiv.clip.right,theDiv.clip.bottom]; }
			return [0,0];
		case 'clip':
			if( theDiv.clip ) { return theDiv.clip; }
			theDiv = ( theDiv.style && theDiv.style.clip ) ? theDiv.style.clip : 'rect()';
			theDiv = theDiv.substr( theDiv.indexOf( '(' ) + 1 ); var theClip = new Object();
			for( var x = 0, y = ['top','right','bottom','left']; x < 4; x++ ) {
				theClip[y[x]] = parseInt( theDiv ); if( isNaN( theClip[y[x]] ) ) { theClip[y[x]] = 0; }
				theDiv = theDiv.substr( theDiv.indexOf( ( theDiv.indexOf( ' ' ) + 1 ) ? ' ' : ( theDiv.indexOf( '	' ) + 1 ) ? '	' : ',' ) + 1 );
			} return theClip;
		default:
			return null;
	}
}