/*
 *  REDCODE.DE JavaScript - redcode-usuals.js
 *  (C)opyright 2001-2005 REDCODE.DE. All Rights reserved.
 *  Visit us at http://www.redcode.de/          
 *  fecit tmh
 */


/** browserChecktoString: displays all information of this object */
function browserChecktoString(html) {
    var buf;
    if (html) {
       buf = '\n<TABLE BORDER="1" CELLPADDING="5">';
       for (key in this) {
           buf += "\n<TR><TD>is." + key + "</TD><TD>" + is[key] + "</TD></TR>";
       }
       buf += "\n</TABLE>";
    } else {
       for (key in this) {
           buf += "\n|   is." + key + "\t |   " + is[key] + " ";
       }
    }
    // document.write(buf);
    return buf;
}


/** XBrowserCheck: constructor for ExtendedBrowserCheck object */
function XBrowserCheck() {
   var b = navigator.appName;
   if (b=="Netscape") this.b = "ns";
   else if (b=="Microsoft Internet Explorer") this.b = "ie";
   else if (b=="Opera") this.b = "op";
   else this.b = b;

   this.version = navigator.appVersion;
   this.v   = parseInt(this.version);
   this.ns  = (this.b=="ns" && this.v>=4);
   this.ns4 = (this.b=="ns" && this.v==4);
   this.ns5 = (this.b=="ns" && this.v==5);
   this.ie  = (this.b=="ie" && this.v>=4);
   this.ie4 = (this.version.indexOf('MSIE 4')>0);
   this.ie5 = (this.version.indexOf('MSIE 5')>0);
   this.ie6 = (this.version.indexOf('MSIE 6')>0);
   this.op  = (this.b == "op" && this.v >= 5);
   this.op5 = (this.b == "op" && this.v == 5);
   this.op6 = (this.b == "op" && this.v == 6);
   this.op7 = (this.b == "op" && this.v == 7);
   this.min = (this.ns || this.ie || this.op);
   this.dom = (document.getElementById) ? true : false;

   if (navigator.platform.indexOf("Win") >= 0) this.os = "win";
   else if (navigator.platform.indexOf("Mac") >= 0) this.os = "mac";
   else if (navigator.platform.indexOf("Unix") >= 0) this.os = "unix";
   else this.os = "unknown";
   this.win = (this.os=="win");
   this.mac = (this.os=="mac");
   this.unix = (this.os=="unix");
   if (this.ns) this.lang = navigator.language;
   else if (this.ie) this.lang = navigator.userLanguage;

   this.toString = browserChecktoString;
}
var is = new XBrowserCheck();


/** pageRedraw: reloads current page (to handle resize for navigator) */
function pageRedraw() {
    if ((outerWidth != initialWidth) || (outerHeight != initialHeight)) {
        location.reload();
    }
}
// enable handler for navigator
if (is.ns) {
   initialWidth  = window.outerWidth;
   initialHeight = window.outerHeight;
   onresize = pageRedraw;
}


/** removeFrames: removes all frames in current browser window */
function removeFrames() {
    if (top.frames.length > 0)
        top.location.href = self.location;
}


/** formatDate: formates date */
function formatDate(date) {
    if (!date) date = new Date();
    var days =   [ "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag" ];
    var months = [ "Januar", "Februar", "M&auml;rz", "April", "Mai", "Juni",
                   "Juli", "August", "September", "Oktober", "November","Dezember" ];
    var dateStr = "" + days[date.getDay()] + ", den "
                      + date.getDate() + ". "
                      + months[date.getMonth()] + " ";
    dateStr += (date.getYear() < 1900) ? date.getYear() + 1900 : date.getYear();
    return dateStr;
}

/** writeEmail: Writes an e-mail address as link */
function writeEmail(user, domain, cssclass, output) {
    buf = '<A HREF="mailto:'+user+'@'+domain+'"'
    if (cssclass) {
        buf += ' CLASS="'+cssclass+'"';
    }   
    if (output) { 
    	buf += '>'+output+'</A>' 
    } else { 
    	buf += '>'+user+'@'+domain+'</A>' 
    }
 document.write(buf);
}	

/*
##############################
#   usuals-javascript-----   #
#   Version: 2               #
#   License Upd.: 01/12:03   #
#   License ID: redcode002   #
#   xCdaSO-99ai8zH5600suI2   #
##############################
*/
