






function $F(id) {
if ($(id)) {
if ($(id).getAttribute("multiple")) {
return $FM(id);
};
return $(id).value;
};

if ($(id + "_yy") && 
$(id + "_mm") && 
$(id + "_dd")) {
return $FD(id);
};

if ($(id + "_yes") &&
$(id + "_no")) {
return $(id + "_yes").checked;
};
return null;
}


function $FD(id) {
return sprintf("%s-%02s-%02s", $F(id + "_yy"), $F(id + "_mm"), $F(id + "_dd"));
}


function $FM(id) {
var result = [];
$A($(id).options).each(function(option) {
if (option.selected) {
result.push(option.value);
};
});
return result;
}

Array.prototype.forall = function(callback) {
return this.reduce(function(a,b) { return a && callback(b); }, true);
}









Class.extend(FormControl, Object);
function FormControl(id, initialValue, validators, filters) {
FormControl.baseConstructor.call(this);
this.id = id;
this.initialValue = initialValue;
this.validators = validators;
this.filters = filters;
}
FormControl.prototype.validate = function() {

if (!$(this.id)) { return true; };
var oldValue = this.getValue();
this.setValue(this.filter(oldValue));
var status = !this.validators.findFirst(function(validator) { return !validator(); });
this.setValue(oldValue);
return status;
}
FormControl.prototype.filter = function(value) {
return this.filters.reduce(function(value, f) { return f.apply(value); }, value);
}
FormControl.prototype.getName = function() {
return $(this.id) ? $(this.id).name : null;
}
FormControl.prototype.getValue = function() {
return $(this.id) ? $(this.id).value : null;
}
FormControl.prototype.setValue = function(value) {
if ($(this.id)) {
$(this.id).value = value;
};
}

Class.extend(FormControlRadio, FormControl);
function FormControlRadio(id, initialValue, ids, validators, filters) {
FormControlRadio.baseConstructor.call(this, id, initialValue, validators, filters);
this.ids = ids;
}
FormControlRadio.prototype.getName = function() {
return $(this.ids[0]).name;
}
FormControlRadio.prototype.getValue = function() {
var checked = this.ids.findFirst(function(id) { return $(id) && $(id).checked; });
if (!checked) return null;
return $(checked).value;
}
FormControlRadio.prototype.setValue = function(value) {
var select = this.ids.findFirst(function(id) { return $(id) && $(id).value == value; });
select.checked = true;
}











Class.inherit(InputForm, Object, {
fromHash: function(hash) {
this._controls.each(function(control) {
if (hash[control.getName()]) {
control.setValue(hash[control.getName()]);
};
});
}
});
function InputForm() {
this._id = null;
this._validatedHandlers = [];
this._controls = [];
this._target = null;
this._targetLoaded = false;
this._submitting = false;
this._noValidation = [];
}
InputForm.prototype.getId = function() {
return this._id;
}
InputForm.prototype.addControl = function(control) {
this._controls.push(control);
}
InputForm.prototype.getControl = function(id) {
return this._controls.findFirst(function(control) {
return control.id == id;
});
}
InputForm.prototype.getControlByName = function(name) {
return this._controls.findFirst(function(control) {
return control.id == this.getId() + "_" + name;
}.bind(this));
}
InputForm.prototype.addValidatedHandler = function(handler) {
this._validatedHandlers.push(handler);
}
InputForm.prototype.beforeValidated = function(e) {
if (window.FCKeditorAPI) {
this._controls.each(function(control) {
var editor = FCKeditorAPI.GetInstance(control.id);
if (editor) {
$(control.id).value = editor.GetXHTML(true);
};
});
}
}
InputForm.prototype.getTarget = function() {
return this._target;
}
InputForm.prototype.getSubmitting = function() {
return this._submitting;
}
InputForm.prototype.isModified = function() {
var notModified = this._controls.forall(function(control) { 
return control.initialValue == $F(control.id); 
});
return !notModified;
}
InputForm.prototype.saveState = function() {
this._controls.each(function(control) { 
control.initialValue = $F(control.id);
});
}
InputForm.prototype.validate = function() {
return this._controls.findFirst(function(control) { return !control.validate(); });
}
InputForm.prototype.setId = function(id) {
this._id = id;
}
InputForm.prototype.setSubmitting = function(value) {
this._submitting = value;
}
InputForm.prototype.setTarget = function(target) {
this._target = target;
}
InputForm.prototype.setupEvents = function() {
var form = this;
var formNode = $(this.getId());
var bypassValidation = false;
this._noValidation.each(function(submit) {
addEvent($(submit.id), "click", function(e) { 
bypassValidation = true;
});
});
addEvent(formNode, "submit", function(e) {
page._inputFeatures.each(function(feature) { feature.cleanup(); });
form.setSubmitting(true);
form.beforeValidated(e);

var badField = null;
var forceSend = false;
var status;

if (!bypassValidation) {
badField = form.validate();
};




if (badField || forceSend) {
form.setSubmitting(false);
page._inputFeatures.each(function(feature) { 
if (!badField || $(badField.id) !== feature._element) {
feature.restore();
};
});
cancelEvent(e);
} else {
form.onValidated(e);
};
});
}
InputForm.prototype.onValidated = function(e) {
this._validatedHandlers.each(function(handler) {
handler(e);
});
}
InputForm.prototype.onTargetLoad = function(e) {
if (!this._targetLoaded) {
this._targetLoaded = true;
return;
};
this.onTargetLoadCustom(e);
}
InputForm.prototype.onTargetLoadCustom = function() {
}
InputForm.prototype.toHash = function() {
var result = this._controls.reduce(function(result, control) { 
result[control.getName()] = control.getValue(); 
return result; 
}, {});
return result;
}
InputForm.prototype.noValidation = function(submitName) {
this._noValidation.push(submitName);
}

InputForm.prototype.resolveId = function(id) {
if ($(id)) {
return { id: id, event: "change" };
};

if ($(id + "_yy") && 
$(id + "_mm") && 
$(id + "_dd")) {
return [{ id: (id + "_yy"), event: "change" }, 
{ id: (id + "_mm"), event: "change" },
{ id: (id + "_dd"), event: "change" }];
};

if ($(id + "_yes") &&
$(id + "_no")) {
return [{ id: (id + "_yes"), event: "click" },
{ id: (id + "_no"),  event: "click" }];
};
return null;
}
function getElementComputedStyle(element, property) {
if (document.defaultView && document.defaultView.getComputedStyle) {
return getElementComputedStyleMozilla(element, property);
}

if (element.currentStyle) {
return getElementComputedStyleIE(element, property);
}
return "";
}
function getElementComputedStyleIE(element, property) {
return element.currentStyle[propertyCssToPropertyDom(property)];
}
function getElementComputedStyleMozilla(element, property) {
return document.defaultView.getComputedStyle(element, "").getPropertyValue(property);
}
function propertyCssToPropertyDom(property) {
var i;
while ((i = property.indexOf("-")) != -1) {
property = property.substr(0, i) + property.substr(i+1,1).toUpperCase() + property.substr(i+2);
};
return property;
}




Class.extend(FeaturePasswordHelpValue, Object);
function FeaturePasswordHelpValue(element, text) {
this._cleared = false;
this._element = element;
this._text = text || element.value;
this._overlay = this.createOverlay(element, this._text);
this._type = element.type;
var _this = this;
addEvent(element, "focus", function(e) { _this.onFocus(e); });
addEvent(element, "keydown", function(e) { _this.onKeyDown(e); });
addEvent(element, "blur", function(e) { _this.onBlur(e); });

setTimeout(function() { element.value = ""; }, 50);
}
FeaturePasswordHelpValue.prototype.createOverlay = function(element, text) {
var overlay = document.createElement("div");
overlay.className = "overlay_help";
overlay.style.position = "absolute";
overlay.style.top = (element.offsetTop + 1).toString() + "px";
overlay.style.left = (element.offsetLeft + 1).toString() + "px";
overlay.style.width = (element.offsetWidth - 8).toString() + "px";
overlay.style.height = (element.offsetHeight - 8).toString() + "px";

["font", "font-family", "font-size", "font-weight", "margin", "padding", "padding-left", "padding-top", "line-height"].each(function(property) {
var value = getElementComputedStyle(element, property);
try {
overlay.style[propertyCssToPropertyDom(property)] = value;
} catch (e) {

};
});  
overlay.appendChild(document.createTextNode(text));
element.offsetParent.appendChild(overlay);
var _this = this;
addEvent(overlay, "click", function(e) { _this.onOverlayClick(e); });
return overlay;
}
FeaturePasswordHelpValue.prototype.hideOverlay = function() {
this._overlay.style.display = "none";
}
FeaturePasswordHelpValue.prototype.showOverlay = function() {
this._overlay.style.display = "block";
}

FeaturePasswordHelpValue.prototype.onBlur = function(e) {
if (!this._cleared) {
if (this._element.value != '') {
this._cleared = true;
} else {
this.showOverlay();
};
};
}
FeaturePasswordHelpValue.prototype.onFocus = function(e) {
this.hideOverlay();
}
FeaturePasswordHelpValue.prototype.onKeyDown = function(e) {
this.hideOverlay();
}
FeaturePasswordHelpValue.prototype.onOverlayClick = function(e) {
this.hideOverlay();
this._element.focus();
}



Class.extend(PopupStay, GuiPopupGeneric);
function PopupStay() {
PopupStay.baseConstructor.call(this);
}
PopupStay.prototype.setup = function(popupElement) {
var popup = $("popup_stay");
popup.style.visibility = "";
popup.style.position = "static";
popupElement.appendChild(popup);

correctPNGNodeBg(popup);
}
PopupStay.prototype.setupVisual = function() {
}









page.c.addOnLoadHandler(function(env) {
env.m.stayPopup = new PopupStay();
$("login_form_login") && new FeatureInputHelpValue($("login_form_login"), "Login Name");
$("login_form_password") && new FeaturePasswordHelpValue($("login_form_password"), "Password");
addEvent($$("span.yes_wrap", $("popup_stay")), "click", function(e) {
$("login_form_remember").value = "1";
$("login_form").submit();
});
addEvent($$("span.no_wrap", $("popup_stay")), "click", function(e) {
$("login_form_remember").value = "";
$("login_form").submit();
});
var form = page.getForm("login_form");
if (form) {
form.addValidatedHandler(function(e) {
cancelEvent(e);
XMLRPC.call(Links.xmlrpc(),
function(response) {
if (response.param) {
env.m.stayPopup.show();
} else {
$(form.getId()).parentNode.className = "login_error";
};
}, null, null,
"login.check", [$F("login_form_login"), $F("login_form_password")]);
});
};
});


page.c.addOnLoadHandler(function(e) {
correctPNG();
});




Bindings.prototype = new Object();
Bindings.prototype.add = Bindings_add;
Bindings.prototype.handle = Bindings_handle;
Bindings.prototype.handleGroup = Bindings_handleGroup;
Bindings.prototype.remove = Bindings_remove;
function Bindings() {
this._bindings = {};
this.GROUPS = ['element', 'group', 'all'];
for (var i=0; i<this.GROUPS.length; i++) {
this._bindings[this.GROUPS[i]] = { sequence: [], hash: {} };
};
}
function Bindings_add(fun, group) {
this.remove(fun, group);
this._bindings[group].sequence.push(fun);
this._bindings[group].hash[fun] = this._bindings[group].sequence.length - 1;
}
function Bindings_handle(event) {
var handled = false;
for (var i=0; i<this.GROUPS.length; i++) {
var data = this.handleGroup(this.GROUPS[i], event);
handled = handled || data.handled;
if (data.terminated) {
break;
};
};
if (handled) {

};
}
function Bindings_handleGroup(group, event) {
var binding = this._bindings[group];
if (!binding || binding.sequence.length == 0) { 
return { handled: false, terminated: false };
};
for (var i = binding.sequence.length - 1; i >= 0; i--) {
if (!binding.sequence[i](event)) {
return { handled: true, terminated: true };
};
};
return { handled: true, terminated: false };
}
function Bindings_remove(fun, group) {
var index = this._bindings[group].hash[fun];
if (index == null) {
return;
};
this._bindings[group].sequence.splice(index, 1);
this._bindings[group].hash[fun] = null;
}
var Event = new Object();
Event.addElement = function(eventType, element, handler) {
Event.initBindings(element, eventType);
element._eventBindings[eventType].add(handler, 'element');
};
Event.addGroup = function(eventType, element, handler) {
Event.initBindings(element, eventType);
element._eventBindings[eventType].add(handler, 'group');
};
Event.initBindings = function(element, eventType) {
if (!element._eventBindings) {
element._eventBindings = {};
};
if (!element._eventBindings[eventType]) { 
element._eventBindings[eventType] = new Bindings();
addEvent(element, eventType, function(e) { element._eventBindings[eventType].handle(e); });
};
};
function textBoxSelect(item, from, to) {
if (item.setSelectionRange) {

item.setSelectionRange(from, to);
} else if (item.createTextRange) {

var range = item.createTextRange();
range.moveStart("character", from);
range.moveEnd("character", to - item.value.length);
range.select();
};
};

var I18N = new Object();
I18N.strings = [];
function _(string) {
return I18N.strings[string] || string;
}
Lang = {
NOMINATIVE: 1,
getWordForm: function(word, value, wordCase) {

if (value == 1) {
return word;
};

var last = word[word.length - 1];
var suffix2 = word.substr(word.length - 2, 2);
if (suffix2 == "ay") { // e.g. day, gay
return word + "s";
};
if (suffix2[1] == "y") {
return word.substr(0, word.length - 1) + "ies";   
};
if (suffix2[1] == "h") {
return word + "es";
};
return word + "s";
}
}






var Validators = {
POPUP_BOTTOM: 0,
POPUP_TOP: 1,
POPUP_LEFT: 2,
POPUP_RIGHT: 3,
errorPopup: null,
hideCallback: null,
offsetX: 3,
offsetY: 3,
timeout: 3000,
_errorPopupVisible: false
};
Validators.handleError = function(element, text) {
this.showErrorPopup(element, text);
}
Validators.showErrorPopup = function(element, text) {
if (Validators._errorPopupVisible) {
return;
};
try {
element.focus();
textBoxSelect(element, 0, element.value.length);
} catch (e) {


};
Validators.showErrorPopupNoSelect(element, text);
}
Validators.getErrorPopup = function() {
if (this.errorPopup == null) {
this.errorPopup = this.createErrorPopup();
};
return this.errorPopup;
}
Validators.getErrorPopupContent = function() {
if (this.errorPopup == null) {
this.errorPopup = this.createErrorPopup();
};
return this.errorPopup;
}
Validators.createErrorPopup = function() {
var errorPopup = document.createElement('div');
errorPopup.className = 'errorpopup';
document.body.appendChild(errorPopup);
addEvent(errorPopup, 'click', function(e) { Validators.hideErrorPopup(); });
return errorPopup;
}
Validators.hideErrorPopup = function() {
if (this.hideCallback != null) {
clearTimeout(this.hideCallback);
this.hideCallback = null;
};
this.doHideErrorPopup();
this._errorPopupVisible = false;
}
Validators.doHideErrorPopup = function() {
this.getErrorPopup().style.visibility = 'hidden';
}
Validators.showErrorPopupNoSelect = function(element, text) { 
if (this._errorPopupVisible) {
return;
};

this.hideErrorPopup();
try {
element.focus();
} catch (e) {

};
this.updateErrorPopup(text);
this.positionErrorPopup(element);
this.displayErrorPopup();
if (this.timeout) {
this.hideCallback = setTimeout(function() { Validators.hideCallback = null; Validators.hideErrorPopup(); }, this.timeout);
};
this._errorPopupVisible = true;
};
Validators.displayErrorPopup = function() {
var error_item = this.getErrorPopup();
error_item.style.visibility = 'visible';
error_item.style.position = 'absolute';
}
Validators.updateErrorPopup = function(text) {
var error_item = this.getErrorPopupContent();
error_item.innerHTML = text + "<div class='comment'>" + _("Click to Close the Window") + "</div>";
}
Validators.positionErrorPopup = function(element) {
var error_item = this.getErrorPopup();

var popupBase = element;
if (getElementComputedStyle(popupBase, "display") == "none") {
popupBase = $(element.id + "___Frame");
};

var popupPosition = this.POPUP_BOTTOM;
var top;
var left;
switch (popupPosition) {
case this.POPUP_TOP:
left = getLeft(popupBase) + this.offsetX;
top = (getTop(popupBase) - error_item.clientHeight - this.offsetY);
break;
case this.POPUP_BOTTOM:
left = getLeft(popupBase) + this.offsetX;
top = getBottom(popupBase) + this.offsetY;
break;
case this.POPUP_LEFT:
top  = getTop(popupBase);
left = getLeft(popupBase) - 150 - this.offsetX;
break;
case this.POPUP_RIGHT:
top  = getTop(popupBase);
left = getRight(popupBase) + this.offsetX;
break;
};
if (top < 0) { top = 0; };

if (left + 150 > document.body.clientWidth) {
left = document.body.clientWidth - 150;
};
if (left < 0) { left = 0; };
error_item.style.left = left.toString() + 'px';
error_item.style.top  = top.toString() + 'px';
}

Array.prototype.all = function() {
return this.reduce(function(a,b) { return a && b; }, true);
}







Validators.not_empty = function(elements, messages) {
var _t = this;
var result = elements.map(function(element) {
if (element.value == "") {
_t.handleError(element, messages.value_missing);
return false;
} else {
return true;
};
});
return result.all();
}


String.prototype.subst = function (vars) {
var result = this;
for (var key in vars) {
var ref = "\\${" + key.toString() + "}";
var value = vars[key].toString();
result = result.replace(new RegExp(ref, "g"), value);
};
return result;
}



Validators.string_length = function(element, minlength, maxlength, messages) {


if (element.value == "") {
return true;
};
var vars = { max_length: maxlength == null ? "" : maxlength.toString(), 
min_length: minlength == null ? "" : minlength.toString() };
if (minlength != null && element.value.length < minlength) {
this.handleError(element, messages.too_short.subst(vars));
return false;
}
if (maxlength != null && element.value.length > maxlength) {
this.handleError(element, messages.too_long.subst(vars));
return false;
};
return true;
};
try {
HTMLSelectElement.prototype.selectOption = HTMLSelectElement__selectOption;
} catch (err) {
}
function HTMLSelectElement__selectOption(value) {
return HTMLSelectElement___selectOption(this, value);
}
function HTMLSelectElement___selectOption(obj, value) {
for (var i=0; i<obj.options.length; i++) {
var option = obj.options[i];
if (option.value == value) {
option.selected = true;
};
};
}


var AJAX = new Object;
AJAX.disableOnlyOption = true;
AJAX.loadHTML = function(object, fetcher) {
fetcher(function(response) { 
object.innerHTML = response.param;
object.disabled = (response.param == "");
});
};
AJAX.loadSelectOptions = function(object, fetcher) {
object.options.length = 0;
object.options[0] = new Option("-- Loading --", "");
object.disabled = true;
fetcher(function(response, defaultValue) { 
var options = response.param;
AJAX.loadSelectOptionsDirect(object, options, defaultValue);
});
};
AJAX.loadSelectOptionsDirect = function(object, options, defaultValue) {
object.options.length = 0;
var group = null;
var optGroupObj = null;
for (var i=0; i <options.length; i++) {
var option = options[i];
if (option.group && option.group != group) {
if (optGroupObj) {
object.appendChild(optGroupObj);
};
group = option.group;
optGroupObj = document.createElement("OPTGROUP");
optGroupObj.setAttribute("label", option.group);
};
var eOption = document.createElement("OPTION");
eOption.setAttribute("value", option.value);
eOption.appendChild(document.createTextNode(option.text));
eOption.selected = option.value == defaultValue
if (optGroupObj) {
optGroupObj.appendChild(eOption);
} else {
object.appendChild(eOption);
};
};
if (optGroupObj) {
object.appendChild(optGroupObj);
};

if (options.length == 0) {
object.options[i] = new Option("-- No items --", "");
};



object.disabled = false;
setTimeout(function() {
if (object.fireEvent) {
object.fireEvent("onchange");
} else {
if (defaultValue) {
object.value = defaultValue;
} else if (object.options.length > 0) {
object.options[0].selected = true;
};
var e = document.createEvent("HTMLEvents");
e.initEvent("change", true, true);
object.dispatchEvent(e);
}
}, 1);
setTimeout(function() {

object.disabled = (options.length <= (AJAX.disableOnlyOption ? 1 : 0)); 
}, 10);
};
AJAX.loadSelectOptionsXMLRPC = function(object, xmlrpcMethod, xmlrpcParams) {
AJAX.loadSelectOptions(object, function(callback) { 
XMLRPC.call(Links.xmlrpc(), callback, null, null, xmlrpcMethod, xmlrpcParams); 
});
}










Class.extend(EnumSelectXMLRPC, Object);
function EnumSelectXMLRPC(fieldObj, xmlrpcMethod, parentIds, defaultValue, additionalParams) {
var _this = this;
this._node = fieldObj;
this._defaultValue = defaultValue;
this._xmlrpcMethod = xmlrpcMethod;
this._additionalParams = additionalParams;
this._parentIds = parentIds;
var resolvedIds = parentIds.map(InputForm.prototype.resolveId).flatten().filter();
resolvedIds.each(function(el) {
addEvent($(el.id), el.event, function(e) { _this.loadOptions(e); } );
});
addEvent(resolvedIds.map(function (el) { return el.id; }).map($), "keyup", function(e) {
var key = e.charCode || e.keyCode;
if (key == 38 || key == 40) {  
_this.loadOptions(e);
};
});

if (fieldObj.form) {
addEvent(fieldObj.form, "submit", function() { 
if (fieldObj.disabled) {
fieldObj.disabled = false; 
setTimeout(function() { fieldObj.disabled = true; }, 1);
};
});
};
_this.loadOptions();
}
EnumSelectXMLRPC.prototype.setDefaultValue = function(value) {
this._defaultValue = value;
}
EnumSelectXMLRPC.prototype.loadOptions = function(e) { 
var _this = this;
AJAX.loadSelectOptions(this._node, function(callback) { _this.fetchOptions(callback); });
};
EnumSelectXMLRPC.prototype.fetchOptions = function(callback) {
var values = this._parentIds.map($F);
XMLRPC.call(Links.xmlrpc(), 
function(response) { callback(response, this._defaultValue); }.bind(this),
null, 
null, 
this._xmlrpcMethod, [values, this._additionalParams]); 
};



page.c.addOnLoadHandler(function(env) {
fsm.clearState();
});



Cls.inherit(Transition, Object, {
doFrame: function(frame, fraction) {
this._frameCallbacks.each(function(cb) { cb(frame, fraction) });
}
});
function Transition() {
this._frames = 10;
this._timeout = 20;
this._frameCallbacks = [];
this._completeCallbacks = [];
this._startCallbacks = [];
this._handles = [];
this._calculateFraction = function(frame) {
return frame / this._frames;
}.bind(this);
}
Transition.prototype.cancel = function() {
this._handles.each(function(handle) {
clearTimeout(handle);
});
this._handles = [];
}
Transition.prototype.getFrames = function(frames) {
return this._frames;
}
Transition.prototype.getTimeout = function(timeout) {
return this._timeout;
}
Transition.prototype.run = function() {
this.cancel();
this._startCallbacks.each(function(cb) { cb(); });
this.doFrame(0, this._calculateFraction(0));
this.setupTimeout();
}
Transition.prototype.setFrames = function(frames) {
this._frames = frames;
}
Transition.prototype.setTimeout = function(timeout) {
this._timeout = timeout;
}
Transition.prototype.doOnComplete = function() {
this._completeCallbacks.each(function(cb) { cb(); });
}
Transition.prototype.doOnStart = function() {
this._startCallbacks.each(function(cb) { cb(); });
}
Transition.prototype.timeoutStep = function(frame) {
this.doFrame(frame, this._calculateFraction(frame));
if (frame >= this._frames) {
this._completeCallbacks.each(function(cb) { cb(); });
};
}
Transition.prototype.setupTimeout = function() {
for (var i = 1; i <= this._frames; i++) {
this._handles.push(setTimeout(function(i) { return function() { this.timeoutStep(i); }.bind(this) }.bind(this)(i), i * this.getTimeout()));
};
}
Transition.prototype.oncomplete = function(f) {
this._completeCallbacks.push(f);
return this;
}
Transition.prototype.onframe = function(f) {
this._frameCallbacks.push(f);
return this;
}
Transition.prototype.onstart = function(f) {
this._startCallbacks.push(f);
return this;
}




Cls.inherit(TransitionSequence, Transition, {
add: function(t) {
this._transitions.push(t);
return t;
},
run: function(t) {
var f = function(transitions) {
if (transitions.length) {
transitions[0].oncomplete(function() { f(transitions.slice(1)); });
transitions[0].run();
};
};
f(this._transitions);
}
});
function TransitionSequence() {
TransitionSequence.baseConstructor.call(this);
this._transitions = [];
}



Cls.inherit(TransitionOpacity, Transition);
function TransitionOpacity(object, startOpacity, stopOpacity) {
object.style.visibility = "";
TransitionOpacity.baseConstructor.call(this);
this.onframe(function(frame, fraction) {
Opacity.set(object, startOpacity + (stopOpacity - startOpacity) * fraction);
});
if (stopOpacity == 1 || stopOpacity == 0) {
this.oncomplete(function() {
object.style.filter = "";
});
};
if (stopOpacity == 0) {
this.oncomplete(function() {
object.style.visibility = "hidden";
});
};
}


Cls.inherit(TransitionHeight, Transition);
function TransitionHeight(object, startHeight, stopHeight) {
TransitionHeight.baseConstructor.call(this);
this.onframe(function(frame, fraction) {
object.style.height = (startHeight + (stopHeight - startHeight) * fraction).toString() + "px";
});
}


Class.extend(PopupFlash, GuiPopupGeneric);
function PopupFlash() {
PopupFlash.baseConstructor.call(this);
}
PopupFlash.prototype.setup = function(popupElement) {
var popup = $("layout_flash_info");
popup.style.visibility = "";
popup.style.position = "static";
popupElement.appendChild(popup);
addEvent($("layout_flash_info_close"), "click", function(e) { this.hide(); }.bind(this));
}







page.c.addOnLoadHandler(function(env) {
var flash = $("layout_flash");
if (flash) {
var hideTimeout = null;
var hideFunc = function() {
hideTimeout && clearTimeout(hideTimeout);
hideTimeout = null;
var transition = new TransitionOpacity(flash, 1, 0);
transition.run();
};
hideTimeout = setTimeout(hideFunc, 5000);
addEvent($$("a", flash), "click", function(e) { cancelEvent(e); cancelBubble(e); hideFunc(); }); 
var info = $("layout_flash_info");
if (info) {
var flashInfoPopup = new PopupFlash();
addEvent(flash, "click", function(e) { flashInfoPopup.show(); });
};
};
});

XMLRPC._ajaxErrorHandler = function(text) {
return true;
};
