var UI={};
UI.version="0.6.0-pre";
UI.Lang={};
UI.Lang.Language=function(_1,_2){
bindMethods(this);
this.code=_1;
this.messages=_2;
};
UI.Lang.Language.prototype={"translate":function(_3){
return this.messages[_3];
}};
UI.Lang.C=new UI.Lang.Language("C",{});
UI.Lang.es=new UI.Lang.Language("es",{"The value must be a number":"El valor debe ser num\xe9rico","The field is required":"Debe ingresar un valor en este campo","The field is not valid":"El valor ingresado no es v\xe1lido","The value must contain only letters":"El valor debe contener solo letras","The value must be a valid email address":"El valor debe contener una direcci\xf3n de correo v\xe1lida","Sun":"Dom","Sunday":"Domingo","Mon":"Lun","Monday":"Lunes","Thu":"Mar","Thursday":"Martes","Wed":"Mie","Wednesday":"Miercoles","Tue":"Jue","Tuesday":"Jueves","Fri":"Vie","Friday":"Viernes","Sat":"Sab","Saturday":"Sabado","January":"Enero","February":"Febrero","March":"Marzo","April":"Abril","May":"Mayo","June":"Junio","July":"Julio","August":"Agosto","September":"Septiembre","October":"Octubre","November":"Noviembre","December":"Diciembre"});
UI.Lang.setLanguage=function(_4){
if(typeof (_4)!="undefined"&&typeof (UI.Lang[_4])!="undefined"){
UI.Lang.current=UI.Lang[_4];
}else{
logWarning("UI.Lang has no translations for language "+_4);
UI.Lang.current=UI.Lang.C;
}
};
if(typeof (LANG)!="undefined"){
UI.Lang.setLanguage(LANG);
}else{
var _detectedLang=navigator.userLanguage||navigator.browserLanguage||navigator.language;
if(_detectedLang.length>=2){
UI.Lang.setLanguage(_detectedLang.substring(0,2));
}else{
logWarning("UI.Lang: Can't autodetect language. (Browser says: "+_detectedLang+")");
UI.Lang.setLanguage("C");
}
_detectedLang=null;
}
function _(_5){
return UI.Lang.current.translate(_5)||_5;
}
UI.Widget=function(_6){
bindMethods(this);
this.element=$(_6);
this.cssClass="uiwidget";
this.register();
};
UI.Widget.get=function(_7){
return $(_7)._widget;
};
var w$=UI.Widget.get;
UI.Widget.prototype={"register":function(){
if(this.element){
this.element._widget=this;
addElementClass(this.element,this.cssClass);
}
},"hide":function(){
hideElement(this.element);
},"show":function(_8){
showElement(this.element,_8);
},"toDOM":function(_9){
return this.element;
},"__dom__":function(_10){
return this.element;
}};
UI.TableModel=function(){
bindMethods(this);
};
UI.TableModel.prototype={"getNumCols":function(){
return 0;
},"getNumRows":function(){
return 0;
},"getCell":function(_11,_12){
return null;
},"getHeader":function(_13){
return null;
},"getFooter":function(_14){
return null;
},"getColType":function(_15){
return null;
},"hasHeader":function(){
return false;
},"hasFooter":function(){
return false;
},"getRow":function(_16){
return map(partial(this.getCell,_16),range(0,this.getNumCols()));
},"getRows":function(){
return map(this.getRow,range(0,this.getNumRows()));
},"getHeaders":function(){
return map(this.getHeader,range(0,this.getNumCols()));
},"getFooters":function(){
return map(this.getFooter,range(0,this.getNumCols()));
},"getColTypes":function(){
return map(this.getColType,range(0,this.getNumCols()));
}};
UI.ArrayTableModel=function(_17,_18,_19,_20,_21){
bindMethods(this);
this.objects=_17||[];
this.fields=_18||this._autoDetectFields();
this.headers=_20||this._autoDetectHeaders();
this.types=_19;
this.footers=_21;
};
UI.ArrayTableModel.prototype=update(new UI.TableModel(),{"getNumCols":function(){
return this.fields?this.fields.length:0;
},"getNumRows":function(){
return this.objects?this.objects.length:0;
},"getCell":function(_22,_23){
var val;
try{
val=this.objects[_22][this.fields[_23]];
if(val==null||typeof (val)=="undefined"){
val="";
}
}
catch(e){
val="";
}
return val;
},"getHeader":function(_25){
try{
return this.headers[_25];
}
catch(e){
return "";
}
},"getFooter":function(_26){
try{
return this.footers[_26];
}
catch(e){
return "";
}
},"getColType":function(_27){
try{
return this.types[_27];
}
catch(e){
return "string";
}
},"_autoDetectFields":function(){
if(this.objects&&this.objects.length>=1){
var _28=[];
for(field in this.objects[0]){
_28.push(field);
}
return _28;
}else{
return [];
}
},"_autoDetectHeaders":function(){
var _29=[];
for(var i=0;i<this.getNumCols();i++){
_29.push(this.fields[i]);
}
return _29;
},"hasHeader":function(){
return !(!this.headers);
},"hasFooter":function(){
return !(!this.footers);
},"changed":function(){
signal(this,"changed");
}});
UI.AsyncArrayTableModel=function(_31,_32,_33,_34,_35){
bindMethods(this);
this.objects=[];
this.fields=_31;
this.headers=_33;
this.types=_32;
this.footers=_34;
this._mapFunc=_35;
};
UI.AsyncArrayTableModel.prototype=update(new UI.ArrayTableModel(),{"retrieveData":function(url,_37){
var _37=_37||"GET";
var d=loadJSONDoc(url);
d.addCallback(this._receiveData);
return d;
},"_receiveData":function(_39){
this.objects=_39;
if(this._mapFunc){
this.objects=map(this._mapFunc,_39);
}
if(!this.fields){
this._autoDetectFields();
}
if(!this.headers){
this._autoDetectHeaders();
}
this.changed();
}});
UI.HTMLTableModel=function(_40,_41){
bindMethods(this);
this._htmlTable=_40;
this._colTypes=_41;
};
UI.HTMLTableModel.prototype=update(new UI.TableModel(),{"getNumCols":function(){
try{
return this._htmlTable.tBodies[0].rows[0].cells.length;
}
catch(e){
return 0;
}
},"getNumRows":function(){
try{
return this._htmlTable.tBodies[0].rows.length;
}
catch(e){
return 0;
}
},"getCell":function(_42,_43){
try{
return this._htmlTable.tBodies[0].rows[_42].cells[_43].childNodes;
}
catch(e){
return "";
}
},"getHeader":function(_44){
try{
return this._htmlTable.tHead.rows[0].cells[_44].childNodes;
}
catch(e){
return "";
}
},"getFooter":function(_45){
try{
return this._htmlTable.tFoot.rows[0].cells[_45].childNodes;
}
catch(e){
return "";
}
},"getColType":function(_46){
try{
if(this._colTypes){
return this._colTypes[_46];
}else{
return "string";
}
}
catch(e){
return "string";
}
},"hasHeader":function(){
return !(!this._htmlTable.tHead);
},"hasFooter":function(){
return !(!this._htmlTable.tFoot);
}});
UI.ListModel=function(){
bindMethods(this);
};
UI.ListModel.prototype={"getLabel":function(_47){
return "";
},"getValue":function(_48){
return "";
},"getLength":function(){
return 0;
}};
UI.ArrayListModel=function(_49,_50,_51){
bindMethods(this);
this.objects=_49;
this.labelField=_50;
this.valueField=_51;
};
UI.ArrayListModel.prototype=update(new UI.ListModel(),{"getLabel":function(_52){
return this.labelField?this.objects[_52][this.labelField]:""+this.objects[_52];
},"getValue":function(_53){
return this.valueField?this.objects[_53][this.valueField]:this.getLabel(_53);
},"getLength":function(){
return this.objects.length;
},"changed":function(){
signal(this,"changed");
}});
UI.AsyncArrayListModel=function(_54,_55){
bindMethods(this);
this.objects=[];
this.labelField=_54;
this.valueField=_55;
};
UI.AsyncArrayListModel.prototype=update(new UI.ArrayListModel(),{"retrieveData":function(url,_56){
var _56=_56||"GET";
var d=loadJSONDoc(url);
d.addCallback(this._receiveData);
return d;
},"_receiveData":function(_57){
this.objects=_57;
this.changed();
return _57;
}});
UI.HTMLSelectListModel=function(_58){
this._options=_58.getElementsByTagName("option");
};
UI.HTMLSelectListModel.prototype=update(new UI.ListModel(),{"getLabel":function(_59){
return scrapeText(this._options[_59]);
},"getValue":function(_60){
return this._options[_60].value;
},"getLength":function(){
try{
return this._options.length;
}
catch(e){
return 0;
}
}});
UI.Window=function(_61){
bindMethods(this);
if(_61){
this.element=$(_61);
}else{
this.element=DIV({style:{"height":"400px","width":"400px","left":"0px","top":"0px","position":"absolute"}});
}
this.titleBar=null;
this.content=null;
this.draggableTitle=null;
var _62=this.element.getElementsByTagName("h1");
var _63=null;
if(_62.length==0){
this.setTitleBar(UI.Window.standardTitleBar("Untitled Window"));
}else{
this.setTitleBar(_62[0]);
}
var _64=getElementsByTagAndClassName("div","uicontent",this.element);
if(_64.length==0){
var div=DIV({"class":"uicontent"});
var _66=filter(function(el){
return el.className!="uititlebar";
},this.element.childNodes);
map(partial(appendChildNodes,div),_66);
this.setContent(div);
}else{
this.setContent(_64[0]);
}
this.resize(elementDimensions(this.element));
this.visible=computedStyle(this.element,"display")!="none";
this.cssClass="uiwindow";
this.register();
this.NAME=this.element.id+" (UI.Window)";
};
UI.Window.prototype=update(new UI.Widget(),{"show":function(_68){
showElement(this.element);
signal(this,"shown");
if(_68){
this.moveTo(_68);
}
},"hide":function(){
hideElement(this.element);
signal(this,"hidden");
},"close":function(){
removeElement(this.element);
this.draggableTitle.disable();
this.draggableTitle=null;
signal(this,"closed");
},"moveTo":function(_69){
setElementPosition(this.element,_69);
signal(this,"moved",_69);
},"resize":function(_70){
setElementDimensions(this.element,_70);
},"_adjustSize":function(){
setElementDimensions(this.content,{"w":this.element.clientWidth-4,"h":this.element.clientHeight-elementDimensions(this.titleBar).h-4});
},"include":function(url){
var el=DIV();
this.setContent(el);
var d=doSimpleXMLHttpRequest(url);
d.addCallback(function(req){
removeElementClass(el,"uierror");
el.innerHTML=req.responseText;
return req;
});
d.addErrback(function(req){
addElementClass(el,"uierror");
if(req){
el.innerHTML=req.responseText;
}else{
el.innerHTML=_("Error loading")+" "+url;
}
});
return d;
},"setTitleBar":function(_72){
if(this.titleBar){
removeElement(this.titleBar);
this.draggableTitle.disable();
}
addElementClass(_72,"uititlebar");
if(this.element.firstChild){
this.element.insertBefore(_72,this.element.firstChild);
}else{
this.element.appendChild(_72);
}
this.titleBar=_72;
this.draggableTitle=new UI.Draggable(this.titleBar);
this.draggableTitle.elementToMove=this.element;
},"setContent":function(_73){
if(this.content){
removeElement(this.content);
}
addElementClass(_73,"uicontent");
this.content=_73;
appendChildNodes(this.element,this.content);
setElementDimensions(this.content,{"w":this.element.clientWidth-4,"h":this.element.clientHeight-elementDimensions(this.titleBar).h-4});
}});
UI.Window._fromElement=function(_74){
var win=new UI.Window(_74);
var _76=getNodeAttribute("ui:draggable")||"true";
if(_76=="false"){
win.draggableTitle.disable();
}
};
UI.Window.standardTitleBar=function(_77){
return H1({"class":"uititlebar"},_77);
};
UI.Draggable=function(_78,_79,_80,_81){
bindMethods(this);
if(_78){
this.element=$(_78);
}else{
this.element=DIV();
}
this.element=$(_78);
this.elementToMove=$(_78);
this.flags=arguments.length>=2?_79:UI.Draggable.DRAG_X|UI.Draggable.DRAG_Y;
this.leftLimits=_80;
this.topLimits=_81;
this._dragXStart=-1;
this._dragYStart=-1;
this._leftStart=-1;
this._topStart=-1;
this._installMouseDown();
this._disabled=false;
this.NAME=repr(_78)+" (Draggable)";
};
UI.Draggable.DRAG_X=1;
UI.Draggable.DRAG_Y=2;
UI.Draggable._oldonmousemove=document.onmousemove;
UI.Draggable._oldonmouseup=document.onmouseup;
UI.Draggable._draggable=null;
UI.Draggable.prototype={"startFromEvent":function(e){
var e=e||window.event;
var x=e.screenX;
var y=e.screenY;
this.start(x,y);
},"start":function(_85,_86){
if(this._disabled){
return;
}
if(UI.Draggable._draggable){
logError("Can't drag "+repr(this.element)+" as "+repr(UI.Draggable._draggable.element)+" is being already dragged");
return;
}
UI.Draggable._draggable=this;
this.elementToMove.style.zIndex=1;
this._dragXStart=_85;
this._dragYStart=_86;
this._leftStart=parseInt(computedStyle(this.elementToMove,"left"),10);
this._topStart=parseInt(computedStyle(this.elementToMove,"top"),10);
if((isNaN(this._leftStart)||isNaN(this._topStart))){
logger.error("Can't start the drag for "+repr(this)+" "+"Either the left or the top of the dragged element is not a number "+"left: "+this._leftStart+" top: "+this._topStart);
return;
}
signal(this,"dragStarted");
},"move":function(_87,_88){
if(this._disabled){
return;
}
if((this.flags&UI.Draggable.DRAG_X)>0){
var _89=(this._leftStart+_87-this._dragXStart);
if(this.leftLimits){
if(_89<this.leftLimits[0]){
_89=this.leftLimits[0];
}
if(_89>this.leftLimits[1]){
_89=this.leftLimits[1];
}
}
if(!isNaN(_89)){
this.elementToMove.style.left=_89+"px";
}else{
logger.error("Draggable.move: newLeft isNaN");
}
}
if((this.flags&UI.Draggable.DRAG_Y)>0){
var _90=(this._topStart+_88-this._dragYStart);
if(this.topLimits){
if(_90<this.topLimits[0]){
_90=this.topLimits[0];
}
if(_90>this.topLimits[1]){
_90=this.topLimits[1];
}
}
if(!isNaN(_90)){
this.elementToMove.style.top=_90+"px";
}else{
logger.error("Draggable.move: newTop isNaN");
}
}
signal(this,"dragging");
},"stop":function(){
var e=e||window.event;
UI.Draggable._draggable=null;
signal(this,"dragFinished");
},"_installMouseDown":function(){
var _91=this.element.onmousedown;
var _92=this;
this.element.onmousedown=function(e){
var e=e||window.event;
_92.startFromEvent(e);
if(_91){
_91.apply(this.element,arguments);
}
};
},"enable":function(){
this._disabled=false;
},"disable":function(){
this._disabled=true;
}};
document.onmousemove=function(e){
var e=e||window.event;
var x=e.screenX;
var y=e.screenY;
if(UI.Draggable._draggable){
UI.Draggable._draggable.move(x,y);
}
if(UI.Draggable._oldonmousemove){
_oldmousemove.apply(document,arguments);
}
};
document.onmouseup=function(e){
if(UI.Draggable._draggable){
UI.Draggable._draggable.stop(e);
}
if(UI.Draggable._oldonmouseup){
_oldonmouseup.apply(document,arguments);
}
};
UI.Table=function(_93,_94){
bindMethods(this);
if(_93){
this.element=$(_93);
}else{
this.element=DIV();
}
this.selectedRow=-1;
this._modelRowIndexes=[];
this._bodyRowIndexes=[];
this._selectedTR=null;
this._highlightedTR=null;
this._sortCol=-1;
this._arrow=SPAN(null);
this._model=null;
this.cssClass="uitable";
this.register();
if(_94){
this.setModel(_94);
}
this.NAME=this.element.id+"(UI.Table)";
};
UI.Table._NO_ARROW="&nbsp;&nbsp;&nbsp;";
UI.Table._DOWN_ARROW="&nbsp;&nbsp;&darr;";
UI.Table._UP_ARROW="&nbsp;&nbsp;&uarr;";
UI.Table.prototype=update(new UI.Widget(),{"setModel":function(_95){
this._model=_95;
connect(_95,"changed",this,"render");
this.render();
},"model":function(){
return this._model;
},"render":function(){
if(!this._model){
logError("Can't render a table without model");
return;
}
var _96=this.getTableElement();
if(_96){
swapDOM(_96,null);
}
var _97=[];
if(this._model.hasHeader()){
_97.push(THEAD(null,TR(null,map(this._makeTH,this._model.getHeaders(),range(0,this._model.getNumCols())))));
}
if(this._model.hasFooter()){
_97.push(TFOOT(null,TR(null,map(partial(TD,null),this._model.getFooters()))));
}
var _98=TABLE(null,_97,TBODY(null,map(this._makeTR,this._model.getRows(),range(0,this._model.getNumRows()))));
this.element.appendChild(_98);
this._initIndexesMaps();
},"_initIndexesMaps":function(){
this._bodyRowIndexes=[];
this._modelRowIndexes=[];
for(var i=0;i<this._model.getNumRows();i++){
this._bodyRowIndexes.push(i);
this._modelRowIndexes.push(i);
}
},"getTableElement":function(){
return this.element.getElementsByTagName("table")[0];
},"_makeTH":function(_99,_100){
var th=TH(null,_99);
addElementClass(th,"col_"+_100);
var _102=this;
th.onclick=function(e){
_102.clickHeader(_100,e||window.event);
};
return th;
},"_makeTR":function(row,_104){
var tr=TR(null,map(this._makeTD,row,this._model.getColTypes()));
addElementClass(tr,"row_"+_104);
addElementClass(tr,(_104%2)==0?"even":"odd");
var _106=this;
tr.onclick=function(e){
_106.clickRow(_106.modelRowIndex(tr.sectionRowIndex),e||window.event);
};
tr.onmouseover=function(e){
_106.mouseOverRow(_106.modelRowIndex(tr.sectionRowIndex),e||window.event);
};
tr.onmouseout=function(e){
_106.mouseOutRow(_106.modelRowIndex(tr.sectionRowIndex),e||window.event);
};
signal(this,"rowAdded",tr,_104);
return tr;
},"_makeTD":function(cell,type){
switch(type){
case "rawhtml":
var td=TD(null);
td.innerHTML=cell;
return td;
default:
return TD(null,cell);
}
},"clickRow":function(_110,_111){
this.selectRow(_110);
signal(this,"rowClicked",_110,_111);
},"clickHeader":function(_112,_113){
var _114=this.getTH(_112);
var _115=_114.getAttribute("_order")||"asc";
var _116=_115=="asc"?"desc":"asc";
_114.setAttribute("_order",_116);
this.sort(_112,_116=="desc");
if(_116=="asc"){
this._arrow.innerHTML=UI.Table._DOWN_ARROW;
}else{
this._arrow.innerHTML=UI.Table._UP_ARROW;
}
_114.appendChild(this._arrow);
signal(this,"headerClicked",_112,_113);
},"mouseOverRow":function(_117,_118){
this.highlightRow(_117);
signal(this,"rowMouseOver",_117,_118);
},"mouseOutRow":function(_119,_120){
this.highlightRow(-1);
signal(this,"rowMouseOut",_119,_120);
},"selectRow":function(_121){
if(this._selectedTR){
removeElementClass(this._selectedTR,"ui_active");
}
var _122=this.getTR(_121);
if(_122){
addElementClass(_122,"ui_active");
this._selectedTR=_122;
}else{
this._selectedTR=null;
}
this.selectedRow=_121;
signal(this,"rowSelected",_121);
},"highlightRow":function(_123){
if(this._highlightedTR){
removeElementClass(this._highlightedTR,"ui_hover");
}
var _124=this.getTR(_123);
if(_124){
addElementClass(_124,"ui_hover");
this._highlightedTR=_124;
}
},"modelRowIndex":function(_125){
return this._modelRowIndexes[_125];
},"bodyRowIndex":function(_126){
return this._bodyRowIndexes[_126];
},"getTR":function(_127){
var _128=this.bodyRowIndex(_127);
if(_128>=0){
return this.getTableElement().tBodies[0].rows[_128];
}else{
return null;
}
},"getTH":function(_129){
if(_129>=0){
return this.getTableElement().tHead.rows[0].cells[_129];
}else{
return null;
}
},"_sortDate":function(a,b){
aa=scrapeText(a.cells[this.sortCol]);
bb=scrapeText(b.cells[this.sortCol]);
if(aa.length==10){
dt1=aa.substr(6,4)+aa.substr(3,2)+aa.substr(0,2);
}else{
yr=aa.substr(6,2);
if(parseInt(yr)<50){
yr="20"+yr;
}else{
yr="19"+yr;
}
dt1=yr+aa.substr(3,2)+aa.substr(0,2);
}
if(bb.length==10){
dt2=bb.substr(6,4)+bb.substr(3,2)+bb.substr(0,2);
}else{
yr=bb.substr(6,2);
if(parseInt(yr)<50){
yr="20"+yr;
}else{
yr="19"+yr;
}
dt2=yr+bb.substr(3,2)+bb.substr(0,2);
}
if(dt1==dt2){
return 0;
}
if(dt1<dt2){
return -1;
}
return 1;
},"_sortCurrency":function(a,b){
aa=scrapeText(a.cells[this.sortCol]).replace(/[^0-9.]/g,"");
bb=scrapeText(b.cells[this.sortCol]).replace(/[^0-9.]/g,"");
return parseFloat(aa)-parseFloat(bb);
},"_sortNumeric":function(a,b){
aa=parseFloat(scrapeText(a.cells[this.sortCol]));
if(isNaN(aa)){
aa=0;
}
bb=parseFloat(scrapeText(b.cells[this.sortCol]));
if(isNaN(bb)){
bb=0;
}
return aa-bb;
},"_sortString":function(a,b){
var aa=scrapeText(a.cells[this.sortCol]).toLowerCase();
var bb=scrapeText(b.cells[this.sortCol]).toLowerCase();
if(aa==bb){
return 0;
}
if(aa<bb){
return -1;
}
return 1;
},"_sortStringCaseSensitive":function(a,b){
aa=scrapeText(a.cells[this.sortCol]);
bb=scrapeText(b.cells[this.sortCol]);
if(aa==bb){
return 0;
}
if(aa<bb){
return -1;
}
return 1;
},"sort":function(_134,_135){
_134=_134||0;
_135=_135||false;
this.sortCol=_134;
var _136=this._model.getColType(_134)||"string";
var _137="_sort"+_136.charAt(0).toUpperCase()+_136.substring(1);
if(!this[_137]){
logError("UI.Table.sort: Type "+_136+" unrecognized");
return;
}
var _138=this.getTableElement();
var _139=new Array();
for(var i=0;i<_138.tBodies[0].rows.length;i++){
_139[i]=_138.tBodies[0].rows[i];
_139[i]._modelIndex=this.modelRowIndex(i);
}
_139.sort(this[_137]);
for(var i=0;i<_139.length;i++){
if(!_135){
_138.tBodies[0].appendChild(_139[i]);
}else{
_138.tBodies[0].appendChild(_139[_139.length-1-i]);
}
this._modelRowIndexes[i]=_139[i]._modelIndex;
this._bodyRowIndexes[_139[i]._modelIndex]=i;
try{
delete _139[i]._modelIndex;
}
catch(e){
_139[i]._modelIndex=null;
}
}
}});
UI.Table._fromElement=function(_140){
var _141=new UI.Table(_140.id||_140.getAttribute("id"));
var _142=_140.getAttribute("ui:model");
if(!_142){
var _143=_140.getElementsByTagName("table");
if(_143&&_143.length>0){
_141.setModel(new UI.HTMLTableModel(_143[0]));
}
return;
}else{
_141.setModel(eval("("+_142+")"));
return;
}
};
UI.Slider=function(_144,_145,_146,_147){
if(typeof (_146)=="number"){
this.minValue=_145;
this.maxValue=_146;
_145=this.maxValue-this.minValue+1;
_146=[partial(operator.add,this.minValue),partial(operator.add,this.minValue)];
}else{
this.minValue=0;
this.maxValue=0;
}
bindMethods(this);
if(_144){
this.element=$(_144);
}else{
this.element=DIV({"style":{"width":"100px"}});
}
this.steps=_145||101;
this.valueMapperFunctions=_146||UI.Slider.ValueMappers.range(0,100,1);
this.step=0;
this.value=_146[0](0);
this.linkedInput=null;
this._valueTip=DIV({"class":"uislidertip"});
hideElement(this._valueTip);
document.getElementsByTagName("body")[0].appendChild(this._valueTip);
var _148=this.element.getElementsByTagName("div");
if(!_148||_148.length==0){
var _149=DIV(null," ");
this.element.appendChild(_149);
_148=this.element.getElementsByTagName("div");
}
var _150=_148[0];
this._draggableWidth=parseInt(computedStyle(_150,"width"),10);
this._maxLeft=parseInt(computedStyle(this.element,"width"),10)-this._draggableWidth;
this.draggable=new UI.Draggable(_150,UI.Draggable.DRAG_X,[0,this._maxLeft]);
connect(_150,"onmouseover",this,"_showValueTip");
connect(_150,"onmouseout",this,"_hideValueTip");
connect(this.draggable,"dragging",this,"_updateValue");
this._connectWithClicks();
this.cssClass="uislider";
this.tipFormatter=operator.identity;
this.register();
this._updateValue();
if(_147){
this.linkWithInput(_147);
_147.value=this.value;
}
this.NAME=this.element.id+"(UI.Slider)";
};
UI.Slider.prototype=update(new UI.Widget(),{"_updateValue":function(left){
var _152=this.value;
if(arguments.length==0){
left=parseInt(computedStyle(this.draggable.element,"left"),10);
}
this.step=Math.round((left/this._maxLeft)*(this.steps-1));
this.value=this.valueMapperFunctions[0](this.step);
this._valueTip.innerHTML=this.tipFormatter(this.value);
if(this.value!=_152){
signal(this,"valueChanged",this.value);
if(this.linkedInput){
this.linkedInput.value=this.value;
}
this._locateTip();
}
},"_click":function(_153,_154){
var _155=elementPosition(this.element).x;
var _156=(_153-_155-this._draggableWidth/2);
this.setStep(parseFloat((_156/this._maxLeft)*(this.steps-1)));
},"setStep":function(step){
if(step>this.steps-1){
step=this.steps-1;
}
if(step<0){
step=0;
}
var left=Math.round(((step)/(this.steps-1))*this._maxLeft);
this.draggable.element.style.left=left+"px";
this._updateValue(left);
},"setValue":function(_158){
this.setStep(this.valueMapperFunctions[1](_158));
},"_showValueTip":function(){
this._locateTip();
showElement(this._valueTip);
},"_locateTip":function(){
var pos=elementPosition(this.draggable.element);
var _160=elementDimensions(this._valueTip);
pos.y-=(_160.h+5);
setElementPosition(this._valueTip,pos);
},"_hideValueTip":function(){
hideElement(this._valueTip);
},"_connectWithClicks":function(){
var _161=this;
connect(this.element,"onclick",function(e){
var _162=e.mouse();
_161._click(_162.page.x,_162.page.y);
});
connect(this.draggable.element,"onclick",function(e){
e.stop();
return false;
});
},"linkWithInput":function(_163){
this.linkedInput=_163;
this.linkedInput.value=this.value;
var _164=this;
connect(_163,"onchange",function(e){
var val=parseInt(_163.value,10);
if(!isNaN(val)){
_164.setValue(val);
}
});
}});
UI.Slider.ValueMappers={"range":function(_165,_166,by){
by=by||1;
var _168=function(step){
return _165+(step*by);
};
var _169=function(_170){
return (_170-_165)/by;
};
return [_168,_169];
},"values":function(){
var vals=arguments;
var _172=function(step){
return vals[step];
};
var _173=function(_174){
var step=findIdentical(vals,_174);
if(step==-1){
throw {"msg":"Step for value "+_174+" not found"};
}
return step;
};
return [_172,_173];
}};
UI.Slider._fromElement=function(_175){
var _176=parseInt(getNodeAttribute(_175,"ui:minvalue")||"0",10);
var _177=parseInt(getNodeAttribute(_175,"ui:maxvalue")||"100",10);
var step=parseInt(getNodeAttribute(_175,"ui:step")||"1",10);
var _178=0;
var _179=getNodeAttribute(_175,"ui:input");
var _180=getNodeAttribute(_175,"ui:values");
var _181=null;
if(_180){
_180=eval(_180);
_178=_180.length;
_181=UI.Slider.ValueMappers.values.apply(window,_180);
}else{
_178=((_177-_176)/step)+1;
_181=UI.Slider.ValueMappers.range(_176,_177,step);
}
var _182=new UI.Slider(_175,_178,_181);
if(_179){
_182.linkWithInput($(_179));
}
};
UI.Form=function(_183,_184,_185){
bindMethods(this);
_183=_183||FORM();
this.element=$(_183);
this.items=_184||[];
this.validators=_185||[];
this.cssClass="uiform";
this._invalidInputs=[];
this.register();
this.NAME=this.element.id+"(UI.Form)";
var _186=_183.onsubmit;
var form=this;
_183.onsubmit=function(){
if(!form.validate()){
return false;
}
if(!_186){
return true;
}else{
return _186();
}
};
};
UI.Form.VALIDATION_PASSED="";
UI.Form.Messages={"REQUIRED":_("The field is required"),"NOT_VALID":_("The field value is not valid"),"NUMBER":_("The value must be a number"),"ALPHA":_("The value must contain only letters"),"ALPHANUM":_("The value must contain only letters and numbers"),"ALPHASPACES":_("The value must contain only letters and spaces"),"ALPHANUMSPACES":_("The value must contain only letters, numbers and spaces"),"EMAIL":_("The value must be a valid email address")};
UI.Form.prototype=update(new UI.Widget(),{"render":function(){
this.element.appendChild(TABLE(null,TBODY(null,map(function(i){
return i.render();
},this.items))));
},"validate":function(){
this._invalidInputs=[];
var _188=true;
for(var i=0;i<this.items.length;i++){
if(this.items[i].inputs){
for(var j=0;j<this.items[i].inputs.length;j++){
if(this.items[i].inputs[j]){
this.items[i].inputs[j].validate();
if(!this.items[i].inputs[j].valid){
this._invalidInputs.push(this.items[i].inputs[j].element);
_188=false;
}
}
}
}
}
for(var i=0;i<this.validators.length;i++){
var errs=this.validators[i](this.element);
var form=this;
if(errs&&errs.length){
_188=false;
forEach(errs,function(err){
var _192=err.fields;
var msg=err.message;
forEach(_192,function(_194){
form._invalidInputs.push(_194);
});
});
}
}
if(_188){
signal(this,"validationPassed");
}else{
signal(this,"validationFailed");
}
return _188;
},"submitAsync":function(url,_195,_196,_197){
if(!this.validate()){
return null;
}
signal(this,"submitted");
var _195=_195||[];
var _196=_196||[];
var _197=_197||"GET";
var url=url||this.element.action;
if(url){
var _198=formContents(this.element);
var _199=_198[0];
var _200=_198[1];
extend(_199,_195);
extend(_200,_196);
var d=doSimpleXMLHttpRequest(url,_199,_200);
signal(this,"sent",_199,_200);
return d;
}
return fail("UI.Form.submitAsync: No url given and url autodetection failed");
},"invalidInputs":function(){
return this._invalidInputs;
}});
UI.Form.Error=function(msg){
this.message=msg;
this.fields=extend([],arguments,1);
};
UI.FormItem=function(_201,_202,_203,flow){
bindMethods(this);
if(_201){
this.element=$(_201);
}else{
this.element=SPAN(null,_203);
}
this.label=_202||"";
this.inputs=_203||[];
this.flow=flow||"horizontal";
};
UI.FormItem.prototype={"render":function(){
var _205=filter(function(el){
return el.nodeType>0;
},this.element.childNodes);
if(_205&&_205.length){
var _206={"class":"noborderspace"};
if(this.flow=="horizontal"){
this.element.appendChild(TABLE(_206,TBODY(null,TR(_206,map(partial(TD,_206),_205)))));
}else{
this.element.appendChild(TABLE(_206,TBODY(null,map(function(el){
return TR(_206,TD(_206,el));
},_205))));
}
}
return TR(null,TD({"align":"right"},LABEL(null,this.label!=""?this.label+":":"")),TD(null,this.element));
}};
UI.FormInput=function(_207,_208){
bindMethods(this);
if(_207){
this.element=$(_207);
}else{
this.element=INPUT();
}
this.validators=_208;
this.cssClass="uiforminput";
this.valid=true;
this.tip=null;
this.register();
this._connectEvents();
};
UI.FormInput.prototype=update(new UI.Widget(),{"validate":function(){
var _209=this.element;
this.unmarkError();
this.valid=true;
if(!this.validators){
return;
}
for(var i=0;i<this.validators.length;i++){
var msg=this.validators[i](this.element);
if(msg&&(msg!=UI.Form.VALIDATION_PASSED)){
this.markError(msg);
return false;
}
}
return true;
},"markError":function(msg){
addElementClass(this.element,"uierror");
var _210=elementPosition(this.element);
var _211=elementDimensions(this.element);
if(typeof (_210.x)!="undefined"&&typeof (_211.w)!="undefined"){
this.tip=DIV({"class":"uitip"},DIV({"class":"uimsg"},msg));
this.tip.style.left=(_210.x+_211.w)+"px";
this.tip.style.top=(_210.y)+"px";
hideElement(this.tip);
document.getElementsByTagName("body")[0].appendChild(this.tip);
connect(this.element,"onmouseover",this,"showTip");
connect(this.element,"onmouseout",this,"hideTip");
}else{
logWarning("FormInput.markError: Can't get element position and/or dimensions");
}
this.valid=false;
},"showTip":function(){
showElement(this.tip);
},"hideTip":function(){
hideElement(this.tip);
},"unmarkError":function(){
removeElementClass(this.element,"uierror");
if(this.tip){
disconnect(this.element,"onmouseover",this,"showTip");
disconnect(this.element,"onmouseout",this,"hideTip");
removeElement(this.tip);
this.tip=null;
this.element.onmouseover=null;
this.element.onmouseout=null;
}
},"_connectEvents":function(){
if(!this.element){
return;
}
var _212=this.element.onblur;
var _213=this.element.onfocus;
var _214=this;
this.element.onblur=function(){
_214.validate();
if(_212){
_212.apply(this.element,arguments);
}
};
this.element.onfocus=function(){
_214.unmarkError();
if(_213){
_213.apply(this.element,arguments);
}
};
}});
UI.SelectFormInput=function(_215,_216,_217){
bindMethods(this);
this._model=null;
if(_215){
this.element=_215;
}else{
this.element=SELECT();
}
this.element=$(_215);
this.cssClass="uiselectforminput";
this.register();
this.setModel(_217);
};
UI.SelectFormInput.prototype=update(new UI.FormInput(),{"setModel":function(_218){
disconnect(this.model,"changed",this,"render");
this._model=_218;
this.render();
connect(_218,"changed",this,"render");
},"model":function(){
return this._model;
},"render":function(){
replaceChildNodes(this.element,[]);
for(var i=0;i<this._model.getLength();i++){
this.element.appendChild(OPTION({"value":this._model.getValue(i)},this._model.getLabel(i)));
}
}});
UI.Form.Validators={};
UI.Form.Validators.required=function(el){
return el.value.match(/^\s*$/)?UI.Form.Messages.REQUIRED:UI.Form.VALIDATION_PASSED;
};
UI.Form.Validators.regexp=function(re,msg){
return function(el){
return el.value.match(re)?UI.Form.VALIDATION_PASSED:msg||UI.Form.Messages.NOT_VALID;
};
};
UI.Form.Validators.numeric=function(el){
var val=el.value.replace(/,/,"").replace(/\./,"");
return (isNaN(val))?UI.Form.Messages.NUMBER:UI.Form.VALIDATION_PASSED;
};
UI.Form.Validators.alpha=UI.Form.Validators.regexp(/^[A-Za-z]*$/,UI.Form.Messages.ALPHA);
UI.Form.Validators.alphaspaces=UI.Form.Validators.regexp(/^[A-Za-z\s]*$/,UI.Form.Messages.ALPHASPACES);
UI.Form.Validators.alphanum=UI.Form.Validators.regexp(/^[0-9A-Za-z]*$/,UI.Form.Messages.ALPHANUM);
UI.Form.Validators.alphanumspaces=UI.Form.Validators.regexp(/^[0-9A-Za-z\s]*$/,UI.Form.Messages.ALPHANUMSPACES);
UI.Form.Validators.email=UI.Form.Validators.regexp(/^[a-zA-Z0-9._%-]+@[a-zA-Z0-9._%-]+\.[A-Za-z]{2,4}$/,UI.Form.Messages.EMAIL);
UI.FormInput._getValidators=function(el){
var _220=el.getAttribute("ui:validators");
if(_220){
with(UI.Form.Validators){
_220=eval("("+_220+")");
}
}else{
_220=[];
}
return _220;
};
UI.FormInput._fromElement=function(el){
return new UI.FormInput(el,UI.FormInput._getValidators(el));
};
UI.SelectFormInput._fromElement=function(el){
var _221=el.getAttribute("ui:model");
if(_221){
_221=eval("("+_221+")");
return new UI.SelectFormInput(el,UI.FormInput._getValidators(el),_221);
}else{
_221=new UI.HTMLSelectListModel(el.cloneNode(true));
var _222=new UI.SelectFormInput(el,UI.FormInput._getValidators(el),_221);
_222.render();
return _222;
}
};
UI.FormItem._fromElement=function(el){
var _223=getNodeAttribute(el,"ui:label");
var _224=[];
if(el.tagName.toLowerCase()=="input"){
_224.push(UI.FormInput._fromElement(el));
}else{
if(el.tagName.toLowerCase()=="select"){
_224.push(UI.SelectFormInput._fromElement(el));
}else{
if(el.tagName.toLowerCase()=="textarea"){
_224.push(UI.FormInput._fromElement(el));
}
}
}
var _225=el.getElementsByTagName("input");
if(_225&&_225.length){
_224=_224.concat(map(UI.FormInput._fromElement,_225));
}
var _226=el.getElementsByTagName("textarea");
if(_226&&_226.length){
_224=_224.concat(map(UI.FormInput._fromElement,_226));
}
var _227=el.getElementsByTagName("select");
if(_227&&_227.length){
_224=_224.concat(map(function(_228){
s=UI.SelectFormInput._fromElement(_228);
},_227));
}
return new UI.FormItem(el,_223,_224);
};
UI.Form._fromElement=function(el){
var _229=getNodeAttribute(el,"ui:keeplayout");
_229=(_229&&(_229=="true"));
var _230=getNodeAttribute(el,"ui:validators");
if(_230){
with(UI.Form.Validators){
_230=eval("("+_230+")");
}
}else{
_230=[];
}
var _231=filter(function(el){
return el.nodeType==1;
},el.childNodes);
var form=new UI.Form(el,map(UI.FormItem._fromElement,_231),_230);
if(!_229){
form.render();
}
return form;
};
UI._slideUp=function(el){
slideUp(el,{"queue":{"position":"break","scope":el.id}});
};
UI._slideDown=function(el){
slideDown(el,{"queue":{"position":"break","scope":el.id}});
};
UI.Accordion=function(_232,_233){
this._hide=UI._slideUp;
this._show=UI._slideDown;
bindMethods(this);
_232=_232||this._defaultElement();
if(_233==null||typeof (_233)=="undefined"){
_233=false;
}
if(_232){
this.element=$(_232);
}else{
this.element=this._defaultElement();
}
this.element=$(_232);
this.multipleExpansion=_233;
this.elements=filter(this._elementNode,iter(this.element.childNodes));
var _234=this._elementNode;
forEach(this.elements,function(el){
var _235=DIV({"class":"uiaccordioncontent"});
_235.id="uiaccordioncontent_"+Math.random();
hideElement(_235);
addElementClass(el,"uiaccordiontitle");
var _236=filter(_234,el.childNodes);
addElementClass(_236[0],"uiaccordiontitlebar");
_236.splice(0,1);
forEach(_236,function(_237){
_235.appendChild(_237);
});
el.appendChild(_235);
});
this._installOnClicks();
this.activeElements=[];
this.cssClass="uiaccordion";
this.collapseAll();
this.register();
this.NAME=this.element.id+"(UI.Accordion)";
};
UI.Accordion.prototype=update(new UI.Widget(),{"setMultipleExpansion":function(_238){
this.multipleExpansion=_238;
if(!_238&&this.activeElements.length>1){
this.collapseAll();
}
},"expand":function(_239){
var _240=filter(this._elementNode,_239.childNodes);
addElementClass(_240[0],"uiexpanded");
_240.splice(0,1);
forEach(_240,this._show);
var _241=findIdentical(this.activeElements,_239);
if(_241==-1){
this.activeElements.push(_239);
}
if(!this.multipleExpansion&&this.activeElements.length>1){
this.collapse(this.activeElements[0]);
}
},"expandAll":function(){
if(!this.multipleExpansion){
logError("UI.Accordion.expandAll: Can't expand all elements if not in multipleExpansion mode");
return;
}
forEach(this.elements,this.expand);
},"collapse":function(_242){
var _243=filter(this._elementNode,_242.childNodes);
removeElementClass(_243[0],"uiexpanded");
_243.splice(0,1);
forEach(_243,this._hide);
var _244=findIdentical(this.activeElements,_242);
if(_244!=-1){
this.activeElements.splice(_244,1);
}else{
logWarning("UI.Accordion.collapse: collapsing a non-expanded element!?");
}
},"collapseAll":function(){
forEach(extend(null,this.activeElements),this.collapse);
},"_defaultElement":function(){
return DIV({"class":"uiaccordion"});
},"_installOnClicks":function(){
var _245=this;
forEach(this._titleBars(),function(_246){
connect(_246,"onclick",function(e){
var _247=findIdentical(_245.activeElements,_246.parentNode);
if(_247==-1){
_245.expand(_246.parentNode);
}else{
_245.collapse(_246.parentNode);
}
});
});
},"_elementNode":function(el){
return el.nodeType==1;
},"_firstChildElement":function(el){
return filter(this._elementNode,el.childNodes)[0];
},"_titleBars":function(){
return map(this._firstChildElement,this.elements);
}});
UI.Accordion._fromElement=function(el){
var _248=(getNodeAttribute(el,"ui:multiple")=="true");
new UI.Accordion(el,_248);
};
UI.Calendar=function(_249,year,_251){
bindMethods(this);
_249=_249||DIV();
var now=new Date();
if(isUndefinedOrNull(year)){
this.year=now.getFullYear();
}else{
this.year=year;
}
var now=new Date();
if(isUndefinedOrNull(_251)){
this.month=now.getMonth()+1;
}else{
this.month=_251;
}
this.showHeader=true;
this.firstDayOfWeek=0;
this.element=$(_249);
this.table=TABLE();
this.element.appendChild(this.table);
this.cssClass="uicalendar";
this.draw();
this.register();
this.NAME=this.element.id+"(UI.Calendar)";
};
UI.Calendar.dayShortNames=[_("Sun"),_("Mon"),_("Thu"),_("Wed"),_("Tue"),_("Fri"),_("Sat")];
UI.Calendar.dayNames=[_("Sunday"),_("Monday"),_("Thursday"),_("Wednesday"),_("Tursday"),_("Friday"),_("Saturday")];
UI.Calendar.monthNames=[_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),_("July"),_("August"),_("September"),_("October"),_("November"),_("December")];
UI.Calendar.monthDaysNormalYear=[31,28,31,30,31,30,31,31,30,31,30,31];
UI.Calendar.monthDaysLeapYear=[31,29,31,30,31,30,31,31,30,31,30,31];
UI.Calendar.SUNDAY=0;
UI.Calendar.MONDAY=1;
UI.Calendar.THURSDAY=2;
UI.Calendar.WEDNESDAY=3;
UI.Calendar.TUESDAY=4;
UI.Calendar.FRIDAY=5;
UI.Calendar.SATURDAY=6;
UI.Calendar._isLeapYear=function(year){
return (year%4==0)&&(year%100!=0||year%400==0);
};
UI.Calendar._monthDays=function(year){
if(UI.Calendar._isLeapYear(year)){
return UI.Calendar.monthDaysLeapYear;
}
return UI.Calendar.monthDaysNormalYear;
};
UI.Calendar._january1st=function(year){
return (year+parseInt((year-1)/4)-parseInt((year-1)/100)+parseInt((year-1)/400))%7;
};
UI.Calendar._month1st=function(year,_253){
var day=UI.Calendar._january1st(year);
var _255=UI.Calendar._monthDays(year);
for(var i=0;i<_253-1;i++){
day+=_255[i];
}
return day%7;
};
UI.Calendar._monthWeeks=function(year,_256,_257){
var _257=_257||0;
var _258=UI.Calendar._monthDays(year)[_256-1];
var _259=UI.Calendar._month1st(year,_256);
_259=(7+_259-_257)%7;
var _260=(7-_259);
var _261=Math.ceil(1+(_258-_260)/7);
return _261;
};
UI.Calendar._day=function(date,_263){
return (7+date.getDay()-_263)%7;
};
UI.Calendar._toPaddedEuroDate=function(d){
var _264=toPaddedAmericanDate(d);
var _265=_264.split("/");
return _265[1]+"/"+_265[0]+"/"+_265[2];
};
UI.Calendar.prototype=update(new UI.Widget(),{"draw":function(){
var day=-1*((7+UI.Calendar._month1st(this.year,this.month)-this.firstDayOfWeek)%7);
var _266=TR();
for(var i=0;i<7;i++){
var d=(i+this.firstDayOfWeek)%7;
var th=TH(UI.Calendar.dayShortNames[d]);
addElementClass(th,"weekday"+day);
_266.appendChild(th);
}
var _267=THEAD(null,_266);
var body=TBODY();
var _269=UI.Calendar._monthWeeks(this.year,this.month,this.firstDayOfWeek);
var _270=UI.Calendar._monthDays(this.year)[this.month-1];
for(var i=0;i<_269;i++){
var tr=TR();
addElementClass(tr,"week"+(i+1));
for(var j=0;j<7;j++){
var td=null;
if(day>=0&&day<_270){
var _271=DIV(null,++day);
addElementClass(_271,"daynumber");
var _272=DIV(null);
addElementClass(_272,"daycontent");
td=TD(null,_271,_272);
}else{
td=TD();
++day;
}
addElementClass(td,"date_"+this.year+"_"+this.month+"_"+day);
addElementClass(td,"weekday"+((j+this.firstDayOfWeek)%7));
tr.appendChild(td);
}
body.appendChild(tr);
}
var _273=[];
if(this.showHeader){
var _274=SPAN({"class":"uicalendar_prevmonth"},"< ");
var _275=SPAN({"class":"uicalendar_nextmonth"}," >");
var _276=SPAN({"class":"uicalendar_monthname"},this.monthName()+" "+this.year);
connect(_274,"onclick",this,"prevMonth");
connect(_275,"onclick",this,"nextMonth");
var _277=createDOM("CAPTION",null,_274,_276,_275);
_273[_273.length]=_277;
}
_273[_273.length]=_267;
_273[_273.length]=body;
if(this.table){
removeElement(this.table);
}
this.table=TABLE(null,_273);
appendChildNodes(this.element,this.table);
signal(this,"drawn");
},"contentForDate":function(date){
var td=this.cellForDate(date);
if(!td){
return null;
}
return getElementsByTagAndClassName("div","daycontent",td)[0];
},"cellForDate":function(date){
return this.cellsForDateRange(date,date)[0];
},"cellsForDateRange":function(_278,_279){
if(_278.getFullYear()>this.year||_279.getFullYear()<this.year||(_278.getFullYear()==this.year&&_278.getMonth()+1>this.month)||(_279.getFullYear()==this.year&&_279.getMonth()+1<this.month)){
logDebug("cellsForDateRange: range out of month");
return [];
}
if(_278.getFullYear()<this.year||(_278.getFullYear()==this.year&&_278.getMonth()+1<this.month)){
_278=new Date(this.year,this.month-1,1);
}
if(_279.getFullYear()>this.year||(_279.getFullYear()==this.year&&_279.getMonth()+1>this.month)){
var _280=UI.Calendar._monthDays(this.year)[this.month];
_279=new Date(this.year,this.month-1,lastMonthDaty);
}
var _281=UI.Calendar._month1st(_278.getFullYear(),_278.getMonth()+1);
_281=(7+_281-this.firstDayOfWeek)%7;
var _282=_281+_278.getDate()-1;
var _283=_281+_279.getDate()-1;
var cal=this;
return map(function(d){
return cal.table.tBodies[0].rows[parseInt(d/7)].cells[d%7];
},range(_282,_283+1));
},"addDateClass":function(date,_285){
addElementClass(this.cellForDate(date),_285);
},"addDateRangeClass":function(_286,_287,_288){
forEach(this.cellsForDateRange(_286,_287),function(c){
addElementClass(c,_288);
});
},"removeDateClass":function(date,_290){
removeElementClass(this.cellForDate(date),_290);
},"nextMonth":function(){
var d=new Date(this.year,this.month,1);
this.year=d.getFullYear();
this.month=d.getMonth()+1;
this.draw();
},"prevMonth":function(){
var d=new Date(this.year,this.month-2,1);
this.year=d.getFullYear();
this.month=d.getMonth()+1;
this.draw();
},"monthName":function(){
return UI.Calendar.monthNames[this.month-1];
}});
UI.Calendar._fromElement=function(el){
var now=new Date();
var year=getNodeAttribute(el,"ui:year");
if(!isUndefinedOrNull(year)){
if(/^[\+-]/.test(year)){
year=now.getFullYear()+parseInt(year,10);
}else{
year=parseInt(year,10);
}
}else{
year=now.getFullYear();
}
var _291=getNodeAttribute(el,"ui:month");
if(!isUndefinedOrNull(_291)){
if(/^[\+-]/.test(_291)){
var _292=new Date(year,now.getMonth()+parseInt(_291,10),1);
_291=_292.getMonth()+1;
year=_292.getFullYear();
}
}
var _293=getNodeAttribute(el,"ui:firstDayOfWeek");
var _294=getNodeAttribute(el,"ui:showHeader");
var cal=new UI.Calendar(el,year,_291);
if(!isUndefinedOrNull(_293)){
cal.firstDayOfWeek=parseInt(_293,10);
}
if(!isUndefinedOrNull(_294)){
cal.showHeader=!(_294=="false");
}
cal.draw();
};
UI.LightBox=function(_295){
bindMethods(this);
UI.LightBox._initialize();
_295=_295||DIV();
this.element=$(_295);
this.cssClass="uilightbox";
this.register();
this.NAME=this.element.id+"(UI.LightBox)";
appendChildNodes("uilightbox_box",this.element);
};
UI.LightBox._initialized=false;
UI.LightBox._initialize=function(){
if(UI.LightBox._initialized){
return;
}
var doc=currentDocument();
var _297=DIV({"id":"uilightbox_overlay","class":"invisible"});
var lb=DIV({"id":"uilightbox_box","class":"invisible"});
appendChildNodes(doc.body,_297);
appendChildNodes(doc.body,lb);
UI.LightBox._initialized=true;
};
UI.LightBox.prototype=update(new UI.Widget(),{_stopEvent:function(e){
e.stop();
},show:function(){
if(computedStyle("uilightbox_box","position")!="fixed"){
this.getScroll();
this.prepareIE("100%","hidden");
this.setScroll(0,0);
this.hideSelects("hidden");
}
showElement(this.element);
showElement("uilightbox_overlay");
showElement("uilightbox_box");
},getScroll:function(){
if(self.pageYOffset){
this.yPos=self.pageYOffset;
}else{
if(document.documentElement&&document.documentElement.scrollTop){
this.yPos=document.documentElement.scrollTop;
}else{
if(document.body){
this.yPos=document.body.scrollTop;
}
}
}
},setScroll:function(x,y){
window.scrollTo(x,y);
},prepareIE:function(_299,_300){
bod=document.getElementsByTagName("body")[0];
bod.style.height=_299;
bod.style.overflow=_300;
htm=document.getElementsByTagName("html")[0];
htm.style.height=_299;
htm.style.overflow=_300;
},hideSelects:function(_301){
selects=document.getElementsByTagName("select");
for(i=0;i<selects.length;i++){
selects[i].style.visibility=_301;
}
},hide:function(){
if(computedStyle("uilightbox_box","position")!="fixed"){
this.setScroll(0,this.yPos);
this.prepareIE("auto","auto");
this.hideSelects("visible");
}
hideElement(this.element);
hideElement("uilightbox_box");
hideElement("uilightbox_overlay");
}});
UI.LightBox._fromElement=function(_302){
new UI.LightBox(_302);
};
addLoadEvent(function(){
var _303=getElementsByTagAndClassName("div","uislider");
map(UI.Slider._fromElement,_303);
var _304=getElementsByTagAndClassName("div","uitable");
map(UI.Table._fromElement,_304);
var _305=getElementsByTagAndClassName("form","uiform");
map(UI.Form._fromElement,_305);
var _306=getElementsByTagAndClassName("div","uiwindow");
map(UI.Window._fromElement,_306);
var _307=getElementsByTagAndClassName("div","uiaccordion");
map(UI.Accordion._fromElement,_307);
var _308=getElementsByTagAndClassName("div","uicalendar");
map(UI.Calendar._fromElement,_308);
var _309=getElementsByTagAndClassName("div","uilightbox");
map(UI.LightBox._fromElement,_309);
});

