// usage: log('inside coolFunc', this, arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
  log.history = log.history || []; // store logs to an array for reference
  log.history.push(arguments);
  if(this.console) {
      arguments.callee = arguments.callee.caller;
      console.log( Array.prototype.slice.call(arguments) );
  }
};
// make it safe to use console.log always
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});

/*
 * Thickbox 3 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
var tb_pathToImage = "/_images/loadingAnimation.gif";
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(o).2S(9(){1u(\'a.18, 3n.18, 3i.18\');1w=1p 1t();1w.L=2H});9 1u(b){$(b).s(9(){6 t=X.Q||X.1v||M;6 a=X.u||X.23;6 g=X.1N||P;19(t,a,g);X.2E();H P})}9 19(d,f,g){3m{3(2t o.v.J.2i==="2g"){$("v","11").r({A:"28%",z:"28%"});$("11").r("22","2Z");3(o.1Y("1F")===M){$("v").q("<U 5=\'1F\'></U><4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}n{3(o.1Y("B")===M){$("v").q("<4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}3(1K()){$("#B").1J("2B")}n{$("#B").1J("2z")}3(d===M){d=""}$("v").q("<4 5=\'K\'><1I L=\'"+1w.L+"\' /></4>");$(\'#K\').2y();6 h;3(f.O("?")!==-1){h=f.3l(0,f.O("?"))}n{h=f}6 i=/\\.2s$|\\.2q$|\\.2m$|\\.2l$|\\.2k$/;6 j=h.1C().2h(i);3(j==\'.2s\'||j==\'.2q\'||j==\'.2m\'||j==\'.2l\'||j==\'.2k\'){1D="";1G="";14="";1z="";1x="";R="";1n="";1r=P;3(g){E=$("a[@1N="+g+"]").36();25(D=0;((D<E.1c)&&(R===""));D++){6 k=E[D].u.1C().2h(i);3(!(E[D].u==f)){3(1r){1z=E[D].Q;1x=E[D].u;R="<1e 5=\'1X\'>&1d;&1d;<a u=\'#\'>2T &2R;</a></1e>"}n{1D=E[D].Q;1G=E[D].u;14="<1e 5=\'1U\'>&1d;&1d;<a u=\'#\'>&2O; 2N</a></1e>"}}n{1r=1b;1n="1t "+(D+1)+" 2L "+(E.1c)}}}S=1p 1t();S.1g=9(){S.1g=M;6 a=2x();6 x=a[0]-1M;6 y=a[1]-1M;6 b=S.z;6 c=S.A;3(b>x){c=c*(x/b);b=x;3(c>y){b=b*(y/c);c=y}}n 3(c>y){b=b*(y/c);c=y;3(b>x){c=c*(x/b);b=x}}13=b+30;1a=c+2G;$("#8").q("<a u=\'\' 5=\'1L\' Q=\'1o\'><1I 5=\'2F\' L=\'"+f+"\' z=\'"+b+"\' A=\'"+c+"\' 23=\'"+d+"\'/></a>"+"<4 5=\'2D\'>"+d+"<4 5=\'2C\'>"+1n+14+R+"</4></4><4 5=\'2A\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4>");$("#Z").s(G);3(!(14==="")){9 12(){3($(o).N("s",12)){$(o).N("s",12)}$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1D,1G,g);H P}$("#1U").s(12)}3(!(R==="")){9 1i(){$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1z,1x,g);H P}$("#1X").s(1i)}o.1h=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}n 3(I==3k){3(!(R=="")){o.1h="";1i()}}n 3(I==3j){3(!(14=="")){o.1h="";12()}}};16();$("#K").C();$("#1L").s(G);$("#8").r({Y:"T"})};S.L=f}n{6 l=f.2r(/^[^\\?]+\\??/,\'\');6 m=2p(l);13=(m[\'z\']*1)+30||3h;1a=(m[\'A\']*1)+3g||3f;W=13-30;V=1a-3e;3(f.O(\'2j\')!=-1){1E=f.1B(\'3d\');$("#15").C();3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4></4><U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\' > </U>")}n{$("#B").N();$("#8").q("<U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\'> </U>")}}n{3($("#8").r("Y")!="T"){3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\'>1l</a> 1k 1j 1s</4></4><4 5=\'F\' J=\'z:"+W+"p;A:"+V+"p\'></4>")}n{$("#B").N();$("#8").q("<4 5=\'F\' 3c=\'3b\' J=\'z:"+W+"p;A:"+V+"p;\'></4>")}}n{$("#F")[0].J.z=W+"p";$("#F")[0].J.A=V+"p";$("#F")[0].3a=0;$("#1H").11(d)}}$("#Z").s(G);3(f.O(\'37\')!=-1){$("#F").q($(\'#\'+m[\'26\']).1T());$("#8").24(9(){$(\'#\'+m[\'26\']).q($("#F").1T())});16();$("#K").C();$("#8").r({Y:"T"})}n 3(f.O(\'2j\')!=-1){16();3($.1q.35){$("#K").C();$("#8").r({Y:"T"})}}n{$("#F").34(f+="&1y="+(1p 33().32()),9(){16();$("#K").C();1u("#F a.18");$("#8").r({Y:"T"})})}}3(!m[\'1A\']){o.21=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}}}}31(e){}}9 1m(){$("#K").C();$("#8").r({Y:"T"})}9 G(){$("#2Y").N("s");$("#Z").N("s");$("#8").2X("2W",9(){$(\'#8,#B,#1F\').2V("24").N().C()});$("#K").C();3(2t o.v.J.2i=="2g"){$("v","11").r({A:"1Z",z:"1Z"});$("11").r("22","")}o.1h="";o.21="";H P}9 16(){$("#8").r({2U:\'-\'+20((13/2),10)+\'p\',z:13+\'p\'});3(!(1V.1q.2Q&&1V.1q.2P<7)){$("#8").r({38:\'-\'+20((1a/2),10)+\'p\'})}}9 2p(a){6 b={};3(!a){H b}6 c=a.1B(/[;&]/);25(6 i=0;i<c.1c;i++){6 d=c[i].1B(\'=\');3(!d||d.1c!=2){39}6 e=2a(d[0]);6 f=2a(d[1]);f=f.2r(/\\+/g,\' \');b[e]=f}H b}9 2x(){6 a=o.2M;6 w=1S.2o||1R.2o||(a&&a.1Q)||o.v.1Q;6 h=1S.1P||1R.1P||(a&&a.2n)||o.v.2n;1O=[w,h];H 1O}9 1K(){6 a=2K.2J.1C();3(a.O(\'2I\')!=-1&&a.O(\'3o\')!=-1){H 1b}}',62,211,'|||if|div|id|var||TB_window|function||||||||||||||else|document|px|append|css|click||href|body||||width|height|TB_overlay|remove|TB_Counter|TB_TempArray|TB_ajaxContent|tb_remove|return|keycode|style|TB_load|src|null|unbind|indexOf|false|title|TB_NextHTML|imgPreloader|block|iframe|ajaxContentH|ajaxContentW|this|display|TB_closeWindowButton||html|goPrev|TB_WIDTH|TB_PrevHTML|TB_iframeContent|tb_position||thickbox|tb_show|TB_HEIGHT|true|length|nbsp|span|Math|onload|onkeydown|goNext|Esc|of|sluiten|tb_showIframe|TB_imageCount|Sluiten|new|browser|TB_FoundURL|toets|Image|tb_init|name|imgLoader|TB_NextURL|random|TB_NextCaption|modal|split|toLowerCase|TB_PrevCaption|urlNoQuery|TB_HideSelect|TB_PrevURL|TB_ajaxWindowTitle|img|addClass|tb_detectMacXFF|TB_ImageOff|150|rel|arrayPageSize|innerHeight|clientWidth|self|window|children|TB_prev|jQuery|frameborder|TB_next|getElementById|auto|parseInt|onkeyup|overflow|alt|unload|for|inlineId||100||unescape|1000|round|hspace|TB_closeAjaxWindow|TB_title|undefined|match|maxHeight|TB_iframe|bmp|gif|png|clientHeight|innerWidth|tb_parseQuery|jpeg|replace|jpg|typeof|which|keyCode|event|tb_getPageSize|show|TB_overlayBG|TB_closeWindow|TB_overlayMacFFBGHack|TB_secondLine|TB_caption|blur|TB_Image|60|tb_pathToImage|mac|userAgent|navigator|of|documentElement|Prev|lt|version|msie|gt|ready|Next|marginLeft|trigger|fast|fadeOut|TB_imageOff|hidden||catch|getTime|Date|load|safari|get|TB_inline|marginTop|continue|scrollTop|TB_modal|class|TB_|45|440|40|630|input|188|190|substr|try|area|firefox'.split('|'),0,{}));


/**
 * @name jQuery placehold (https://github.com/jgarber623/jquery-placehold)
 * @author Jason Garber
 * @copyright (cc) Jason Garber (http://sixtwothree.org and http://www.viget.com)
 *
 * Licensed under the CC-GNU GPL (http://creativecommons.org/licenses/GPL/2.0/)
 */

(function(a){a.fn.placehold=function(d){var d=d||"placeholder",c=a.fn.placehold.is_supported();function b(){for(i=0;i<arguments.length;i++){arguments[i].toggle();}}return c?this:this.each(function(){var f=a(this),e=f.attr("placeholder");if(e){if(f.val()===""||f.val()==e){f.addClass(d).val(e);}if(f.is(":password")){var g=a("<input />",{"class":f.attr("class")+" "+d,value:e});g.bind("focus.placehold",function(){b(f,g);f.focus();});f.bind("blur.placehold",function(){if(f.val()===""){b(f,g);}});f.hide().after(g);}f.bind({"focus.placehold":function(){if(f.val()==e){f.removeClass(d).val("");}},"blur.placehold":function(){if(f.val()===""){f.addClass(d).val(e);}}});f.closest("form").bind("submit.placehold",function(){if(f.val()==e){f.val("");}return true;});}});};a.fn.placehold.is_supported=function(){return"placeholder" in document.createElement("input");};})(jQuery);


Array.prototype.clear=function()
{
    this.length = 0;
};

Array.prototype.contains = function (element) 
{
    for (var i = 0; i < this.length; i++) 
    {
        if (this[i] == element) 
        {
            return true;
        }
    }
    return false;
};

var strFormErrorMessage = "";
var checkedCheckboxes = new Array();
var strLastCheckedRadio = "";
var firstObj = null;

function validateForm(Form)
{
    var strRequired = "";
    var strRequiredType = "";
    var blnNeedsChecking;
    
    firstObj = null;
    // Clear array
    checkedCheckboxes.clear();
    
    strFormErrorMessage = "";
    
    //check every element on the form
    for (var i=0; i<Form.length; i++)
    {
        if (Form[i].getAttribute("data-required") != null)
        {
            strRequired = Form[i].getAttribute("data-required");
            strRequiredType = Form[i].getAttribute("data-required-type");
            strName = Form[i].name;
            blnNeedsChecking = false;
            if (strRequired != null)
            {
                if ((strRequired.toLowerCase() == "true") || (strRequired.toLowerCase() == "optional"))
                {
                    blnNeedsChecking = true;
                }
            }
            if (checkedCheckboxes.contains(strName)==false)
            {
                if (Form[i].nodeName.toLowerCase()=='input')
                {
                    checkedCheckboxes.push(strName);
                }
            }
            else
            {
                blnNeedsChecking = false;
            }
            //check wether an VALIDATED-Attribute exists
            if (blnNeedsChecking == true)
            {
                checkControl(Form, Form[i]);
            }
        }
    }

    // show the actual error messages
    valForm_ShowErrorMessage(Form);
    if (firstObj!=null)
    {
        try
        {
            firstObj.focus();
        }
        catch (e)
        {
            // error
            window.console("error");
        }
    }

    // first check if there are no more error messages, so the final submit is coming up
    if (strFormErrorMessage.length == 0)
    {
        // add a hidden input for all unchecked checkboxes
        valForm_FixCheckBoxes(Form);
    }
    
    return (strFormErrorMessage.length > 0 ? false : true);
}
    
function checkControl(form, obj)
{
    var strValue = "";
    var strErrorMsg = obj.getAttribute("data-required-errormsg");
    var required = obj.getAttribute("data-required");
    var type = obj.getAttribute("data-required-type");
    var re = "";

    if ((required.toLowerCase() == "true") || (required.toLowerCase() == "optional"))
    {
        //make sure a filled optional text-box is cleared
        if ((required.toLowerCase() == "optional") && (obj.value == ""))
        {
            valForm_SetOK(form, obj);
        }
        else
        {

            switch (type.toLowerCase())
            {
                case "text":
                    if (obj.value == "")
                    {
                        valForm_SetError(form, obj);
                    }
                    else
                    {
                        valForm_SetOK(form, obj);
                    }
                    break;
                case "dutchzip":
                    valForm_formatDutchZip(obj);
                    //read new value
                    strValue = obj.value;
                    re = /^[0-9]{4}\s{0,1}[a-zA-Z]{2}$/; 
                    if (valForm_doRegularExpression(re,strValue)== false) 
                    {
                        valForm_SetError(form, obj);
                    }
                    else
                    {
                        valForm_SetOK(form, obj);
                    }
                    break;
                case "phonenumber":
                    //only NUMERIC KEYS, (, ) , * , +, -,# and spaces are allowed
                    strValue = obj.value;
                    re = /^[\d\(\)\-\+\*\# ]+$/;
                    if (valForm_doRegularExpression(re,strValue)== false) 
                    {
                        valForm_SetError(form, obj);
                    }
                    else
                    {
                        valForm_SetOK(form, obj);
                    }
                    break;
                case "numeric":
                    strValue = obj.value;
                    re = /^[0-9]+$/;
                    if (valForm_doRegularExpression(re,strValue)== false) 
                    {
                        valForm_SetError(form, obj);
                    }
                    else
                    {
                        valForm_SetOK(form, obj);
                    }
                    break;
                case "password":
                    strValue = obj.value;
                    re = /(?=^.{5,30}$)(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+}{"":;'?/>.<,]).*$/;
                    if (valForm_doRegularExpression(re,strValue)== false) 
                    {
                        valForm_SetError(form, obj);
                    }
                    else
                    {
                        valForm_SetOK(form, obj);
                    }
                    break;
                case "password2":
                    strValue = obj.value;
                    re = /(?=^.{5,30}$).*$/;
                    if (valForm_doRegularExpression(re,strValue)== false) 
                    {
                        valForm_SetError(form, obj);
                    }
                    else
                    {
                        valForm_SetOK(form, obj);
                    }
                    break;
                case "email":
                    //check if the email address is valid
                    strValue = obj.value;
                    re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/;
                    if (valForm_doRegularExpression(re,strValue)== false) 
                    {
                        valForm_SetError(form, obj);
                    }
                    else
                    {
                        valForm_SetOK(form, obj);
                    }
                    break;
                case "dd/mm/yyyy":
                    //check if date is valid for the format: DD/MM/YYYY
                    //If D or M is supplied, a preceding 0 will be automatically added.
                    //YYYY should have four digits
                    //allowed separation chars: '/','-','.',' '(space)
                    //All separation chars will be replaced by a '/'
                    valForm_formatDate(obj);
                    if (CheckDate(obj.value,'dd/mm/yyyy')== false) {
                        valForm_SetError(form, obj);
                    }
                    else
                    {
                        valForm_SetOK(form, obj);
                    }
                    break;
                    //arSupportedTypes[0] = "hh:mm"
                    //arSupportedTypes[2] = "mm/dd/yyyy"
                case "select":
                    if (obj.value == "")
                    {
                        valForm_SetError(form, obj);
                    }
                    else
                    {
                        valForm_SetOK(form, obj);
                    }
                    break;
                case "check":
                    var checks = document.getElementsByName(obj.name);
                    if (chkFrm_isOneCheckboxSelected(checks))
                    {
                        valForm_SetOK(form, obj);
                    }
                    else
                    {
                        valForm_SetError(form, obj);
                    }
                    break;
                case "radio":
                    var radios = document.getElementsByName(obj.name);
                    if (obj.name != strLastCheckedRadio) 
                    {
                        //This radiobuttongroup is not checked yet
                        strLastCheckedRadio = obj.name;
                        if (!(chkFrm_isOneRadioButtonSelected(radios))) 
                        {
                            valForm_SetError(form, obj);
                        }
                        else
                        {
                            valForm_SetOK(form, obj);
                        }
                    }
                    break;
                default:
                    break;
            }
        }
    }
}

function valForm_FixCheckBoxes(Form)
{
    var newElement = null;
    
    //check every checkbox
    for (var i=0; i<Form.length; i++)
    {
        if ((Form[i].tagName!="FIELDSET") && (Form[i].type.toLowerCase() == "checkbox"))
        {
            //when a checkbox is not checked...
            if (Form[i].checked == false)
            {
                //create a hidden input-box and put the alternative value in it...
                //because a non-checked checkbox is not submitted with the form...
                newElement = document.createElement("INPUT");
                newElement.type = "hidden";
                newElement.name = Form[i].name;
                newElement.value = Form[i].getAttribute("ALTERNATIVEVALUE");
                
                //add the hidden text-box in the DOM-hierarchy...
                if (Form[i].nextSibling)
                {
                    if (Form[i].nextSibling.nodeName.toUpperCase() == "#TEXT")
                    {
                        Form[i].parentNode.appendChild(newElement);
                    }
                    else
                    {
                        Form[i].nextSibling.insertBefore(newElement);
                    }
                }
                else
                {
                    Form[i].parentNode.appendChild(newElement);
                }
            }
        }
    }
}

function ResetForm(Form)
{
    //check every element on the form
    for (var i=0; i<Form.length; i++)
    {
        if (Form[i].getAttribute("data-required") != null)
        {
            valForm_SetOK(Form, Form[i]);
        }
    }
}

function valForm_SetOK(form, obj)
{
    if (obj.getAttribute("data-normalclass") != null)
    {
        obj.className = obj.getAttribute("data-normalclass");
        obj.removeAttribute("data-normalclass", false);
    }
}

function valForm_SetError(form, obj)
{
    var strErrorType = (form.getAttribute("data-errortype")) ? form.getAttribute("data-errortype") : "";
    //append to the error message, depending on the errortype
    switch (strErrorType.toLowerCase())
    {
        case "alertandinputboxes":
            strFormErrorMessage += obj.getAttribute("data-required-errormsg") + "\n";
            if (obj.getAttribute("data-normalclass") == null)
            {
                obj.setAttribute("data-normalclass", obj.className, 0);
                obj.className = obj.getAttribute("data-errorclass");
            }
            if (firstObj==null) firstObj=obj;
            break;
        case "alert":
            strFormErrorMessage += obj.getAttribute("data-required-errormsg") + "\n";
            if (firstObj==null) firstObj=obj;
            break;
        case "div":
            strFormErrorMessage += obj.getAttribute("data-required-errormsg") + "<BR>";
            break;
        case "inputboxes":
            strFormErrorMessage = " ";
            //put the classname in a new attribute and put the classname to the errorclass
            if (obj.getAttribute("data-normalclass") == null)
            {
                obj.setAttribute("data-normalclass", obj.className, 0);
                obj.className = obj.getAttribute("data-errorclass");
            }
            break;
        case "":
            strFormErrorMessage = " ";
            break;
        default:
            break;
    }
}

function valForm_ShowErrorMessage(form)
{
    var strErrorMsgDivID = "";
    var strErrorType = (form.getAttribute("data-errortype")) ? form.getAttribute("data-errortype") : "";
    var strErrorMsgDivID = (form.getAttribute("data-errordiv")) ? form.getAttribute("data-errordiv") : "";

    var errorDiv = ((strErrorMsgDivID != "") ? document.getElementById(strErrorMsgDivID) : null);
    
    if (strFormErrorMessage.length > 0)
    {
        switch (strErrorType.toLowerCase())
        {
            case "alertandinputboxes":
                myAlert(strFormErrorMessage);
                break;
            case "alert":
                myAlert(strFormErrorMessage);
                break;
            case "div":
                if (errorDiv != null)
                {
                    errorDiv.innerHTML = strFormErrorMessage;
                    errorDiv.style.display = "inline";
                }
                else
                {
                    myAlert("Please set the Form-attribute: \"ERRORDIV\" to hold the ID of the DIV that will display the errormessage!");
                }
                break;
            case "inputboxes":
                break;
            case "":
                myAlert("Please set the Form-attribute: \"ERRORTYPE\" to one of the following values: \"alert\", \"div\" or \"inputboxes\" ");
                break;
            default:
                break;
        }
/*        var obj = document.getElementById("FormCheckerError");
        obj.innerHTML = strFormErrorMessage;
        obj.style.display = "block";*/
    }
    else
    {
        switch (strErrorType.toLowerCase())
        {
            case "div":
                errorDiv.innerHTML = "";
                errorDiv.style.display = "none";
                break;
            default:
                break;
        }
    }
}

function valForm_formatDutchZip(obj) 
{
    //remove all spaces
    obj.value = obj.value.replace(/ /g,'')
    //upperCase value
    obj.value = obj.value.toUpperCase();
}

function valForm_doRegularExpression(re, strWhat) 
{
    return (re.test(strWhat) == true);
}

function valForm_formatDate(objField) {
    //replace all spaces, dots and stripes with a slash '/'
    objField.value = objField.value.replace(/[\. \-]/g,'/')
    var arValue = objField.value.split("/")
    var strTmpvalue = '';
    var i;
    if (arValue.length == 3) {
        //two slashes are found
        //Make sure the values have a preceding 0, except the last element
        for (i=0;i<arValue.length-1;i++){
            if (arValue[i].length < 2) {
                arValue[i] = '0' + arValue[i]
            }
        }
        //The last element should have 4 characters (==year)
        while (arValue[arValue.length-1].length < 4) {
            //Ad an x until the length is at least 4 chars
            arValue[arValue.length-1] = 'x' + arValue[arValue.length-1]
        }
        
        //save array data into a string
        for (i=0;i<arValue.length;i++){
            strTmpvalue += arValue[i] + '/'
        }
        //Remove last slash
        if (strTmpvalue.substr(strTmpvalue.length-1,1)=='/') {
            strTmpvalue = strTmpvalue.substr(0,strTmpvalue.length-1)
        }
        
        //Show altered value 
        objField.value = strTmpvalue;
    }
}

function CheckDate(strDatum, strFormat){
    //Input: 
    //    strDatum: Date string to check, use / a delimiter
    //    strFormat: either 'dd/mm/yyyy' OR 'mm/dd/yyyy'
    var datDate, strNewDate = ""
    var strDate_mmddyyyy

    //Create  a string conform mm/dd/yyyy
    switch (strFormat.toLowerCase()) {
        case ('dd/mm/yyyy') :
            var arTmp = strDatum.split("/")
            if (arTmp.length == 3) {
                //two slashes are found
                strDate_mmddyyyy = arTmp[1] + '/' + arTmp[0] + '/' + arTmp[2]
            } else {
                strDate_mmddyyyy = ''
            }
            break;
        case ('mm/dd/yyyy'):
            strDate_mmddyyyy = strDatum
            break;
    }

    //Perform datecheck on DD/MM/YYYY string
    datDate = new Date(strDate_mmddyyyy)
    
    //NOTE :getMonth is zero based
    if( ( datDate.getMonth() + 1 ) < 10 ){strNewDate += "0"}
    strNewDate += ( datDate.getMonth() + 1 ) + "/"
    if( datDate.getDate() < 10 ){strNewDate += "0"}
    strNewDate += datDate.getDate() + "/"
    strNewDate += datDate.getFullYear()
    
    if( ( strNewDate == strDate_mmddyyyy ) && ( strNewDate.length == 10 ) ){
        return true
    } else{
        return false
    }
}


function chkFrm_isOneCheckboxSelected(objCheckbox) {
    //objCheckbox is the radio button collection, not one specific field!!
    var bOneIsChecked = false
    for (k=0;k<objCheckbox.length;k++){
        if (objCheckbox[k].checked) {
            bOneIsChecked = true;
            break;
        }
    }
    return (bOneIsChecked);
}    

function chkFrm_isOneRadioButtonSelected(objRadios) {
    //objCheckbox is the radio button collection, not one specific field!!
    var bOneIsChecked = false
    for (k=0;k<objRadios.length;k++){
        if (objRadios[k].checked) {
            bOneIsChecked = true;
            break;
        }
    }
    return (bOneIsChecked);
}    

function myAlert(msg)
{
    alert(msg);
}
