////////////////////////////////////////////////
// Obfuscated by Javascript Obfuscator v.2.53 //
//        http://javascript-source.com        //
////////////////////////////////////////////////
/* MarcGrabanski.com *//* Pop-Up Calendar Built from Scratch by Marc Grabanski *//* Update (7/16/2007): To enable closing of the calendar when a user clicks on the page, the functionscheckExternalClick and hideCalendar were added. These were taken from the most recent version of the calendar from the URL above. All lines where the calendar was being closed via the original method have now been updated with the new method. The original line has been commentedout. ---CDS*/
var popUpCal={selectedMonth:new Date().getMonth(),// 0-11
selectedYear:new Date().getFullYear(),// 4-digit year
selectedDay:new Date().getDate(),init:function(){this.popUpShowing=false;$(document).mousedown(popUpCal.checkExternalClick);$('<div id="calendarDiv"></div>').appendTo("body");var x=$('input.calendarSelectDate');var y=$('#calendarDiv');x.focus(function(){popUpCal.input=$(this);//y.hide();			
popUpCal.hideCalendar();setPos(this,y);// setPos(targetObj,moveObj)
setDateFromField();popUpCal.drawCalendar();});},// end init function
checkExternalClick:function(event){if(popUpCal.popUpShowing){var node=event.target;var cal=$('#calendarDiv')[0];while(node&&node!=cal&&node.className!='calendar_trigger'){node=node.parentNode;}if(!node){popUpCal.hideCalendar();}}},/* Hide the calendar from view. */hideCalendar:function(speed){if(this.popUpShowing){$('#calendarDiv').hide(speed);this.popUpShowing=false;}},drawCalendar:function(){html='<a id="closeCalender">X</a>';html+='<table cellpadding="0" cellspacing="0" id="linksTable"><tr>';html+='	<td><a id="prevMonth"><< Prev</a></td>';html+='	<td><a id="nextMonth">Next >></a></td>';html+='</tr></table>';html+='<table id="calendar" cellpadding="0" cellspacing="0"><tr>';html+='<th colspan="7" class="calendarHeader">'+getMonthName(popUpCal.selectedMonth)+' '+popUpCal.selectedYear+'</th>';html+='</tr><tr class="weekDaysTitleRow">';var weekDays=new Array('S','M','T','W','T','F','S');for(var j=0;j<weekDays.length;j++){html+='<td>'+weekDays[j]+'</td>';}daysInMonth=getDaysInMonth(popUpCal.selectedYear,popUpCal.selectedMonth);startDay=getFirstDayofMonth(popUpCal.selectedYear,popUpCal.selectedMonth);numRows=0;printDate=1;if(startDay!=7){numRows=Math.ceil(((startDay+1)+(daysInMonth))/7);}// calculate the number of rows to generate
// calculate number of days before calendar starts
(startDay!=7)?noPrintDays=startDay+1:noPrintDays=0;// if sunday print right away	
// function with cruft for figuring out what day to highlight
selectedDate=popUpCal.input.val().split('/');if(selectedDate.length==3){thisMonth=parseFloat(selectedDate[0])-1;thisDay=parseFloat(selectedDate[1]);thisYear=parseFloat(selectedDate[2]);}else{thisDay=new Date().getDate();thisMonth=new Date().getMonth();thisYear=new Date().getFullYear();};// create calendar rows
for(var e=0;e<numRows;e++){html+='<tr class="weekDaysRow">';// create calendar days
for(var f=0;f<7;f++){if((printDate==thisDay)&&(popUpCal.selectedYear==thisYear)&&(popUpCal.selectedMonth==thisMonth)&&(noPrintDays==0)){html+='<td id="today" class="weekDaysCell">';}else{html+='<td class="weekDaysCell">';};if(noPrintDays==0){if(printDate<=daysInMonth){html+='<a>'+printDate+'</a>';}printDate++;}html+='</td>';if(noPrintDays>0)noPrintDays--;}html+='</tr>';}html+='</table>';// add calendar to element to calendar Div
var calendarDiv=$('#calendarDiv');calendarDiv.empty().append(html).show("medium");popUpCal.setupLinks();// close button link
$('#closeCalender').click(function(){//calendarDiv.hide(250);
popUpCal.hideCalendar(250);});// setup next and previous links
$('#prevMonth').click(function(){popUpCal.selectedMonth--;if(popUpCal.selectedMonth<0){popUpCal.selectedMonth=11;popUpCal.selectedYear--;}popUpCal.drawCalendar();});$('#nextMonth').click(function(){popUpCal.selectedMonth++;if(popUpCal.selectedMonth>11){popUpCal.selectedMonth=0;popUpCal.selectedYear++;}popUpCal.drawCalendar();});this.popUpShowing=true;},// end drawCalendar function
setupLinks:function(){// set up link events on calendar table
var x=$('#calendar a');x.mouseover(function(){this.parentNode.className='weekDaysCellOver';});x.mouseout(function(){this.parentNode.className='weekDaysCell';});x.click(function(){//$('#calendarDiv').hide(250);
popUpCal.hideCalendar(250);popUpCal.selectedDay=$(this).html();setVal=formatDate(popUpCal.selectedDay,popUpCal.selectedMonth,popUpCal.selectedYear);popUpCal.input.val(setVal);/////////custome code added by HCM////////////////////
//raise change event for any listeners
var inputField=popUpCal.input.get(0);//FF
if(document.createEvent){var onchangeEvent=document.createEvent('HTMLEvents');onchangeEvent.initEvent('change',true,false);inputField.dispatchEvent(onchangeEvent);}//IE
else if(document.createEventObject){inputField.fireEvent('onchange');}//////////end HCM custom code//////////////////////////
});}// end setupLinks function
};// Initialize the calendar
$(document).ready(function(){popUpCal.init();});/* Functions Dealing with Dates */function formatDate(Day,Month,Year){Month++;// adjust javascript month
if(Month<10)Month='0'+Month;// add a zero if less than 10
if(Day<10)Day='0'+Day;// add a zero if less than 10
var dateString=Month+'/'+Day+'/'+Year;return dateString;}function setDateFromField(){selectedDate=popUpCal.input.val().split('/');if(selectedDate.length==3){popUpCal.selectedMonth=parseFloat(selectedDate[0])-1;popUpCal.selectedDay=parseFloat(selectedDate[1]);popUpCal.selectedYear=parseFloat(selectedDate[2]);}else{popUpCal.selectedDay=new Date().getDate();popUpCal.selectedMonth=new Date().getMonth();popUpCal.selectedYear=new Date().getFullYear();}}function getMonthName(month){var monthNames=new Array('January','February','March','April','May','June','July','August','September','October','November','December');return monthNames[month];}function getDayName(day){var dayNames=new Array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');return dayNames[day];}function getDaysInMonth(year,month){return 32-new Date(year,month,32).getDate();}function getFirstDayofMonth(year,month){var day;day=new Date(year,month,0).getDay();return day;}/* Position Functions */function setPos(targetObj,moveObj){var coors=findPos(targetObj);moveObj.css('position','absolute');moveObj.css('top',coors[1]+18+'px');moveObj.css('left',coors[0]+'px');}function findPos(obj){var curleft=curtop=0;if(obj.offsetParent){curleft=obj.offsetLeft;curtop=obj.offsetTop;while(obj=obj.offsetParent){curleft+=obj.offsetLeft;curtop+=obj.offsetTop}}return[curleft,curtop];}
