/* ################################################################## */ /* JavaScript Funktionen fuer EPCOM Self-Edit 3.x Author: p.pirker & j.zauner, epcom it-systeme Datum: 21.06.2005 Version: 1.1 (c): 2005 by EPCOM /* ################################################################## */ if(top.SelfeditFrame){ if(top.SelfeditFrame.kat) { var $katnav=top.SelfeditFrame.kat; } if(top.SelfeditFrame.center) { var $main=top.SelfeditFrame.center.main; } if(top.SelfeditFrame.center) { var $nav=top.SelfeditFrame.center.nav; } if(top.SelfeditFrame.head) { var $top=top.SelfeditFrame.head; } if(top.SelfeditFrame.bottom) { var $bottom=top.SelfeditFrame.bottom; } } /* ################################################################## */ var PopupWin=false; var selectVals=Array(); function getFrameObject(frame){ if(frame=='katnav' && top.SelfeditFrame.kat ){ return top.SelfeditFrame.kat; }else if(frame=='main' && top.SelfeditFrame.center){ return top.SelfeditFrame.center.main; }else if(frame=='nav' && top.SelfeditFrame.center){ return top.SelfeditFrame.center.nav; }else if(frame=='top' && top.SelfeditFrame.head){ return top.SelfeditFrame.head; }else if(frame=='bottom' && top.SelfeditFrame.bottom){ return top.SelfeditFrame.bottom; }else{ return undefined; } } function openPopup(page,fb,fh,options){ if(PopupWin && PopupWin.closed==false){PopupWin.close(); } bb=screen.availWidth; bh=screen.availHeight; l=(bb-fb)/2; t=(bh-fh)/2; if(options==undefined){ $winopt="toolbar=no,menubar=no,location=no,scrollbars=auto,dependent=yes"; $winopt+=",resizable=no,fullscreen=0"; }else{ $winopt=options; } $winopt+=",width="+fb+",height="+fh+",left="+l+",top="+t ; if(page=='http://www.epcom.cc/sehelp/index.php'){ PopupWin = this.open(page, "PopupHelpWin", $winopt); }else{ PopupWin = this.open(page, "PopupWin", $winopt); } } /*#################################################################*/ function getIFrameDocument($ifObj){ var $doc=($ifObj.contentWindow || $ifObj.contentDocument); if ($doc.document) { $doc = $doc.document; } return $doc; } /*#################### TRIM Funktionen ###################################*/ /* */ function ltrim(str){ var whitespace = new String(" \t\n\r"); var s = new String(str); if (whitespace.indexOf(s.charAt(0)) != -1) { var j=0, i = s.length; while (j < i && whitespace.indexOf(s.charAt(j)) != -1) j++; s = s.substring(j, i); } return s; } function rtrim(str){ var whitespace = new String(" \t\n\r"); var s = new String(str); if (whitespace.indexOf(s.charAt(s.length-1)) != -1) { var i = s.length - 1; // Get length of string while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) i--; s = s.substring(0, i+1); } return s; } function trim(str){ return rtrim(ltrim(str)).toString(); } /*################ Mail checker ######################################*/ function chkfilled(feld,feldname,$lang) { if(!$lang){$lang="de";} if($lang=="de"){ $alert=encStr('Bitte füllen Sie das Feld ' + feldname + ' aus!'); }else{ $alert='Please fill in the field ' + feldname + '!'; } if (feld.value == "") { alert($alert); if(feld.parentNode.style.visibility=='visible'){ feld.focus(); } return false; } return true; } function chkemail(feld,$lang) { if(!$lang){$lang="de";} var txt=feld.value; return chkmail(txt,$lang); } function chkmail(txt,$lang) { if(!$lang){$lang="de";} if($lang=="de"){ $alert=encStr('Sie müssen eine gültige E-Mailadresse eingeben'); }else{ $alert="You have to fill in a valid email-adress"; } if (txt.search(/ /) != -1){ alert($alert); return false; } if ( txt == ""){ alert($alert); return false; } ary1=txt.split('\@'); if ( ary1[0].length < 2){ alert($alert); return false; } if ( ary1[1] == null || ary1[1] == "" ){ alert($alert); return false; } ary2=ary1[1].split('\.'); if ( ary2[1] == null || ary2[1] == "" ){ alert($alert); return false; } return true; } /*#################################################################*/ function chknr(nr,doalert) { if(doalert==undefined){ doalert=true; } chkZ=1; for(i=0;i "9") && (nr.charAt(i) != "," && nr.charAt(i) != ".")){ chkZ = -1; } } if(chkZ == -1){ if(doalert){ alert(encStr('Sie dürfen nur Zahlen verwenden!')); } return false; } return true; } /*#################################################################*/ function chkdate(ChkDate,silent) { if(silent==undefined){ silent=false; } var Year=parseInt(ChkDate.substring(6,10), 10); var Month=parseInt(ChkDate.substring(3,5), 10); var Day=parseInt(ChkDate.substring(0,2), 10); var errMsg=encStr('Sie müssen ein gültiges Datum eingeben! (z.B.: 01.05.2024)'); if ((ChkDate.charAt(2)==".") && (ChkDate.charAt(5)==".") && (ChkDate.length==10)) { if ((Day<=31) && (Day>=1) && (Month>=1) && (Month<=12)) { if((Month==1) || (Month==3) || (Month==5) || (Month==7) || (Month==8) || (Month==10) || (Month==12)) { return true; } else { if ((Day<=30) && (Day>=1)) { if((Month==4) || (Month==6) || (Month==9) || (Month==11)) { return true; } else { if ((Day<=28) && (Day>=1)) { return true; } else { if(Day==29) { if ((Year%4)==0) { if ((Year%100)!=0) { return true; } else { if ((Year%400)==0) { return true; } else { return false; } } } else { if(!silent){ alert (errMsg); } return false; } } else { if(!silent){ alert (errMsg); } return false; } } } } else { if(!silent){ alert (errMsg); } return false; } } } else { if(!silent){ alert (errMsg); } return false; } } else { if(!silent){ alert (errMsg); } return false; } } /*#################################################################*/ function chkTime(tStr,doAlert){ var reg=/^[0-2]\d:[0-5]\d(:[0-5]\d)?$/; if(!reg.test(tStr)){ if(doAlert==undefined || doAlert==true || doAlert==1){ alert(encStr('Sie müssen eine gültige Zeit eingeben! (z.B.: 19:03 oder 19:03:46)')); } return false; } return true; } /*#################################################################*/ function chkSelectedValue(obj,doAlert){ var val=obj.value; if(val=='' || val==' ' || val=='0' || val=='null'){ if(doAlert==undefined || doAlert==true || doAlert==1){ var ddName=obj.name; if(obj.title){ ddName=obj.title; } alert(encStr('Bitte wählen Sie einen Eintrag aus dem Dropdown "'+ddName+'" aus.')); } return false; }else{ return true; } } /*#################################################################*/ function isChecked(id){ chkObject=document.getElementById('icon' + id); if(chkObject){ if(chkObject.src.indexOf('checkboxno')!=-1){ return false; }else{ return true; } }else{ alert('Objekt ' + id + ' nicht gefunden'); return false; } } /*#################################################################*/ function picSelected(id){ chkObject=document.getElementById('icon' + id); if(chkObject){ if(chkObject.src.indexOf('/selfedit/icon/bild.gif')!=-1){ return false; }else{ return true; } }else{ alert('Objekt ' + id + ' nicht gefunden'); return false; } } /*#################################################################*/ xtime=false; function showTooltip($text){ if($text!='' && $text!=''){ if(top.document.getElementById("tooltip")){ $tt=top.document.getElementById("tooltip"); go='top.document.getElementById("tooltip").style.visibility="visible"'; }else if(top.picdbhead.document.getElementById("tooltip")){ $tt=top.picdbhead.document.getElementById("tooltip"); go='top.picdbhead.document.getElementById("tooltip").style.visibility="visible"'; }else{ alert('nix gfunden'); return; } with($tt){ if(xtime){clearTimeout(xtime);} if($text=='hide'){ style.visibility='hidden'; }else{ xtime=window.setTimeout(go,500); innerHTML=$text; } } } } /* ################################################################## */ function encStr(txt){ if(txt != undefined){ txt=txt.replace(/ä/g,'%E4'); txt=txt.replace(/ö/g,'%F6'); txt=txt.replace(/ü/g,'%FC'); txt=txt.replace(/Ä/g,'%C4'); txt=txt.replace(/Ü/g,'%DC'); txt=txt.replace(/Ö/g,'%D6'); txt=txt.replace(/ß/g,'%DF'); } return unescape(txt); } /* ################################################################## */ function aktDate(type){ if(type==undefined){ type='date'; } var d=new Date(); var j=d.getYear(); if(j<1900){ j+=1900; } //FireFox startet die Jahresberechnung bei 1900 mit 0 var dStr=''; if(type=='date'){ dStr=fmtDatePart(d.getDate()) + '.' + fmtDatePart((d.getMonth()+1)) + '.' + j; }else if(type=='time'){ dStr=fmtDatePart(d.getHours()) + ':' + fmtDatePart(d.getMinutes()) + ':' + fmtDatePart(d.getSeconds()); }else if(type=='timestamp'){ dStr=fmtDatePart(d.getDate()) + '.' + fmtDatePart((d.getMonth()+1)) + '.' + j + ' ' + fmtDatePart(d.getHours()) + ':' + fmtDatePart(d.getMinutes()); }else if(type=='timestamp_secs'){ dStr=fmtDatePart(d.getDate()) + '.' + fmtDatePart((d.getMonth()+1)) + '.' + j + ' ' + fmtDatePart(d.getHours()) + ':' + fmtDatePart(d.getMinutes()) + ':' + fmtDatePart(d.getSeconds()); } return dStr; } /* ################################################################## */ function fmtDatePart(dPart){ if(dPart<10){ return '0'+dPart; }else{ return dPart; } } /* ################################################################## */ function setSelected(selectId,selVal){ if(document.getElementById(selectId)){ var objSel=document.getElementById(selectId); for(var i=0;i < objSel.length;i++){ if(objSel[i].value==selVal){ objSel.selectedIndex=i; return; } } } } /* Funktion wurde angepasst da arr.length undefined liefert for(var j=0;j < arr.length; j++){ */ function fillSelect(objSelect,arr){ objSelect.options.length=0; if(arr.length==undefined){ arr=obj2array(arr); } var i=0; for(var j=0;j < arr.length; j++){ obj=arr[j]; opt=document.createElement("option"); opt.value=obj[0]; opt.text=encStr(obj[1]); objSelect.appendChild(opt); i++; } if(selectVals!=undefined && objSelect.id){ if(selectVals[objSelect.id]){ for(i=0;i < objSelect.options.length;i++){ if(objSelect.options[i].value==selectVals[objSelect.id]){ objSelect.selectedIndex=i; } } }else{ objSelect.selectedIndex=0; } } } function obj2array(obj){ var tmpObj; var fillArr=[]; var fillCnt=0; for (x in obj){ tmpObj=obj[x]; fillArr[fillCnt++]=[tmpObj[0],tmpObj[1]]; } return fillArr; } /** * Logging in die Console von FireBug * @param string str Der Text, der Protokolliert werden soll * @param string level Der Loglevel (debug|info|warn|error) * @param boolean force Soll ein Alert ausgegeben werden, wenn die Konsole nicht verfügbar ist? */ function devLog(str,level,force){ if(force==undefined){ force=false; } var debugWindow=document.getElementById('debug_window'); /** * Internet Explorer bzw. FireFox ohne der Erweiterung * Firebug haben kein Element window.console */ if(window.console && window.console.log){ if(level==undefined){ level='debug'; } /** * Opera implementiert window.console für die Fehlerkonsole * es gibt jedoch kein Element window.console.debug */ if(window.console.debug){ if(level=='debug'){ console.debug(str); }else if(level=='info'){ console.info(str); }else if(level=='warn'){ console.warn(str); }else if(level=='error'){ console.error(str); }else{ console.log(str); //Eigentlich auch wieder debug } }else{ console.log(str); //Eigentlich auch wieder debug } }else{ if(force==true && debugWindow==null){ alert('Konsole nicht gefunden (FF mit FireBug). DEBUG: ' + str); } } if(debugWindow!=null){ var text=new Element('pre',{ 'text':str, 'styles':{ 'white-space':'pre-wrap' } }); var d=new Element('div',{ styles:{ 'display':'block' }, 'class':'debug_list' }); text.inject(d); d.inject(debugWindow); } } /* ################################################################## */ function getDoc(doc){ if(doc.getElementById('ifDiv')){ if(doc.getElementById('ifDiv').style.visibility=='visible'){ var iF=doc.getElementById('subiframe'); doc=(iF.contentWindow || iF.contentDocument); if (doc.document) { doc = doc.document; } } } return doc; } /* ################################################################## */ function clickRegister(index){ parent.location.href=parent.document.getElementById('reg' + index).href; } /* ################################################################## */ /* ################################################################## */ function chkIsAdmin($noError){ $isAdmin=false; if($isAdmin==false && !$noError){ alert(encStr('Diese Funktion steht nur Administratoren zur Verfügung.')); } return false; } var movePicGal=false; var picGalStep=5; var picGalWidth=-1; var picgalObjects=Array(); var picgalObjectCnt=0; var houseObjects=Array(); var houseObjectCnt=0; houseObjects[houseObjectCnt++]=4 houseObjects[houseObjectCnt++]=6 houseObjects[houseObjectCnt++]=7 houseObjects[houseObjectCnt++]=10 houseObjects[houseObjectCnt++]=13 houseObjects[houseObjectCnt++]=14 houseObjects[houseObjectCnt++]=15 houseObjects[houseObjectCnt++]=16 houseObjects[houseObjectCnt++]=17 houseObjects[houseObjectCnt++]=18 houseObjects[houseObjectCnt++]=20 houseObjects[houseObjectCnt++]=23 houseObjects[houseObjectCnt++]=24 houseObjects[houseObjectCnt++]=25 houseObjects[houseObjectCnt++]=27 houseObjects[houseObjectCnt++]=29 houseObjects[houseObjectCnt++]=30 houseObjects[houseObjectCnt++]=31 houseObjects[houseObjectCnt++]=32 houseObjects[houseObjectCnt++]=36 houseObjects[houseObjectCnt++]=37 houseObjects[houseObjectCnt++]=38 houseObjects[houseObjectCnt++]=39 houseObjects[houseObjectCnt++]=40 houseObjects[houseObjectCnt++]=43 houseObjects[houseObjectCnt++]=44 houseObjects[houseObjectCnt++]=48 houseObjects[houseObjectCnt++]=52 houseObjects[houseObjectCnt++]=54 houseObjects[houseObjectCnt++]=55 houseObjects[houseObjectCnt++]=56 houseObjects[houseObjectCnt++]=57 houseObjects[houseObjectCnt++]=58 houseObjects[houseObjectCnt++]=59 function picgalImage(img){ this.img=new Image(); this.img.src=img; debug('Image ' + img + ' wird an array gefuegt',true); } function picgalPreviewBoxMove(picgalId,direction){ if(movePicGal==true){ if(document.getElementById('picgalPreviewBoxContent'+picgalId)){ var obj=document.getElementById('picgalPreviewBoxContent'+picgalId); if(picGalWidth==-1){ getPicGalWidth(obj); } debug('vorher ' + obj.style.left,false); var objLeft=0; if(!isNaN(parseInt(obj.style.left))){ objLeft=parseInt(obj.style.left); } if(direction=='left'){ debug('nachher ' + (objLeft-picGalStep) + 'px',true); debug('objLeft ' + objLeft + ', picGalWidth: ' + picGalWidth + 'obj.offsetWidth: ' + obj.offsetWidth,true); if(objLeft>(250-picGalWidth)){ objLeft-=picGalStep; }else{ movePicGal=false; } }else{ if(objLeft<=(picGalStep*-1)){ objLeft+=picGalStep; debug('nachher ' + (objLeft+picGalStep) + 'px',true); }else{ objLeft=0; movePicGal=false; } } obj.style.left=objLeft + 'px'; }else{ alert('nicht gefunden: '+picgalId); } window.setTimeout('picgalPreviewBoxMove(' + picgalId + ',\'' + direction + '\')',20); } } function getPicGalWidth(obj){ for(var i=0;i0){ picGalWidth+=obj.childNodes[i].offsetWidth; } } } function showPicgal(picgalId,pic){ if(document.getElementById('picgalBigPic'+picgalId)){ if(pic==false){ //Schlieszen document.getElementById('picgalBigPic'+picgalId).style.display='none'; }else{ document.getElementById('picgalBigPic'+picgalId).style.display='inline'; document.getElementById('picgalBigPic_content'+picgalId).innerHTML=loadPicgalPic(pic); } } return false; } function loadPicgalPic(pic){ var picgalImageIndex=-1; for(var i=0;i'; } function loadBigPic(pic,alt,w,h){ //alert('Lade Bild: ' + pic + ' ,W: ' + w + ', H: '+h); var imgHTML='' + alt + ''; document.getElementById('bigPic_content').innerHTML=imgHTML; document.getElementById('bigPic').style.width=w+'px'; document.getElementById('bigPic').style.height=h+'px'; document.getElementById('bigPic').style.display='inline'; } function debug(txt,append){ if(append==undefined){ append=false; } if(document.getElementById('debugDiv')){ if(append==true){ document.getElementById('debugDiv').innerHTML+='
'; }else{ document.getElementById('debugDiv').innerHTML=''; } document.getElementById('debugDiv').innerHTML+=txt; } } function switchDisplay(objId){ if(document.getElementById(objId)){ if(document.getElementById(objId).style.display=='none' || document.getElementById(objId).style.display==''){ document.getElementById(objId).style.display='inline'; }else{ document.getElementById(objId).style.display='none'; } } } function switchClass(objId,class1,class2){ if(document.getElementById(objId)){ if(document.getElementById(objId).className==class1){ document.getElementById(objId).className=class2; }else if(document.getElementById(objId).className==class2){ document.getElementById(objId).className=class1; } } } function closeBoxes(exceptBox){ for(var i=0; i<=houseObjectCnt; i++){ if(houseObjects[i]!=exceptBox && document.getElementById('content_house_' + houseObjects[i])){ if(document.getElementById('content_house_' + houseObjects[i]).style.display=='inline'){ document.getElementById('content_house_' + houseObjects[i]).style.display='none'; switchClass('list_header_'+ houseObjects[i],'listheader_open','listheader_close'); } } } } String.prototype.ucFirst = function () { return this.substr(0,1).toUpperCase() + this.substr(1,this.length); };