﻿function ClearTextField(id) {
    document.getElementById(id).value = "";
}
function ClearCheckBoxField(id) {
    document.getElementById(id).checked = false;
}
function isEmptyTextField(id) {

    if (document.getElementById(id).value == "")
        return true;
    else
        return false;
}
function isChecked(id) {
    return document.getElementById(id).checked;
}
function isValidEmail(email) {
    var reEmail = /^(([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+([;.](([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+)*$/;
    return reEmail.test(email);
}
function ShowAllButThisDiv(divIdArray, IdToShow, arrayCount) {
    var toShow = document.getElementById(IdToShow);
    for (index = 0; index <= arrayCount; index++) {
        var current = document.getElementById(divIdArray[index])
        current.style.display = 'none';
        if (toShow == current) {
            current.style.display = 'block';
        }
    }

}
function ReturnQueryString(param) {
    
    var qryStr = "";
    if (window.location.search.substring(1) != "")
        qryStr = window.location.search.substring(1);

    if (qryStr == null)
        return null;

    var allParams = qryStr.split("&");
    for (i = 0; i < allParams.length; i++) {
        var qParam = allParams[i].split("=");
        if (qParam[0] == param)
            return qParam[1];
    }

    return null;

}

function ChangeMouseCursor(NewCursor, elementId) {
    var elem = document.getElementById(elementId);
    elem.style.cursor = NewCursor; 
    
}

