/**
 * Joints the parts of an email address
 * @param name {string}
 * @param server {string}
 * @param domain {string}
 * @param text {mixed}
 * @returns {string} jointed eMail address
 */
function createMail (name, server, domain, text) {
    
    var email = name+'@'+server+'.'+domain;
    var output = email;
    if (text === true) {
        output = '<a href="mailto:'+email+'">'+email+'</a>';
    } else if (text !== '')  {
        output = '<a href="mailto:'+email+'">'+text+'</a>';
    }
    document.write(output);
}

/**
 * Creates the local time string for the main.html template and outputs it.
 * 
 * @returns {void}
 */
function output_local_time (time_offset, dst) {
    // create campus specific date
    var date = new Date();
    var campus_date = new Date();
    campus_date.setTime(date.getTime() + time_offset * 1000);
    
    var hourse = campus_date.getHours();
    if (hourse < 10) hourse = " " + hourse;
    var minutes = campus_date.getMinutes();
    if (minutes < 10) minutes = "0" + minutes;
    var seconds = campus_date.getSeconds();
    if (seconds < 10) seconds = "0" + seconds;

    var output = hourse +':'+ minutes +':'+ seconds + ((dst == '1') ? ' DST' : '');
    
    if (document.getElementById("localtime")) document.getElementById("localtime").innerHTML = output;
    setTimeout('output_local_time('+time_offset+', '+dst+')', 1000);
}

