{"action":"opened","issue":{"url":"https://api.github.com/repos/stevenballs/Hello-world/issues/3","repository_url":"https://api.github.com/repos/stevenballs/Hello-world","labels_url":"https://api.github.com/repos/stevenballs/Hello-world/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/stevenballs/Hello-world/issues/3/comments","events_url":"https://api.github.com/repos/stevenballs/Hello-world/issues/3/events","html_url":"https://github.com/stevenballs/Hello-world/issues/3","id":186219936,"number":3,"title":"helper","user":{"login":"stevenballs","id":5410002,"avatar_url":"https://avatars.githubusercontent.com/u/5410002?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenballs","html_url":"https://github.com/stevenballs","followers_url":"https://api.github.com/users/stevenballs/followers","following_url":"https://api.github.com/users/stevenballs/following{/other_user}","gists_url":"https://api.github.com/users/stevenballs/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenballs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenballs/subscriptions","organizations_url":"https://api.github.com/users/stevenballs/orgs","repos_url":"https://api.github.com/users/stevenballs/repos","events_url":"https://api.github.com/users/stevenballs/events{/privacy}","received_events_url":"https://api.github.com/users/stevenballs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-31T07:18:14Z","updated_at":"2016-10-31T07:18:14Z","closed_at":null,"body":"$(document).ready(function () {\r\n    $(\"#predictive_id\").val(GetQueryStringParams('predictive_id'))\r\n});\r\n\r\nvar secTalktime = 0;\r\n\r\nvar support = {}\r\n\r\nsupport.dateFormat = function (val, format) {\r\n    var rn = null;\r\n    try {\r\n        if (null != val && val.length == 10 && val.indexOf('/') !== -1) {\r\n            var date = val.split(\"/\");\r\n\r\n            if (null != format && format == \"yyyy-MM-dd\") {\r\n                rn = date[2] + \"-\" + date[1] + \"-\" + date[0];\r\n            } else if (null != format && format == \"dd/MM/yyyy\") {\r\n                rn = date[0] + \"/\" + date[1] + \"/\" + date[2];\r\n            }\r\n        }\r\n        else if (val != \"\" && val.length == 8) {\r\n            rn = val;\r\n        }\r\n\r\n        return rn;\r\n    } catch (e) {\r\n        alert(e.Message);\r\n    }\r\n}\r\nfunction AjaxWebService(webMethod, data) {\r\n    var _tmp;\r\n    $.ajax({\r\n        async: false\r\n        , type: \"POST\"\r\n        , url: webMethod\r\n        , contentType: \"application/json; charset=utf-8\"\r\n        , dataType: \"json\"\r\n        , data: \"{data:'\" + JSON.stringify(data).replace(/'/g, \"\\\\'\\\\'\") + \"'}\"\r\n        , success: function (response) {\r\n            _tmp = response.d\r\n        }\r\n        , error: function (xhr, status, msg) {\r\n            var error = eval(\"(\" + xhr.responseText + \")\");\r\n            alert(error.Message);\r\n            _tmp = null\r\n        }\r\n    });\r\n    return _tmp;\r\n}\r\nfunction AjaxWebServiceNoAsync(webMethod, data) {\r\n    var _tmp;\r\n    $.ajax({\r\n        type: \"POST\"\r\n        , url: webMethod\r\n        , contentType: \"application/json; charset=utf-8\"\r\n        , dataType: \"json\"\r\n        , data: \"{data:'\" + JSON.stringify(data).replace(/'/g, \"\\\\'\\\\'\") + \"'}\"\r\n        , success: function (response) {\r\n            _tmp = response.d\r\n        }\r\n        , error: function (xhr, status, msg) {\r\n            var error = eval(\"(\" + xhr.responseText + \")\");\r\n            alert(error.Message);\r\n            _tmp = null\r\n        }\r\n    });\r\n    return _tmp;\r\n}\r\nfunction GetQueryStringParams(sParam) {\r\n    var sPageURL = decodeURIComponent(window.location.search.substring(1));\r\n    var sURLVariables = sPageURL.split('&');\r\n    for (var i = 0; i < sURLVariables.length; i++) {\r\n        var sParameterName = sURLVariables[i].split('=');\r\n        if (sParameterName[0].toLowerCase() == sParam.toLowerCase()) {\r\n            return sParameterName[1];\r\n        }\r\n    }\r\n}\r\n\r\nfunction FileExists(url) {\r\n    if (url) {\r\n        var req = new XMLHttpRequest();\r\n        req.open('GET', url, false);\r\n        req.send();\r\n        return req.status == 200;\r\n    } else {\r\n        return false;\r\n    }\r\n}\r\n\r\nfunction DateFormat(cvtValue) {\r\n    var date = \"\";\r\n    if (typeof (cvtValue) === \"undefined\") {\r\n        date = \"-\";\r\n    }\r\n    else {\r\n        var dateString = cvtValue.substr(6);\r\n        var currentTime = new Date(parseInt(dateString));\r\n        var month = currentTime.getMonth() + 1;\r\n        var day = currentTime.getDate();\r\n        var year = currentTime.getFullYear();\r\n        var date = day + \"/\" + month + \"/\" + year;\r\n    }\r\n    return date;\r\n}\r\n\r\nfunction DayFormat(cvtValue) {\r\n    var dateString = cvtValue.substr(6);\r\n    var currentTime = new Date(parseInt(dateString));\r\n    var day = currentTime.getDate();\r\n    return day;\r\n}\r\n\r\nfunction MonthFormat(cvtValue) {\r\n    var dateString = cvtValue.substr(6);\r\n    var currentTime = new Date(parseInt(dateString));\r\n    var month = currentTime.getMonth() + 1;\r\n    return month;\r\n}\r\n\r\nfunction YearFormat(cvtValue) {\r\n    var dateString = cvtValue.substr(6);\r\n    var currentTime = new Date(parseInt(dateString));\r\n    var year = currentTime.getFullYear();\r\n    return year;\r\n}\r\n\r\nfunction DateTimeNow() {\r\n    var d = new Date();\r\n    var month = d.getMonth() + 1;\r\n    var day = d.getDate();\r\n    var hour = d.getHours();\r\n    var minute = d.getMinutes();\r\n    var second = d.getSeconds();\r\n    var output =\r\n    (('' + day).length < 2 ? '0' : '') + day + '/' +\r\n    (('' + month).length < 2 ? '0' : '') + month + '/' +\r\n    d.getFullYear() + ' ' +\r\n    (('' + hour).length < 2 ? '0' : '') + hour + ':' +\r\n    (('' + minute).length < 2 ? '0' : '') + minute + ':' +\r\n    (('' + second).length < 2 ? '0' : '') + second;\r\n    return output;\r\n}\r\n\r\nfunction AgeCalculation(birthday) {\r\n    var result = {};\r\n\r\n    var from = birthday.split(/\\/|-/g);\r\n    var cal = new Date(from[2], from[1] - 1, from[0]);\r\n    var cur = new Date();\r\n\r\n    var curday = cur.getDate();\r\n    var curmon = cur.getMonth();\r\n    var curyear = cur.getFullYear();\r\n\r\n    var calday = cal.getDate();\r\n    var calmon = cal.getMonth();\r\n    var calyear = cal.getFullYear();\r\n\r\n    if (parseFloat(calyear) > parseFloat(curyear)) {\r\n        alert(\"Enter Your date of birth year less than current year\");\r\n    }\r\n    else if (parseFloat(calyear) == parseFloat(curyear) && parseFloat(calmon) > parseFloat(curmon)) {\r\n        alert(\"Enter Your date of birth month less than current month\");\r\n    }\r\n    else if (parseFloat(calyear) == parseFloat(curyear) && parseFloat(calmon) == parseFloat(curmon) && parseFloat(calday) > parseFloat(curday)) {\r\n        alert(\"Enter Your date of birth date less than current date\");\r\n    }\r\n    else {\r\n        var curd = new Date(curyear, curmon - 1, curday);\r\n        var cald = new Date(calyear, calmon - 1, calday);\r\n\r\n        if (cald.getMonth() != (calmon - 1)) {\r\n            alert(\"Invalid Date\");\r\n        }\r\n        else if (curd.getMonth() != (curmon - 1)) {\r\n            alert(\"Invalid Date\");\r\n        }\r\n        else {\r\n            var diff = Date.UTC(curyear, curmon - 1, curday, 0, 0, 0) - Date.UTC(calyear, calmon - 1, calday, 0, 0, 0);\r\n            var dife = Datediff(cald, curd);\r\n            var days = dife.days;\r\n            var months = dife.months;\r\n            var years = dife.years;\r\n\r\n            var secleft = diff / 1000 / 60;     //minutes since your birth - Approximate\r\n            var hrsleft = secleft / 60;         //hours since your birth - Approximate\r\n            var daysleft = hrsleft / 24;        //days since your birth\r\n\r\n            var as = parseInt(calyear) + dife.years + 1;\r\n            var diff = Date.UTC(as, calmon - 1, calday, 0, 0, 0) - Date.UTC(curyear, curmon - 1, curday, 0, 0, 0);\r\n            var datee = diff / 1000 / 60 / 60 / 24; //days left for your next birthday\r\n\r\n            result = {\r\n                days: days,\r\n                months: months,\r\n                years: years,\r\n                secleft: secleft,\r\n                hrsleft: hrsleft,\r\n                daysleft: daysleft,\r\n                datee: datee\r\n            };\r\n        }\r\n    }\r\n\r\n    return result;\r\n}\r\n\r\nfunction Datediff(dateFrom, dateTo) {\r\n    var from = {\r\n        d: dateFrom.getDate(),\r\n        m: dateFrom.getMonth(),\r\n        y: dateFrom.getFullYear()\r\n    };\r\n\r\n    var to = {\r\n        d: dateTo.getDate(),\r\n        m: dateTo.getMonth(),\r\n        y: dateTo.getFullYear()\r\n    };\r\n\r\n    var daysFebruary = to.y % 4 != 0 || (to.y % 100 == 0 && to.y % 400 != 0) ? 28 : 29;\r\n    var daysInMonths = [0, 31, daysFebruary, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\r\n\r\n    if (to.d < from.d) {\r\n        to.d += daysInMonths[parseInt(to.m)];\r\n        from.m += 1;\r\n    }\r\n    if (to.m < from.m) {\r\n        to.m += 12;\r\n        from.y += 1;\r\n    }\r\n\r\n    return {\r\n        days: to.d - from.d,\r\n        months: to.m - from.m,\r\n        years: to.y - from.y\r\n    };\r\n}\r\n\r\nfunction MergeTableCells(table, column) {\r\n    var dimension_cells = new Array();\r\n    var dimension_col = column + 1;\r\n\r\n    var i = 1;\r\n    $(table).find('th').each(function () {\r\n        i++;\r\n    });\r\n    var first_instance = null;\r\n    var rowspan = 1;\r\n    $(table).find('tbody > tr').each(function () {\r\n        var dimension_td = $(this).find('td:eq(' + column + '):nth-child(' + dimension_col + ')');\r\n        if (first_instance == null) {\r\n            first_instance = dimension_td;\r\n        } else if (dimension_td.text() == first_instance.text()) {\r\n            dimension_td.remove();\r\n            ++rowspan;\r\n            first_instance.attr('rowspan', rowspan);\r\n        } else {\r\n            first_instance = dimension_td;\r\n            rowspan = 1;\r\n        }\r\n    });\r\n}\r\n\r\nfunction ScrollToElement(elem) {\r\n    $('html, body').animate({ scrollTop: elem.offset().top - 40 }, 1200);\r\n}\r\n\r\nfunction UniqueList(data) {\r\n    var UniqueList = [];\r\n    $.each(data, function (i, el) {\r\n        if ($.inArray(el, UniqueList) === -1) UniqueList.push(el);\r\n    });\r\n    return UniqueList.sort();\r\n}\r\n\r\nfunction FilterFloat(value) {\r\n    if (/^\\-?([0-9]+(\\.[0-9]+)?|Infinity)$/\r\n      .test(value))\r\n        return Number(value);\r\n    return NaN;\r\n}\r\n\r\nfunction AddCommas(elem) {\r\n    var newValue = elem.val().replace(/,/g, '').replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\r\n    elem.val(newValue);\r\n}\r\n\r\nfunction RemoveCommas(elem) {\r\n    var newValue = elem.val().replace(/,/g, '');\r\n    elem.val(newValue);\r\n}\r\n\r\nfunction AddCommasToFloat(elem) {\r\n    var newValue = elem.val().replace(/,/g, '');\r\n    if (val.indexOf('.') != -1) {\r\n        var valBeforeFloatPoint = GetValueBeforeFloatPoint(val);\r\n        var valAfterFloatPoint = GetValueAfterFloatPoint(val);\r\n        newValue = valBeforeFloatPoint.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\") + '.' + valAfterFloatPoint;\r\n    }\r\n    else {\r\n        newValue = val.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\r\n    }\r\n    elem.val(newValue);\r\n}\r\n\r\nfunction GetValueBeforeFloatPoint(text) {\r\n    return text.split(\".\")[0];\r\n}\r\n\r\nfunction GetValueAfterFloatPoint(text) {\r\n    return text.split(\".\")[1];\r\n}\r\n\r\nfunction UrlParam(name) {\r\n    var sPageURL = decodeURIComponent(window.location.search.substring(1));\r\n    var sURLVariables = sPageURL.split('&');\r\n    for (var i = 0; i < sURLVariables.length; i++) {\r\n        var sParameterName = sURLVariables[i].split('=');\r\n        if (sParameterName[0].toLowerCase() == name.toLowerCase()) {\r\n            return sParameterName[1];\r\n        }\r\n    }\r\n}\r\n\r\nfunction ValidateColorRGB(text) {\r\n    var data = $.trim(text);\r\n    var regex = /^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/;\r\n\r\n    return regex.test(data);\r\n}\r\n\r\nfunction ValidateColorHex(text) {\r\n    var data = $.trim(text);\r\n    var regex = /^#?([a-f0-9]{6}|[a-f0-9]{3})$/;\r\n\r\n    return regex.test(data);\r\n}\r\n\r\nfunction ValidateColorHexaDecimal(text) {\r\n    var data = $.trim(text);\r\n    var regex = /(#?([A-Fa-f0-9]){3}(([A-Fa-f0-9]){3})?)/gm;\r\n\r\n    return regex.test(data);\r\n}\r\n\r\nfunction ValidateDomain(text, type) {\r\n    var data = $.trim(text);\r\n    var regex = /\\S+/; // non-empty\r\n    switch (type) {\r\n        case \"http\": // match domain name (with HTTP)\r\n            regex = /(.*?)[^w{3}\\.]([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,65}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}/igm;\r\n        case \"www\": // match domain name (www. only)\r\n            regex = /[^w{3}\\.]([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,65}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}/igm;\r\n        case \"alternative\": // match domain name (alternative)\r\n            regex = /(.*?)\\.(com|net|org|info|coop|int|com\\.au|co\\.uk|org\\.uk|ac\\.uk|)/igm;\r\n        case \"sub\": // match sub domains: www, dev, int, stage, int.travel, stage.travel\r\n            regex = /(http:\\/\\/|https:\\/\\/)?(www\\.|dev\\.)?(int\\.|stage\\.)?(travel\\.)?(.*)+?/igm;\r\n    }\r\n\r\n    return regex.test(text);\r\n}\r\n\r\nfunction ValidateEmpty(text) {\r\n    var data = $.trim(text);\r\n    var rex = /\\S+/;\r\n\r\n    return regex.test(data);\r\n}\r\n\r\nfunction ValidateEmail(text) {\r\n    var data = $.trim(text);\r\n    var regex = /^([\\w-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([\\w-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$/;\r\n\r\n    return regex.test(data);\r\n}\r\n\r\nfunction ValidateIDCard(text) {\r\n    var data = $.trim(text);\r\n    if (data.length != 13) {\r\n        return false;\r\n    }\r\n    else {\r\n        for (i = 0, sum = 0; i < 12; i++) {\r\n            sum += parseFloat(id.charAt(i)) * (13 - i);\r\n        }\r\n        if ((11 - sum % 11) % 10 != parseFloat(id.charAt(12))) {\r\n            return false;\r\n        }\r\n        else {\r\n            return true;\r\n        }\r\n    }\r\n}\r\n\r\nfunction ValidateImages(text) {\r\n    var data = $.trim(text);\r\n    var regex = /([^\\s]+(?=\\.(jpg|gif|png))\\.\\2)/gm;\r\n\r\n    return regex.test(data);\r\n}\r\n\r\nfunction ValidateLength(text, minLength, maxLength) {\r\n    var data = $.trim(text).length;\r\n    return ((data >= minLength) && (data <= maxLength)) ? true : false;\r\n}\r\n\r\nfunction ValidateMobile(text) {\r\n    var data = $.trim(text);\r\n    var regex = /^(08|09)[0-9]{8}$/;\r\n    return regex.test(data);\r\n}\r\n\r\nfunction ValidateVehicleNumber(text) {\r\n    var data = $.trim(text);\r\n    var regex = (/^[1-9]{1}[ก-ฮ]{2}(([1-9]{1}[0-9]{0,3})|([1-9]{1}[0-9]{0,3})|( {1}[1-9]{1}[0-9]{0,3}))$/) | (/^[ก-ฮ]{2}(([1-9]{1}[0-9]{0,3})|([1-9]{1}[0-9]{0,3})|( {1}[1-9]{1}[0-9]{0,3}))$/);\r\n    return regex.test(data);\r\n}\r\n\r\nfunction AllowKeyNum(elem, event) {\r\n    if (!event) var event = window.event;\r\n    var key = event.keyCode ? event.keyCode : event.which;\r\n\r\n    if (!(key == 8                     // backspace\r\n        || key == 9                     // tab\r\n        || key == 46                    // delete\r\n        || (key >= 48 && key < 58)      // numbers on keyboard\r\n        || (key >= 96 && key <= 105)    // number on keypad\r\n        || (key >= 35 && key <= 40)     // arrow/home/end\r\n        || key == undefined))\r\n        event.preventDefault();\r\n}\r\n\r\nfunction AllowKeyEn(elem, event) {\r\n    if (!event) var event = window.event;\r\n    var key = event.keyCode ? event.keyCode : event.which;\r\n\r\n    if (!((key > 64 && key < 91) || (key > 96 && key < 123) || key == 32 || key == 8 || key == 9 || key == 46 || (key >= 35 && key <= 40) || (key >= 112 && key <= 123) || key == 3653 || key == undefined))\r\n        event.preventDefault();\r\n}\r\n\r\nfunction AllowKeyEnAndNum(elem, event) {\r\n    if (!event) var event = window.event;\r\n    var key = event.keyCode ? event.keyCode : event.which;\r\n\r\n    if (!(((key > 64 && key < 91) || (key > 96 && key < 123)) || (key > 47 && key < 58) || key == 45 || key == 46 || key == 64 || key == 95 || key == 32 || key == 8 || key == 9 || (key >= 35 && key <= 40) || (key >= 112 && key <= 123) || key == 3653 || key == undefined))\r\n        event.preventDefault();\r\n}\r\n\r\nfunction AllowKeyEnAndNumAndSing(elem, event) {\r\n    if (!event) var event = window.event;\r\n    var key = event.keyCode ? event.keyCode : event.which;\r\n\r\n    if (!(((key > 64 && key < 91) || (key > 96 && key < 123)) || (key > 47 && key < 58) || key == 45 || key == 46 || key == 47 || key == 64 || key == 95 || key == 32 || key == 8 || key == 9 || (key >= 35 && key <= 40) || (key >= 112 && key <= 123) || key == 3653 || key == undefined))\r\n        event.preventDefault();\r\n}\r\n\r\nfunction AllowKeyTh(elem, event) {\r\n    if (!event) var event = window.event;\r\n    var key = event.keyCode ? event.keyCode : event.which;\r\n\r\n    if (!((key >= 3585) || (key == 32) || key == 8 || key == 9 || key == 0 || key == undefined))\r\n        event.preventDefault();\r\n}\r\n\r\nfunction AllowKeyThAndNum(elem, event) {\r\n    if (!event) var event = window.event;\r\n    var key = event.keyCode ? event.keyCode : event.which;\r\n\r\n    if (!((key >= 3585) || (key == 32) || (key >= 48 && key < 58) || (key == 32) || key == 8 || key == 9 || key == 0 || key == undefined))\r\n        event.preventDefault();\r\n}\r\n\r\nfunction AllowInt(elem, event) {\r\n    var val = elem.value.replace(/[^\\d].+/, \"\");\r\n    if ((event.which != 45)\r\n            && (event.which < 48 || event.which > 57)\r\n            && (event.ctrlKey != true && event.which != 99)\r\n            && (event.ctrlKey != true && event.which != 118)\r\n            && (event.ctrlKey != true && event.which != 120)) {\r\n        if (($.inArray(event.keyCode, [46, 8, 9, 27, 13]) !== -1\r\n            || (event.keyCode >= 35 && event.keyCode <= 39)) != true) {\r\n            event.preventDefault();\r\n        }\r\n    }\r\n    else {\r\n        if (event.which == 45 && elem.value.length != 0) {\r\n            event.preventDefault();\r\n        }\r\n    }\r\n}\r\n\r\nfunction AllowDecimal(elem, event) {\r\n    var val = elem.value.replace(/^\\s*(\\+|-)?[^0-9]/g, \"\");\r\n    if (((event.which != 45 && event.which != 46) || val.indexOf('.') != -1)\r\n        && (event.which < 48 || event.which > 57)\r\n        && (event.ctrlKey != true && event.which != 99)\r\n        && (event.ctrlKey != true && event.which != 118)\r\n        && (event.ctrlKey != true && event.which != 120)) {\r\n        if (($.inArray(event.keyCode, [46, 8, 9, 27, 13]) !== -1 || (event.keyCode >= 35 && event.keyCode <= 39)) != true) {\r\n            event.preventDefault();\r\n        }\r\n    }\r\n    else {\r\n        if (event.which == 45 && elem.value.length != 0) {\r\n            event.preventDefault();\r\n        }\r\n        if (val.indexOf('.') != -1 && GetValueAfterDecimalPoint(val).length > 1) {\r\n            event.preventDefault();\r\n        }\r\n    }\r\n}\r\n\r\nvar validation = {}\r\n\r\nvalidation.updateTips = function (validate_tips, msg) {\r\n    validate_tips.text(msg);\r\n    validate_tips.addClass('ui-state-highlight');\r\n    setTimeout(function () {\r\n        validate_tips.removeClass(\"ui-state-highlight\", 1500);\r\n    }, 1000);\r\n}\r\n\r\nvalidation.checkRequired = function (o, validate_result_msg, validate_tip_id) {\r\n    if (o.val().replace(/\\s/g, '').length < 1) {\r\n        // validation.updateTips(validate_tip_id, validate_result_msg);\r\n        $('html, body').animate({ scrollTop: o.offset().top - 150 }, 1000);\r\n        o.css({ 'background-color': '#fafad2', 'border': 'solid 1px #ffa500' }).focus();\r\n        return false;\r\n    } else {\r\n        // validation.updateTips(validate_tip_id, \"\");\r\n        o.css({ 'background-color': '#FFFFFF', 'border': 'solid 1px #ccc' });\r\n        return true;\r\n    }\r\n}\r\n\r\nvalidation.checkRequiredRD = function (o, validate_result_msg, validate_tip_id) {\r\n    if (validate_result_msg == undefined || validate_result_msg == \"\" || validate_result_msg == null) {\r\n        // validation.updateTips(validate_tip_id, validate_result_msg);\r\n        o.css('background-color', '#fafad2')\r\n        $('html, body').animate({ scrollTop: o.offset().top - 150 }, 1000);\r\n        return false;\r\n    } else {\r\n        o.css('background-color', '#FFFFFF');\r\n        //  o.css('border', 'solid 1px #9fadc7');\r\n        return true;\r\n    }\r\n}\r\n\r\nvalidation.checkRequiredSelect = function (o, validate_result_msg, x) {\r\n    if (o == '' || o == \"0\" || o == \"99\" || o == \"99999\") {\r\n        // validation.updateTips(validate_tip_id, validate_result_msg);\r\n        x.css('background-color', '#fafad2')\r\n        $('html, body').animate({ scrollTop: x.offset().top - 150 }, 1000);\r\n\r\n        // x.css('border', 'solid 1px #ff9999').focus();\r\n\r\n        //     $(\".ui-combobox-input\").css('border', 'solid 1px #ff9999').animate({ scrollTop: o.offset().top }, 360);\r\n        return false;\r\n    } else {\r\n        x.css('background-color', '#FFFFFF');\r\n        // x.css('border', 'solid 1px #9fadc7');\r\n        return true;\r\n    }\r\n}\r\n\r\nfunction checkIDCard(id, o) {\r\n    if (id.length != 13) {\r\n        o.css({ 'background-color': '#fafad2', 'border': 'solid 1px #ffa500' }).focus();\r\n        $('html, body').animate({ scrollTop: o.offset().top - 40 }, 360);\r\n        //o.css('border', 'solid 1px #ff9999').focus();\r\n        return (false);\r\n    }\r\n    else {\r\n        for (i = 0, sum = 0; i < 12; i++) {\r\n            sum += parseFloat(id.charAt(i)) * (13 - i);\r\n        }\r\n\r\n        if ((11 - sum % 11) % 10 != parseFloat(id.charAt(12))) {\r\n            // o.css('border', 'solid 1px #ff9999').focus();\r\n            o.css({ 'background-color': '#fafad2', 'border': 'solid 1px #ffa500' }).focus();\r\n            $('html, body').animate({ scrollTop: o.offset().top - 40 }, 360);\r\n            return (false);\r\n        }\r\n        else {\r\n            o.css('background-color', 'solid 1px #FFFFFF');\r\n            // o.css('border', 'solid 1px #9fadc7');\r\n            return (true);\r\n        }\r\n    }\r\n}\r\n\r\nfunction checkCreditCard(id, o) {\r\n    if (id.length != 16) {\r\n        o.css({ 'background-color': '#fafad2', 'border': 'solid 1px #ffa500' }).focus();\r\n        $('html, body').animate({ scrollTop: o.offset().top - 40 }, 360);\r\n        //o.css('border', 'solid 1px #ff9999').focus();\r\n        return (false);\r\n    }\r\n    else {\r\n        o.css('background-color', 'solid 1px #FFFFFF');\r\n        // o.css('border', 'solid 1px #9fadc7');\r\n        return (true);\r\n    }\r\n}\r\n\r\nfunction remcomma(num) {\r\n    num = num.toString().replace(/\\$|\\,/g, '');\r\n    if (isNaN(num) || num == \"\") {\r\n        num = \"0\";\r\n    }\r\n    return (num);\r\n}\r\n\r\nfunction incommaJ(value) {\r\n    var num;\r\n    value = remcomma(value);\r\n    num = parseInt(value).toFixed(0).replace(/(\\d)(?=(\\d\\d\\d)+(?!\\d))/g, \"$1,\");\r\n\r\n    if (num == 0) {\r\n        num = \"\";\r\n    }\r\n    return (num);\r\n}\r\n\r\nfunction CheckDataInt(_val) {\r\n    if (_val == \"\") {\r\n        _val = 0;\r\n    }\r\n    return _val;\r\n}\r\n//#region SetLoading\r\nvar utils = {\r\n    BaseUrl: window.location.href.replace('#', '').replace(window.location.pathname, '')\r\n   , BaseUrl1: window.location.href.replace('#', '').replace(window.location.pathname, '').split('?')[0]\r\n   , BastDir: window.location.pathname.split(\"/\")[1]\r\n}\r\nvar img = {\r\n    progress: 'images/ajax/ajax-loader.gif'\r\n\r\n}\r\nvar progress = {\r\n    content: {\r\n        general: '<table cellpadding=\\\"0\\\" cellspacing=\\\"0\\\" border=\\\"0\\\" style=\\\"width: 100%; height: 100%;\\\"><tr valign=\\\"middle\\\"><td valign=\"middle\" style=\\\"vertical-align: middle;text-align: center; height:auto;\\\"><img title=\\\"...\\\" alt=\"\" src=\\\"' + img.progress + '\\\" /></td></tr></table>',\r\n        imgOnly: '<table cellpadding=\\\"0\\\" cellspacing=\\\"0\\\" border=\\\"0\\\" style=\\\"width: 100%; height: 100%;\\\"><tr valign=\"middle\"><td valign=\"middle\" style=\\\"text-align: center; height: auto;\\\"><img title=\\\"...\\\" alt=\"\" src=\\\"' + img.progress + '\\\" /></td></tr></table>'\r\n    }\r\n}\r\n//#endregion SetLoading\r\n\r\n//#region key_event\r\nfunction num_key(e) {\r\n    if (!e) var e = window.event;\r\n    var key = e.keyCode ? e.keyCode : e.which;\r\n\r\n    if (key >= 48 && key < 58 || key == 8 || key == 9 || key == 0 || key == undefined) {\r\n        return (true);\r\n    }\r\n    else {\r\n        return (false);\r\n    }\r\n\r\n}\r\n\r\nfunction en_key(e, o) {\r\n    if (!e) var e = window.event;\r\n    var key = e.keyCode ? e.keyCode : e.which;\r\n\r\n    if ((key > 64 && key < 91) || (key > 96 && key < 123) || key == 32 || key == 8 || key == 9 || key == 46 || (key >= 35 && key <= 40) || (key >= 112 && key <= 123) || key == 3653 || key == undefined) {\r\n        $('span.change-lang ').remove(); return (true);\r\n    }\r\n    else {\r\n        $('span.change-lang ').remove(); $('#' + o).after(\"<span class='change-lang '>กรุณากรอกภาษาอังกฤษ</span\"); return (false);\r\n    }\r\n}\r\n\r\nfunction en_num_key(e) {\r\n    if (!e) var e = window.event;\r\n    var key = e.keyCode ? e.keyCode : e.which;\r\n\r\n    if (((key > 64 && key < 91) || (key > 96 && key < 123)) || (key > 47 && key < 58) || key == 45 || key == 46 || key == 64 || key == 95 || key == 32 || key == 8 || key == 9 || (key >= 35 && key <= 40) || (key >= 112 && key <= 123) || key == 3653 || key == undefined) {\r\n        return (true);\r\n    }\r\n    else {\r\n        return (false);\r\n    }\r\n}\r\n\r\nfunction en_num_sign_key(e) {\r\n    if (!e) var e = window.event;\r\n    var key = e.keyCode ? e.keyCode : e.which;\r\n    if (((key > 64 && key < 91) || (key > 96 && key < 123)) || (key > 47 && key < 58) || key == 45 || key == 46 || key == 47 || key == 64 || key == 95 || key == 32 || key == 8 || key == 9 || (key >= 35 && key <= 40) || (key >= 112 && key <= 123) || key == 3653 || key == undefined) {\r\n        return (true);\r\n    }\r\n    else {\r\n        return (false);\r\n    }\r\n}\r\n\r\nfunction email_key(e) {\r\n    if (!e) var e = window.event;\r\n    var key = e.keyCode ? e.keyCode : e.which;\r\n\r\n    if (((key > 64 && key < 91) || (key > 96 && key < 123)) || (key > 47 && key < 58) || key == 64 || key == 95 || key == 13 || key == 45 || key == 46 || key == 8 || key == 9 || (key >= 35 && key <= 40) || (key >= 112 && key <= 123) || key == 3653 || key == undefined) {\r\n        return (true);\r\n    }\r\n    else {\r\n        return (false);\r\n    }\r\n}\r\n\r\nfunction th_key(e, o) {\r\n    if (!e) var e = windows.event;\r\n\r\n    var key = e.keyCode ? e.keyCode : e.which;\r\n    if ((key >= 3585) || (key == 32) || key == 8 || key == 9 || key == 0 || key == undefined)\r\n    { $('span.change-lang ').remove(); return true; }\r\n    else\r\n    { $('span.change-lang ').remove(); $('#' + o).after(\"<span class='change-lang '>กรุณากรอกภาษาไทย</span\"); return false; }\r\n}\r\n\r\nfunction num_key_and_th_key(e, o) {\r\n    if (!e) var e = windows.event;\r\n\r\n    var key = e.keyCode ? e.keyCode : e.which;\r\n    if ((key >= 3585) || (key == 32) || (key >= 48 && key < 58) || (key == 32) || key == 8 || key == 9 || key == 0 || key == undefined)\r\n    { $('span.change-lang ').remove(); return true; }\r\n    else\r\n    { $('span.change-lang ').remove(); $('#' + o).after(\"<span class='change-lang '>กรุณากรอกภาษาไทย</span\"); return false; }\r\n}\r\n\r\n//#endregion key_event\r\n\r\nfunction getYear() {\r\n    var day = new Date();\r\n    var now = day.getFullYear();\r\n    // var yearnow = now + 543;\r\n    var yearnow = now;\r\n    var minyear = \"\";\r\n    if (yearnow == 2015) {\r\n        minyear = yearnow - 1;\r\n    } else {\r\n        minyear = yearnow - 5;\r\n    }\r\n    var optionData = \"\";\r\n    optionData += \"<option  value='0' title='0'>-- ปี --</option>\";\r\n    var startDate = \"\";\r\n    var endDate = \"\";\r\n    var yearth = \"\";\r\n    for (var i = yearnow; i >= minyear; i--) {\r\n        startDate = i.toString() + \"-\" + \"01-01\";\r\n        endDate = i.toString() + \"-\" + \"12-31\";\r\n        yearth = (i + 543).toString().slice(-2)\r\n        optionData += \"<option value='\" + i + \"' title = '\" + startDate + \"' name='\" + endDate + \"' rel='\" + yearth + \"' >\" + i + \"</option>\";\r\n    }\r\n    return optionData;\r\n}\r\n\r\nfunction getMonthEN() {\r\n    var month = new Array();\r\n    var monthEn = new Array();\r\n    month[0] = \"1\";\r\n    month[1] = \"2\";\r\n    month[2] = \"3\";\r\n    month[3] = \"4\";\r\n    month[4] = \"5\";\r\n    month[5] = \"6\";\r\n    month[6] = \"7\";\r\n    month[7] = \"8\";\r\n    month[8] = \"9\";\r\n    month[9] = \"10\";\r\n    month[10] = \"11\";\r\n    month[11] = \"12\";\r\n\r\n    monthEn[0] = \"January\";\r\n    monthEn[1] = \"February\";\r\n    monthEn[2] = \"March\";\r\n    monthEn[3] = \"April\";\r\n    monthEn[4] = \"May\";\r\n    monthEn[5] = \"June\";\r\n    monthEn[6] = \"July\";\r\n    monthEn[7] = \"August\";\r\n    monthEn[8] = \"September\";\r\n    monthEn[9] = \"October\";\r\n    monthEn[10] = \"November\";\r\n    monthEn[11] = \"December\";\r\n    var optionData = \"\";\r\n    optionData += \"<option value='0' title='0'>-- เดือน --</option>\";\r\n    for (var i = 0; i < month.length; i++) {\r\n        optionData += \"<option value='\" + month[i] + \"'>\" + monthEn[i] + \"</option>\";\r\n    }\r\n    return optionData;\r\n}\r\n\r\nfunction getDay() {\r\n    var optionData = \"\";\r\n    optionData += \"<option value='0' title='0'>-- เดือน --</option>\";\r\n    for (var i = 1; i <= 31; i++) {\r\n        optionData += \"<option value='\" + i + \"'>\" + i + \"</option>\";\r\n    }\r\n    return optionData;\r\n}"}}
{"actor":{"display_login":"stevenballs"}}