function defined(object) {
    if (typeof (object) == "undefined")
        return false;
    else
        return true;
}
function hasStringOrNumberContent(object) {
    return ((typeof (object) == "string") && object != "" || (typeof (object) == "number"));
}

//Test if an object is  null :p
function isnull(object) {
    if (object != null)
        return false;
    else
        return true;
}

function printProps(obj, objName) {
    var output = "";
    for (var prop in obj) {
        output += objName + "." + prop + " = " + obj[prop] + "\n";
    }
    alert(output);
}

function isInt(value) {
    if ((parseFloat(value) == parseInt(value)) && !isNaN(value)) {
        return true;
    } else {
        return false;
    }
}

function isPositiveInt(value) {
    if ((parseFloat(value) == parseInt(value)) && !isNaN(value) && (value >=0)) {
        return true;
    } else {
        return false;
    }
}

function toDate(dateStr) {
    var parts = dateStr.split("-");
    return new Date(parts[2], parts[1] - 1, parts[0]);
}