// Detect Browser
function RedirectForNonIE5(strRedirectLocation)
{
	var fOK = true;
	var sUserAgent = navigator.userAgent;
	
	var nIndexBrowser = sUserAgent.indexOf( "MSIE " );
	if ( nIndexBrowser == -1)
		fOK = false;	
	
	if (fOK)
	{
		var sMSIETemp = sUserAgent.substr(nIndexBrowser);
		var nIndexSemiColon = sMSIETemp.indexOf(";");
		
		var sBrowserVer = sUserAgent.substr(nIndexBrowser + 5,nIndexSemiColon);
		
		if (parseFloat("5.01") > parseFloat(sBrowserVer))
			fOK = false;
	}	
	
	if (false == fOK)
		location = strRedirectLocation;
}

// Detect MSXML
function RedirectForNonMSXML(strRedirectLocation)
{
  // Create a new instance of the XMLClientVer object
  var oXMLClientVer = new XMLClientVer();
  
  if (oXMLClientVer.bIsMSXML3)
  {
	if (oXMLClientVer.bIsMSXML4)
	{
		location = strRedirectLocation;
	}
  }  
}

//*****************************
// XML Client Version Object
//*****************************

function XMLClientVer()
{
  //*********************
  // Public properties
  //*********************
  
  this.bIsMSXML4   = false;
  this.bIsMSXML3   = false;
  this.bIsMSXML2  = false;
  
  //**********************************
  // Private implementation details
  //**********************************
  
  var e = new Error();
  var oXML = null;
  
  // Try to load the most recent version of the MSXML parser;
  // if that fails, try to load the next most recent version, and so on.
  // Always test using the version *dependent* PROGID.

  try
  {
    // Test for MSXML 4.0
    oXML = new ActiveXObject("MSXML2.DOMDocument.4.0");
    oXML = null;
    this.bIsMSXML4 = true;
    return;
  }
  catch (e)
  {
    try
    {
      // Test for MSXML 3.0
      oXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
      oXML = null;
      this.bIsMSXML3 = true;
      return;
    }
    catch (e)
    {
      try
      {
        // Test for MSXML 2.0
        oXML = new ActiveXObject("Microsoft.XMLDOM.1.0");
        oXML = null;
        this.bIsMSXML2 = true;
        return;
      }
      catch (e)
      {
        // Stub
      }
    }
  }
}

// Get Parameter from QueryString
function GetParameter ( QueryString, ParameterName )
{
	// Add "=" to the parameter name (i.e. parameterName=value)
	var ParameterName = ParameterName + "=";
				
	if ( QueryString.length > 0 )
	{
		// Find the beginning of the string
		begin = QueryString.indexOf ( ParameterName );
				
		// If the parameter name is not found, skip it, otherwise return the value
		if ( begin != -1 )
		{
			// Add the length (integer) to the beginning
			begin += ParameterName.length;
						
			// Multiple parameters are separated by the "&" sign
			end = QueryString.indexOf ( "&" , begin );
			if ( end == -1 )
			{
				end = QueryString.length
			}
					
			// Return the string
			return unescape ( QueryString.substring ( begin, end ) );
		}
				
		// Return "null" if no parameter has been found
		return "null";
		//return "";
	}
}
