function openPopUpWindow(url, left, top, width, height) 
{
    if (left == '0') left = (screen.width - width) / 2;
    if (top == '0') top = (screen.height - height) / 2;

    var popUpWin = 0;

    if (popUpWin)
    {
        if (!popUpWin.closed) popUpWin.close();
    }

    popUpWin = window.open(url, null, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,copyhistory=no,width=' + width + ',height=' + height + ',left=' + left + ', top=' + top + ',screenX=' + left + ',screenY=' + top + '');
}


function checkCodePostal(formObject) {
    var redigit = /^\d{1,5}$/
    if (formObject.value.search(redigit) == -1) //if match failed
        formObject.value = formObject.value.substring(0, formObject.value.length - 1);
}

function checkDigit(formObject) {
    var redigit = /^\d{1,100}$/
    if (formObject.value.search(redigit) == -1) //if match failed
        formObject.value = formObject.value.substring(0, formObject.value.length - 1);
}


function checkLength(formObject, size) {
    if (formObject.value.length > size) //if match failed
        formObject.value = formObject.value.substring(0, size);
}


function ClosePopupAndReloadParent()
{
    window.opener.location.reload();
    window.close();
}
