// *********************************************************
// file: querystring.js
// date: 27.09.2007
// author: (c) by Marko Schulz - <info@tuxnet24.de>
// description: Get formular data from QueryString.
// *********************************************************
// example of script call:
// http://www.doman.de/querystring.html?src=xxx&target=yyy
var pairs = new Array();
var form = new Array();
var queryString = location.search.substring( 1, location.search.length );
if ( queryString ) pairs = queryString.split( '&' );
for ( var i=0; i<pairs.length; i++ ) {
// split pairs into name/data and encode them...
var line = pairs[i].split( '=' );
var name = line[0].replace( /\+/g, " " );
var data = line[1].replace( /\+/g, " " );
name = unescape( name );
data = unescape( data );
// eliminate XY coordinates from image button...
name = name.replace( /[a-z]*(\.x|\.y)/ig, "" );
// define assoc-array "form"...
if ( form[name] ) { form[name] = form[name]+","+data; }
else { form[name] = data; }
}
// example of form data:
// alert( form['src'] );
// alert( form['target'] );
// *********************************************************
// end of this script...