	function isEmpty(s){
		return ((s == null) || (s.length == 0))
	}

    function getContextPath(){
        var appArray    = top.window.location.href.split('/');
        if(appArray == null || appArray.length < 4){
            alert("Unable to determine application context");
            return '';
        }
        return ('/' + appArray[3]);
    }

    // if you remove the LANGUAGE="JavaScript", this won't work in Firefox
    function includeJS(name){
        if(isEmpty(name)) return;
        document.write(
                        '<scr'
                        +'ipt LANGUAGE="JavaScript" type="text/javascript" src="' 
                        + getContextPath() + '/javascript/phistream/' + name + '" ></scr'
                        +'ipt>'
                      );
    }
    
    function addHidden(tbl,fieldName,fieldValue){
        var hidden    			= document.createElement("input");
        hidden.type   			= 'hidden';
        hidden.name   			= fieldName;
        hidden.value  			= fieldValue;
        tbl.appendChild(hidden);
	}

    includeJS('misc.js');
    includeJS('validations.js');
    includeJS('datetime.js');
    includeJS('validations_mandatory.js');
    includeJS('combobox.js');
    includeJS('checkbox.js');
    includeJS('ajax.js');
    includeJS('docuphi.js');
    includeJS('hashmap.js');
    includeJS('labels.js');
