function URL(str){
	this.raw 	= str

	this.toString	= function(){ 
		return this.raw;	
	}

	var loc = String(str).match(/^([^:]*):\/\/([^\/]*)\/(.*)$/)
	if(!loc) return;
	this.proto 	= loc[1]
	this.host  	= loc[2]
	var tmpuri	= loc[3]
	var pos		= tmpuri.lastIndexOf('/')
	this.file   	= tmpuri.substring(pos)
	this.uri	= tmpuri.substring(0,pos)
	
}

function Environment(){

	//get host info

	var u = new URL(document.location);
	
//	var loc = String(document.location).match(/^([^:]*):\/\/([^\/]*)\/(.*)$/)
	this.proto 	= u.proto
	this.host  	= u.host
	this.file   	= u.file
	this.uri	= u.uri
	this.platform 	= navigator.platform

	this.working_dir = "/home/groups/home/web/"+this.uri

	this.engine	= 'jsp'

	//for(var i in navigator) alert(i+' = '+navigator[i])
	//get browser info
	this.NS6 = (navigator && (navigator.vendor || String(navigator.product).toLowerCase() == 'gecko')) ? 1 : 0;
	this.NS4 = (!this.NS6 && document.layers) ? 1 : 0;
	this.IE = this.IE4 = (!this.NS6 && document.all) ? 1 : 0;
	this.IE5_5 = (navigator.appVersion.match(/MSIE 5.5|MSIE 6/) != null)
	this.DOM   = (this.IE4 || this.NS6) //DHTML enabled browsers using the DOM
	this.isMac = (navigator.appVersion.indexOf("Mac") != -1);


//PD_ROOT_PATH = xmlConf.selectSingleNode('//defaultpath').text
//PD_ROOT_DIR = xmlConf.selectSingleNode('//defaultdir').text
//PD_DRIVE_PATH = xmlConf.selectSingleNode('//drivepath').text
//PD_FTP_USER= xmlConf.selectSingleNode('//ftpuser').text

//PD_URI = String(document.location).replace(new RegExp('http:\/\/'+PD_HTTP_HOST),'').replace(/\/[^\/]*$/,'')
//PD_DOCUMENT_ROOT = PD_DRIVE_PATH.replace(new RegExp(PD_URI.replace(/\//g,'\\')+'\\\\?$'),'')

//PD_USER = '<%= String(Request.ServerVariables("AUTH_USER")).replace(/PLATYPUSDESIGN\\/i,'') %>'
//PD_CLIENT_PATH = 'D:\\clients\\'

}


var env = new Environment()
