// library of functions related to URL manipulation.  Pages using this function include:
// Presss Center:               for ADCAMPAIGN tracking 
// AOL's office_locator.html:   for pre-selecting states

function getNVPvalue(strURL, strParmName, bCaseSpecific)
{  
    // Description: returns value of a name/value pair in the passed URL string
    // Usage: getNVPvalue(url, 'ADCAMPAIGN', '1');
    //
    // Parameters:
    //   strURL: url to extract the name/value pair from
    //   strParmName: name part of name/value pair
    //   bCaseSpecific: when searching for name, use case passed to function. 1==true; 0==false
    //
    // Returns:
    //  the value of the nvp if found and "" if not found

    if (bCaseSpecific)
    {
    }
    else
    {
        strParmName = strParmName.toLowerCase();
        strURL      = strURL.toLowerCase();
    }

    var strChar = "";

    if (strURL.indexOf("?"+strParmName+"=") != -1)
    {   strChar = "?";
    }
    else if (strURL.indexOf("&"+strParmName+"=") != -1)
    {   strChar = "&";
    }
    else
    {   return "";
    }

    var strTemp1 = strURL.substring(strURL.indexOf(strChar+strParmName+"=")+strParmName.length+2, strURL.length);

    if (strTemp1.indexOf("&", 0) == -1)
    {   return strTemp1;
    }
    else
    {   return strTemp1.substring(0, strTemp1.indexOf("&"));
    }
}