﻿jQuery(document).ready(function () {
    var currentTime = new Date();
    var year = currentTime.getFullYear() + 2;
    $('.myDatePicker').datepicker({
        showOn: 'button',
        buttonImage: 'http://www.latinosunidosonline.net/App_Themes/SkinFile/Images/calendar.gif',
        buttonImageOnly: true,
        changeMonth: true,
        changeYear: true,
        yearRange: '1970:' + year
    });

    $('.ceebox2').ceebox();

    var sPath = window.location.pathname.toLowerCase();
    if (sPath == '' || sPath == '/') {
        sPath = '/default.aspx';
    }
    $('.topReveal').click(function () {
        if (sPath == '/default.aspx') {
            //('#ContentPlaceHolder1_uEmail').focus();
        } else {
            $('#ContentPanel').slideToggle(800, 'easeOutQuart');
            //$.scrollTo('#ContentPanel'); 
            return false;
        }
    });

    $('a.jt:eq(0)').cluetip({
        cluetipClass: 'jtip',
        arrows: true,
        dropShadow: true,
        hoverIntent: false,
        sticky: true,
        mouseOutClose: true,
        closePosition: 'title',
        closeText: '<img src="http://www.latinosunidosonline.net/App_Themes/SkinFile/Images/fancy_close.png" alt="Close" />'
    });
});
function DoBlur(fld) {
    fld.className = 'normalfld';
}
function DoFocus(fld) {
    fld.className = 'focusfld';
}
function deleteitem(id, section) {
    if (!jConfirm('Are you sure you want to delete this ' + section + '?', 'Confirm Delete',
            function (r) {
                if (r) {
                    var returnData = $.ajax({
                        type: "POST",
                        url: "http://www.latinosunidosonline.net/Controls/Delete.ashx",
                        data: "{'id':" + id + ",'section':'" + section + "'}",
                        contentType: "application/json;charset=utf-8",
                        dataType: "json",
                        async: false
                    }).responseText;
                    jAlert(returnData, 'Delete Status', function (r) { window.location.reload(); });
                    return false;
                } else {
                    return false;
                }
            })) return false;
}
function popup(qs, scroll) {
    var strFeatures = "toolbar=no,status=no,menubar=no,location=no"
    strFeatures = strFeatures + ",scrollbars=" + scroll + ",resizable=no,height=500,width=550"
    window.name = "main";
    var newWin = window.open(qs, "TellObj", strFeatures);
    if (window.focus) { newWin.focus() }
}
function formatCurrency(num) {
    num = num.toString().replace(/\$|\,/g, '');
    if (isNaN(num))
        num = "0";
    var sign = (num == (num = Math.abs(num)));
    num = Math.floor(num * 100 + 0.50000000001);
    var 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);
    }
}
