﻿// pad.js


var space="<img src=\"/ibt/adm/core/ibt/lib/image/util/nix.gif\" height=\"1\" width=\"1\">";
var space10="<img src=\"/ibt/adm/core/ibt/lib/image/util/nix.gif\" height=\"10\" width=\"1\">";
var border_h = "<table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td bgcolor=#000000 height=1>"+space+"</td></tr></table>";

var emoticonsStd = new Array(
"[]", "text.gif", "text", true,
":()", "say.gif", "say", true,
":-)", "smile.gif", "smile", true,
":)", "smile.gif", "smile", false,
"(o:", "smile.gif", "smile", false,
"(-:", "smile.gif", "smile", false,
";)", "wink.gif", "wink", false,
";-)", "wink.gif", "wink", true,
":D", "biggrin.gif", "big grin", false,
":-D", "biggrin.gif", "big grin", false,
":p", "tongue.gif", "razz", false,
":-p", "tongue.gif", "razz", false,
":-(", "frown.gif", "frown", true,
":(", "frown.gif", "frown", false,
":-|", "disappointed.gif", "disappointed", true,
":-/", "disappointed.gif", "disappointed", false,
":-\\", "disappointed.gif", "disappointed", false,
":-!", "disappointed.gif", "disappointed", false,
"(+)", "up.gif", "up", true,
"(-)", "down.gif", "down", true,
"->", "seealso.gif", "seealso", true,
"(*)", "light.gif", "light", true,
"(!)", "warning.gif", "warning", true,
"(?)", "question.gif", "question", true,
"???", "confused.gif", "confused", false,
"!!!", "cool.gif", "cool", true  )

if (typeof type == "undefined" || type == null || type == "null") type = ""; //JC 190508

var sortLabel = new Array()
sortLabel.time = "nach Datum"
sortLabel.sender = "nach Absender"
sortLabel.type = "nach Art"
sortLabel.recipient = "nach Empfänger"
sortLabel.priority = "nach Priorität"
sortLabel.subject = "nach Betreff"
if( !type=="datebook"){
sortLabel.summary = "nach Zusammenfassung";
sortLabel.keywords = "nach Stichwörter";
}else{
sortLabel.summary = "Ort";
sortLabel.keywords = "Terminart";
}
sortLabel.message = "nach Beitrag"
sortLabel.url = "nach Link"
sortLabel.distribution = "nach lcom.pad2.distribution.label"
sortLabel.status = "nach Status"
sortLabel.startTime = "nach Beginn"
sortLabel.endTime = "nach Ende"
sortLabel.thread = "nach Bezug"


function isAuthenticatedEdit ()
{
var result = false;
if ( typeof(render) != "undefined" && render != null
&& render.match(/authenticatedEdit/i) && user == "unknown" ) {
result = true;
}
return result;
}


function getSay(msg)
{
if (msg.sender) return msg.sender.say;
if (!msg.attach) return "-";
for (a=0; a<msg.attach.length; a++) {
if (msg.attach[a].name == "say") return msg.attach[a].value;
}
return "-";
}


function getUser(msg)
{
if (msg.sender) return msg.sender.user;
return "-";
}


function getSender(msg)
{
if (msg.sender) return msg.sender;
return null;
}


function getUserIcon(msg)
{
result = (msg.sender) ? msg.sender.icon : null;
if (result != null && result != "")
result = (result.substr(0,1)=="/") ? "/ibt/GC21/area=gc21/main/de" + result : "/ibt/var/core/ibt/user/icons/" + result
else
result = "/ibt/adm/core/ibt/lib/image/role/unknown.gif";
return result;
}


function getSubject(msg)
{
result = "";
if (typeof(msg.emoticon) != "undefined" && msg.emoticon != null)
result += msg.emoticon + " ";
if (typeof(msg.subject) != "undefined" && msg.subject != null)
result += msg.subject;
if (result == "") result = "-";
result = expandMsg(result);
return result;
}


function isRead (msg, markTime)
{
if ( (typeof(msg)=="undefined")||(typeof(msg.read) == "undefined") )
return false;
if (typeof(markTime) == "undefined") {
return msg.read;
} else  {
return (msg.time < markTime || msg.read);
}
}

function getNewIconPath(msg, markTime)
{
var result = "/btn/i50/message/read.gif";
if (!isRead(msg, markTime))
result = "/btn/i50/message/unread.gif";
if ( isAuthenticatedEdit() ) result="/ibt/adm/core/ibt/lib/image/util/nix.gif";
return result;
}


function getNewIcon(msg, markTime)
{
return "<img src=\""+getNewIconPath(msg, markTime)+"\" border=\"0\" />";
}


function getDatebookNewIcon() {
var result = "/ibt/adm/core/ibt/lib/image/util/nix.gif";
if (typeof(time)=="undefined")
time = msg.time;
if (time > mark)
result = "/ibt/style=myso/paint=myso/mode/ibt/style/myso/image/text/new-s.gif";
return result;
}

function getNewLink(msg, markTime)
{
if (msg.time > markTime)
if ( isAuthenticatedEdit() ) return "";
else return "<a href=\"javascript:setRead("+msg.time+","+!isRead(msg, markTime)+")\">"+getNewIcon(msg, markTime)+"</a>";
else
return getNewIcon(msg, markTime);
}


function isMarked (msg)
{
if ( (typeof(msg)=="undefined")||(typeof(msg.marked) == "undefined") )
return false;
else
return (msg.marked);
}


function getMarkedIconPath(msg)
{
if ( isAuthenticatedEdit() ) return "/ibt/adm/core/ibt/lib/image/util/nix.gif";
if ( isMarked(msg) )
return "/btn/i50/message/marked.gif";
else
return "/btn/i50/message/unmarked.gif";
}


function getMarkedIconLabel(msg)
{
if ( isMarked(msg) )
return "Markiert";
else
return "Nicht Markiert";
}


function getMarkedIcon(msg)
{
var label = getMarkedIconLabel(msg);
return "<img src=\"" + getMarkedIconPath(msg) + "\" border=\"0\" alt=\"" + label + "\" title=\"" + label + "\" />";
}


function getMarkedLink(msg)
{
if ( isAuthenticatedEdit() ) return "";
else return "<a href=\"javascript:setMarked("+msg.time+","+!isMarked(msg)+")\" >"+getMarkedIcon(msg)+"</a>";
}


function getSummary(msg)
{
result = "";
if (typeof(msg.summary)!= "undefined" && msg.summary != null)
result = msg.summary;
if (result == "") result = "-";
result = expandMsg(result);
return result;
}


function getMessage(msg)
{
result = "";
if (typeof(msg.message)!= "undefined" && msg.message != null)
result = msg.message;
if (result == "") result = "-";
result = result;
return result;
}


function getType(msg)
{
result = "";
if (typeof(msg.type)!= "undefined" && msg.type != null)
result = msg.type;
return result;
}


function getKeywords(msg)
{
result = "";
if (typeof(msg.keywords)!= "undefined" && msg.keywords != null)
result = msg.keywords;
if (result == "") result = "-";
result = expandMsg(result);
return result;
}


function getDatebookType(msg)
{
result = "";
if (typeof(msg.keywords)!= "undefined" && msg.keywords != null) {
if(msg.keywords == "roomstart") result = "Nutzungsbeginn";
if(msg.keywords == "coursestart") result = "Kursbeginn";
if(msg.keywords == "courseend") result = "Kursende";
if(msg.keywords == "training") result = "Präsenzveranstaltung";
if(msg.keywords == "liveevent") result = "Live Event";
if(msg.keywords == "chat") result = "Chat";
if(msg.keywords == "milestone") result = "Meilenstein";
if(msg.keywords == "deadline") result = "Einsendeschluss";
if(msg.keywords == "test") result = "Test";
if(msg.keywords == "absence") result = "Abwesenheit";
if(msg.keywords == "misc") result = "Sonstiges";
}
return result;
}

function getAttachValue(msg,name)
{
if (msg.attach == null) return ""
for (var i = 0; i<msg.attach.length; i++) {
if (msg.attach[i].name == name)
return msg.attach[i].value
}
return ""
}

function getTickerType(msg)
{
result = "";
if (typeof(msg.type)!= "undefined" && msg.type != null) {
if(msg.type == "bold") result = "Fett";
if(msg.type == "border") result = "Rahmen";
if(msg.type == "line") result = "Tickerzeile";
if(msg.type == "marquee") result = "Windows-Marquee";
if(msg.type == "status") result = "Statusticker";
if(msg.type == "telex") result = "Telex";
if(msg.type == "text") result = "Text";
}
return result;
}


function getDelay(msg)
{
var result="";
var delay = "";
for(j=0;j<msg.attach.length;j++)
if (msg.attach[j].name == "delay") delay = msg.attach[j].value;
if (delay != "") {
if (delay == 1) result = "ab sofort"
else if (delay == 86400) result = "1 Tag"
else if (delay == 172800) result = "2 Tage"
else if (delay == 259200) result = "3 Tage"
else if (delay == 604800) result = "1 Woche"
else if (delay == 1209600) result = "2 Wochen"
else if (delay == 1814400) result = "3 Wochen"
else if (delay == 2419200) result = "4 Wochen"
else if (delay == 3024000) result = "5 Wochen"
else if (delay == 3628800) result = "6 Wochen"
else if (delay == 5184000) result = "2 Monate"
else if (delay == 7776000) result = "3 Monate"
}
return result;
}


function getUrl(msg,maxlength)
{
result = "";
if (typeof(msg.url)!= "undefined" && msg.url != null)
result = msg.url;
if (typeof(maxlength) != "undefined")
result = result.substring(0,maxlength);
return result;
}


function getRefCount(msg)
{
var result = "";
if(msg.refcount && msg.refcount != "undefined")
result = "(" + msg.refcount + ")";
return result;
}


function getFiles(msg)
{
var result = "";
if (withPool() && msg.files) {
for (j=0; j<msg.files.length; j++) {
if (msg.files[j].name != "file") {
if (result != "")
result += "<br>"
result += "<a target=\"_blank\" href=\"/ibt/GC21/var/core/ibt/pool/"+pool+"/"+escape(msg.files[j].value)+"?pad="+pad+"&pad:time="+msg.time+"\">"+expandMsg(msg.files[j].name)+"</a>"
}
}
}
return result;
}


function getFilesEdit(msg)
{
var result = "";
if (withPool() && msg.files) {
for (j=0; j<msg.files.length; j++) {
if (msg.files[j].name != "file") {
if (result != "")
result += "<br>"
result += "<input type=\"checkbox\" name=\"attach.deletefile\" value=\"" + msg.files[j].value + "\">&nbsp;Löschen&nbsp;&nbsp;&nbsp;&nbsp;";
result += "<a target=\"_blank\" href=\"/ibt/GC21/var/core/ibt/pool/"+pool+"/"+escape(msg.files[j].value)+"?pad="+pad+"&pad:time="+msg.time+"\">"+expandMsg(msg.files[j].name)+"</a>"
}
}
}
return result;
}



function getUiGroupFiles(msg)
{
var result = new uiGroup("arrange", "h");
if ( withPool() ) {
if (msg.files && msg.files.length > 0) {
for (var a=0; a<msg.files.length; a++) {
if (msg.files[a].name != "file") {
var pathHref="/ibt/GC21/var/core/ibt/pool/"+pool+"/"+escape(msg.files[a].value)+"?pad="+pad+"&pad:time="+msg.time;
result.add(new uiValue("image", "/btn/i50/object/pad/attachment.gif", "imageHref", pathHref, "imageTitle", escape(msg.files[a].name), "target", "_blank"));
}
}
}
}
return result;
}


function getStatus(msg)
{
result = "";
if (typeof(msg.status)!= "undefined" && msg.status != null)
result = msg.status;
return result;
}


function getPoolStatus(msg)
{
result = "";
if (typeof(msg.status)!= "undefined" && msg.status != null) {
if (msg.status == "started") result = "In Bearbeitung";
if (msg.status == "ready") result = "Erledigt";
if (msg.status == "abInitio") result = "Nicht begonnen";
}
return result;
}


function getPoolStatusImage(msg)
{
result = "/ibt/adm/core/ibt/lib/image/util/nix.gif";
if (typeof(msg.status)!= "undefined" && msg.status != null) {
if (msg.status == "started") result = "/ibt/GC21/area=gc21/main/de/mode/ibt/style/lite/image/status/started.gif";
if (msg.status == "ready") result = "/ibt/GC21/area=gc21/main/de/mode/ibt/style/lite/image/status/ready.gif";
if (msg.status == "abInitio") result = "/ibt/GC21/area=gc21/main/de/mode/ibt/style/lite/image/status/abInitio.gif";
}
return result;
}


function getPriority(msg)
{
result = "";
if (typeof(msg.priority)!= "undefined" && msg.priority != null) {
if (msg.priority == "h") result = "Hoch";
if (msg.priority == "u") result = "Sehr hoch";
if (msg.priority == "m") result = "Normal";
if (msg.priority == "l") result = "Gering";
if (msg.priority == "d") result = "Sehr gering";
}
return result;
}


function getPriorityImage(msg)
{
result = "/ibt/adm/core/ibt/lib/image/util/nix.gif";
if (typeof(msg.priority)!= "undefined" && msg.priority != null) {
if (msg.priority == "h") result = "/ibt/style=myso/paint=myso/mode/ibt/style/myso/image/priority/h.gif";
if (msg.priority == "u") result = "/ibt/style=myso/paint=myso/mode/ibt/style/myso/image/priority/u.gif";
if (msg.priority == "m") result = "/ibt/style=myso/paint=myso/mode/ibt/style/myso/image/priority/m.gif";
if (msg.priority == "l") result = "/ibt/style=myso/paint=myso/mode/ibt/style/myso/image/priority/l.gif";
if (msg.priority == "d") result = "/ibt/style=myso/paint=myso/mode/ibt/style/myso/image/priority/d.gif";
}
return result;
}


function getRecipients(msg)
{
result = new String();
if (msg.recipients && typeof(msg.recipients)!= "undefined")
result = msg.recipients;
result = result.toString();
result = result.replace(","+getUser(msg), "")
return result;
}


function getMessageDate(msg)
{
result = new Date();
if (typeof(msg.time)!= "undefined" && msg.time > 0) {
result.setTime(msg.time)
result = datum(result)
} else {
result="-"
}
return result;
}


function getMessageDateShort(msg)
{
result = new Date();
if (typeof(msg.time)!= "undefined" && msg.time > 0) {
result.setTime(msg.time)
result = datumShort(result)
} else {
result="-"
}
return result;
}


function getMessageTimeShort(msg)
{
result = new Date();
if (typeof(msg.time)!= "undefined" && msg.time > 0) {
result.setTime(msg.time)
result = timeShort(result)
} else {
result="-"
}
return result;
}


function getMessageRefDate(msg)
{
result = new Date();
if (typeof(msg.reference)!= "undefined" && msg.reference > 0) {
result.setTime(msg.reference)
result = datum(result)
} else {
result="Kein Bezug"
}
return result;
}

function getStartTime(msg,type)
{
result = new Date();
if (typeof(msg.startTime)!= "undefined" && msg.startTime > 0) {
result.setTime(msg.startTime);
if ( type == 'time' )
result = "<nobr>" + timeShort(result) + "</nobr>";
else if ( type == 'date' )
result = "<nobr>" + datumShort(result) + "</nobr>";
else
result = "<nobr>" + datum(result) + "</nobr>";
} else {
result=""
}
return result;
}


function getEndTime(msg,type)
{
result = new Date();
if (typeof(msg.endTime)!= "undefined" && msg.endTime > 0) {
result.setTime(msg.endTime);
if ( type == 'time' )
result = "<nobr>" + timeShort(result) + "</nobr>";
else if ( type == 'date' )
result = "<nobr>" + datumShort(result) + "</nobr>";
else
result = "<nobr>" + datum(result) + "</nobr>";
} else {
result=""
}
return result;
}


function getTimeDiff(msg)
{
var result = 0;
if (typeof(msg.startTime)!="undefined"
&& msg.startTime > 0
&& typeof(msg.endTime)!="undefined"
&& msg.endTime > 0) {
var startDate = new Date();
startDate.setTime(msg.startTime);
var endDate = new Date();

endDate.setTime(msg.endTime);
endDate.setHours(startDate.getHours());
endDate.setMinutes(startDate.getMinutes());
endDate.setSeconds(startDate.getSeconds());
endDate.setMilliseconds(startDate.getMilliseconds());
var diffDate = new Date();
diffDate.setTime(endDate.getTime() - startDate.getTime());
result = diffDate.getTime();
result = Math.ceil(result / 1000 / 60 / 60 / 24);
}
return result;
}


function getActiveSince(msg)
{
result = new Date();
if (typeof(msg.activeSince)!= "undefined" && msg.activeSince > 0) {
result.setTime(msg.activeSince);
result = "<nobr>" + datum(result) + "</nobr>";
} else {
result=""
}
return result;
}


function getActiveUntil(msg)
{
result = new Date();
if (typeof(msg.activeUntil)!= "undefined" && msg.activeUntil > 0) {
result.setTime(msg.activeUntil);
result = "<nobr>" + datum(result) + "</nobr>";
} else {
result=""
}
return result;
}


function getMessageTime(msg)
{
if (typeof(msg.time)!= "undefined")
return msg.time;
return 0;
}


function getMessageRefTime(msg)
{
if (typeof(msg.reference)!= "undefined")
return msg.reference;
return 0;
}


function getImage(msg,maxwidth)
{
maxwidth = (maxwidth) ? " width=" + maxwidth : "";
if (typeof(msg.image) != "undefined" && msg.image != null && msg.image != "") {
result = (msg.image.substr(0,1)=="/") ? "/ibt/GC21/area=gc21/main/de" + msg.image : "/ibt/GC21/area=gc21/main/de/" + msg.image;
result = "<img border=0"+maxwidth+" src=\"" + result + "\">";
} else
result = "<img src=\"/ibt/adm/core/ibt/lib/image/util/nix.gif\" height=\"1\" width=\"1\">";
return result;
}


function delMessage(time)
{
if (confirm("Nachrichten loeschen: Sind Sie sicher?"))
document.location.href="Pad.ibt?load=createResult.xhtml&pad="+pad+"&time="+time+"&action=del"+parameter;
}


function setRead(time, setRead)
{
document.location.href="Pad.ibt?load=createResult.xhtml&pad="+pad+"&time="+time+"&action=set&read="+setRead+parameter;
}


function setMarked(time, setMarked)
{
document.location.href="Pad.ibt?load=createResult.xhtml&pad="+pad+"&time="+time+"&action=set&marked="+setMarked+parameter;
}


function expandBR(str)
{
if (typeof str=="undefined" || str==null || str=="") return ""
var a = str.split("<BR>")
var r = a[0]
for (var i=1; i<a.length; i++) r+=a[i] + "\n"
return r;
}


function indentBR(str)
{
if (typeof str=="undefined" || str==null || str=="") return ""
var a = (str + "\n").split("<BR>")
var r = ""
for (var i=0; i<a.length; i++) r+="&gt; "+a[i] + "\n"
return r;
}


function expandLink(prefix, str)
{
if (typeof str=="undefined" || str==null || str=="") return ""
var i=0 ;
var n=0 ;
var arw = ">";
while ( ( h = str.indexOf(prefix, i) ) >= 0) {
var e=str.indexOf(" ", h)
if (e<0) e=str.length ;
var href=str.substring(h,e)
var lastChars =  str.substring((h-6) , (h-1))
if( lastChars == "href=" ){
if(str.indexOf("&gt;")!=-1) arw = "&gt;" ;
(str.indexOf("a"+arw, h)!=-1)? e= str.indexOf("a"+arw, h) : e= str.indexOf("A"+arw, h) ;
i=e+2;
}else{
var link="<A TARGET=_window HREF=\"" + href + "\">" + href + "</A>"
str= str.substring(0,h) + link + str.substring(e,str.length)
i = h + link.length
}
}
str = str.replace("&lang=","&amp;lang=");
return str
}


function expandLinks(str)
{
str = expandLink("ftp://", str);
str = expandLink("http://", str);
str = expandLink("https://", str);
str = expandLink("mailto://", str);
return str;
}


function expandIcon(name, image, str)
{
if (typeof str=="undefined" || str==null || str=="") return ""
var a = str.split(name);
var r = a[0];
for (var i=1; i<a.length; i++)
r+= iconImg(image) +  a[i]
return r;
}

function iconImg(image)
{
return "<IMG BORDER=0 SRC=\"/ibt/adm/core/ibt/lib/image/emoticon/" + image + "\">"
}


function expandIcons(icons, str)
{
for (var i=0; i<icons.length; i+=4)
str = expandIcon( icons[i], icons[i+1], str)
return str
}


function getIcons(category)
{
return emoticonsStd
}


function expandMsg(str)
{
return expandLinks( expandIcons( emoticonsStd, str))
}


function w(text)
{ document.write(text) }


function selectIcon(icons)
{
w("<TABLE WIDTH=\"100%\"><TR><TD>")
checked=""
for (var i=0; i<icons.length; i+=4) {
if (icons[i+3]) {
w( "<NOBR><INPUT TYPE=RADIO NAME=icon VALUE=\"" + icons[i] + "\"" + checked + "> "  )
w( iconImg(icons[i+1]) + "</NOBR>" )
}
}
w("</TD></TR></TABLE>")
}


function iconIntoSubject()
{
var f=document.form
var icon=""
if (typeof f.icon != "undefined" ) {
for (var i=0; i<f.icon.length; i++) {
if (f.icon[i].checked) {
icon=f.icon[i].value + " "
break
}
}
f.subject.value = icon + f.subject.value
}
}


function iconHelp(icons)
{
w("<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER>")
w("<TR><TD><B>Kürzel</B></TD><TD><B>Icon</B></TD><TD><B>Bedeutung</B></TD></TR>" )
for (var i=0; i<icons.length; i+=4) {
if ( icons[i+3] )
w("<TR><TD> <TT>" + icons[i] + "</TT> </TD><TD ALIGN=CENTER> " + iconImg(icons[i+1]) + " </TD><TD> " + icons[i+2] + " </TD></TR>" )
}
w("</TABLE>")
}


function datum(termin)
{
var datumstring= datumShort(termin) + "  " + timeShort(termin);
return (datumstring)
}


function datumShort(termin)
{
var date = new Date()
date.setTime (termin);
var tag = date.getDate();
tag = ((tag<10) ? "0" : "") + tag;
var monat = date.getMonth()+1;
monat = ((monat<10) ? "0" : "") + monat;
var jahr = date.getFullYear();
var datumstring= jahr + "-" + monat + "-" + tag;
return (datumstring)
}


function timeShort(termin)
{
var date = new Date()
date.setTime (termin);
var stunde = date.getHours();
stunde = ((stunde<10) ? "0" : "") + stunde;
var minute = date.getMinutes();
minute = ((minute<10) ? ":0" : ":") + minute;
var datumstring = stunde + minute;
return (datumstring)
}


function nobr(str)
{ if (str=="") return ""
a = (str + "\n").split("<BR>");
r = ""
for (var i=0; i<a.length ; i++)
r+="&gt; "+a[i] + "\n";
return r;
}


function nobr0(str)
{ if (str=="") return ""
a = (str + "\n").split("<BR>");
r = ""
for (var i=0; i<a.length ; i++)
r+=a[i] + "\n";
return r;
}


function nobrEdit(str)
{
if (str=="") return ""
a = (str + "\n").split("<br>");
r = ""
for (var i=0; i<a.length; i++) {
b = a[i].split("<BR>")
for (var j=0; j<b.length; j++)
r+=b[j] + "\n"
}
return r;
}

function nobrEditBody(str)
{
if (str=="") return ""
a = str.split("<br>");
r = ""
for (var i=0; i<a.length; i++) {
b = a[i].split("<BR>")
for (var j=0; j<b.length; j++){
if(j<b.length-1)
r+=b[j] + "\n"
else{
r+=b[j]
}
}
}
return r;
}


function emoticons(inputSelect, icons)
{
inputSelect["value"] = "";
for (var i=0; i<icons.length; i+=4)
if (icons[i+3])
inputSelect.add(new uiValue("type", "data", "label", iconImg(icons[i+1]), "name", icons[i]));
inputSelect.add(new uiValue("type", "data", "label", "-", "name", ""));
}


function withPool()
{
if ( typeof(pool) == "undefined" ) return false;
if ( pool == null ) return false;
if ( pool == "" ) return false;
if ( pool == false ) return false;
if ( pool == "false" ) return false;
if ( pool == "null" ) return false;
return true;
}


function scrollDown()
{
if ( window.scrollBy ) window.scrollBy(0, 10000)
else if ( window.scroll ) window.scroll(0,19999)
else if ( window.scrollTo ) setTimeout("window.scrollTo(0,19999)", 1);
}


function printPadtitle(actionLabel, padView, target)
{
if (typeof(padView) == "undefined") padView = "";
if (typeof(actionLabel)=="undefined") actionLabel = "";
if (typeof(target)=="undefined") target = "_self";
buttons = getTitleButtons();
buttonsRight = printButtonsRight(buttons,padView,target);
buttonsLeft = printButtonsLeft(buttons,padView,target);
var paneWidth = (type=="gc21chat") ? "100%" : "90%";
w("<table border=0 cellspacing=0 cellpadding=0 width="+paneWidth+"><tr>"
+ "<td bgcolor=#000000 height=1 width=1>"+space+"</td>"
+ "<td bgcolor=#000000 height=1 width=10000 colspan=2 >"+space+"</td>"
+ "<td bgcolor=#000000 height=1 width=1>"+space+"</td></tr>"
+ "<tr valign=top>"
+ "<td rowspan=3 width=1 bgcolor=#000000>"+space
+ "</td><td valign=top bgcolor=#e5e5e5>"
+ "<table border=0 width=\"100%\" cellpadding=5 cellspacing=0><tr><td align=left class=lay-buttons-nav-pad-title>"
+ "<b>"+title+"</b>");
if (actionLabel != "") {
w("&nbsp;&bull;&nbsp;"+actionLabel);
}
w("</td></tr></table>"
+ "</td><td valign=top bgcolor=#e5e5e5 align=right>"
+ "<table border=0 cellpadding=5 cellspacing=0><tr><td class=lay-buttons-nav-pad-title>"
+ typelabel
+ "</td></tr></table>"
+ "</td><td rowspan=3 width=1 bgcolor=#000000>"+space
+ "</td></tr><tr>"
+ "<td colspan=2 bgcolor=#000000 height=1>"+space
+ "</td></tr><tr><td valign=top bgcolor=#f3f3f3 align=left class=lay-buttons-nav-pad>"
+ "<table border=0 cellpadding=0 cellspacing=0><tr><td>"
+ buttonsLeft
+ "<img src=\"/ibt/adm/core/ibt/lib/image/util/nix.gif\" width=1 height=24></td></tr></table>"
+ "</td><td valign=top bgcolor=#f3f3f3 align=right class=lay-buttons-nav-pad>"
+ "<table border=0 cellpadding=0 cellspacing=0><tr><td>"
+ "<img src=\"/ibt/adm/core/ibt/lib/image/util/nix.gif\" width=1 height=24>"
+ buttonsRight
+ "</td></tr></table>"
+ "</td></tr>"
+ "<tr><td colspan=4 bgcolor=#000000 height=1>"
+ space+"</td></tr></table>");
}


function printButtonsRight(buttons,padView,target)
{
var result = "";
var aButtons = new Array();
if(buttons != "")
aButtons = buttons.split(",");
var rButtons = new Array();
for(i=0;i<aButtons.length;i++){
if(aButtons[i] == "search") rButtons.search = true;
if(aButtons[i] == "help") rButtons.help = true;
if(aButtons[i] == "thelp") rButtons.thelp = true;
}
if (padView == "tree") {
if (rButtons.search) result += searchButton(pad, viewParam, "topframe");
if (rButtons.help) result += helpButton(type, "view");
if (rButtons.thelp) result += thelpButton(type, "view");
} else {
if (rButtons.search) result += searchButton(pad, parameter ,target)
if (rButtons.help) result += helpButton(type, target)
if (rButtons.thelp) result += thelpButton(type, target)
}
return result;
}


function printButtonsLeft(buttons,padView,target)
{
var result = "";
var aButtons = new Array();
if(buttons != "")
aButtons = buttons.split(",");
var lButtons = new Array();
for(i=0;i<aButtons.length;i++){
if(aButtons[i] == "create") lButtons.create = true;
if(aButtons[i] == "overview") lButtons.overview = true;
if(aButtons[i] == "details") lButtons.details = true;
if(aButtons[i] == "tree") lButtons.tree = true;
if(aButtons[i] == "archive") lButtons.archive = true;
if(aButtons[i] == "about") lButtons.about = true;
if(aButtons[i] == "print") lButtons.print = true;
if(aButtons[i] == "summary") lButtons.summary = true;
if(aButtons[i] == "stream") lButtons.stream = true;
if(aButtons[i] == "poll") lButtons.poll = true;
if(aButtons[i] == "inbox") lButtons.inbox = true;
if(aButtons[i] == "outbox") lButtons.outbox = true;
if(aButtons[i] == "rss") lButtons.rss = true;
}
if (padView=="tree") {
if (lButtons.create) result += createButton(pad, parameter,"view")
if (lButtons.overview) result += overviewButton(pad, viewParam, "topframe")
if (lButtons.details) result += detailsButton(pad, viewParam, "topframe")
if (lButtons.tree) result += treeButton(pad, viewParam, "topframe")
if (lButtons.summary) result += summaryButton(pad, viewParam, "topframe")
if (lButtons.stream) result += streamButton(pad, viewParam, "topframe")
if (lButtons.poll) result += pollButton(pad, viewParam, "topframe")
if (lButtons.inbox) result += inboxButton(pad, viewParam, "topframe")
if (lButtons.outbox) result += outboxButton(pad, viewParam, "topframe")
if (lButtons.archive) result += archiveButton(pad, viewParam, "topframe")
if (lButtons.about) result += aboutButton(pad, "", "topframe")
if (lButtons.print) result += printButton(pad, "&sort=thread&reverse=false&max=-2000", "_blank")
if (lButtons.rss) result += rssButton(type, viewParam, "view");
} else {
if (lButtons.create) result += createButton(pad, parameter ,"_self")
if (lButtons.overview) result += overviewButton(pad, viewParam ,target)
if (lButtons.details) result += detailsButton(pad, viewParam ,target)
if (lButtons.tree) result += treeButton(pad, viewParam ,target)
if (lButtons.summary) result += summaryButton(pad, viewParam, target)
if (lButtons.stream) result += streamButton(pad, viewParam, target)
if (lButtons.poll) result += pollButton(pad, viewParam, target)
if (lButtons.inbox) result += inboxButton(pad, viewParam, target)
if (lButtons.outbox) result += outboxButton(pad, viewParam, target)
if (lButtons.archive) result += archiveButton(pad, viewParam, target)
if (lButtons.about) result += aboutButton(pad, "", target)
if (lButtons.print) result += printButton(pad, viewParam+"&max=-2000", "_blank")
if (lButtons.rss) result += rssButton(type, parameter, target)
}
return result;
}


function printMessageUiButtons(arrange)
{
if (typeof(arrange) == "undefined")
arrange = "r";
var buttons = ""
buttons = getMessageButtons()
var aButtons = new Array();
if(buttons != "")
aButtons = buttons.split(",");
var mButtons = new Array();
for(j=0;j<aButtons.length;j++){
if(aButtons[j] == "reply") mButtons.reply = true;
if(aButtons[j] == "update") mButtons.update = true;
if(aButtons[j] == "edit") mButtons.edit = true;
if(aButtons[j] == "delete") mButtons.del = true;
if(aButtons[j] == "scratch") mButtons.scratch = true;
}
result =  new uiGroup("arrange", arrange)
if (mButtons.reply)
result.add(new uiValue("image", "/btn/i50/object/action/reply/out.gif", "imageHref", "Pad.ibt?load=createInput.xhtml&time="+msg.time+"&pad="+pad+parameter+"&sendAction=reply", "imageTitle", "Beantworten"))
if (mButtons.update)
result.add(new uiValue("image", "/btn/i50/object/action/update/out.gif", "imageHref", "Pad.ibt?load=createInput.xhtml&time="+msg.time+"&pad="+pad+parameter+"&sendAction=update", "imageTitle", "Aktualisieren"))
if (mButtons.edit)
result.add(new uiValue("image", "/btn/i50/object/action/edit/out.gif", "imageHref", "Pad.ibt?load=editInput.xhtml&time="+msg.time+"&pad="+pad+parameter, "imageTitle", "Bearbeiten"))
if (mButtons.del)
result.add(new uiValue("image", "/btn/i50/object/action/delete/out.gif", "imageHref", "javascript:delMessage("+msg.time+")", "imageTitle", "Löschen"))
if (mButtons.scratch)
result.add(new uiValue("image", "/btn/i50/object/action/delete/out.gif", "imageHref", "Pad.ibt?load=createResult.xhtml&action=scratch&time="+msg.time+"&pad="+pad+parameter, "imageTitle", "Löschen"))
return result;
}


function printSortLinks(href)
{
var out = "";
var cat = new Array();
cat = sortLinks[type].split(",");
if (cat != "")
for (i=0;i<cat.length;i++){
if (type == "webmail" && padView =="inbox" && cat[i] == "recipient")
continue;
if (type == "webmail" && padView =="outbox" && cat[i] == "sender")
continue;
out += "<nobr>" + sortLabel[cat[i]] + " ";
if (cat[i] == "thread") {
out += sortLink(pad, "invthread", "false", href, sortParam);
out += sortLink(pad, "thread", "false", href, sortParam);
} else {
out += sortLink(pad, cat[i], "false", href, sortParam);
out += sortLink(pad, cat[i], "true", href, sortParam);
}
out += "</nobr> | ";
}
out = out.substring(0,(out.lastIndexOf(" | ")))
if (out != "")
printLinks("Sortieren nach:", out);
}


function printFilterLinks(href, showArray, param, view)
{
var out = "";
if (!param) param = sortString;
if (typeof(padView ) == "undefined") padView="overview";
if (view == "sinceless") {
if (showArray["newIcon"]) {
out += (unread=="true") ? "<a href=\"Pad.ibt?load="+href+"&pad="+pad+param+"&unread=false\">Alle</a>" :  "<a href=\"Pad.ibt?load="+href+"&pad="+pad+param+"&unread=true\">Nur neue</a>";
out += "&nbsp;&nbsp;"
out += (lastTime>mark) ? "<a href=\"Pad.ibt?load="+href+"&pad="+pad+param+"&mark="+lastTime+"\">Alles gelesen</a>&nbsp;&nbsp;" : "";
}
} else {
if (showArray["newIcon"]) {
out += (unread=="true") ? "<a href=\"Pad.ibt?load="+href+"&pad="+pad+"&padView="+padView+param+"&unread=false\">Alle</a>" :  "<a href=\"Pad.ibt?load="+href+"&pad="+pad+"&padView="+padView+param+"&unread=true&since=mark\">Nur neue</a>";
out += "&nbsp;&nbsp;"
out += (lastTime>mark) ? "<a href=\"Pad.ibt?load="+href+"&pad="+pad+"&padView="+padView+param+"&mark="+lastTime+"\">Alles gelesen</a>&nbsp;&nbsp;" : "";
}
if (showArray["newIcon"] && view == "tree") out+="|&nbsp;";
if (view == "tree") {
out += "&nbsp;<a href=\"javascript:expandAll()\">Alle öffnen</a>&nbsp;&nbsp;";
if (showArray["newIcon"])
out += "<a href=\"javascript:expandNew()\">Ungelesene öffnen</a>&nbsp;&nbsp;";
out += "<a href=\"javascript:collapseAll()\">Alle schließen</a>";
}
}
if (out.length > 0)
printLinks("Beiträge anzeigen:", out);
}


function createButton(pad, otherParam, target)
{
if (typeof(pad)!="undefined") {
if (typeof(render)!="undefined" && render!=null) {
if (padView=="overview" && render.match("overviewWithoutCreate"))
return "";
}
if (typeof(target)=="undefined") target = "_self";
param = pad;
if(typeof(otherParam)!="undefined") param += otherParam;
href = "<a href=\"Pad.ibt?action=about&load=createInput.xhtml";
if (type=="webmail" || type=="biff") {
href += "&users=./%23role/student";
}
href += "&action=about&pad="+param+"\" target=\""+target+"\"><img src=\"/btn/i50/object/action/create/out.gif\" title=\"Neu\" alt=\"Neu\" border=0></a>";
return href;
} else {
return null;
}
}


function overviewButton(pad, otherParam, target)
{
if (typeof(pad)!="undefined") {
if (typeof(target)=="undefined") target = "_self";
param = pad;
if(typeof(otherParam)!="undefined") param += otherParam;
if (type!="webmail" && type!="pool" && type!="reminder" && type!="datebook")
hrefParameter = "load=overviewLayout.xhtml&padView=overview&select=subject&pad="+param
else
hrefParameter = "load=overviewLayout.xhtml&padView=overview&pad="+param
href = "<a href=\"Pad.ibt?"+hrefParameter+"\" target=\""+target+"\"><img src=\"/btn/i50/object/action/overview/out.gif\" title=\"Übersicht\" alt=\"Übersicht\" border=0></a>";
return href;
} else {
return null;
}
}


function detailsButton(pad, otherParam, target)
{
if (typeof(pad)!="undefined") {
if (typeof(target)=="undefined") target = "_self";
param = pad;
if(typeof(otherParam)!="undefined") param += otherParam;
href = "<a href=\"Pad.ibt?load=detailsLayout.xhtml&action=read&padView=details&pad="+param+"\" target=\""+target+"\"><img src=\"/btn/i50/object/action/details/out.gif\" title=\"Details\" alt=\"Details\" border=0></a>";
return href;
} else {
return null;
}
}


function treeButton(pad, otherParam, target)
{
if (typeof(pad)!="undefined") {
if (typeof(target)=="undefined") target = "_self";
param = pad;
if(typeof(otherParam)!="undefined") param += otherParam;
href = "<a href=\"frameset2.sxhtml?padView=tree&pad="+param+"\" target=\""+target+"\"><img src=\"/btn/i50/object/action/tree/out.gif\" title=\"Strukturansicht\" alt=\"Strukturansicht\" border=0></a>";
return href;
} else {
return null;
}
}


function aboutButton(pad, otherParam, target)
{
if (typeof(pad)!="undefined") {
if (typeof(target)=="undefined") target = "_self";
href = "<a href=\"/ibt/GC21/area=gc21/main/de/sico/core/ibt/object/about.cos?select.id="+pad+"\" target=\""+target+"\"><img src=\"/btn/i50/object/action/about/out.gif\" title=\"Info\" alt=\"Info\" border=0></a>";
return href;
} else {
return null;
}
}


function archiveButton(pad, otherParam, target)
{
if (typeof(pad)!="undefined") {
if (typeof(target)=="undefined") target = "_self";
param = pad;
param += "&until=0&max=-10"
if(typeof(otherParam)!="undefined") param += otherParam;
href = "<a href=Pad.ibt?load=archiveLayout.xhtml&pad="+param+" target=\""+target+"\"\"><img src=\"/btn/i50/object/action/archive/out.gif\" title=\"Archiv\" alt=\"Archiv\" border=0></a>";
return href;
} else {
return null;
}
}


function printButton(pad, otherParam)
{
if (typeof(pad)!="undefined") {
param = pad;
if(typeof(otherParam)!="undefined") param += otherParam;
href = "<a href=\"Pad.ibt?load=printLayout.xhtml&pad="+param+"\" target=_blank><img src=\"/btn/i50/object/action/print/out.gif\" title=\"Drucken\" alt=\"Drucken\" border=0></a>";
return href;
} else {
return null;
}
}


function searchButton(pad, otherParam, target)
{
if (typeof(pad)!="undefined") {
if (typeof(target)=="undefined") target = "_self";
param = pad;
if(typeof(otherParam)!="undefined") param += otherParam;
href = "<a href=\"Pad.ibt?load=searchInput.xhtml&users=./%23role/student&action=about&pad="+param+"\" target=\""+target+"\"><img src=\"/btn/i50/object/action/search/out.gif\" title=\"Durchsuchen\" alt=\"Durchsuchen\" border=0></a>";
return href;
} else {
return null;
}
}


function helpButton(type, target)
{
if (typeof(type)!="undefined") {
if (typeof(target)=="undefined") target = "_self";
href = "<a href=\"/ibt/GC21/area=gc21/main/de/sico/help/login/de/student/object/pad2/"+type+".xhtml\" target=\""+target+"\"><img src=\"/btn/i50/object/action/help/out.gif\" title=\"Hilfe\" alt=\"Hilfe\" border=0></a>";
return href;
} else {
return null;
}
}


function thelpButton(type, target)
{
if (typeof(type)!="undefined") {
if (typeof(target)=="undefined") target = "_self";
href = "<a href=\"/ibt/GC21/area=gc21/main/de/sico/help/login/de/handle/object/pad2/"+type+".xhtml\" target=\""+target+"\"><img src=\"/btn/i50/object/action/help/!attend/out.gif\" title=\"Hilfe für Tutoren\" alt=\"Hilfe für Tutoren\" border=0></a>";
return href;
} else {
return null;
}
}


function summaryButton(pad, otherParam, target)
{
if (typeof(pad)!="undefined") {
if (typeof(target)=="undefined") target = "_self";
param = pad;
if(typeof(otherParam)!="undefined") param += otherParam;
href = "<a href=\"Pad.ibt?load=summaryLayout.xhtml&padView=summary&pad="+param+"\" target=\""+target+"\"><img src=\"/btn/i50/object/action/summary/out.gif\" title=\"Zusammenfassung\" alt=\"Zusammenfassung\" border=0></a>";
return href;
} else {
return null;
}
}


function streamButton(pad, otherParam, target)
{
if (typeof(pad)!="undefined") {
if (typeof(target)=="undefined") target = "_self";
param = pad;
if(typeof(otherParam)!="undefined") param += otherParam;
href = "<a href=\"frameset2.xhtml?load=streamLayout.xhtml&padView=stream&pad="+param+"\" target=\""+target+"\"><img src=\"/btn/i50/object/action/stream/out.gif\" title=\"Mitverfolgen\" alt=\"Mitverfolgen\" border=0></a>";
return href;
} else {
return null;
}
}


function pollButton(pad, otherParam, target)
{
if (typeof(pad)!="undefined") {
if (typeof(target)=="undefined") target = "_self";
param = pad;
if(typeof(otherParam)!="undefined") param += otherParam;
href = "<a href=\"frameset2.xhtml?load=pollLayout.xhtml&padView=poll&pad="+param+"\" target=\""+target+"\"><img src=\"/btn/i50/object/action/poll/out.gif\" title=\"Abfragen\" alt=\"Abfragen\" border=0></a>";
return href;
} else {
return null;
}
}


function inboxButton(pad, otherParam, target)
{
if (typeof(pad)!="undefined") {
if (typeof(target)=="undefined") target = "_self";
param = pad;
if(typeof(otherParam)!="undefined") param += otherParam;
href = "<a href=\"Pad.ibt?load=overviewLayout.xhtml&padView=inbox&pad="+param+"\" target=\""+target+"\"><img src=\"/btn/i50/object/action/inbox/out.gif\" title=\"Posteingang\" alt=\"Posteingang\" border=0></a>";
return href;
} else {
return null;
}
}


function outboxButton(pad, otherParam, target)
{
if (typeof(pad)!="undefined") {
if (typeof(target)=="undefined") target = "_self";
param = pad;
if(typeof(otherParam)!="undefined") param += otherParam;
href = "<a href=\"Pad.ibt?load=overviewLayout.xhtml&padView=outbox&pad="+param+"\" target=\""+target+"\"><img src=\"/btn/i50/object/action/outbox/out.gif\" title=\"Postausgang\" alt=\"Postausgang\" border=0></a>";
return href;
} else {
return null;
}
}


function rssButton(type, otherParam, target)
{
if (typeof(pad)!="undefined") {
if (typeof(target)=="undefined") target = "_self";
param = pad;
if(typeof(otherParam)!="undefined") param += otherParam;
href = "<a href=\"Pad.ibt?load=rssLayout.xhtml&pad="+pad+"\" target=\""+target+"\"><img src=\"/btn/i50/object/action/rss/out.gif\" title=\"RSS Abonnieren\" alt=\"RSS Abonnieren\" border=0></a>";
return href;
} else {
return null;
}
}



function sortLink(pad, sort, reverse, load, otherParam, target)
{
var iconsPath = "/ibt/style=myso/paint=myso/mode/ibt/style/myso/image";
if (typeof(pad)!="undefined") {
target = (typeof(target)!="undefined") ? " target="+target+" " : ""
var param = "pad="+pad;
if(typeof(sort)!="undefined") param += "&sort="+sort;
if(typeof(reverse)!="undefined") param += "&reverse="+reverse;
if(typeof(load)!="undefined")
param += "&load="+load
else
param += "&load=overviewLayout.xhtml"
if(typeof(otherParam)!="undefined") param += otherParam;
href = "<a href=\"Pad.ibt?"+param+"\""+target+">"
if (reverse=="true" || sort == "invthread")
href += "<img src=\""+iconsPath+"/sort/up.gif\" border=0 width=10></a>"
else
href += "<img src=\""+iconsPath+"/sort/down.gif\" border=0 width=10></a>"
return href;
} else {
return null;
}
}


function printLinks(label, links)
{
if(typeof(label)=="undefined") label = "";
if(typeof(links)=="undefined") links = "";
w("<table cellpadding=0 cellspacing=0 border=0>"
+ "<tr><td height=5 colspan=2><img src=\"/ibt/adm/core/ibt/lib/image/util/nix.gif\" height=\"5\"></td></tr>"
+ "<tr><td valign=top><b>"+label+"&nbsp;</b></td><td valign=top>"
+ links
+ "</td></tr>");
w("</table>");
}


function printRssMessage()
{
var href = location.host;
if (location.href.indexOf("login") < 0) {
href += "/ibt/ibt/pad.ibt?action=xml&format=rss&pad=";
} else {
href += "/ibt/login/Pad.ibt?action=xml&format=rss&pad=";
}
var parts = pad.split("/");
href+=parts[0];
for (var i=1;i<parts.length;i++) {
href += "%2F"+parts[i];
}
var podcastHref = "http://"+href;
var rssHref = "rss://"+href;
var feedHref = "feed://"+href;
w( "<table cellpadding=0 cellspacing=0 border=0>"
+ "<tr><td height=10><img src=\"/ibt/adm/core/ibt/lib/image/util/nix.gif\" height=\"10\"></td></tr>"
+ "<tr><td>");
w( "Dieses Forum kann als RSS Feed abonniert werden. Es gibt verschiedene Möglichkeiten, solche Feeds zu lesen."
+ "<br/><br/><b>iTunes</b><br/>"
+ "Um dieses Forum als Podcast in <b>iTunes</b> zu abonnieren, gehen Sie wie folgt vor:"
+ "<ul><li>Öffnen Sie iTunes</li>"
+ "<li>Öffnen Sie im Menü \"Erweitert\" den Menüpunkt \"Podcast abonnieren...\" </li>"
+ "<li>Kopieren Sie dann folgende URL in das Eingabefeld:"
+ "<nobr><img src=\"/ibt/GC21/area=gc21/main/de/sico/lcom/ibt/pad2/pad/icons/itunes.gif\"/> <a href=\""+podcastHref+"\">"+podcastHref+"</a></nobr></li>"
+ "</ul>"
+ "<b>RSS Reader</b><br/>"
+ "Um dieses Forum als RSS Feed in Ihrem <b>RSS Reader</b> zu abonnieren, klicken Sie auf eine der folgenden Links, je nachdem ob Ihr RSS Reader \"RSS\"- oder \"Feed\"-URLs unterstzützt oder kopieren Sie die entsprechende URL in Ihren Reader. "
+ "<ul><li>RSS Link: "
+ "<nobr><img src=\"/ibt/GC21/area=gc21/main/de/sico/lcom/ibt/pad2/pad/icons/rss.gif\"/> <a href=\""+rssHref+"\">"+rssHref+"</a></nobr></li>"
+ "<li>Feed Link: "
+ "<nobr><img src=\"/ibt/GC21/area=gc21/main/de/sico/lcom/ibt/pad2/pad/icons/feed.gif\"/> <a href=\""+feedHref+"\">"+feedHref+"</a></nobr></li>"
+ "</ul>");
w("</td></tr></table>");
}


function printDescription()
{
if(description!=null && description!="")
w("<font size=-1>"+description+"</font><br><br>");
}


function getDetailsHref(msglocal)
{
var msgtime = msg.time;
if(typeof(msglocal) != "undefined"){
msgtime = msglocal.time;
}
var result = "Pad.ibt?load=detailsLayout.xhtml&action=read&time="+msgtime+"&pad="+pad+parameter;
return result;
}


function dataValue(label, name)
{
return new uiValue("label", label, "name", name);
}


function specialOverview()
{
parameter = sortString + unreadString + viewString;
sortParam = unreadString + viewString;
viewParam = sortString + unreadString;
for ( i=0; i<messages.length; i++ ) {
msg = messages[i];
timeMessages[msg.time] = msg;
msg.timelist = msg.time + ",";
msg.refcount = 0;
msg.lastUpdate = msg.time;
msg.read = isRead(msg, mark);
if (msg.reference==0)
any = true;
}

for ( i=0; i<messages.length; i++ ) {
msg = messages[i];
if (msg.reference != 0 && !timeMessages[msg.reference])
msg.reference = 0;
if (msg.reference != 0) {
mainMsg = timeMessages[msg.reference];
while (mainMsg.reference != 0 && timeMessages[mainMsg.reference])
mainMsg = timeMessages[mainMsg.reference];
if (mainMsg.reference == 0 && mainMsg.time != msg.time) {
if (msg.time > mainMsg.time)
mainMsg.lastUpdate = updateTime.setTime(msg.time);
mainMsg.marked = (mainMsg.marked || msg.marked);
mainMsg.read = (mainMsg.read && isRead(msg, mark));
mainMsg.refcount += 1;
mainMsg.timelist += msg.time + ","
}
}
}
if (unread == "true") {
any = false;
for ( i=0; i<messages.length; i++) {
if ( !isRead(messages[i]) && (messages[i].lastUpdate > mark) ) {
any = true;
break;
}
}
}
}


function sendEmailToAll()
{

var msgMore = "false";
var mailMessage = message;
var maxMsgLength = 400;
if (mailMessage.length > maxMsgLength) {
mailMessage = mailMessage.substring(0, maxMsgLength);
msgMore = "true";
}

var mailPadLink = "http://gc21.inwent.org/ibt/GC21/area=gc21/main/de/sico/lcom/ibt/pad/pad/padActionDispatch.jsp?select.id="+pad+"&time="+time;
if (reference != null && reference != "0")
mailPadLink += "&reference=" + reference;

var mailHref = "sendMail.jsp"
+ "?pad=" + escape(pad)
+ "&subject=" + escape(subject)
+ "&message=" + escape(mailMessage)
+ "&more=" + escape(msgMore)
+ "&padLabel=" + escape(label)
+ "&padLink=" + escape(mailPadLink);

w("<iframe src=\"" + mailHref + "\" width=\"90%\" height=\"20\" frameborder=\"0\" border=\"0\"><b>Bitte beachten: Automatische E-Mail an alle wurde nicht verschickt!!</b></iframe>");
}
