function isValEmpty(val) { return val == '' || val == undefined; }
function alertIncorrectMessage(message) { alert(message); return false; }
function validEmail(email) {
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    return (reg.test(trim(email)) != false);
}
function createXmlFromString(str) {
    var out;
    try {
        var xml = ($.browser.msie) ? new ActiveXObject("Microsoft.XMLDOM") : new DOMParser();
        xml.async = false;
        
    } catch(e){ throw new Error("XML Parser could not be instantiated") };
    
    try {
        if ($.browser.msie) out = (xml.loadXML(str)) ? xml : false;
        else out = xml.parseFromString(str, "text/xml");
    } catch(e){ throw new Error("Error parsing XML string") };
    
    return out;
}
function in_array(needle, haystack, strict) {
    var found = false, key, strict = !!strict;
 
    for (key in haystack) {
        if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
            found = true;
            break;
        }
    }
 
    return found;
}
function LTrim(value) { var re = /\s*((\S+\s*)*)/; return value.replace(re, "$1"); }
function RTrim(value) { var re = /((\s*\S+)*)\s*/; return value.replace(re, "$1"); }
function trim(value) { return LTrim(RTrim(value)); }