﻿//ceebox
jQuery(document).ready(function () {
    $(".ceebox2").ceebox();
});

//Disable Button Submit
function disableTheControl(control) {
    DisableControl_SetTimeout(control.id, 100);
}
function DisableControl_SetTimeout(controlId, interval) {
    setTimeout("DisableControl('" + controlId + "')", interval);
}
function DisableControl(controlId) {
    if (navigator.appName == 'Microsoft Internet Explorer') {
        if (typeof (Page_ClientValidate) == 'function') {
            if (Page_ClientValidate() == false) { return false; }
        }
        document.getElementById(controlId).disabled = true;
        document.getElementById(controlId).value = 'Please wait...';
    }
}

//Popup
function popup(qs) {
    var strFeatures = "toolbar=no,status=no,menubar=no,location=no"
    strFeatures = strFeatures + ",scrollbars=no,resizable=no,height=300,width=350"

    window.name = "main";
    newWin = window.open(qs, "TellObj", strFeatures);

    if (window.focus) { newWin.focus() }
}

//Format Currency
function formatCurrency(num) {
    num = num.toString().replace(/\$|\,/g, '');
    if (isNaN(num))
        num = "0";
    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num * 100 + 0.50000000001);
    cents = num % 100;
    num = Math.floor(num / 100).toString();
    if (cents < 10)
        cents = "0" + cents;
    for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
        num = num.substring(0, num.length - (4 * i + 3)) + ',' +
        num.substring(num.length - (4 * i + 3));
    if (num < 1 && cents < 01) {
        return ''
    } else {
        return (((sign) ? '' : '-') + '$' + num + '.' + cents);
    }
}
