/*********************************************************************
	
	=== Client Information ===
	
	* Client [ Client.js ]
	
	* updated 2001/05/28
	
	mail : peace@skipup.com
	home : http://www.skipup.com/~peace/
	
*********************************************************************/



//public class Client extends Object
function Client(){
	
	var C = Client ;
	
	var D = document ;
	var N = navigator ;
	
	/***************************** SET_STATIC_MEMBER - BEGIN *****************************/
	
	// public static final string
	C.PLATFORM = N.platform ;
	C.UA       = N.userAgent ;
	
	// public static final string
	C.NAME = N.appName ;
	
	// public static final number
	C.VERSION = parseInt( N.appVersion );
	
	// public static final boolean
	C.IE = ( D.all    !== void 0 );
	C.NN = ( D.layers !== void 0 );
	C.MZ = ( C.UA.match(/gecko/i) != null );
	
	// public static final boolean
	C.WIN = ( C.UA.match(/Win/) != null );
	C.MAC = ( C.UA.match(/Mac/) != null );
	
	// public static final boolean
	C.IE4 = ( C.IE && D.getElementById === void 0 );
	C.IE5 = ( C.IE && D.getElementById !== void 0 );
	C.NS4 = ( C.NN && C.VERSION == 4 );
	C.NS6 = ( C.NAME.match(/Netscape/) != null && C.VERSION == 5 );
	
	// public static void
	C.setBackgroundColor = function(){
		var a = arguments ;
		var c = ( a.length == 1 ) ? ( ( typeof( a[0] ) == "string" ) ? a[0] : a[0].toColor() ) : '' ;
		if( c == '' && !C.IE ) c = C.NN ? null : "transparent" ;
		if( !C.NN ){
			D.body.style.backgroundColor = c ;
		}else{
			D.bgColor = c ;
		}
	};
	
	// public static string
	C.getBackgroundColor = function(){
		var c = !C.NN ? D.body.style.backgroundColor : D.bgColor ;
		if( C.MZ && c.match(/rgb/i) != null ){
			var k = c.substring( 4 , c.length-1 ).split(',');
			for(var i=0;i<3;i++){
				k[i] = parseInt( k[i] );
				k[i] = ( k[i] < 0x10 ) ? "0"+k[i].toString(16) : k[i].toString(16) ;
			}
			return k[0]+k[1]+k[2];
		}
		if( !C.NN && !(c) ) c = D.bgColor ;
		return c.substring(1,7);
	};
	
	// public static Dimension
	C.getInnerSize = C.getSize = function(){ return !C.IE ? new Dimension( parseInt( innerWidth ) , parseInt( innerHeight ) ) : new Dimension( D.body.clientWidth , D.body.clientHeight ) ; };
	
	// public static Dimension
	C.getScroll = C.getPageOffset = C.getOffset = function(){ return C.IE ? new Dimension( D.body.scrollLeft , D.body.scrollTop ) : ( C.NN ? new Dimension( pageXOffset , pageYOffset ) : ( C.MZ ? new Dimension( parseInt( scrollX ) , parseInt( scrollY ) ) : new Dimension() ) ) ; };
	
	// public static string
	C.toString = function(){ return "Client : "+C.PLATFORM+" \/ "+C.NAME+" "+C.VERSION ; };
	
	/***************************** SET_STATIC_MEMBER - E N D *****************************/
	
} new Client();


