<!--
//######################
//# Description: Handle the Parameters in the URL
//# Author       (c) Philip Jahmani Chauvet 
//# Dated:       11/12/2006 - 11/14/2006
//# Notice:      Free to use, download, publish, but keep my name on this code.
//######################

    //Get all the Parameters in the URL
    //@return An array of parameters
function getURLParams()
{
    var params = location.href;
    pos = params.indexOf( "?");
    
    if ( pos > 0 )
    {
            //Get the params
        params = params.substring( pos+1, params.length );
            //Get the params from &
        params = params.split("&");
    } else params = null;

    return params;
}

    //Get all the Parameters in the URL
    //@return A string representing the URL parameters.
function getURLParamsString()
{
    var params = location.href;
    pos = params.indexOf( "?");
    
    if ( pos > 0 )
    {
            //Get the params
        params = params.substring( pos+1, params.length );
    } else params = null;

    return params;
}

    //Get a parameter value
    //@param The parameter to search for.
    //@return The parameter value.
function getURLParam( theParam )
{
    var params = getURLParams();
    var theValue = "";
    var theName = "";
    var param = "";

    if ( params != null && params.length > 0 )
    {
        for ( var i = 0; i < params.length; i++ )
        {
            param = params[i];
            pos = param.indexOf( "=" );
            if ( pos > 0 )
            {
                    //Compare the name of param
                theName = param.substring( 0, pos );
                if ( theParam == theName )
                {
                        //Get the value
                  theValue = param.substring( pos+1, param.length );
                  break;
                }
            }
        }
    }

    return theValue;
}

//-->


