var sURL = window.document.URL.toString();
var arrParamValues;
var arrParamNames;
var arrURLParams;

function getURLParameters() {
    var arrParams;
    if (sURL.indexOf("?") > 0) {
        arrParams = sURL.split("?");
        arrURLParams = arrParams[1].split("&");
        arrParamNames = new Array(arrURLParams.length);
        arrParamValues = new Array(arrURLParams.length);

        var i = 0;
        for (i = 0; i < arrURLParams.length; i++) {
            var sParam = arrURLParams[i].split("=");
            arrParamNames[i] = sParam[0];
            if (sParam[1] != "") {
                if (sParam[1].indexOf("#") >= 0) {
                    arrParamValues[i] = unescape(sParam[1].substring(0,sParam[1].indexOf("#")));
                } else {
                    arrParamValues[i] = unescape(sParam[1]);
                }
            } else {
                arrParamValues[i] = null;
            }
        }
    }
}

function getParamValue(strParam) {
    if (arrURLParams != null) {
        for (i = 0; i < arrURLParams.length; i++) {
            if (arrParamNames[i] == strParam) return arrParamValues[i];
        }
    }
    return null;
}

getURLParameters();

function loadPage() {
    pg = '';
    if (sURL.indexOf(".aspx") > 0) {
        pg = sURL.substring(sURL.lastIndexOf("/") + 1, sURL.lastIndexOf(".aspx"));
    }
    if (pg.toLowerCase() == 'default' || pg.toLowerCase() == '') {
    } else if (pg.toLowerCase() == 'content') {
        //if (document.getElementById('amenu' + arrParamValues[0]))
        //    document.getElementById('amenu'+arrParamValues[0]).style.color = "#E46C0A";
    } else {
        if (pg.toLowerCase() == 'ourmarkets') {
            loadIndustries();
        }
    }
}


var docPath='';
function openSpecDocument() {
    //var docPath = document.getElementById('DocImage').getAttribute('longDesc');
	docPath = docPath.substring(1,docPath.length);
//alert(docPath);
    window.open(docPath, '', 'height=650,width=850,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');
    return false;
}

function openEmployeePortal() {
    window.open('EmployeePortal/login.aspx', '', 'height=625,width=640,status=yes,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=yes'); 
    return true;
}

function openFabricatorPortal() {
    window.open('FabricatorPortal/login.aspx', '', 'height=625,width=640,status=yes,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=yes');
    return true;
}
