aoe.core.desktop={};
aoe.core.desktop.DesktopClass=function(){
    var domObj=aoe.util.getID("aoe_desktop");
    var windows=new Array();
    var InputGroup;
    this.add=function(window){
        windows.push(window);
    };
    this.setInputGroup=function(ig){
        InputGroup=ig;
    };
    this.getInputGroup=function(){
        return InputGroup;
    };
    this.getDOMObj=function(){
        return domObj;
    };
};
aoe.Desktop=new aoe.core.desktop.DesktopClass();
aoe.core.desktop.Window=function(_id){
    var id=_id;
    var domObj=aoe.util.getID(id);
    var areas=new Array();
    this.add=function(area){
        areas.push(area);
    };
    this.getDOMObj=function(){
        return domObj;
    };
};
aoe.core.desktop.Area=function(_id){
    var id=(_id!=-1)?_id:null;
    var domObj=((id!==null)?aoe.util.getID(id):((_id!=-1)?document.createElement('div'):null));
    var components=new Array();
    this.add=function(component){
        components.push(component);
    };
    this.getDOMObj=function(){
        return domObj;
    };
};
aoe.core.desktop.SplitArea=function(_id,_direction){
    this._base=aoe.core.desktop.Area;
    this._base(_id);
    var id=(_id!=-1)?_id:null;
    var domObjBar;
    var domObj1;
    var domObj2;
    var minimized=false;
    if(id){
        domObjBar=aoe.util.getID(id+"_bar");
        domObj1=aoe.util.getID(id+"_0");
        domObj2=aoe.util.getID(id+"_1");
    }
    var direction=(_direction)?_direction:0;
    aoe.util.setIntance(domObjBar, this);
    domObjBar.onmousedown=function(){
        document.body.onmousemove=function(ev){
            aoe.util.getInstance(domObjBar).resize(ev);
        };
        document.body.onmouseup=function(){
            document.body.onmousemove=function(){};

        };
    };
    domObjBar.draggable=false;
    var img1=aoe.util.cE('img');
    img1.onclick=function(){
        aoe.util.getInstance(this.parentNode).minimize(1);
    };
    img1.src="/icon/arrow-"+((direction==1)?'left':'up')+"-small.png";
    img1.alt=String.fromCharCode(((direction==1)?60:94));
    var img2=aoe.util.cE('img');
    img2.onclick=function(){
        aoe.util.getInstance(this.parentNode).minimize(2);
    };
    img2.src="/icon/arrow-"+((direction==1)?'right':'down')+"-small.png";
    img2.alt=String.fromCharCode(((direction==1)?62:118));
    domObjBar.appendChild(img1);
    if(direction==1){
        //domObjBar.appendChild(aoe.util.cE('br'));
        img2.style.width=domObjBar.offsetWidth+'px';
        img1.style.width=domObjBar.offsetWidth+'px';
        img1.style.marginTop=((domObjBar.offsetHeight/2)-domObjBar.offsetWidth)+"px";
    }else{
        img2.style.height=domObjBar.offsetHeight+'px';
        img1.style.height=domObjBar.offsetHeight+'px';
    }
    img2.style.cursor='default';
    img1.style.cursor='default';
    domObjBar.appendChild(img2);
    this.resize=function(ev){
        var el1=aoe.util.getPos(domObj1);
        var el2=aoe.util.getPos(domObj2);
        var parent=aoe.util.getPos(domObj1.parentNode);
        var bar=aoe.util.getPos(domObjBar);
        var m=aoe.util.getMousePos(ev);
        var f;
        var fproz;
        if(direction==0){
            var h=parent.h-bar.h;
            el1.proz=Number(domObj1.style.height.replace(/%/,""));
            el2.proz=Number(domObj2.style.height.replace(/%/,""));
            f=m.y-(bar.y+bar.h/2);
            fproz=f*100/h;
            if(f>0){
                if(parent.h>el1.h+f+30){
                    domObj1.style.height=(el1.proz+fproz)+"%";
                    domObj2.style.height=(el2.proz-fproz)+"%";
                }
            }else if(el1.h+f>30){
                fproz*=-1;
                domObj1.style.height=(el1.proz-fproz)+"%";
                domObj2.style.height=(el2.proz+fproz)+"%";
            }
        }else {
            domObjBar.childNodes[0].style.marginTop=((domObjBar.offsetHeight/2)-domObjBar.offsetWidth)+"px";
            var w=parent.w-bar.w;
            el1.proz=Number(domObj1.style.width.replace(/%/,""));
            el2.proz=Number(domObj2.style.width.replace(/%/,""));
            f=m.x-(bar.x+bar.w/2);
            fproz=f*100/w;
            if(f>0){
                if(parent.w>el1.w+f+100){
                    domObj1.style.width=(el1.proz+fproz)+"%";
                    domObj2.style.width=(el2.proz-fproz)+"%";
                }
            }else if(30<el1.w+f){
                fproz*=-1;
                domObj1.style.width=(el1.proz-fproz)+"%";
                domObj2.style.width=(el2.proz+fproz)+"%";
            }
        }
        domObjBar.focus();
    };
    this.minimize=function(el){
        var parent=aoe.util.getPos(domObj1.parentNode);
        var bar=aoe.util.getPos(domObjBar);
        if(direction==1){
            if(el==1){
                domObj2.style.width=(Number(domObj1.style.width.replace(/%/,""))+Number(domObj2.style.width.replace(/%/,"")))+'%';
                domObj1.style.width='0%';
            }else {
                domObj1.style.width=(Number(domObj1.style.width.replace(/%/,""))+Number(domObj2.style.width.replace(/%/,"")))+'%';
                domObj2.style.width='0%';
            }
        }else {
            if(el==1){
                domObj2.style.height=(Number(domObj1.style.height.replace(/%/,""))+Number(domObj2.style.height.replace(/%/,"")))+'%';
                domObj1.style.height='0%';
            }else {
                domObj1.style.height=(Number(domObj1.style.height.replace(/%/,""))+Number(domObj2.style.height.replace(/%/,"")))+'%';
                domObj2.style.height='0%';
            }
        }
        minimized=!minimized;
    };
};
aoe.core.desktop.SplitArea.prototype=new aoe.core.desktop.Area(-1);

aoe.core.desktop.InputGroup=function(_name){
    var groups=new Object();
    var inputs=new Object();
    var name=_name;
    var Parent;
    this.addGroup=function(Group){
        groups[Group.getName()]=Group;
        Group.setParent(this);
    };
    this.add=function(Input){
        inputs[Input.getName()]=Input;
        Input.setGroup(this);
    };
    this.getName=function(){
        return name;
    };
    this.setParent=function(Group){
        Parent=Group;
    };
    this.getGroup=function(group){
        var pos;
        if((pos=group.indexOf(':'))>0){
            var c=group.substr(0,pos);
            if(groups[c]){
                return groups[c].getGroup(group.substr(pos+1));
            }else if(c==name){
                return this.getGroup(group.substr(pos+1));
            }
        }else if(groups[group]){
            return groups[group];
        }else if(name==group){
            return this;
        }
        return null;
    };
};
aoe.core.desktop.input={};
aoe.core.desktop.Input=function(_name){
    var name=(_name!=-1)?_name:null;
    var default_value;
    var value;
    var Group;
    var domObj;
    var Routine;
    this.setGroup=function(_Group){
        Group=_Group;
    };
    this.set=function(val){
        value=val;
    };
    this.get=function(){
        return value;
    };
    this.reset=function(){
        this.set(default_value);
    };
    this.getName=function(){
        return name;
    };
};
aoe.core.desktop.input.DateTime=function(name,showCalendar){
    this._base=aoe.core.desktop.Input;
    this._base(name);

    var domObjVal=aoe.util.getFE(name+'[value]');
    var domObjYear=aoe.util.getFE(name+'[year]');
    var domObjMonth=aoe.util.getFE(name+'[month]');
    var domObjDay=aoe.util.getFE(name+'[day]');
    var domObjHour=aoe.util.getFE(name+'[hour]');
    var domObjMinutes=aoe.util.getFE(name+'[minutes]');
    var domObjSeconds=aoe.util.getFE(name+'[seconds]');

    aoe.util.setIntance(domObjYear, this);
    aoe.util.setIntance(domObjMonth, this);
    aoe.util.setIntance(domObjDay, this);
    aoe.util.setIntance(domObjHour, this);
    aoe.util.setIntance(domObjMinutes, this);
    aoe.util.setIntance(domObjSeconds, this);
    var clImg=null;
    if(showCalendar){
        clImg=aoe.util.cE('img');
        clImg.src="/icon/calendar.png";
        clImg.alt="Calendar";
        clImg.style.width="20px";
        clImg.style.height="20px";
        clImg.style.marginBottom="-5px";
        clImg.style.marginRight="5px";
        domObjHour.parentNode.insertBefore(clImg, domObjHour);
        aoe.util.setIntance(clImg,this);
        clImg.onclick=function(){
            aoe.util.getInstance(this).toggleCalendar();
        };
    }

    var date=new Date();
    if(domObjVal.value>0||domObjVal.value==="0"||domObjVal.value===0){
        date.setTime(Number(domObjVal.value)*1000);
        this.set(date.getTime()/1000);
    }
    var _year=date.getFullYear();
    var _month=date.getMonth()+1;
    var _day=date.getDate();
    var _hour=date.getHours();
    var _minutes=date.getMinutes();
    var _seconds=date.getSeconds();

    this.setYear=function(year,flost,cal){
        if(year.length==4||(flost&&(year.length==2||year.length==4))){
            if(year.length==2||cal){
                if(year.length==2)year="20"+year;
                domObjYear.value=year;
            }
            _year=Number(year);
            this.setTime();
            if(!flost){
                domObjHour.focus();
            }
        }
    };
    this.setMonth=function(month,flost,cal){
        if(month.length==2||(flost&&month.length==1)){
            if(month.length==1||cal){
                if(month.length==1)month="0"+month;
                domObjMonth.value=month;
            }
            _month=Number(month);
            this.setTime();
            if(!flost){
                domObjYear.focus();
            }
        }
    };

    this.setDay=function(day,flost,cal){
        if(day.length==2||(flost&&day.length==1)){
            if(day.length==1||cal){
                if(day.length==1)day="0"+day;
                domObjDay.value=day;
            }
            _day=Number(day);
            this.setTime();
            if(!flost){
                domObjMonth.focus();
            }
        }
    };
    this.setHour=function(hour,flost){
        if(hour.length==2||(flost&&hour.length==1)){
            if(hour.length==1){
                domObjHour.value="0"+hour;
            }
            _hour=Number(hour);
            this.setTime();
            if(!flost){
                domObjMinutes.focus();
            }
        }
    };
    this.setMinutes=function(minutes,flost){
        if(minutes.length==2||(flost&&minutes.length==1)){
            if(minutes.length==1){
                domObjMinutes.value="0"+minutes;
            }
            _minutes=Number(minutes);
            this.setTime();
            if(!flost){
                domObjSeconds.focus();
            }
        }
    };
    this.setSeconds=function(seconds,flost){
        if(seconds.length==2||(flost&&seconds.length==1)){
            if(seconds.length==1){
                domObjSeconds.value="0"+seconds;
            }
            _seconds=Number(seconds);
            this.setTime();
            if(!flost){
        //domObjYear.focus();
        }
        }
    };
    this.getDate=function(){
        return date;
    };
    this.setTime=function(time){
        if(!time){
            date.setFullYear(_year, _month-1, _day);
            date.setHours(_hour, _minutes, _seconds, 0);
        }
        this.set(date.getTime()/1000);
    };

    var Calendar;
    var CalendarClass=function(dt,img){
        var DateTime=dt;
        var domObj=aoe.util.cE('div');
        domObj.style.display='none';
        domObj.style.position='absolute';
        domObj.style.width='250px';
        domObj.style.height='190px';
        domObj.className="calendar";
        domObj.style.zIndex="9999";
        var domObjImg=img;
        domObjImg.parentNode.insertBefore(domObj,domObjImg);
        domObjImg.style.position="absolute";
        var pos=aoe.util.getPos(domObjImg);
        domObjImg.style.position="static";
        var visible=false;
        aoe.util.setIntance(domObj,this);
        var _date=null;
        this.show=function(){
            visible=true;
            domObj.style.display='block';
            while(domObj.childNodes.length>0){
                domObj.removeChild(domObj.childNodes[0]);
            }

            var days=["Mo","Di","Mi","Do","Fr","Sa","So"];
            var months=["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","Novermber","Dezember"];
            var date;
            if(_date===null){
                date=new Date(DateTime.getDate().getTime());
                _date=new Date(date.getTime());
            }else {
                date=new Date(_date.getTime());
            }
            var bar=aoe.util.cE('table');
            var brow=bar.insertRow(0);
            var bprev=brow.insertCell(0);
            bprev.innerHTML="&lt;";
            bprev.className="prev_month";
            bprev.onclick=function(){
                aoe.util.getInstance(this).prevMonth();
            };
            aoe.util.setIntance(bprev, this);
            var btmp=brow.insertCell(1);
            btmp.colSpan=5;
            btmp.innerHTML=months[_date.getMonth()]+" - "+_date.getFullYear();
            btmp.style.textAlign="center";
            var bnext=brow.insertCell(2);
            bnext.innerHTML="&gt;";
            bnext.className="next_month";
            bnext.onclick=function(){
                aoe.util.getInstance(this).nextMonth();
            };
            aoe.util.setIntance(bnext, this);
            var bhide=brow.insertCell(3);
            bhide.innerHTML="x";
            bhide.className="hide";
            bhide.onclick=function(){
                aoe.util.getInstance(this).hide();
            };
            aoe.util.setIntance(bhide, this);
            domObj.appendChild(bar);
            date.setDate(1);
            var t=aoe.util.cE('table');
            var first=new Date(date.getFullYear(),0,1);
            var week=Math.ceil((((date.getTime() - first.getTime()) / 86400000) + first.getDay()+1)/7);
            var startindex=7+date.getDay();
            var count=0;
            var dsofm= 32 - new Date(date.getFullYear(), date.getMonth(), 32).getDate();
            var daysc=1;
            for(var i=0;i<7;i++){
                var row=t.insertRow(i);
                for(var j=0;j<8;j++){
                    var col=row.insertCell(j);
                    if(i==0 && j>0){
                        col.innerHTML=days[j-1];
                    }else if(i>0){
                        if(j==0){
                            //col.innerHTML=week;
                        }else if(count>startindex&&daysc<dsofm+1){
                            col.innerHTML=daysc;
                            if(daysc==DateTime.getDate().getDate()&&date.getMonth()==DateTime.getDate().getMonth()&&date.getFullYear()==DateTime.getDate().getFullYear()){
                                col.className="selected_day";
                            }else {
                                aoe.util.setIntance(col, this);
                                col.className="day";
                                col.onclick=function(){
                                    aoe.util.getInstance(this).selectDay(this.innerHTML);
                                };
                            }
                            daysc++;
                        }
                    }
                    count++;
                }
                if(i>0)week++;
            }
            domObj.appendChild(t);
            var x=(pos.x+pos.w+3);
            var y=(pos.y+pos.h+3);
            domObj.style.left=x+"px";
            domObj.style.top=y+"px";
        };
        this.hide=function(){
            visible=false;
            _date=null;
            domObj.style.display='none';
        };
        this.toggle=function(){
            if(visible){
                this.hide();
            }else{
                this.show();
            }
        };
        this.nextMonth=function(){
            _date.setMonth(_date.getMonth()+1);
            this.show();
        };
        this.prevMonth=function(){
            _date.setMonth(_date.getMonth()-1);
            this.show();
        };
        this.selectDay=function(day){
            DateTime.setYear(""+_date.getFullYear(),true,true);
            DateTime.setMonth(""+(_date.getMonth()+1),true,true);
            DateTime.setDay(""+day,true,true);
            this.hide();
        };
    };

    this.showCalendar=function(){
        if(clImg!==null){
            if(Calendar==null){
                Calendar=new CalendarClass(this,clImg);
            }
            Calendar.show();
        }
    };
    this.toggleCalendar=function(){
        if(clImg!==null){
            if(Calendar==null){
                Calendar=new CalendarClass(this,clImg);
            }
            Calendar.toggle();
        }
    };
    this.hideCalendar=function(){
        if(clImg!==null){
            if(Calendar==null){
                Calendar=new CalendarClass(this,clImg);
            }
            Calendar.hide();
        }
    };

};
aoe.core.desktop.input.DateTime.prototype=new aoe.core.desktop.Input(-1);
aoe.core.desktop.input.Text=function(name,_multiline,_width,_height,_html){
    this._base=aoe.core.desktop.Input;
    this._base(name);
    var multiline=_multiline;
    var width=_width;
    var height=_height;
    var txtArea=null;
    var html=_html;
    var domObj;
    var previewClass="";
    if(multiline){
        txtArea=aoe.util.getFE(this.getName());
        aoe.util.setIntance(txtArea, this);
        if(html){
            txtArea.className='tinymce';
            var dummyTxtArea=aoe.util.cE('textarea');
            dummyTxtArea.style.display='none';
            dummyTxtArea.name=txtArea.name;
            aoe.util.setIntance(dummyTxtArea, this);
            txtArea.name=txtArea.name.replace(/\W/g,"_");
            aoe.core.browser.addJs("/extern/tiny_mce/tiny_mce.js", null, function(){
                tinymce.dom.Event.domLoaded=1;
                tinyMCE.init({
                    mode : "textareas",
                    theme : "advanced",
                    theme_advanced_buttons1 : "undo,redo,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
                    theme_advanced_buttons2 : "forecolor,backcolor,|,bullist,numlist,|,outdent,indent,blockquote,|,code,preview,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,|,moveforward,movebackward,|,cite,del,ins,|,template",
                    theme_advanced_buttons3 : "link,unlink,image,|,replace,",
                    theme_advanced_toolbar_location : "top",
                    theme_advanced_toolbar_align : "left",
                    theme_advanced_statusbar_location : "bottom",
                    theme_advanced_resizing : false,
                    entity_encoding : "numeric",
                    skin : "o2k7",
                    skin_variant : "silver",
                    verify_html : true,
                    plugins : "autolink,lists,advimage,advlink,inlinepopups,preview,media,searchreplace,contextmenu,noneditable,xhtmlxtras,template,advlist",
                    document_base_url:"/extern/tiny_mce/",
                    content_css : "/css/billy.css",
                    language: "de",
                    doctype:"<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1 Strict//EN' "
                        + "'http://www.w3.org/TR/xhtml1/DTD/xhtml11-strict.dtd'>"
                });
                txtArea.parentNode.appendChild(dummyTxtArea);
            });
        }
    }
    this.setPreviewClass=function(pc){
        previewClass=pc;
    };
    this.getPreviewClass=function(){
        return previewClass;
    };
    var setEventListener=function(obj){

    };
    if(html){
        this.get=function(){
            return tinyMCE.selectedInstance.getContent();
        };
    }
     
};
aoe.core.desktop.input.Text.prototype=new aoe.core.desktop.Input(-1);
aoe.core.desktop.input.File=function(name,_multi,_max){
    this._base=aoe.core.desktop.Input;
    this._base(name);
    var files=new Array();
    var multi=_multi;
    var max=_max;
    var swfEmb;
    var swfObj;
    var s=document.createElement('script');
    var id=name.replace(/\W/g,"_");
    var uploadComplete=false;
    if(name!=-1&&!aoe.util.getID(id+"_swf")){
        var domFile=aoe.util.getFE(this.getName());
        aoe.util.setIntance(domFile,this);

    domFile.id=id;
    name=id+"_swf";
    if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
    s.language='JavaScript';
        s.text='function '+name+'_DoFSCommand(cmd,args){\n'
	+'aoe.util.getInstance(aoe.util.getID(\''+name+'\')).fscommand(cmd, args)\n'
        +'}';
        document.getElementsByTagName('head')[0].appendChild(s);
        var s2=document.createElement('script');
        s2.language='JavaScript';
        s2.setAttribute("for",name);
        s2.setAttribute("event",'FSCommand(command,args)');
        s2.text=name+'_DoFSCommand(command, args)';
        document.getElementsByTagName('head')[0].appendChild(s2);

        swfEmb = document.createElement("embed");
        swfEmb.setAttribute("src","/f/uploader/uploader.swf");
        swfEmb.setAttribute("loop","false");
        swfEmb.setAttribute("menu","false");
        swfEmb.setAttribute("quality","low");
        swfEmb.setAttribute("scale","noborder");
        swfEmb.setAttribute("wmode","transparent");
        swfEmb.setAttribute("width","130");
        swfEmb.setAttribute("height","26");
        swfEmb.setAttribute("swLiveConnect","true");
        swfEmb.setAttribute("id",name);
        swfEmb.setAttribute("name",name);
        swfEmb.setAttribute("allowScriptAccess","sameDomain");
        swfEmb.setAttribute("type","application/x-shockwave-flash");
        swfEmb.setAttribute("pluginspage","http://www.macromedia.com/go/getflashplayer");
        swfEmb.setAttribute("flashvars","aoe_sid=" + aoe.util.getFE('aoe:sid').value + '&f_name='+name+'&aoe_lang=de&'+((multi)?"&multi=1":""));
        swfObj=swfEmb;
    }else {
        s.type="text/javascript";
        var st=document.createTextNode('function '+name+'_DoFSCommand(cmd,args){\n'
	+'aoe.util.getInstance(aoe.util.getID(\''+name+'\')).fscommand(cmd, args)\n'
        +'}');
        s.appendChild(st);
        document.getElementsByTagName('head')[0].appendChild(s);
        swfEmb = document.createElement("embed");
        swfEmb.setAttribute("src","/f/uploader/uploader.swf");
        swfEmb.setAttribute("loop","false");
        swfEmb.setAttribute("menu","false");
        swfEmb.setAttribute("quality","low");
        swfEmb.setAttribute("scale","noborder");
        swfEmb.setAttribute("wmode","transparent");
        swfEmb.setAttribute("width","130");
        swfEmb.setAttribute("height","26");
        swfEmb.setAttribute("swLiveConnect","true");
        swfEmb.setAttribute("id",name);
        swfEmb.setAttribute("name",name);
        swfEmb.setAttribute("allowScriptAccess","sameDomain");
        swfEmb.setAttribute("type","application/x-shockwave-flash");
        swfEmb.setAttribute("pluginspage","http://www.macromedia.com/go/getflashplayer");
        swfEmb.setAttribute("flashvars","aoe_sid=" + aoe.util.getFE('aoe:sid').value + '&f_name='+name+'&aoe_lang=de'+((multi)?"&multi=1":""));
        swfObj=swfEmb;
    }
    aoe.util.setIntance(swfObj,this);
    var sl=aoe.util.cE("span");
    sl.setAttribute("style","background-image:url(/icon/button_bg_left.png);display:inline-block;height:26px;width:5px;");
    domFile.parentNode.appendChild(sl);
    swfObj.setAttribute("style","background-image:url(/icon/button_bg_center.png);background-repeat:repeat-x;");
    domFile.parentNode.appendChild(swfObj);
    var sr=aoe.util.cE("span");
    sr.setAttribute("style","background-image:url(/icon/button_bg_right.png);display:inline-block;height:26px;width:4px;");
    domFile.parentNode.appendChild(sr);
    var sx=aoe.util.cE("span");
    sx.className="clear";
    domFile.parentNode.appendChild(sx);
    domFile.style.display="none";

    var domFileList=aoe.util.getID(id+"_filelist").cloneNode(true);
    domFile.parentNode.removeChild(aoe.util.getID(id+"_filelist"));
    domFile.parentNode.appendChild(domFileList);
    var o=aoe.util.cE("ol");
    o.setAttribute("style","list-style:decimal inside;");
    domFileList.appendChild(o);
    }
    var titles=new Array();
    this.get=function(){
        return files;
    };

    this.updateList=function(fs){
        files=fs;
        var c=0;
        uploadComplete=false;
        while(o.childNodes[0]){
            o.removeChild(o.childNodes[0]);
        }
        if(0<(c=files.length)){
            for(var i=0;i<c;i++){
                if(!titles[files[i].id]){
                    titles[files[i].id]=files[i].name.split(".").slice(0, -1).join(".");
                }
                var li=aoe.util.cE("li");
                li.innerHTML="<span>"+files[i].name+"</span><span>Titel: <input onblur=\"aoe.util.getInstance(aoe.util.getFE(\'"+domFile.name+"\')).setTitle(\'"+files[i].id+"\',this.value);\" type=\"text\" value=\""+((titles[files[i].id])?titles[files[i].id]:"")+"\" /></span><span><a href=\"javascript:void(0);\">Löschen</a></span><span id=\"file_state_"+files[i].id+"\"></span>";
                o.appendChild(li);
            }
        }
    }
    this.setTitle=function(id,title){
        titles[id]=title;
    }
    var onComplete;
    this.upload=function(ponComplete){
        if(ponComplete){
            onComplete=ponComplete;
        }
        if(!uploadComplete){swfObj.GotoFrame(1);}
    };
    this.updateState=function(fs){
        var c=fs.length;
        for(var i=0;i<c;i++){
            aoe.util.getID("file_state_"+fs[i].id).innerHTML=fs[i].state+" "+fs[i].loaded;
        }
    };
    this.complete=function(){
      uploadComplete=true;
      var c=files.length;
      for(var i=0;i<c;i++){
          files[i].title=titles[files[i].id];
      }
      if(onComplete){
          onComplete();
      }
    };
};
aoe.core.desktop.input.File.prototype=new aoe.core.desktop.Input(-1);
aoe.core.desktop.input.Captcha=function(name,value){
    this._base=aoe.core.desktop.Input;
    this._base(name);

    this.set(aoe.util.Base64.decode(value));
    aoe.util.getFE(name+"[value]").value=this.get();
    aoe.util.getFE(name+"[value]").parentNode.parentNode.style.display="none";
};
aoe.core.desktop.input.Captcha.prototype=new aoe.core.desktop.Input(-1);
aoe.core.desktop.TabArea=function(_id,_visible_index){
    this._base=aoe.core.desktop.Area;
    this._base(_id);
    var id=(_id!=-1)?_id:null;
    var domObj;
    var tabs;
    var visible_index=_visible_index;
    if(id!=null){
        domObj=aoe.util.getID(id);
        aoe.util.setIntance(domObj,this);
        tabs=aoe.util.getID(id+"_tabs").childNodes;
        for(var i=0;i<tabs.length;i++){
            aoe.util.setIntance(tabs[i], this);
            aoe.util.setIntance(aoe.util.getID(id+"_tabt_"+i), this);
        }
    }

    this.setVisible=function(i){
        tabs[visible_index].style.display='none';
        visible_index=i;
        tabs[visible_index].style.display='block';
    };
};
aoe.core.desktop.TabArea.prototype=new aoe.core.desktop.Area(-1);
aoe.core.desktop.Element=function(_id){
    var id=(_id!=-1)?_id:null;
    var domObj=((id!==null)?aoe.util.getID(id):((_id!=-1)?document.createElement('div'):null));
    var components=new Array();
    this.add=function(component){
        components.push(component);
    };
    this.getDOMObj=function(){
        return domObj;
    };
};
aoe.core.desktop.MailElement =function(_id,mail,name,sub){
    this._base=aoe.core.desktop.Area;
    this._base(_id);
    var id=(_id!=-1)?_id:null;
    var domObj=((id!==null)?aoe.util.getID(id):null);
    var q="";
    if(sub){
        q="subject="+escape(sub);
    }
    mail=aoe.util.Base64.decode(mail);
    if(domObj)domObj.innerHTML="<a href=\"mailto:"+((name)?escape(name)+"%20":"")+"%3c"+mail+"%3e"+((q!="")?"?"+q:"")+"\" title=\"E-Mail schreiben an "+((name)?name:mail)+"\">"+mail+"</a>";


};
aoe.core.desktop.MailElement.prototype=new aoe.core.desktop.Element(-1);
