// start info
if(typeof jsReport != 'undefined'){
	jsVersion = new Array(
	/*Name			=*/ 'URL Functions',
	/*Version 		=*/ '1.22',
	/*Date 			=*/ 20020218,
	/*Author		=*/ 'Maurice van Creij',
	/*ProjectCode	=*/ 'l1_urlfuncs',
	/*Summary		=*/ 'Pass variables to a document as arguments in the URL, and manipulate URL\'s for storing and passing on.',
	/*Dependencies	=*/ new Array('urlfuncs.js'),
	/*Browsers		=*/ new Array('NS','MO','IE','OP'),
	/*Changes		=*/ new Array(
						'1.22: added "URLdomain()" to retrieve the domain from an URL',
						'1.21: added "Pathstrip" to remove folder-names from local paths ("file://...")',
						'1.2: added "HTMLencode" to complement "URLencode"',
						'1.11: fixed exceedingly stupid ie4 "var" bug',
						'1.1: added support for getting arguments from other frames\' URLs',
					  	'1.0: A modular version was compiled from code-scraps'
					  	),
	/*Usage			=*/ new Array(
						'URLparam(\'id\',\'defaultvalue\')',
						'URLframeparam(document,\'id\',\'defaultvalue\')',
						'URLstrip(document.location.href)',
						'URLencode(URLstrip(document.location.href))',
						'HTMLencode(\'<HTML></HTML>\')'
					  	)
	)
}else{
// end info


	function URLparam(paramName,defaulValue) { //-- get a given parameter from the URL
		var idx = document.URL.indexOf('?');
		var params = new Array();
		if (idx != -1) {
			var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
				for (var i=0; i<pairs.length; i++) {
					nameVal = pairs[i].split('=');
					params[nameVal[0]] = nameVal[1];
				}
		}
		var paramValue = unescape(params[paramName]);
		var test = "z" + paramValue;
		if(test == "zundefined"){paramValue = defaulValue}
	return paramValue;
	}
	
	function URLframeparam(frameName,paramName,defaulValue) { //-- get a given parameter from the URL
		var idx = frameName.URL.indexOf('?');
		var params = new Array();
		if (idx != -1) {
			var pairs = frameName.URL.substring(idx+1, frameName.URL.length).split('&');
				for (var i=0; i<pairs.length; i++) {
					nameVal = pairs[i].split('=');
					params[nameVal[0]] = nameVal[1];
				}
		}
		var paramValue = unescape(params[paramName]);
		var test = "z" + paramValue;
		if(test == "zundefined"){paramValue = defaulValue}
	return paramValue;
	}
	
	function URLencode(inStr) { //-- translate all "reserved" characters of a string to HTML equivalents
	outStr=' '; //not '' for a NS bug!
		for (i=0; i < inStr.length; i++) {
			aChar=inStr.substring (i, i+1);
			switch(aChar){
			case '%': outStr += "%25"; break; case ',': outStr += "%2C"; break;
			case '/': outStr += "%2F"; break; case ':': outStr += "%3A"; break;
			case '~': outStr += "%7E"; break; case '!': outStr += "%21"; break;
			case '"': outStr += "%22"; break; case '#': outStr += "%23"; break;
			case '$': outStr += "%24"; break; case "'": outStr += "%27"; break;
			case '`': outStr += "%60"; break; case '^': outStr += "%5E"; break;
			case '&': outStr += "%26"; break; case '(': outStr += "%28"; break;
			case ')': outStr += "%29"; break; case '+': outStr += "%2B"; break;
			case '{': outStr += "%7B"; break; case '|': outStr += "%7C"; break;
			case '}': outStr += "%7D"; break; case ';': outStr += "%3B"; break;
			case '<': outStr += "%3C"; break; case '=': outStr += "%3D"; break;
			case '>': outStr += "%3E"; break; case '?': outStr += "%3F"; break;
			case '[': outStr += "%5B"; break; case '\\': outStr += "%5C"; break;
			case ']': outStr += "%5D"; break; case ' ': outStr += "+"; break;
			default: outStr += aChar;
			}
		}
	return outStr.substring(1, outStr.length);
	}
	
	function HTMLencode(inStr) { //-- translate all "reserved" characters of a string to HTML equivalents
	outStr=' '; //not '' for a NS bug!
		for (i=0; i < inStr.length; i++) {
			aChar=inStr.substring (i, i+1);
			switch(aChar){
			case '<': outStr += "&lt;"; break; 
			case '>': outStr += "&gt;"; break;
			case ' ': outStr += "&nbsp;"; break; 
			case '	': outStr += "&nbsp;&nbsp;&nbsp;"; break;
			default: outStr += aChar;
			}
		}
	return outStr.substring(1, outStr.length);
	}

	function URLstrip(lokatie){ //-- determine the absolute path of a location (strip the domain)
		if(lokatie==-1){ //-- take the current doc's URL if no location is given
			lokatie = document.location.href;
		}
	
		var slashcount = 0;
		var urllength = 0;
		
		for (var i=0; i<lokatie.length;i++){
		var lettercheck = lokatie.substring(i,i+1)
			if (lettercheck == '/'){
				slashcount=slashcount+1
				if (slashcount == 3){urllength=i;}
			}
		}
	
		lokatie = lokatie.substring(urllength,(lokatie.length))
	return lokatie
	}
	
	
	function URLrip(lokatie){ //-- determine the absolute path of a location (strip the domain)
		lokatie = URLstrip(lokatie)
	
		ripPoint = lokatie.indexOf('?')
		if(ripPoint>-1){
			lokatie = lokatie.substring(0,ripPoint)
		}	

	return lokatie
	}
	
	function URLdomain(lokatie){
		arrDomain = lokatie.split('/')
		return arrDomain[2]
	}
	
	function Pathstrip(lokatie){ //-- determine the file-name of a complete path (strip the direcories)
		// take the current doc's Path if no location is given
		if(lokatie==-1){
			lokatie = document.location.href;
		}
		// find all the slashes
		var slashcount = 0;
		var urllength = 0;
		var slashMax = 0;
		var firstFound = false;
		
		i=lokatie.length;
		while(urllength==0&&i>0){
			lettercheck = lokatie.substring(i-1,i)
			if (lettercheck == '/'){
				urllength=i
			}
			i=i-1
		}
		
		lokatie = lokatie.substring(urllength,(lokatie.length))
	return lokatie
	}


}