﻿// Popup Calendar JScript
function FillWeekNumber()
{
	DateChanged(document.getElementById('txtRange'),window.PopCalendar3)
}

function DateChanged(_TextBox,_PopCal)
{
	var _TextBoxWeek=document.getElementById("txtNoSem")
	_TextBoxWeek.value=''
	if((!_TextBox)||(!_PopCal)) return
	var _format=_TextBox.getAttribute("Format")
	var _Date=_PopCal.getDate(_TextBox.value, _format)
	if(_Date)
	{
		_TextBoxWeek.value=_PopCal.getWeekNumber(_Date)
	}
}

function SpecialDateStyle(_Date, _PopCal, _Tooltip)
{
	if(_Tooltip.toLowerCase().indexOf("cumpleaños")!=-1)
	{
		var _Style="Background-Position:center center;"
		_Style+="Background-Image:url("+_PopCal.imgDir+"special.gif);"
		_Style+="Background-Repeat:no-repeat;"
		_Style+="Background-Color:#00aa00;"

		return(_Style)
	}
	return("")
}

function DisabledDateStyle(_Date, _PopCal, _Tooltip, _RazonDisabled)
{
	var _Today=_PopCal.getDate("Hoy")
	var _Style="Background-Position:center center;"
	_Style+="Background-Image:url("+_PopCal.imgDir+"baddate.gif);"
	_Style+="Background-Repeat:no-repeat;"
	if(_RazonDisabled.indexOf("Holiday")!=-1)
	{
		if((_PopCal.isGoodFriday(_Date))||(_PopCal.isCarnival(_Date)))
		{
			if((_Date>_Today)&&(_RazonDisabled.indexOf("RangeFrom")!=-1))
			{
				return(_Style+"Color:#ffffff;Background-Color:#ff0000!important;")
			}
			return("DisabledCustom")
		}
	}
	if((_Date>_Today)&&(_RazonDisabled.indexOf("RangeFrom")!=-1))
	{
		if(_Tooltip.toLowerCase().indexOf("cumpleaños")!=-1)
		{
			_Style+="Background-Color:#00aa00!important;"
		}
		return(_Style+"Color:#0a0a0a!important;")
	}
	return("")
}
