function GetUrlParam(name)
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return unescape(results[1]);
}

    function GetUrlScriptname()
    {
      var rex = new RegExp("\\/[^\\/]+\\.\\w+($|\\?)");
      var match = rex.exec(location.pathname);
      return match[0].substring(1);
    }

function ColorToFilenameFormat(color) 
{
	color = color.toLowerCase();
	color = color.replace(/ /g,"");
	color = color.replace(/\//g,"");
	return color;	
}

function OpenUrlNewWindow(url, width, height)
{
  var left, top1;
  
  left = (screen.width - 0.85*screen.width)/2;
  top1 = (screen.height - 0.85*screen.height)/4;

  window.open(url, 'popupwindow',
              'width=' + width.toString() + ',height=' + height.toString() + ',alwaysLowered=1,alwaysRaised=0,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,left=' + left.toString() + ',top=' + top1.toString() + ',z-lock=0');

}

//========= Functions to determine window size and scroll positions =========
function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
//---------------------------------------------------------------------------