//http://www.netlobo.com/url_query_string_javascript.html
function gup( name, str )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var url=null;

  if(str)
  	url = str;
  else
	  url = window.location.href;

  url = url.replace(/&amp;/,"&");

  //alert(url);
  var results = regex.exec( url );
  if( results == null )
    return "";
  else
    return results[1];
}



var getUrlParameters = gup;
/*
The way that the function is used is fairly simple. Let's say you have the following URL:
     http://www.foo.com/index.html?bob=123&frank=321&tom=213#top
You want to get the value from the frank parameter so you call the javascript function as follows:
     var frank_param = gup( 'frank' );
*/
//===========================================================================================
function parseURL(url)
{
	var i = url.indexOf('?');
	var newstr = url.substring(i+1, url.length);
	return newstr;
}
//===========================================================================================