﻿/// <reference name="MicrosoftAjax.js" />

String.prototype.trim = function() {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

function cleanStr(item) {
    var txt, re, r;
    txt = item.value;
    re = /[^A-Za-z0-9_\s\.\-\&\,]/g;
    r = txt.replace(re, '');
    r = r.trim();
    item.value = r.toUpperCase();
}

function chk_Select(src, args) {
    var s = $get(src.controltovalidate);
    /* var s = document.getElementById(src.controltovalidate); */
    args.IsValid = (s.selectedIndex > 0);
}

function justNumbers(item) {
    var txt, re, r;
    txt = item.value;
    re = /[^0-9]/g;
    r = txt.replace(re, '');
    item.value = r.trim();
}

function justAlphaNum(item) {
    var txt, re, r;
    txt = item.value;
    re = /[^A-Za-z0-9]/g;
    r = txt.replace(re, '');
    item.value = r.trim();
}

function justAlpha(item) {
    var txt, re, r;
    txt = item.value;
    re = /[^A-Za-z\s]/g;
    r = txt.replace(re, '');
    r = r.trim();
    item.value = r.toUpperCase();
}

function justDates(item) {
    var txt, re, r;
    txt = item.value;
    re = /[^0-9\-\/]/g;
    r = txt.replace(re, '');
    r = r.trim();
    item.value = r.toUpperCase();
}

function trimEmail(item) {
    //var r = new String(item.value);
    //item.value = r.trim();
    var txt, re, r;
    txt = item.value;
    re = /[^A-Za-z0-9_\@\.\-]/g;
    r = txt.replace(re, '');
    item.value = r.trim();
}

