
// Create variable is_input to see if there is a ? in the url
var is_input = document.URL.indexOf('?');
var inputArgs= new Array();

// Check the position of the ? in the url
if (is_input != -1)
{ 
	// Create variable from ? in the url to the end of the string
	addr_str = document.URL.substring(is_input+1, document.URL.length);
	var keyIndex1=0;
	var keyIndex2=0;
	var valueIndex1=0;
	
	// Loop through the url and write out values found
	// or a line break to seperate values by the &
	for (count = 0; count <= addr_str.length; count++) 
	{
	
		
		if (addr_str.charAt(count) == "&" || count==addr_str.length) {
			// Write a line break for each & found
//			document.write ("<br>");
			
			if (keyIndex1>=0 && valueIndex1>=0 && keyIndex2>keyIndex1 && count>valueIndex1) {
				var key=addr_str.substring(keyIndex1, keyIndex2);
				var value=addr_str.substring(valueIndex1, count);
				inputArgs[key]=value;
//				document.write ("parsed "+key+" is "+inputArgs[key]+"<br>");
			}	

			keyIndex1=count+1;
		
		} else if (addr_str.charAt(count) == "=") {
			// Write a line break for each & found
//			document.write (" is ");
			valueIndex1=count+1;
			keyIndex2=count;
		
		} else {
			// Write the part of the url 
//			document.write (addr_str.charAt(count));
		
		}
	
	}
}
/*
for ( key in inputArgs) {
	document.write ("args key="+key+" value="+inputArgs[key]+"<br>");
}	
*/
