﻿// JScript File
    function pageLoaded(sender, args) {
        var control = document.getElementById('info');
    	
        control.style.display = "none";
    }

    function showwait(childid) { 
        var ddlcontrol = document.getElementById(childid);
    	
        ddlcontrol.options.length = 0;
        ddlcontrol.options[ddlcontrol.options.length] = new Option('[Please Wait...]',' ');
        ddlcontrol.disabled=true;
        
        var searchbutton = document.getElementById('uc_left_search_btnSearch');
        searchbutton.disabled=true;
    }

    //for calendar
    function dateEditor_OnShown(dateControl, emptyEventArgs)
    {       
       // Open current popup
       // Create the popup element
       var dateEditorShim;
       dateEditorShim = document.getElementById("dateEditorShim");
       dateEditorShim.style.width = dateControl._popupDiv.offsetWidth;
       dateEditorShim.style.height = dateControl._popupDiv.offsetHeight;
       dateEditorShim.style.top = dateControl._popupDiv.style.top;                                                                        
       dateEditorShim.style.left = dateControl._popupDiv.style.left;
       dateControl._popupDiv.style.zIndex = 999;
       dateEditorShim.style.zIndex = 998;
       dateEditorShim.style.display = "block";
       
    }
   
    // Function: dateEditor_OnShown
    // Summary:  Handles the OnShown event of the dateEditor control. 
    // Inputs:   dateControl    -> The date control object
    //           emptyEventArgs -> Empty event arguments raised by the date control
    // Remarks:  Make sure to insert a shim of an empty iframe underneath the calendar popup container
    function dateEditor_OnHiding(dateControl, emptyEventArgs)
    {       
       // Open current popup
       // Create the popup element
       var dateEditorShim;
       dateEditorShim = document.getElementById("dateEditorShim");
       dateEditorShim.style.width = 0;
       dateEditorShim.style.height = 0;
       dateEditorShim.style.top = 0;
       dateEditorShim.style.left = 0;
       dateEditorShim.style.display = "none";
    }
    
    function OpenHelpWindow()
    {
		    window.open('help.htm','Help','scrollbars=no,menubar=no,height=418,width=400,resizable=yes,toolbar=no,location=no,status=no');
		    return false;
    }
    
function checkDate()
{
	var day = document.getElementById("depdate-day").value;
	var month = document.getElementById("depdate-month").value;
	var year = document.getElementById("depdate-year").value;
    var AlertMsg;
    AlertMsg='';
	var now = new Date();
	now = now.getTime(); //NN3

	var dateToCheck = new Date();
	dateToCheck.setYear(year);
	dateToCheck.setMonth(month-1);
	dateToCheck.setDate(day);
	var checkDate = dateToCheck.getTime();

	var futureDate = (now < checkDate);
	var pastDateDep = (now > checkDate);
	

	if (pastDateDep==true)
	{
	AlertMsg+='Please search for a check in date that is in the future \n';
    }
	
	if (pastDateDep==true)
	{
	alert(AlertMsg);
	return false;
	}else{
	return true;
	}
}