﻿function _xbcDisplayDate(yearOnly)
{
    var currentDate = new Date();
    var currentMonth = currentDate.getMonth() + 1;
    var currentDay = currentDate.getDate();
    var currentYear = currentDate.getYear();
    if (currentYear<1000) currentYear+=1900;
    if(yearOnly==1)
        document.write(currentYear);
    else 
        document.write(currentMonth + '/' + currentDay + '/' + currentYear);
}
function colorRow(srcElement) {
    var curElement = srcElement;
    while (curElement && !(curElement.tagName == "TR"))
	    curElement = curElement.parentNode;

    if (srcElement.checked)
	    curElement.style.color="red";
    else
	    curElement.style.color="black";
}
function OpenMap(ZipCode, ShowPin, Title)
{
    var URL="/map.aspx?Location="+ZipCode;
    if( ShowPin=='True' ) {
        URL=URL+"&pin="
    }
    if( Title!='' ) {
        URL=URL+"&title="+Title
    }
    var wnd=window.open(URL,"Map","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=640");
    wnd.focus();
}
function CheckPage()
{
    try {
        var theForm = document.forms['aspnetForm'];
        if (!theForm) 
            theForm = document.aspnetForm;
        var i;
        i=theForm.__EVENTTARGET.value;
        i=theForm.__EVENTARGUMENT.value;
    }
    catch(err) {
        alert("Please, wait and click it again!");
        return false;
    }
    return true;
}
function DisableMe(obj)
{
    if( CheckPage() ) {
        obj.value='Processing...';
        obj.innerHTML='<i><strong>Processing...</strong></i>';
        obj.style.color="red";
    }
}
function CheckEnterKey (e)
{
    if (!e) e = event;
    var code;
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;

    if(code == 13)
        if( document.getElementById('HDTrigger') )
            if( document.getElementById('HDTrigger').value=='1' ) {
                e.returnValue = false;
                e.cancel = true;
                return false;
            }        
    return true;
}
