﻿// JScript File
function MyURLDecode (clearString) {
    var output = '';
    
    var huruf = new Array(" ", "\"", "#", "$", "%", "&", "+", ",", "/", ":", ";", "<", "=", ">", "?", "@", "[", "\\", "]", "^", "`", "{", "|", "}", "~", String.fromCharCode(13), String.fromCharCode(10));            
    var hurufEncode = new Array("%20", "%22", "%23", "%24", "%25", "%26", "%2b", "%2c", "%2f", "%3a", "%3b", "%3c", "%3d", "%3e", "%3f", "%40", "%5b", "%5c", "%5d", "%5e", "%60", "%7b", "%7c", "%7d", "%7e", "%0d", "%0a");
            
    for (var j = 0; j < hurufEncode.length; j++) {
        while(clearString.indexOf(hurufEncode[j]) > -1)
            clearString = clearString.replace(hurufEncode[j], huruf[j]);
    }
   
    output = clearString;
    
    return output;
}

function MyURLencode (clearString) {
    var output = '';
    
    var hurufEncode = new Array(" ", "\"", "#", "$", "%", "&", "+", ",", "/", ":", ";", "<", "=", ">", "?", "@", "[", "\\", "]", "^", "`", "{", "|", "}", "~", String.fromCharCode(13), String.fromCharCode(10));            
    var huruf = new Array("%20", "%22", "%23", "%24", "%25", "%26", "%2b", "%2c", "%2f", "%3a", "%3b", "%3c", "%3d", "%3e", "%3f", "%40", "%5b", "%5c", "%5d", "%5e", "%60", "%7b", "%7c", "%7d", "%7e", "%0d", "%0a");
            
    for (var j = 0; j < hurufEncode.length; j++) {
        while(clearString.indexOf(hurufEncode[j]) > -1)
            clearString = clearString.replace(hurufEncode[j], huruf[j]);
    }
   
    output = clearString;
    
    return output;
}  

function toNumeric(o) {
    if(/[^0-9]/.test(o.value)){
        o.value=o.value.replace(/([^0-9])/g,"");
    }
}

function charFilter(o) {
    if(/[-~=*|\[\]{}\"'`#\^]/.test(o.value)){
        o.value=o.value.replace(/([-~=*|\[\]{}\"'`#\^])/g,"");
    }
}


