utils = {};

defaultWindow = {};
defaultWindow.popup = null;
defaultWindow.width = 400;
defaultWindow.height = 580;
defaultWindow.properties = "location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0";
/**
 *  Will open up the URL in our default window settings
 **/

utils.popUpWindow = function(url, width, height) {
    if (defaultWindow.popup && !defaultWindow.popup.closed) {
        defaultWindow.popup.location = url;
    } else {
        if (width != null) {
            defaultWindow.popup = window.open(url, '_blank', 'width=' + width + ',height=' + height + ',' + defaultWindow.properties);
        } else {
            defaultWindow.popup = window.open(url, '_blank', 'width=' + defaultWindow.width + ',height=' + defaultWindow.height + ',' + defaultWindow.properties);
        }
    }
    defaultWindow.popup.focus();
}

utils.popUpNewTarget = function(url) {
    defaultWindow.popup = window.open(url, '_blank');
    defaultWindow.popup.focus();
}


/**
 * Will read the url from from the input field 'idFrom' and pop it up in a new window
 **/
utils.popUpPage = function(idFrom) {
    var elm = document.getElementById(idFrom);
    if (!elm) return;
    window.open(elm.value);
};

utils.isIE = function() {
    return navigator.appName.indexOf('Microsoft') > -1;
}

utils.isIE7 = function() {
    return navigator.userAgent.indexOf("MSIE 7.") > -1;
}

/**
 * This is to disabled forms from being submitted more than once
 **/
disableForm = function(theForm) {
    if (theForm.theSubmit != null) {
        theForm.theSubmit.disabled = true;
    }
};