/********************************************************************************************
* BlueShoes Framework; This file is part of the php application framework.
* NOTE: This code is stripped (obfuscated). To get the clean documented code goto 
*       www.blueshoes.org and register for the free open source *DEVELOPER* version or 
*       buy the commercial version.
*       
*       In case you've already got the developer version, then this is one of the few 
*       packages/classes that is only available to *PAYING* customers.
*       To get it go to www.blueshoes.org and buy a commercial version.
* 
* @copyright www.blueshoes.org
* @author    Samuel Blume <sam at blueshoes dot org>
* @author    Andrej Arn <andrej at blueshoes dot org>
*/
if (!Bs_Objects) {var Bs_Objects = [];};function bs_dp_inputFieldBlur() {
event.srcElement.bsObj.updateByInputFieldBlur();}
function bs_dp_inputFieldChange() {
event.srcElement.bsObj.updateByInputFieldChange();}
function bs_dp_inputFieldWheel() {
return event.srcElement.bsObj.updateByMouseWheel();}
function Bs_DatePicker(fieldName) {
this._objectId;this.fieldName = fieldName;this.jsBaseDir = '';this.imgDir = '/datepicker/img/win2k/';this.openByInit = false;this.autoClose  = true;this.validateErrorMsg = "Not a valid date: '__VALUE__'. Try again or use the date picker. Valid formats are:\nAmerican mm/dd/yyyy (eg 12/31/2003)\nEuropean dd.mm.yyyy (eg 31.12.2003)\nISO yyyy-mm-dd (eg 2003-12-31)";this.validateErrorMsgEn;this.rangeErrorMsg = "Not a valid date: '__VALUE__'. It is not in the allowed range.";this._language = 'en';this.monthLong = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');;this.monthLongEn;this.monthNumChars = 0;this.days = new Array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');;this.daysEn;this.daysNumChars = 2;this.useYearField = 3;this.useMonthField = 2;this.useSpinEditForYear	= (typeof(Bs_NumberField) != 'undefined');this.useArrows = true;this.useButtonToday = true;this.dayHeaderFontColor = '#D4D0C8';this.dayHeaderBgColor   = 'navy';this.dayFontColor       = 'black';this.dayBgColor         = 'white';this.dayFontColorActive = 'white';this.dayBgColorActive   = '#0A246A';this.dayTableBgColor    = 'white';this.dayBgColorOver     = '#FFFFE1';this.dayTableAttributeString = 'width="100%" border="0" cellspacing="0" cellpadding="3"';this.width = 200;this.internalDateFormat = 'iso';this.displayDateFormat = 'iso';this.dateFormat = 'iso';this.dayClassNameByDay = new Array();this.dateRangeLower = '1800-01-01';this.dateRangeUpper = '2100-12-31';this._currentDate  = '';this._currentYear  = 0;this._currentMonth = 0;this._currentDay   = 0;this.toggleButton;this._lastCursorPos = 0;this._wheelTimeout;this.dateToday = new Date();this._constructor = function() {
this._id = Bs_Objects.length;Bs_Objects[this._id] = this;this._objectId = "Bs_DatePicker_"+this._id;var btnName = this._objectId + '_tglBtn';this.toggleButton = new Bs_Button(btnName);eval(btnName + ' = this.toggleButton;');this.toggleButton.group           = 'toggleButton';this.toggleButton.imgName         = 'bs_calendar';this.toggleButton.cssClassDefault = 'bsBtnMouseOver';this.toggleButton.attachEvent('Bs_Objects['+this._id+'].toggleSelector();', 'on');this.toggleButton.attachEvent('Bs_Objects['+this._id+'].toggleSelector();', 'off');}
this.setLanguage = function(language) {
if (typeof(Bs_DatePicker_Lang) == 'undefined') return false;if (typeof(Bs_DatePicker_Lang[language]) == 'undefined') return false;this._language = language;this.monthLong        = Bs_DatePicker_Lang[language]['months'];this.days             = Bs_DatePicker_Lang[language]['days'];this.validateErrorMsg = Bs_DatePicker_Lang[language]['errorValidate'];this.rangeErrorMsg = Bs_DatePicker_Lang[language]['errorRange'];return true;}
this.resetDate = function() {
this._currentYear  = 0;this._currentMonth = 0;this._currentDay   = 0;this.updateCurrentDate();}
this.setDateByChunks = function(year, month, day, reRender) {
if (typeof(reRender) == 'undefined') reRender = true;year = this.fixYear(year);var newDate = this.dateToIsoDate(year + '-' + month + '-' + day);if (newDate == false) return false;if (!this.isDateSelectable(year, month, day)) return false;this._currentYear  = year;this._currentMonth = month;this._currentDay   = day;this.updateCurrentDate();this.updateInputField();if (reRender) this._reRenderDatePicker();return true;}
this.setDateByJunks = function(year, month, day) {
return this.setDateByChunks(year, month, day);}
this.setDateByIso = function(isoDate, reRender) {
if ("" == isoDate) {
this.resetDate();} else {
var newDate = this.dateToIsoDate(isoDate);if (newDate == false) return false;var year  = parseInt(newDate.substr(0, 4), 10);var month = parseInt(newDate.substr(5, 2), 10);var day   = parseInt(newDate.substr(8, 2), 10);if (!this.isDateSelectable(year, month, day)) return false;this._currentYear  = year;this._currentMonth = month;this._currentDay   = day;this.updateCurrentDate();}
this.updateInputField();if (reRender) this._reRenderDatePicker();return true;}
this.setDateByObject = function(dateObject, reRender) {
return this.setDateByChunks(dateObject.getYear(), dateObject.getMonth()+1, dateObject.getDate(), reRender);}
this.seedInternalWithCurrentDate = function() {
var dateNow = new Date();this._currentYear  = this.fixYear(dateNow.getYear());this._currentMonth = dateNow.getMonth() +1;this._currentDay   = dateNow.getDate();this.updateCurrentDate();}
this.fixYear = function(year) {
if (year < 100) {
year = parseInt('19' + year, 10);} else if ((year >= 100) && (year < 110)) {
year = parseInt(200 + '' + year.toString().substr(2, 1), 10);}
return year;}
this.drawInto = function(tagId) {
var tag = document.getElementById(tagId);if ((tag == null) || !tag) return false;tag.innerHTML = this.render();this._convertYearToSpinEdit();return true;}
this.convertField = function(fieldId) {
var origFld = document.getElementById(fieldId);if ((origFld == null) || !origFld) return false;origFld.maxLength = 11;if (bs_isEmpty(origFld['name'])) origFld['name'] = fieldId;this.fieldName = origFld['name'];var htmlCode = this.render(true);origFld.insertAdjacentHTML('afterEnd', htmlCode);this._convertYearToSpinEdit();origFld.bsObj = this;origFld.attachEvent('onblur',       bs_dp_inputFieldBlur);origFld.attachEvent('onkeyup',      bs_dp_inputFieldChange);origFld.attachEvent('onmousewheel', bs_dp_inputFieldWheel);return true;}
this.render = function(noInputField) {
if (typeof(this.monthLongEn)        != 'undefined') this.monthLong        = this.monthLongEn;if (typeof(this.daysEn)             != 'undefined') this.days             = this.daysEn;if (typeof(this.validateErrorMsgEn) != 'undefined') this.validateErrorMsg = this.validateErrorMsgEn;var ret = new Array();ret[ret.length] = '<table border="0" cellspacing="0" cellpadding="0"><tr><td valign="center">';if (!noInputField) {
ret[ret.length] = '<input';ret[ret.length] = ' type="text"';ret[ret.length] = ' name="'    + this.fieldName + '"';ret[ret.length] = ' id="'      + this.fieldName + '"';ret[ret.length] = ' onblur="Bs_Objects['+this._id+'].updateByInputFieldBlur();"';ret[ret.length] = ' onkeyup="Bs_Objects['+this._id+'].updateByInputFieldChange();"';ret[ret.length] = ' onmousewheel="Bs_Objects['+this._id+'].updateByMouseWheel(); return false;"';ret[ret.length] = ' size="10"';ret[ret.length] = ' maxlength="11"';ret[ret.length] = ' style="width:' + (77-22) + 'px;"';ret[ret.length] = ' class="BsDp_date"';ret[ret.length] = ' title="' + this.getCurrentDateReadable() + '"';ret[ret.length] = ' value="' + this.getCurrentDateFormatted() + '">';}
ret[ret.length] = '</td><td valign="center">';this.toggleButton.title = (this.openByInit) ? 'Hide Calendar' : 'Show Calendar';if (this.openByInit) this.toggleButton.setStatus(2);var btnHtml = this.toggleButton.render();ret[ret.length] = btnHtml;ret[ret.length] = '</td></tr></table>';ret[ret.length] = '<div id="' + this._objectId + '_div"';ret[ret.length] = ' style="width:' + this.width + 'px;';if (!this.openByInit) {
ret[ret.length] = ' display:none;';}
ret[ret.length] = '"';ret[ret.length] = ' class="BsDp_div"';ret[ret.length] = '>';ret[ret.length] = this.renderDatePicker();ret[ret.length] = '</div>';return ret.join('');}
this.renderDatePicker = function() {
var ret = new Array();if (this._currentDate.length == 0) {
this.seedInternalWithCurrentDate();}
ret[ret.length] = '<div class="BsDp_monthYearDiv">';ret[ret.length] = '<table border="0" width="100%" cellpadding="0" cellspacing="0" align="center"><tr>';if (this.useArrows) {
ret[ret.length] = '<td align="center" onclick="Bs_Objects['+this._id+'].dateCalc(0, -1);" style="cursor:hand;cursor:pointer;" class="BsDp_arrowLeft">';ret[ret.length] = '&nbsp;';ret[ret.length] = '<img src="' + this.imgDir + 'arrowLeft.gif' + '" border="0"/>';ret[ret.length] = '&nbsp;';ret[ret.length] = '</span>';ret[ret.length] = '</td><td align="center">';} else {
ret[ret.length] = '<td align="center">';}
if (this.useMonthField == 1) {
ret[ret.length] = '<span class="BsDp_monthText">' + this.monthLong[this._currentMonth -1] + '</span>';} else if (this.useMonthField == 2) {
ret[ret.length] = '<select name="' + this.fieldName + '_month"';ret[ret.length] = ' id="' + this._objectId + '_month" size="1"';ret[ret.length] = ' onChange="Bs_Objects['+this._id+'].updateByMonth();"';ret[ret.length] = ' class="BsDp_month"';ret[ret.length] = '>';var i = 1;for (var m=0; m<this.monthLong.length; m++) {
ret[ret.length] = '<option value="' + i + '"';if (this._currentMonth == i) ret[ret.length] = ' selected';ret[ret.length] = '>';if (this.monthNumChars > 0) {
ret[ret.length] = this.monthLong[m].substr(0, this.monthNumChars);} else {
ret[ret.length] = this.monthLong[m];}
ret[ret.length] = '</option>';i++;}
ret[ret.length] = '</select>';}
ret[ret.length] = '</td>';if (moz && this._useSpinEditForYear()) {
ret[ret.length] = '<td align="left">';} else {
ret[ret.length] = '<td align="center">';}
if (this.useYearField == 1) {
ret[ret.length] = '<span class="BsDp_yearText">' + this._currentYear + '</span>';} else if (this.useYearField >= 2) {
ret[ret.length] = '<input type="text" name="' + this.fieldName + '_year"';ret[ret.length] = ' id="' + this._objectId + '_year" value="' + this._currentYear + '"';ret[ret.length] = ' size="4" maxlength="4" onKeyUp="Bs_Objects['+this._id+'].updateByYearChange();"';ret[ret.length] = ' onBlur="Bs_Objects['+this._id+'].updateByYearBlur();"';ret[ret.length] = ' class="BsDp_year"';ret[ret.length] = '>';if (this._useSpinEditForYear()) {
ret[ret.length] = '&nbsp;&nbsp;&nbsp;';}
}
if (this.useArrows) {
ret[ret.length] = '</td><td align="center" onclick="Bs_Objects['+this._id+'].dateCalc(0, 1);" style="cursor:hand;cursor:pointer;" class="BsDp_arrowRight">';ret[ret.length] = '&nbsp;';ret[ret.length] = '<img src="' + this.imgDir + 'arrowRight.gif' + '" border="0"/>';ret[ret.length] = '&nbsp;';}
ret[ret.length] = '</td>';ret[ret.length] = '</tr></table>';ret[ret.length] = '</div>';ret[ret.length] = '<div id="' + this._objectId + '_dayDiv" class="BsDp_dayTableDiv">';ret[ret.length] = this.renderDayTable(this._currentYear, this._currentMonth, this._currentDay);ret[ret.length] = '</div>';if (this.useButtonToday) {
ret[ret.length] = '<div class="BsDp_buttonsDiv">';ret[ret.length] = '<input type="button" id="today_button" class="searchButton" value="Today"';/*ret[ret.length] = '<img src="' + this.imgDir + 'en_btnToday.gif' + '" align="middle" border="0"';*/ret[ret.length] = ' onclick="Bs_Objects['+this._id+'].setDateByObject(Bs_Objects['+this._id+'].dateToday);"';ret[ret.length] = ' style="cursor:hand; cursor:pointer;"';ret[ret.length] = '/>';ret[ret.length] = '</div>';}
return ret.join('');}
this._reRenderDatePicker = function() {
var div = document.getElementById(this._objectId + '_div');if ((div == null) || !div) return;div.innerHTML = this.renderDatePicker();this._convertYearToSpinEdit();}
this.renderDayTable = function(currentYear, currentMonth, currentDay) {
var day            = 1;var lastDayOfMonth = this.getNumberOfDays(currentYear, currentMonth);var ret            = new Array();ret[ret.length] = '<table ' + this.dayTableAttributeString;ret[ret.length] = ' bgcolor="' + this.dayTableBgColor + '"';ret[ret.length] = ' class="BsDp_dayTable"';ret[ret.length] = '>';if (currentYear >= 1970) {
ret[ret.length] = '<tr bgcolor="' + this.dayHeaderBgColor + '">';for (var d=0; d<this.days.length; d++) {
ret[ret.length] = '<td width="14%" bgcolor="' + this.dayHeaderBgColor + '" align="right"';ret[ret.length] = ' title="' + this.days[d] + '"';ret[ret.length] = ' class="BsDp_dayHeader"';ret[ret.length] = ' style="color:' + this.dayHeaderFontColor + '; cursor:default;">';if (this.daysNumChars > 0) {
ret[ret.length] = this.days[d].substr(0, this.daysNumChars);} else {
ret[ret.length] = this.days[d];}
ret[ret.length] = '</td>';}
ret[ret.length] = '</tr>';var dateObjFirst = new Date(currentYear, currentMonth-1, 1, 0, 0, 0);var weekDayFirst = dateObjFirst.getDay();if (weekDayFirst == 0) weekDayFirst = 7;} else {
var weekDayFirst = 1;}
for (var i=0; i<6; i++) {
ret[ret.length] = '<tr>';for (var j=1; j<8; j++) {
var isSelectableDate = this.isDateSelectable(this._currentYear, this._currentMonth, day);if ((day > lastDayOfMonth) || ((i == 0) && (j < weekDayFirst))) {
ret[ret.length] = '<td>&nbsp;</td>';} else {
ret[ret.length] = '<td';ret[ret.length] = ' id="' + this._objectId + '_td' + day + '"';ret[ret.length] = ' align="right"';if (isSelectableDate) {
ret[ret.length] = ' onMouseOver="Bs_Objects['+this._id+'].dayMouseOver(' + day + ');"';ret[ret.length] = ' onMouseOut="Bs_Objects['+this._id+'].dayMouseOut(' + day + ');"';ret[ret.length] = ' onClick="Bs_Objects['+this._id+'].updateByDay(' + day + ');"';}
var classArr = new Array();classArr[classArr.length] = 'BsDp_day';classArr[classArr.length] = 'BsDp_weekday' +j;if (typeof(this.dayClassNameByDay[day])   != 'undefined') classArr[classArr.length] = this.dayClassNameByDay[day];if ((this.dateToday.getDate() == day) && (this.dateToday.getMonth() == (this._currentMonth -1)) && (this.fixYear(this.dateToday.getYear()) == this._currentYear)) {
classArr[classArr.length] = 'BsDp_dayToday';}
if (!isSelectableDate) classArr[classArr.length] = 'BsDp_dayUnselectable';if (classArr.length > 0) {
ret[ret.length] = ' class="' + classArr.join(' ') + '"';ret[ret.length] = ' style="';} else {
ret[ret.length] = ' style="font-family:arial; font-size:11px;';}
if (isSelectableDate) {
ret[ret.length] = 'cursor:hand; cursor:pointer;';} else {
ret[ret.length] = 'cursor:default;';}
if (day == currentDay) {
ret[ret.length] = ' color:' + this.dayFontColorActive + '; background-color:' + this.dayBgColorActive + ';';} else {
ret[ret.length] = ' color:' + this.dayFontColor + '; background-color:' + this.dayBgColor + ';';}
ret[ret.length] = '">';ret[ret.length] = day;ret[ret.length] = '</td>';day++;}
}
ret[ret.length] = '</tr>';if (day >= (lastDayOfMonth +1)) break;}
ret[ret.length] = '</table>';return ret.join('');}
this.updateDayTable = function() {
document.getElementById(this._objectId + '_dayDiv').innerHTML = this.renderDayTable(this._currentYear, this._currentMonth, this._currentDay);}
this.getCurrentDateReadable = function() {
if (this._currentDay   == 0) return '';if (this._currentMonth == 0) return '';if (this._currentYear  == 0) return '';var ret = '';var dateObj = new Date(this._currentYear, this._currentMonth -1, this._currentDay);var weekDay = dateObj.getDay();if (weekDay == 0) weekDay = 7;ret += this.days[weekDay -1] + ', '
ret += this.monthLong[this._currentMonth -1] + ' ';ret += this._currentDay;switch (this._currentDay) {
case 1: case 21: case 31:
ret += 'st'; break;case 2: case 22:
ret += 'nd'; break;case 3: case 23:
ret += 'rd'; break;default:
ret += 'th';}
ret += ' ' + this._currentYear;return ret;}
this.getCurrentDateFormatted = function() {
if (this._currentDay   == 0) return '';if (this._currentMonth == 0) return '';if (this._currentYear  == 0) return '';switch (this.dateFormat) {
case 'us':
var ret = '';if (this._currentMonth < 10) ret += '0';ret += this._currentMonth + '/';if (this._currentDay < 10) ret += '0';ret += this._currentDay + '/';ret += this._currentYear;return ret;break;case 'eu':
var ret = '';if (this._currentDay < 10) ret += '0';ret += this._currentDay + '.';if (this._currentMonth < 10) ret += '0';ret += this._currentMonth + '.';ret += this._currentYear;return ret;break;default:
return this._currentDate;}
}
this.updateInputField = function() {
var fld = document.getElementById(this.fieldName);if ((fld == null) || !fld) return;fld.value = this.getCurrentDateFormatted();fld.title = this.getCurrentDateReadable();}
this.updateByMouseWheel = function() {
if (typeof(this._wheelTimeout) != 'undefined') clearTimeout(this._wheelTimeout)
var pos = this._rememberCursorPos();if (pos > 0) {
var negative = (event.wheelDelta < 0);var calcObj = this._posToDateCalcHelper(pos, negative);this.dateCalc(calcObj.calcDay, calcObj.calcMonth, calcObj.calcYear, false);this._resetCursorPos();} else {
if (event.wheelDelta > 0) {
this.dateCalc(1, 0, 0, false);} else if (event.wheelDelta < 0) {
this.dateCalc(-1, 0, 0, false);}
}
this._wheelTimeout = setTimeout('Bs_Objects['+this._id+']._reRenderDatePicker();', 300);return false;}
this.updateByInputFieldChange = function() {
switch (window.event.keyCode) {
case 16:
case 35:
case 36:
case 37:
case 39:
return;case 38:
case 40:
var negative = (window.event.keyCode == 40) || ((window.event.keyCode == 34));if ((document.selection) && (document.selection.createRange)) {
var pos = this._rememberCursorPos();var calcObj = this._posToDateCalcHelper(pos, negative);this.dateCalc(calcObj.calcDay, calcObj.calcMonth, calcObj.calcYear);this._resetCursorPos();} else {
this.dateCalc((negative) ? -1 : 1);}
return;case 107:
var fld = document.getElementById(this.fieldName);var pos = fld.value.indexOf('+');var calcObj = this._posToDateCalcHelper(pos);this.dateCalc(calcObj.calcDay, calcObj.calcMonth, calcObj.calcYear);this.setCursorPos(pos);return;default:
}
var userVal = document.getElementById(this.fieldName).value;if ((userVal.length == 10) && (this.dateToIsoDate(userVal) != false)) {
this.updateByInputFieldBlur();}
}
this.updateByInputFieldBlur = function() {
var fld = document.getElementById(this.fieldName);var userVal = fld.value;if (userVal == this._currentDate) return;if (userVal.length > 0) {
var isDateOk = false;do {
newVal = this.dateToIsoDate(userVal);if (newVal == false) {
					alert(this.validateErrorMsg.replace(/__VALUE__/, userVal));
break;}
var year  = parseInt(newVal.substr(0, 4), 10);var month = parseInt(newVal.substr(5, 2), 10);var day   = parseInt(newVal.substr(8, 2), 10);if (!this.isDateSelectable(year, month, day)) {
fld.value = '';					alert(this.rangeErrorMsg.replace(/__VALUE__/, userVal));
break;}
isDateOk = true;} while (false);if (!isDateOk) {
return;}
this._currentYear  = year;this._currentMonth = month;this._currentDay   = day;this.updateCurrentDate();this.updateInputField();} else {
this.seedInternalWithCurrentDate();}
this._reRenderDatePicker();}
this.dateToIsoDate = function(someDate) {
if (someDate.length <  6) return false;if (someDate.length > 10) return false;if (someDate.indexOf('/') >= 0) {
var chunks = someDate.split('/');if (chunks.length != 3) return false;var day   = parseInt(chunks[1], 10);var month = parseInt(chunks[0], 10);var year  = parseInt(chunks[2], 10);} else if (someDate.indexOf('-') >= 0) {
var chunks = someDate.split('-');if (chunks.length != 3) return false;var day   = parseInt(chunks[2], 10);var month = parseInt(chunks[1], 10);var year  = parseInt(chunks[0], 10);} else if (someDate.indexOf('.') >= 0) {
var chunks = someDate.split('.');if (chunks.length != 3) return false;var day   = parseInt(chunks[0], 10);var month = parseInt(chunks[1], 10);var year  = parseInt(chunks[2], 10);} else {
return false;}
if (year < 100) {
if (year < 30) {
year += 2000;} else {
year += 1900;}
}
if (!this.isValidDate(year, month, day)) return false;var ret = '';ret += year + '-';if (month < 10) ret += '0';ret += month + '-';if (day < 10) ret += '0';ret += day;return ret;}
this.updateByDay = function(day) {
try {
var oldTd = document.getElementById(this._objectId + '_td' + this._currentDay);oldTd.style.backgroundColor = this.dayBgColor;oldTd.style.color           = this.dayFontColor;} catch (e) {
}
var oldTd = document.getElementById(this._objectId + '_td' + day);oldTd.style.backgroundColor = this.dayBgColorActive;oldTd.style.color           = this.dayFontColorActive;this._currentDay = parseInt(day, 10);this.updateCurrentDate();this.updateInputField();if (this.autoClose) this.toggleSelector();}
this.updateByMonth = function() {
var tmp = new Bs_FormFieldSelect();var monthSelect = document.getElementById(this._objectId + '_month');tmp.init(monthSelect);this._currentMonth = parseInt(monthSelect.getValue(), 10);var isDateOk = false;do {
if (!this.isValidDate(this._currentYear, this._currentMonth, this._currentDay)) {
break;}
if (!this.isDateSelectable(this._currentYear, this._currentMonth, this._currentDay)) {
break;}
isDateOk = true;} while (false);this.updateCurrentDate();if (isDateOk) {
this.updateInputField();} else {
var fld = document.getElementById(this.fieldName);fld.value = '';fld.title = '';}
this.updateDayTable();}
this.updateByYearChange = function() {
var tmpYear = parseInt(document.getElementById(this._objectId + '_year').value, 10);if ((tmpYear < 2100) && (tmpYear > 1800)) {
this.updateByYearBlur();}
}
this.updateByYearBlur = function() {
var tmpYear = parseInt(document.getElementById(this._objectId + '_year').value, 10);tmpYear = this.fixYear(tmpYear);this._currentYear = tmpYear;var isDateOk = false;do {
if (!this.isValidDate(this._currentYear, this._currentMonth, this._currentDay)) {
break;}
if (!this.isDateSelectable(this._currentYear, this._currentMonth, this._currentDay)) {
break;}
isDateOk = true;} while (false);this.updateCurrentDate();if (isDateOk) {
this.updateInputField();} else {
var fld = document.getElementById(this.fieldName);fld.value = '';fld.title = '';}
this.updateDayTable();}
this.updateCurrentDate = function() {
if ((0 == this._currentYear) &&
(0 == this._currentMonth) &&
(0 == this._currentDay) ) {
this._currentDate = "";} else {
this._currentDate = this._currentYear + '-';if (this._currentMonth < 10) this._currentDate += '0';this._currentDate += this._currentMonth + '-';if (this._currentDay < 10) this._currentDate += '0';this._currentDate += this._currentDay;}
}
this.toggleSelector = function() {
var div = document.getElementById(this._objectId + '_div');if (div.style.display == 'none') {
div.style.display = 'block';div.style.position = 'absolute';var inputField = document.getElementById(this.fieldName);if (inputField.offsetLeft > div.offsetLeft) {
div.style.marginLeft = inputField.offsetLeft + 'px';}div.style.marginLeft = (inputField.offsetLeft - 140)+ 'px';
var newChar  = '-';if (this._useSpinEditForYear()) {
var objName = this._objectId + '_yObj';eval(objName + '.redraw();');}
this.toggleButton.setStatus(2);this.toggleButton.setTitle('Hide Calendar');
this.dateCalc(0,0);
} else {
div.style.display = 'none';var newChar  = '+';this.toggleButton.setStatus(1);this.toggleButton.setTitle('Show Calendar');}
}
this.dayMouseOver = function(day) {
var td = document.getElementById(this._objectId + '_td' + day);if (td.style.backgroundColor.toLowerCase() == this.dayBgColor.toLowerCase()) {
td.style.backgroundColor = this.dayBgColorOver;}
}
this.dayMouseOut = function(day) {
var td = document.getElementById(this._objectId + '_td' + day);if (day != this._currentDay) {
td.style.backgroundColor = this.dayBgColor;}
}
this.isLeapYear = function(year) {
return (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0));}
this.getNumberOfDays = function(year, month) {
switch (month) {
case 2:
if (this.isLeapYear(year)) return 29;return 28;break;case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
return 31;break;default:
return 30;}
}
this.dateCalc = function(addDays, addMonths, addYears, reRender) {
if (typeof(reRender) == 'undefined') reRender = true;if (this._currentDay   == 0) return false;if (this._currentMonth == 0) return false;if (this._currentYear  == 0) return false;if (typeof(addDays)   == 'undefined') addDays   = 0;if (typeof(addMonths) == 'undefined') addMonths = 0;if (typeof(addYears)  == 'undefined') addYears  = 0;var tmpDate = new Date(this._currentYear+addYears, this._currentMonth-1+addMonths, this._currentDay+addDays);this.setDateByChunks(tmpDate.getYear(), tmpDate.getMonth()+1, tmpDate.getDate(), reRender);return true;}
this.setCursorPos = function(pos) {
if ((document.selection) && (document.selection.createRange)) {
var fld = document.getElementById(this.fieldName);var x = document.selection.createRange();x.move('character', -(fld.value.length - pos));x.select();return this._lastCursorPos;} else {
return false;}
}
this.getCursorPos = function() {
if ((document.selection) && (document.selection.createRange)) {
var text = '!';var fld = document.getElementById(this.fieldName);if (document.activeElement == fld) {
var caretPos = document.selection.createRange().duplicate();caretPos.collapse(false);caretPos.text = "!";var pos = fld.value.indexOf('!');fld.value = fld.value.substring(0, pos) + fld.value.substring(pos +1);caretPos.collapse(false);return pos;}
}
return 0;}
this.loadSkin = function(skinName) {
try {
var oLink = document.createElement("link")
oLink.href = this.jsBaseDir + '/datepicker/css/' + skinName + '.css';oLink.rel  = "stylesheet";oLink.type = "text/css";document.body.appendChild(oLink);} catch (e) {
}
switch (skinName) {
case 'win2k':
this.imgDir               = this.jsBaseDir + '/datepicker/img/win2k/';this.toggleButton.imgPath = this.imgDir;this.toggleButton.imgName = 'toggleButton';this.daysNumChars   = 1;return true;case 'osx':
case 'h2ogtk2':
this.imgDir                       = this.jsBaseDir + 'components/datepicker/img/' + skinName + '/';this.toggleButton.imgPath         = this.imgDir;this.toggleButton.imgName         = 'toggleButton';this.toggleButton.backgroundColor = 'transparent';this.toggleButton.cssClassDefault     = '';this.toggleButton.cssClassMouseOver   = '';this.toggleButton.cssClassMouseDown   = '';this.daysNumChars   = 1;this.useMonthField  = 1;this.useYearField   = 1;this.useArrows      = true;this.useButtonToday = true;this.dayTableAttributeString    = 'width="100%" border="0" cellspacing="0" cellpadding="2" bordercolor="white"';this.dayHeaderFontColor         = 'black';this.dayHeaderBgColor           = 'white';this.dayFontColor               = 'black';this.dayBgColor                 = 'white';this.dayFontColorActive         = 'white';this.dayBgColorActive           = '#B5B6BD';this.dayTableBgColor            = 'white';this.dayBgColorOver             = '#B5B6BD';return true;}
return false;}
this.isDateSelectable = function(year, month, day) {
if (typeof(this._dateRangeLower_year) == 'undefined') {
this._dateRangeLower_year  = this.dateRangeLower.substr(0, 4);this._dateRangeLower_month = this.dateRangeLower.substr(5, 2);this._dateRangeLower_day   = this.dateRangeLower.substr(8, 2);this._dateRangeUpper_year  = this.dateRangeUpper.substr(0, 4);this._dateRangeUpper_month = this.dateRangeUpper.substr(5, 2);this._dateRangeUpper_day   = this.dateRangeUpper.substr(8, 2);}
var isSelectableDate = false;do {
if (year < this._dateRangeLower_year) break;if ((year == this._dateRangeLower_year) && (month < this._dateRangeLower_month)) break;if ((year == this._dateRangeLower_year) && (month == this._dateRangeLower_month) && (day < this._dateRangeLower_day)) break;if (year > this._dateRangeUpper_year) break;if ((year == this._dateRangeUpper_year) && (month > this._dateRangeUpper_month)) break;if ((year == this._dateRangeUpper_year) && (month == this._dateRangeUpper_month) && (day > this._dateRangeUpper_day)) break;isSelectableDate = true;} while (false);return isSelectableDate;}
this.isValidDate = function(year, month, day) {
if (year >= 1970) {
var tDate = new Date(year, month -1, day);if (day   != tDate.getDate())               return false;if (month != (tDate.getMonth() +1))         return false;if (year  != this.fixYear(tDate.getYear())) return false;} else {
if ((day   < 1)    || (day   > 31))   return false;if ((month < 1)    || (month > 12))   return false;if ((year  < 1000) || (year  > 3000)) return false;}
if (day > 28) {
if (this.getNumberOfDays(year, month) < day) return false;}
return true;}
this._posToDateCalcHelper = function(pos, negative) {
var ret = new Object();ret.calcDay   = 0;ret.calcMonth = 0;ret.calcYear  = 0;switch (this.dateFormat) {
case 'eu':
if (pos <= 2) {
ret.calcDay   = 1;} else if (pos <= 5) {
ret.calcMonth = 1;} else {
ret.calcYear  = 1;}
break;case 'us':
if (pos <= 2) {
ret.calcMonth = 1;} else if (pos <= 5) {
ret.calcDay   = 1;} else {
ret.calcYear  = 1;}
break;default:
if (pos <= 4) {
ret.calcYear  = 1;} else if (pos <= 7) {
ret.calcMonth = 1;} else {
ret.calcDay   = 1;}
}
if (negative) {
ret.calcDay   = -ret.calcDay;ret.calcMonth = -ret.calcMonth;ret.calcYear  = -ret.calcYear;}
return ret;}
this._convertYearToSpinEdit = function() {
if (this._useSpinEditForYear()) {
var objName = this._objectId + '_yObj';var myNf = new Bs_NumberField(this._objectId + '_year');eval(objName + ' = myNf;');myNf.buttonUp.imgPath   = this.jsBaseDir + '/datepicker/img/win2k/';myNf.buttonDown.imgPath = this.jsBaseDir + '/datepicker/img/win2k/';myNf.buttonUp.horizonSpace = 3;myNf.buttonUp.verticalSpace = 3;myNf.buttonDown.horizonSpace = 3;myNf.buttonDown.verticalSpace = 3;myNf.minValue = 1800;myNf.maxValue = 2300;myNf.attachEvent('onAfterChange', 'Bs_Objects['+this._id+'].updateByYearBlur();');myNf.draw();}
}
this._useSpinEditForYear = function() {
return ( ( (this.useYearField == 3) && ((typeof(Bs_NumberField) != 'undefined')) ) ||
((typeof(this.useYearField) == 'undefined') && this.useSpinEditForYear));}
this._rememberCursorPos = function() {
this._lastCursorPos = this.getCursorPos();return this._lastCursorPos;}
this._resetCursorPos = function() {
return this.setCursorPos(this._lastCursorPos)
}
this._constructor();}

/********************************************************************************************
* BlueShoes Framework; This file is part of the php application framework.
* NOTE: This code is stripped (obfuscated). To get the clean documented code goto 
*       www.blueshoes.org and register for the free open source *DEVELOPER* version or 
*       buy the commercial version.
*       
*       In case you've already got the developer version, then this is one of the few 
*       packages/classes that is only available to *PAYING* customers.
*       To get it go to www.blueshoes.org and buy a commercial version.
* 
* @copyright www.blueshoes.org
* @author    sam blum <sam-at-blueshoes>
* @author    Andrej Arn <andrej-at-blueshoes>
* Bs_Misc.lib.js
*/
var ie = document.all != null;var moz = !ie && document.getElementById != null && document.layers == null;function bs_isNull(theVar) {
if (typeof(theVar) == 'undefined') return true;if (theVar == null) return true;return false;}
function bs_isObject(theVar) {
ret = false;if (typeof(theVar) == 'object') {
ret = !bs_isNull(theVar);}
return ret;}
function bs_isEmpty(theVar) {
if (bs_isNull(theVar)) return true;if (theVar == '') return true;return false;}
function bs_typeOf(theVar) {
ret = 'undefined';switch (typeof(theVar)) {
case 'boolean':  ret = 'boolean';  break;case 'number':   ret = 'number';   break;case 'string':   ret = 'string';   break;case 'function': ret = 'function'; break;case 'object':
if (bs_isNull(theVar)) {
ret = 'null';break;}
if (theVar.concat && theVar.join && theVar.sort && theVar.pop) {
ret = 'array';break;}
break;case 'undefined':
default:
ret = 'undefined';}
return ret;}
function bs_isTrue(value) {
var trueVals = new Array('true','on','y','yes',1,'1','ja','oui');if (value == '') return false;if (typeof(value) == 'string') value = value.toLowerCase();if (value == true) return true;for (var i=0; i<trueVals.length; i++) {
if (value == trueVals[i].toLowerCase()) return true;}
return false;}
function instanceOf(object, constructor) {
while (object != null) {
if (object == constructor.prototype) return true;object = object.__proto__;}
return false;}
function bs_arrayMerge(obj1, obj2) {
if (!bs_isObject(obj1) || !bs_isObject(obj2)) return false;for (var key in obj2) {obj1[key] = obj2[key];}
return obj1;}
function bs_arrayFlip(aArray) {
var aHash = new Object();type = bs_typeOf(aArray);if (type == 'array') {
for (var i=0; i<aArray.length; i++) {
aHash[aArray[i]] = true;}
} else if (type == 'string') {
if (aArray != '') {
aHash[aArray] = true;}
}
return aHash;}
function queryStringToHash(queryString) {
if (typeof(queryString) == 'undefined') {
var queryString = window.location.search;}
var ret = new Array;if (bs_isEmpty(queryString)) return ret;queryString = queryString.substr(1);if (bs_isEmpty(queryString)) return ret;var junks = queryString.split('&');for (var i=0; i<junks.length; i++) {
var x = junks[i].split('=');if (x.length == 2) {
ret[x[0]] = x[1];} else {
ret[x[0]] = '';}
}
return ret;}
function dump(theVar, doReturn, showFunctions, _out, _indent, _numCall) {
if (!_indent) {
_indent  = ' ';_bsDumpOverallNumCall = 1;} else {
_indent  += ' ';_bsDumpOverallNumCall++;}
if (_bsDumpOverallNumCall < 8) {
if (_out) {
var isInternal = true;} else {
_out = '';_numCall = 1;}
var goOn = true;if (_numCall > 10) {
goOn = false;if (!doReturn) {
goOn = confirm("There have been 10 recursive calls so far. Maybe you have an endless loop. Do you want to continue?");}
if (!goOn) {
_out += _indent + "error/warning: nesting levels too deep (>10 times)!\n";} else {
_numCall = 0;}
}
if (goOn) {
switch (typeof(theVar)) {
case 'object':
for (var key in theVar) {
switch (typeof(theVar[key])) {
case 'function':
if (typeof(showFunctions) == 'boolean') {
if (showFunctions) {
_out += _indent + 'function "' + key + '" => ' + theVar[key] + "\n";} else {
_out += _indent + 'function "' + key + "\n";}
} else {
if (showFunctions == 2) {
_out += _indent + 'function "' + key + '" => ' + theVar[key] + "\n";} else if (showFunctions == 1) {
_out += _indent + 'function "' + key + "\n";} else {
}
}
break;case 'undefined':
break;case 'object':
_out += _indent + key;if (instanceOf(theVar[key], Array)) {
_out += ' (Array) => \n';} else if (instanceOf(theVar[key], Date)) {
_out += ' (Date) => '+ theVar[key] +'\n';} else {
_out += ' (Object) => \n';}
_out = dump(theVar[key], doReturn, showFunctions, _out, _indent + "    ", _numCall+1);break;case 'number':
if (instanceOf(theVar, Date)) alert('date');default:
_out += _indent + typeof(theVar[key]) + ' "' + key + '" => ' + theVar[key] + "\n";}
}
break;default:
_out += _indent + typeof(theVar) + ' => ' + theVar + "\n";}
}
}
if (isInternal || doReturn) {
return _out;} else {
alert(_out);return;}
}
function Position(x, y) {
this.x = x;this.y = y;};function getAbsolutePos(el, stopIfAbsolute) {
if (bs_isNull(el)) {
return {x:0, y:0};}
var res = {x:el.offsetLeft, y:el.offsetTop};if (el.offsetParent) {
if (el.offsetParent.currentStyle && el.offsetParent.currentStyle.position) {
var position = el.offsetParent.currentStyle.position;var overflow = el.offsetParent.currentStyle.overflow;} else if (document.defaultView) {
var position = document.defaultView.getComputedStyle(el, null).getPropertyValue("position");var overflow = document.defaultView.getComputedStyle(el, null).getPropertyValue("overflow");} else {
return false;}
if ((stopIfAbsolute != true ) || ((position != 'absolute') && (position != 'relative') && (overflow != 'auto') && (overflow != 'scroll'))) {
var tmp = getAbsolutePos(el.offsetParent, stopIfAbsolute);res.x += tmp.x;res.y += tmp.y;}
}
return res;};function getElementDimensions(elm, stopIfAbsolute) {
var ret = getAbsolutePos(elm, stopIfAbsolute);if (!ret) return ret;ret.w = elm.offsetWidth;ret.h = elm.offsetHeight;return ret;}
function bs_findBackgroundColor(elm) {
if (typeof(elm) == 'string') {
elm = document.getElementById(elm);}
if (typeof(elm) == 'undefined') return false;if (moz) {
try {
var col = document.defaultView.getComputedStyle(elm, null).getPropertyValue("background-color");} catch (e) {
return false;}
} else {
if (typeof(elm.currentStyle) == 'undefined') return false;var col = elm.currentStyle.backgroundColor;}
if ((typeof(col) != 'undefined') && (col != 'transparent') && (col != '')) {
return col;} else {
return bs_findBackgroundColor(elm.parentNode);}
}
function bs_toggleVisibility(show, tags) {
try {
if (typeof(tags) == 'undefined') tags = new Array('select', 'iframe');for (var tag in tags) {
var elms = document.getElementsByTagName(tags[tag]);for (var e = 0; e < elms.length; e++) {
elms[e].style.visibility = (show) ? 'visible' : 'hidden';}
}
} catch (e) {
}
}
Function.prototype.method = function (name, func) {
this.prototype[name] = func;return this;};Function.method('inherits', function (parent) {
var d = 0, p = (this.prototype = new parent());this.method('uber', function uber(name) {
var f, r, t = d, v = parent.prototype;if (t) {
while (t) {
v = v.constructor.prototype;t -= 1;}
f = v[name];} else {
f = p[name];if (f == this[name]) {
f = v[name];}
}
d += 1;r = f.apply(this, Array.prototype.slice.apply(arguments, [1]));d -= 1;return r;});return this;});Function.method('swiss', function (parent) {
for (var i = 1; i < arguments.length; i += 1) {
var name = arguments[i];this.prototype[name] = parent.prototype[name];}
return this;});Function.method('extend', function (object) {
for (property in object.prototype) {
this.prototype[property] = object.prototype[property];}
});if ("undefined" != typeof(HTMLElement)) {
if ("undefined" == typeof(HTMLElement.insertAdjacentElement)) {
HTMLElement.prototype.insertAdjacentElement = function(where, parsedNode)	{
switch(where){
case 'beforeBegin':
this.parentNode.insertBefore(parsedNode,this)
break;case 'afterBegin':
this.insertBefore(parsedNode,this.firstChild);break;case 'beforeEnd':
this.appendChild(parsedNode);break;case 'afterEnd':
if (this.nextSibling) this.parentNode.insertBefore(parsedNode,this.nextSibling);else this.parentNode.appendChild(parsedNode);break;}
}
}
}
if (moz) {
extendEventObject();emulateAttachEvent();emulateEventHandlers(["click", "dblclick", "mouseover", "mouseout",
"mousedown", "mouseup", "mousemove",
"keydown", "keypress", "keyup"]);emulateCurrentStyle(["left", "right", "top", "bottom", "width", "height"]);emulateHTMLModel();Event.LEFT = 1;Event.MIDDLE = 2;Event.RIGHT = 3;}
else {
Event = {};Event.LEFT = 1;Event.MIDDLE = 4;Event.RIGHT = 2;}
function extendEventObject() {
Event.prototype.__defineSetter__("returnValue", function (b) {
if (!b) this.preventDefault();return b;});Event.prototype.__defineSetter__("cancelBubble", function (b) {
if (b) this.stopPropagation();return b;});Event.prototype.__defineGetter__("srcElement", function () {
var node = this.target;while (node.nodeType != 1) node = node.parentNode;return node;});Event.prototype.__defineGetter__("fromElement", function () {
var node;if (this.type == "mouseover")
node = this.relatedTarget;else if (this.type == "mouseout")
node = this.target;if (!node) return;while (node.nodeType != 1) node = node.parentNode;return node;});Event.prototype.__defineGetter__("toElement", function () {
var node;if (this.type == "mouseout")
node = this.relatedTarget;else if (this.type == "mouseover")
node = this.target;if (!node) return;while (node.nodeType != 1) node = node.parentNode;return node;});Event.prototype.__defineGetter__("offsetX", function () {
return this.layerX;});Event.prototype.__defineGetter__("offsetY", function () {
return this.layerY;});}
function emulateAttachEvent() {
HTMLDocument.prototype.attachEvent =
HTMLElement.prototype.attachEvent = function (sType, fHandler) {
		var shortTypeName = sType.replace(/on/, "");
fHandler._ieEmuEventHandler = function (e) {
window.event = e;return fHandler();};this.addEventListener(shortTypeName, fHandler._ieEmuEventHandler, false);};HTMLDocument.prototype.detachEvent =
HTMLElement.prototype.detachEvent = function (sType, fHandler) {
		var shortTypeName = sType.replace(/on/, "");
if (typeof fHandler._ieEmuEventHandler == "function")
this.removeEventListener(shortTypeName, fHandler._ieEmuEventHandler, false);else
this.removeEventListener(shortTypeName, fHandler, true);};}
function emulateEventHandlers(eventNames) {
for (var i = 0; i < eventNames.length; i++) {
document.addEventListener(eventNames[i], function (e) {
window.event = e;}, true);}
}
function emulateAllModel() {
var allGetter = function () {
var a = this.getElementsByTagName("*");var node = this;a.tags = function (sTagName) {
return node.getElementsByTagName(sTagName);};return a;};HTMLDocument.prototype.__defineGetter__("all", allGetter);HTMLElement.prototype.__defineGetter__("all", allGetter);}
function extendElementModel() {
HTMLElement.prototype.__defineGetter__("parentElement", function () {
if (this.parentNode == this.ownerDocument) return null;return this.parentNode;});HTMLElement.prototype.__defineGetter__("children", function () {
var tmp = [];var j = 0;var n;for (var i = 0; i < this.childNodes.length; i++) {
n = this.childNodes[i];if (n.nodeType == 1) {
tmp[j++] = n;if (n.name) {
if (!tmp[n.name])
tmp[n.name] = [];tmp[n.name][tmp[n.name].length] = n;}
if (n.id)
tmp[n.id] = n
}
}
return tmp;});HTMLElement.prototype.contains = function (oEl) {
if (oEl == this) return true;if (oEl == null) return false;return this.contains(oEl.parentNode);};}
function emulateCurrentStyle(properties) {
HTMLElement.prototype.__defineGetter__("currentStyle", function () {
var cs = {};var el = this;for (var i = 0; i < properties.length; i++) {
cs.__defineGetter__(properties[i], encapsulateObjects(el, properties[i]));}
return cs;});}
function encapsulateObjects(el, sProperty) {
return function () {
return document.defaultView.getComputedStyle(el, null).getPropertyValue(sProperty);};}
function emulateHTMLModel() {
function convertTextToHTML(s) {
		s = s.replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<BR>");
while (/\s\s/.test(s))
			s = s.replace(/\s\s/, "&nbsp; ");
		return s.replace(/\s/g, " ");
}
HTMLElement.prototype.insertAdjacentHTML = function (sWhere, sHTML) {
var df;var r = this.ownerDocument.createRange();switch (String(sWhere).toLowerCase()) {
case "beforebegin":
r.setStartBefore(this);df = r.createContextualFragment(sHTML);this.parentNode.insertBefore(df, this);break;case "afterbegin":
r.selectNodeContents(this);r.collapse(true);df = r.createContextualFragment(sHTML);this.insertBefore(df, this.firstChild);break;case "beforeend":
r.selectNodeContents(this);r.collapse(false);df = r.createContextualFragment(sHTML);this.appendChild(df);break;case "afterend":
r.setStartAfter(this);df = r.createContextualFragment(sHTML);this.parentNode.insertBefore(df, this.nextSibling);break;}
};HTMLElement.prototype.__defineSetter__("outerHTML", function (sHTML) {
var r = this.ownerDocument.createRange();r.setStartBefore(this);var df = r.createContextualFragment(sHTML);this.parentNode.replaceChild(df, this);return sHTML;});HTMLElement.prototype.__defineGetter__("canHaveChildren", function () {
switch (this.tagName) {
case "AREA":
case "BASE":
case "BASEFONT":
case "COL":
case "FRAME":
case "HR":
case "IMG":
case "BR":
case "INPUT":
case "ISINDEX":
case "LINK":
case "META":
case "PARAM":
return false;}
return true;});HTMLElement.prototype.__defineGetter__("outerHTML", function () {
var attr, attrs = this.attributes;var str = "<" + this.tagName;for (var i = 0; i < attrs.length; i++) {
attr = attrs[i];if (attr.specified)
str += " " + attr.name + '="' + attr.value + '"';}
if (!this.canHaveChildren)
return str + ">";return str + ">" + this.innerHTML + "</" + this.tagName + ">";});HTMLElement.prototype.__defineSetter__("innerText", function (sText) {
this.innerHTML = convertTextToHTML(sText);return sText;});var tmpGet;HTMLElement.prototype.__defineGetter__("innerText", tmpGet = function () {
var r = this.ownerDocument.createRange();r.selectNodeContents(this);return r.toString();});HTMLElement.prototype.__defineSetter__("outerText", function (sText) {
this.outerHTML = convertTextToHTML(sText);return sText;});HTMLElement.prototype.__defineGetter__("outerText", tmpGet);HTMLElement.prototype.insertAdjacentText = function (sWhere, sText) {
this.insertAdjacentHTML(sWhere, convertTextToHTML(sText));};}
function encodeFilename(filename, e) {
if (typeof(e) == 'undefined') e = '_';var ret      = '';for (var i=0; i<filename.length; i++) {
var chr = filename.substr(i,1);if (chr == e) {
ret += chr;continue;}
ord = chr.charCodeAt(1);if ((ord < 48) || (ord > 122) || ((ord > 57) && (ord < 65)) || ((ord > 90) && (ord < 97))) {
if (ord < 10) {
ret += e + '00' + ord;} else if (ord < 100) {
ret += e + '0' + ord;} else {
ret += e + ord;}
} else {
ret += chr;}
}
return ret;}

/********************************************************************************************
* BlueShoes Framework; This file is part of the php application framework.
* NOTE: This code is stripped (obfuscated). To get the clean documented code goto 
*       www.blueshoes.org and register for the free open source *DEVELOPER* version or 
*       buy the commercial version.
*       
*       In case you've already got the developer version, then this is one of the few 
*       packages/classes that is only available to *PAYING* customers.
*       To get it go to www.blueshoes.org and buy a commercial version.
* 
* @copyright www.blueshoes.org
* @author    sam blum <sam-at-blueshoes>
* @author    Andrej Arn <andrej-at-blueshoes>
* Bs_Button.class.js
*/
if (!Bs_Objects) {var Bs_Objects = [];};
function Bs_Button() {
this._id;this._objectId;this.id;this.group;this._status = 1;this.inactiveStyle = 3;this._imgPathDefault = '/_bsImages/buttons/';this.imgPath;this.imgName;this.height;this.width;this.horizonSpace = 0;this.verticalSpace = 0;this.backgroundColor;this.title;this.caption;this.action;this.cssClassDefault   = 'bsBtnDefault';this.cssClassMouseOver = 'bsBtnMouseOver';this.cssClassMouseDown = 'bsBtnMouseDown';this._buttonBar;this.actualizeFromChildren = 0;this._childrenButtonBar;this._childrenButtonBarFixed;this._isDragAction;this._attachedEvents = new Array;this._constructor = function() {
this._id = Bs_Objects.length;Bs_Objects[this._id] = this;this._objectId = "Bs_Button_"+this._id;}
this.attachEvent = function(fire, e) {
if (typeof(e) == 'undefined') e = 'on';if (typeof(this._attachedEvents[e]) == 'undefined') this._attachedEvents[e] = new Array;this._attachedEvents[e][this._attachedEvents[e].length] = fire;}
this.detachEvents = function(e) {
this._attachedEvents[e] = new Array();}
this.attachFireOff = function(param) {
}
this.render = function() {
var isGecko        = this._isGecko();var out            = new Array;var containerStyle = new Array;out[out.length] = '<div style="display:inline; white-space:nowrap;">';var tagType = 'div';out[out.length] = '<' + tagType;out[out.length] = ' id="' + this._getId() + '"';if (typeof(this.title) != 'undefined') {
out[out.length] = ' title="' + this.title + '"';}
out[out.length] = ' unselectable="on"';captionType = typeof(this.caption);if (captionType != 'undefined') {
containerStyle[containerStyle.length] = 'width:auto';} else {
if (typeof(this.width)  != 'undefined') containerStyle[containerStyle.length] = 'width:'  + this.width  + 'px';if (typeof(this.height) != 'undefined') containerStyle[containerStyle.length] = 'height:' + this.height + 'px';}
if (typeof(this.backgroundColor) != 'undefined') containerStyle[containerStyle.length] = 'background-color:' + this.backgroundColor;switch (this._status) {
case 0:
var filter = this._getInactiveStyleFilter();if (typeof(filter) == 'string') {
containerStyle[containerStyle.length] = 'filter:' + filter;}
case 1:
out[out.length] = ' class="' + this.cssClassDefault + '"';break;case 2:
out[out.length] = ' class="' + this.cssClassMouseDown + '"';break;}
out[out.length] = ' style="' + containerStyle.join(';') + '"';out[out.length] = ' onMouseOver="Bs_Objects['+this._id+'].mouseOver(this);"';out[out.length] = ' onMouseOut="Bs_Objects['+this._id+'].mouseOut(this);"';out[out.length] = ' onMouseDown="Bs_Objects['+this._id+'].mouseDown(this);"';out[out.length] = ' onMouseUp="Bs_Objects['+this._id+'].mouseUp(this);"';out[out.length] = '>';if (typeof(this.imgName) != 'undefined') {
var imgFullPath = '';imgFullPath += this._getImgPath();imgFullPath += this.imgName;if (this.imgName.substr(this.imgName.length -4) != '.gif') imgFullPath += '.gif';out[out.length] = '<img id="' + this._getId() + '_icon" src="' + imgFullPath + '"';out[out.length] = ' hspace="' + this.horizonSpace + '" vspace="' + this.verticalSpace + '"';if ((typeof(this.height) == 'undefined') || (this.height > 18)) out[out.length] = ' style="vertical-align:top;"';out[out.length] = '>';}
captionType = typeof(this.caption);if (captionType != 'undefined') {
if (captionType == 'string') {
out[out.length] = this.caption;} else {
out[out.length] = this.title;}
if (!isGecko) out[out.length] = '&nbsp;';}
if ((typeof(this._childrenButtonBar) != 'undefined') && (this.numberOfAttachedEvents('on') == 0)) {
this.group =  this._objectId + '_pseudoGroup';var imgFullPath = '';imgFullPath += this._getImgPath();imgFullPath += 'small_black_arrow_down.gif';out[out.length] = '&nbsp;<img src="' + imgFullPath + '" style="vertical-align:middle;">&nbsp;';var subBarString = this._childrenButtonBar.render();if (this._childrenButtonBarFixed) {
var divPosition = 'fixed';} else {
var divPosition = 'absolute';}
subBarString = '<div id="' + this._objectId + '_childBar" class="bsBtnMouseOver" style="width:auto; height:auto; display:none; position:' + divPosition + '; left:50px; top:50px;">' + subBarString + '</div>';if (this._childrenButtonBarFixed) {
document.body.insertAdjacentHTML('beforeEnd', subBarString);} else {
out[out.length] = subBarString;}
}
out[out.length] = '</' + tagType + '>';out[out.length] = '</div>';return out.join('');}
this.drawOut = function() {
document.writeln(this.render());}
this.drawInto = function(elm) {
if (typeof(elm) == 'string') {
elm = document.getElementById(elm);}
if (elm != null) {
var x = this.render();			//x = x.replace(/<nobr>/, '');
			//x = x.replace(/<\/nobr>/, '');
			x = x.replace(/<nobr>/, '<span style="white-space: nowrap">');
			x = x.replace(/<\/nobr>/, '<\/span>');
elm.innerHTML = x;}
}
this.mouseOver = function(div) {
if (this._status == 2) return;if (this._status == 0) return;if (!this._isGecko()) {
div.className = this.cssClassMouseOver;}
this._fireEvent('over');}
this.mouseOut = function(div) {
if (this._status == 2) return;if (this._status == 0) return;if (!this._isGecko()) {
div.className = this.cssClassDefault;}
this._fireEvent('out');}
this.mouseDown = function(div) {
if (this._status == 0) return;this._isDragAction = false;div.className = this.cssClassMouseDown;}
this.mouseUp = function(div) {
if (this._status == 0) return;var doFireOn  = true;var doFireOff = false;if (this._isGecko()) {
div.className = this.cssClassDefault;} else {
div.className = this.cssClassMouseOver;}
if (typeof(this.group) != 'undefined') {
if (this._status == 2) {
this._status = 1;doFireOn  = false;doFireOff = true;} else {
div.className = this.cssClassMouseDown;this._status = 2;this._deactivateOtherGroupButtons();}
}
if (this._isDragAction) doFireOn = false;if (doFireOn) {
this._fireEvent('on');} else if (doFireOff) {
this._fireEvent('off');}
}
this.keyClose = function(div) {
var e = window.event;
if (e.keyCode == 27){
    if (this._status == 0) return;var doFireOn  = true;var doFireOff = false;
    
    if (this._isGecko()) {
    div.className = this.cssClassDefault;} else {
    div.className = this.cssClassMouseOver;}
    if (typeof(this.group) != 'undefined') {
    if (this._status == 2) {
    this._status = 1;doFireOn  = false;doFireOff = true;} /*else {
    div.className = this.cssClassMouseDown;this._status = 2;this._deactivateOtherGroupButtons();}*/
    }
    if (doFireOn) {
    /*this._fireEvent('on');*/} else if (doFireOff) {
    this._fireEvent('off');}
}
}
this.dragStart = function(div) {
if (this._status == 0) return false;this._isDragAction = true;div.className = this.cssClassMouseOver;return false;}
this._deactivateOtherGroupButtons = function() {
if (typeof(this._buttonBar) == 'undefined') return;for (var i=0; i<this._buttonBar._buttons.length; i++) {
var btnObj = this._buttonBar._buttons[i][0];if (typeof(btnObj) != 'object') continue;if ((btnObj.group == this.group)) {
if (btnObj._objectId == this._objectId) continue;btnObj._status = 1;btnDiv = document.getElementById(btnObj._getId());btnDiv.className = btnObj.cssClassDefault;}
}
}
this.pretendClick = function() {
if (this._status == 0) return false;if (typeof(this.group) != 'undefined') this.setStatus(2);this._fireEvent('on');}
this.setStatus = function(status) {
if (this._status == status) return;var oldStatus = this._status;this._status = status;var btnDiv = document.getElementById(this._getId());if (btnDiv != null) {
switch (status) {
case 0:
var filter = this._getInactiveStyleFilter();if (typeof(filter) == 'string') {
btnDiv.style.filter = filter;}
break;case 1:
btnDiv.className = this.cssClassDefault;break;case 2:
if (this._isGecko()) {
btnDiv.className = this.cssClassDefault;} else {
btnDiv.className = this.cssClassMouseDown;}
if (typeof(this.group) != 'undefined') {
this._deactivateOtherGroupButtons();}
break;}
}
if ((oldStatus == 0) && (this.inactiveStyle != 0)) {
btnDiv.style.filter = "";}
}
this.getStatus = function() {
return this._status;}
this.setTitle = function(title) {
var elm = document.getElementById(this._getId());if (elm != null) elm.title = title;this.title = title;}
this.setChildrenButtonBar = function(bar, posFixed) {
bar._parentButton = this;this._childrenButtonBar = bar;this._childrenButtonBarFixed = (typeof(posFixed) != 'undefined') ? posFixed : false;}
this._isGecko = function() {
if (navigator.appName == "Microsoft Internet Explorer") return false;    var x = navigator.userAgent.match(/gecko/i);
return (x);return false;}
this._fireEvent = function(e) {
if ((e == 'on') && (typeof(this._buttonBar) != 'undefined') && (typeof(this._buttonBar._parentButton) != 'undefined')) {
this._buttonBar._parentButton._fireEvent('off');if ((this._buttonBar._parentButton.actualizeFromChildren == 1) || (this._buttonBar._parentButton.actualizeFromChildren == 3)) {
var elm = document.getElementById(this._buttonBar._parentButton._getId() + '_icon');var imgFullPath = '';if (this.imgPath) imgFullPath += this.imgPath;imgFullPath += this.imgName;if (this.imgName.substr(this.imgName.length -4) != '.gif') imgFullPath += '.gif';elm.src = this._getImgPath() + imgFullPath;}
}
if (((e == 'on') || (e == 'off')) && (typeof(this._childrenButtonBar) != 'undefined') && (this.numberOfAttachedEvents('on') == 0)) {
var elm = document.getElementById(this._objectId + '_childBar');if (elm != null) {
if (e == 'on') {
this._buttonBar.ignoreEvents = true;var pos = getAbsolutePos(document.getElementById(this._getId()), true);var plusPixel = (typeof(this.height)  != 'undefined') ? parseInt(this.height) : 22;elm.style.top     = (pos.y + plusPixel) + 'px';elm.style.left    = pos.x + 'px';elm.style.display = 'block';} else {
this._buttonBar.ignoreEvents = false;elm.style.display = 'none';}
}
} else {
if (!this._attachedEvents[e]) return;for (var i=0; i<this._attachedEvents[e].length; i++) {
switch (typeof(this._attachedEvents[e][i])) {
case 'function':
this._attachedEvents[e][i](this);break;case 'string':
						//var ev = this._attachedEvents[e][i].replace(/__THIS__/, this);
eval(this._attachedEvents[e][i]);break;default:
}
}
}
}
this.numberOfAttachedEvents = function(e) {
try {
return this._attachedEvents[e].length;} catch (ex) {
return 0;}
}
this._getId = function() {
if (typeof(this.id) != 'undefined') return this.id;return this._objectId + "_container";}
this._getInactiveStyleFilter = function() {
switch (this.inactiveStyle) {
case 0:
return false;break;case 1:
return 'progid:DXImageTransform.Microsoft.BasicImage(grayScale=1)';break;case 2:
return 'progid:DXImageTransform.Microsoft.BasicImage(opacity=.3)';break;default:
return 'progid:DXImageTransform.Microsoft.BasicImage(grayScale=1) progid:DXImageTransform.Microsoft.BasicImage(opacity=.3)';}
}
this._getImgPath = function() {
if (typeof(this.imgPath) != 'undefined') {
return this.imgPath;} else if (typeof(this._buttonBar) != 'undefined') {
return this._buttonBar.imgPath;} else {
return this._imgPathDefault;}
}
this._constructor();}

/********************************************************************************************
* BlueShoes Framework; This file is part of the php application framework.
* NOTE: This code is stripped (obfuscated). To get the clean documented code goto 
*       www.blueshoes.org and register for the free open source *DEVELOPER* version or 
*       buy the commercial version.
*       
*       In case you've already got the developer version, then this is one of the few 
*       packages/classes that is only available to *PAYING* customers.
*       To get it go to www.blueshoes.org and buy a commercial version.
* 
* @copyright www.blueshoes.org
* @author    sam blum <sam-at-blueshoes>
* @author    Andrej Arn <andrej-at-blueshoes>
* Bs_NumberField.class.js
*/
if (!Bs_Objects) {var Bs_Objects = [];};function bs_numberFieldKeyDown() {
return event.srcElement.bsObject.onKeyDown();}
function bs_numberFieldKeyUp() {
return event.srcElement.bsObject.onKeyUp();}
function bs_numberFieldFocus() {
return event.srcElement.bsObject.onFocus();}
function bs_numberFieldWheel() {
return event.srcElement.bsObject.onWheel();}
function bs_numberFieldBlur() {
return event.srcElement.bsObject.onBlur();}
function bs_numberFieldRedraw() {
for (var i=0; i<bs_numberFieldObjects.length; i++) {
try {
bs_numberFieldObjects[i].redraw();} catch (e) {
break;}
}
}
var bs_numberFieldObjects = new Array;try {
window.attachEvent('onresize', bs_numberFieldRedraw);} catch (e) {
}
window.setInterval(bs_numberFieldRedraw, 1000);function Bs_NumberField(elm) {
var a = arguments;this._elementId = (a.length>1) ? a[1] :  a[0];this._elm       = document.getElementById(this._elementId);this._objectId;this.maxValue;this.minValue = 0;this.horizonSpace = 0;this.verticalSpace = 0;this.allowEmpty = false;this.zeroFill;this.buttonUp;this.buttonDown;this.drawButtonsInside = false;this._value   = 0;this._attachedEvents;this._constructor = function() {
this._id = Bs_Objects.length;Bs_Objects[this._id] = this;this._objectId = "Bs_NumberField_"+this._id;if (typeof(this._elm) == 'string') this._elm = document.getElementById(this._elm);bs_numberFieldObjects[bs_numberFieldObjects.length] = this;this._elm.bsObject = this;this._elm.attachEvent('onkeydown',    bs_numberFieldKeyDown);this._elm.attachEvent('onkeyup',      bs_numberFieldKeyUp);this._elm.attachEvent('onfocus',      bs_numberFieldFocus);this._elm.attachEvent('onmousewheel', bs_numberFieldWheel);this._elm.attachEvent('onblur',       bs_numberFieldBlur);var arrowUpObjName   = this._objectId + '_btnUpObj';var arrowUpDivName   = this._objectId + '_btnUpDiv';var arrowDownObjName = this._objectId + '_btnDownObj';var arrowDownDivName = this._objectId + '_btnDownDiv';var buttonHeights = this._getButtonHeights();this.buttonUp   = new Bs_Button();this.buttonUp.objectName = arrowUpObjName;this.buttonUp.imgPath = '/_bsJavascript/components/numberfield/img/';this.buttonUp.imgName = 'arrowBlackUp';this.buttonUp.title   = 'Increase';this.buttonUp.height  = buttonHeights.button1;this.buttonUp.width   = 13;this.buttonUp.horizonSpace = this.horizonSpace;this.buttonUp.verticalSpace = this.verticalSpace;this.buttonUp.cssClassDefault = 'bsBtnMouseOver';this.buttonUp.attachEvent('Bs_Objects['+this._id+'].onClickButtonUp();');this.buttonDown = new Bs_Button();this.buttonDown = new Bs_Button();this.buttonDown.objectName = arrowDownObjName;this.buttonDown.imgPath = '/_bsJavascript/components/numberfield/img/';this.buttonDown.imgName = 'arrowBlackDown';this.buttonDown.title   = 'Decrease';this.buttonDown.height  = buttonHeights.button2;this.buttonDown.width   = 13;this.buttonDown.horizonSpace = this.horizonSpace;this.buttonDown.verticalSpace = this.verticalSpace;this.buttonDown.cssClassDefault   = 'bsBtnMouseOver';this.buttonDown.attachEvent('Bs_Objects['+this._id+'].onClickButtonDown();');}
this.setValue = function(value) {
value = this.fixValue(value);this._value = value;this._elm.value = this._zeroFillValue(value);}
this.getValue = function() {
this.updateByField();return this._value;}
this.increase = function() {
this.updateByField();this.setValue(this._value +1);}
this.decrease = function() {
this.updateByField();this.setValue(this._value -1);}
this.render = function() {
var arrowUpDivName   = this._objectId + '_btnUpDiv';var arrowDownDivName = this._objectId + '_btnDownDiv';var fldPos        = getAbsolutePos(this._elm, true);var fldHeight     = this._elm.offsetHeight;var fldWidth      = this._elm.offsetWidth;var left          = fldPos.x + fldWidth;left=166;var top           = fldPos.y;top=3; if (this.drawButtonsInside) {
left      -= 15;top       += 2;fldHeight -= 4;}
var bDiv = new Array;bDiv[bDiv.length] = '<div id="' + this._objectId + '_btnContainer"';bDiv[bDiv.length] = ' style="position:absolute; left:' + left + 'px; top:' + top + 'px; ';if (false) {
var zIndex = (this._elm.style.zIndex > 0) ? this._elm.style.zIndex : 1;bDiv[bDiv.length] = ' z-index:' + zIndex + ';';}
bDiv[bDiv.length] = '">';bDiv[bDiv.length] = this._renderButtonContainers(arrowUpDivName, arrowDownDivName);bDiv[bDiv.length] = '</div>';return bDiv.join('');}
this._getButtonHeights = function() {
var ret = new Object;var fldHeight = this._elm.offsetHeight;if (this.drawButtonsInside) {
fldHeight -= 4;}
ret.button1   = parseInt(fldHeight /2);ret.button2   = fldHeight - ret.button1;return ret;}
this.redraw = function() {
var fldPos        = getAbsolutePos(this._elm, true);var fldWidth      = this._elm.offsetWidth;var left          = fldPos.x + fldWidth;left=166;var top           = fldPos.y;top=3;if (this.drawButtonsInside) {
left      -= 15;top       += 2;}
var container = document.getElementById(this._objectId + '_btnContainer');if ((parseInt(container.style.left) == left) && (parseInt(container.style.top) == top)) {
return;}
container.style.left = left;container.style.top  = top;/*if (moz) {
var fldPos = getAbsolutePos(container, true);if (fldPos.x != left) {
container.style.left = left - (fldPos.x - left);}
if (fldPos.y != top) {
container.style.top = top - (fldPos.y - top);}
}*/
container.innerHTML  = this._renderButtonContainers();this._renderButtons();}
this.draw = function() {
if (this.updateByField()) {
}
var htmlCode = this.render();this._elm.insertAdjacentHTML('afterEnd', htmlCode);this._renderButtons();}
this._renderButtons = function() {
var arrowUpDivName   = this._objectId + '_btnUpDiv';var arrowDownDivName = this._objectId + '_btnDownDiv';var arrowUpObjName   = this._objectId + '_btnUpObj';var arrowDownObjName = this._objectId + '_btnDownObj';var buttonHeights = this._getButtonHeights();this.buttonUp.height    = buttonHeights.button1;this.buttonDown.height  = buttonHeights.button2;this.buttonUp.drawInto(arrowUpDivName);eval(arrowUpObjName+' = Bs_Objects['+this._id+'].buttonUp;');this.buttonDown.drawInto(arrowDownDivName);eval(arrowDownObjName+' = Bs_Objects['+this._id+'].buttonDown;');}
this._renderButtonContainers = function(arrowUpDivName, arrowDownDivName) {
if (typeof(arrowUpDivName)   == 'undefined') arrowUpDivName   = this._objectId + '_btnUpDiv';if (typeof(arrowDownDivName) == 'undefined') arrowDownDivName = this._objectId + '_btnDownDiv';var bDiv = new Array;bDiv[bDiv.length] = '<div style="display:block;" id="' + arrowUpDivName   + '"></div>';bDiv[bDiv.length] = '<div style="display:block" id="' + arrowDownDivName + '"></div>';return bDiv.join('');}
this.fixValue = function(value) {
value = parseInt(value, 10);if (isNaN(value)) {
if (this.allowEmpty) {
return '';} else {
if (!isNaN(this.minValue)) return this.minValue;return 0;}
}
if (!bs_isNull(this.minValue) && (value < this.minValue)) value = this.minValue;if (!bs_isNull(this.maxValue) && (value > this.maxValue)) value = this.maxValue;return value;}
this._zeroFillValue = function(value) {
if (typeof(this.zeroFill) != 'undefined') {
var numLength = (value + '').length;for (var i=numLength; i<this.zeroFill; i++) {
value = '0' + value;}
}
return value;}
this.isValidValue = function(value) {
if (isNaN(value)) return false;if (!bs_isNull(this.minValue) && (value < this.minValue)) return false;if (!bs_isNull(this.maxValue) && (value > this.maxValue)) return false;return true;}
this.onKeyDown = function() {
if ((window.event.keyCode <= 90) && (window.event.keyCode >= 65)) return false;switch (window.event.keyCode) {
case 40:
if (!this.fireEvent('onBeforeChange')) return false;this.decrease();this.fireEvent('onAfterChange');return false;break;case 38:
if (!this.fireEvent('onBeforeChange')) return false;this.increase();this.fireEvent('onAfterChange');return false;break;}
return true;}
this.onKeyUp = function() {
if (this.isValidValue(this._elm.value)) {
if (!this.fireEvent('onBeforeChange')) return;this.updateByField();this.fireEvent('onAfterChange');}
}
this.onClickButtonUp = function() {
if (!this.fireEvent('onBeforeChange')) return;this.increase();this.fireEvent('onAfterChange');}
this.onClickButtonDown = function() {
if (!this.fireEvent('onBeforeChange')) return;this.decrease();this.fireEvent('onAfterChange');}
this.onFocus = function() {
this.updateByField();this._elm.select();}
this.onWheel = function() {
if (!this.fireEvent('onBeforeChange')) return;if (event.wheelDelta > 0) {
this.increase();} else if (event.wheelDelta < 0) {
this.decrease();}
this.fireEvent('onAfterChange');return false;}
this.onBlur = function() {
this.updateByField();}
this.updateByField = function() {
var oldVal = this._elm.value;if (isNaN(oldVal) || (oldVal == '') || (oldVal.length == 0)) {
if (this.allowEmpty) {
oldVal = '';} else {
oldVal = this.minValue;}
}
if ((this._value != oldVal)) {
this.setValue(oldVal);}
return (this._value != oldVal);}
this.toggleButtonDisplay = function(show) {
var elm = document.getElementById(this._objectId + '_btnContainer');elm.style.display = (show) ? 'block' : 'none';}
this.attachEvent = function(trigger, yourEvent) {
if (typeof(this._attachedEvents) == 'undefined') {
this._attachedEvents = new Array();}
if (typeof(this._attachedEvents[trigger]) == 'undefined') {
this._attachedEvents[trigger] = new Array(yourEvent);} else {
this._attachedEvents[trigger][this._attachedEvents[trigger].length] = yourEvent;}
}
this.hasEventAttached = function(trigger) {
return (this._attachedEvents && this._attachedEvents[trigger]);}
this.fireEvent = function(trigger) {
if (trigger == 'onAfterChange') this._fireOnChange();if (this._attachedEvents && this._attachedEvents[trigger]) {
var e = this._attachedEvents[trigger];if ((typeof(e) == 'string') || (typeof(e) == 'function')) {
e = new Array(e);}
for (var i=0; i<e.length; i++) {
if (typeof(e[i]) == 'function') {
var status = e[i](this);} else if (typeof(e[i]) == 'string') {
var status = eval(e[i]);}
if (status == false) return false;}
}
return true;}
this._fireOnChange = function() {
if (this._elm.onchange) {
this._elm.onchange();}
}
this._constructor();}

/********************************************************************************************
* BlueShoes Framework; This file is part of the php application framework.
* NOTE: This code is stripped (obfuscated). To get the clean documented code goto 
*       www.blueshoes.org and register for the free open source *DEVELOPER* version or 
*       buy the commercial version.
*       
*       In case you've already got the developer version, then this is one of the few 
*       packages/classes that is only available to *PAYING* customers.
*       To get it go to www.blueshoes.org and buy a commercial version.
* 
* @copyright www.blueshoes.org
* @author    sam blum <sam-at-blueshoes>
* @author    Andrej Arn <andrej-at-blueshoes>
* Bs_FormFieldSelect.class.js
*/
function Bs_FormFieldSelect() {}
Bs_FormFieldSelect.prototype.hasValue = function(val) {
val = val + '';for (var i=0; i<this.length; i++) {
var t = this.options[i].value + '';if (t == val) return true;}
return false;}
Bs_FormFieldSelect.prototype.getValue = function() {
var selIndex = this.selectedIndex;if ((selIndex != 'undefined') && (selIndex > -1)) {
if (typeof(this.options[selIndex].value) != 'undefined') return this.options[selIndex].value;if (typeof(this.options[selIndex].text)  != 'undefined') return this.options[selIndex].text;}
return 'undefined';}
Bs_FormFieldSelect.prototype.getValueOrText = function(selIndex) {
if (typeof(selIndex) == 'undefined') selIndex = this.selectedIndex;if ((selIndex != 'undefined') && (selIndex > -1)) {
if (typeof(this.options[selIndex].value) != 'undefined') {
if (typeof(this.options[selIndex].outerHTML) == 'string') {
if (this.options[selIndex].outerHTML.toLowerCase().indexOf('value=') != -1) {
return this.options[selIndex].value;}
} else {
if (this.options[selIndex].value != '') return this.options[selIndex].value;}
}
if (typeof(this.options[selIndex].text)  != 'undefined') return this.options[selIndex].text;}
return false;}
Bs_FormFieldSelect.prototype.getTextForValue = function(value) {
for (var i=0; i<this.options.length; i++) {
if (this.options[i].value == value) {
return this.options[i].text;}
}
return false;}
Bs_FormFieldSelect.prototype.setTo = function(compare, type) {
if (typeof(type) == 'undefined') type = 'text';for (var i=0; i<this.length; i++) {
if (this.options[i][type] == compare) {
this.selectedIndex = i;return true;}
}
return false;}
Bs_FormFieldSelect.prototype.selectAll = function() {
for (var i=0; i<this.length; i++) {
this.options[i].selected = true;}
}
Bs_FormFieldSelect.prototype.moveSelectedTo = function(toField, keepSelected) {
if (typeof(toField) == 'string') toField = document.getElementById(toField);if (bs_isNull(toField)) return false;var unsetArray = new Array();for (var i=0; i<this.length; i++) {
if (this.options[i].selected) {
var newOpt = new Option(this.options[i].text, this.options[i].value, false, false);toField.options[toField.length] = newOpt;unsetArray[unsetArray.length] = i;}
}
unsetArray.reverse();for (var i=0; i<unsetArray.length; i++) {
this.options[unsetArray[i]] = null;}
return true;}
Bs_FormFieldSelect.prototype.moveAllTo = function(toField) {
if (typeof(toField) == 'string') toField = document.getElementById(toField);if (bs_isNull(toField)) return false;var unsetArray = new Array();for (var i=0; i<this.length; i++) {
var newOpt = new Option(this.options[i].text, this.options[i].value, false, false);toField.options[toField.length] = newOpt;unsetArray[unsetArray.length] = i;}
unsetArray.reverse();for (var i=0; i<unsetArray.length; i++) {
this.options[unsetArray[i]] = null;}
return true;}
Bs_FormFieldSelect.prototype.moveTo = function(toField, optionValue) {
if (typeof(toField) == 'string') toField = document.getElementById(toField);if (bs_isNull(toField)) return false;var unsetArray = new Array();for (var i=0; i<this.options.length; i++) {
if (this.options[i].value == optionValue) {
var newOpt = new Option(this.options[i].text, this.options[i].value, false, false);toField.options[toField.length] = newOpt;unsetArray[unsetArray.length] = i;break;}
}
unsetArray.reverse();for (var i=0; i<unsetArray.length; i++) {
this.options[unsetArray[i]] = null;}
return true;}
Bs_FormFieldSelect.prototype.moveHashTo = function(toField, hash) {
if (typeof(toField) == 'string') toField = document.getElementById(toField);if (bs_isNull(toField)) return false;var unsetArray = new Array();for (var i=0; i<this.length; i++) {
if (typeof(hash[this.options[i].value]) != 'undefined') {
var newOpt = new Option(this.options[i].text, this.options[i].value, false, false);toField.options[toField.length] = newOpt;unsetArray[unsetArray.length] = i;}
}
unsetArray.reverse();for (var i=0; i<unsetArray.length; i++) {
this.options[unsetArray[i]] = null;}
return true;}
Bs_FormFieldSelect.prototype.getAllKeys = function() {
var ret = new Array();for (var i=0; i<this.options.length; i++) {
ret[i] = this.options[i].value;}
return ret;}
Bs_FormFieldSelect.prototype.getAllOptions = function() {
var ret = new Array();for (var i=0; i<this.options.length; i++) {
var key = this.getValueOrText(i);ret[key] = this.options[i].text;}
return ret;}
Bs_FormFieldSelect.prototype.prune = function() {
this.options.length = 0;}
Bs_FormFieldSelect.prototype.addElement = function() {
}
Bs_FormFieldSelect.prototype.addElementsByHash = function(dataHash) {
var i = 0;for (var key in dataHash) {
var newOpt = new Option(dataHash[key], key, false, false);this.options[this.options.length] = newOpt;i++;}
return i;}
Bs_FormFieldSelect.prototype.sortByText = function(desc, natural) {
if (typeof(desc)    == 'undefined') desc    = this._param1;if (typeof(natural) == 'undefined') natural = this._param2;var sortArr = new Array;for (var i=0; i<this.length; i++) {
if (this.options[i].value == 'undefined') this.options[i].value = this.options[i].text;var bool = (this.options[i].selected) ? '1' : '0';sortArr[i] = this.options[i].text + '__BS_SORT__' + this.options[i].value + '_' + bool;}
sortArr.sort();if (desc) sortArr.reverse();this.prune();var key = '';var txt = '';for (var i=0; i<sortArr.length; i++) {
var pos = sortArr[i].lastIndexOf('__BS_SORT__');txt = sortArr[i].substr(0, pos);key = sortArr[i].substr(pos + '__BS_SORT__'.length);var selected = (key.substr(key.length -1) == '1') ? true : false;key = key.substr(0, key.length -2);var newOpt = new Option(txt, key, selected, selected);this.options[this.options.length] = newOpt;}
}
Bs_FormFieldSelect.prototype.sortByKey = function() {
}
Bs_FormFieldSelect.prototype.setText = function(value, text) {
for (var i=0; i<this.length; i++) {
if (this.options[i].value == value) {
this.options[i].text = text
return true;}
}
return false;}
Bs_FormFieldSelect.prototype.removeElement = function(value) {
if (typeof(value) == 'undefined') value = this._param1;for (var i=0; i<this.options.length; i++) {
if (this.options[i].value == value) {
this.options[i] = null;return true;}
}
return false;}
Bs_FormFieldSelect.prototype.init = function(formField) {
if (formField == null) return;for (var name in this) {
if (name == 'init') continue;formField[name] = this[name];}
}
