﻿function changeColor(menuid, linkid) {
    var links = document.getElementById(menuid).getElementsByTagName("A");
    for (i = 0; i < links.length; i++) {
        links[i].style.color = "#ffffff";
    }
    if (linkid.indexOf("Home") != -1) {
        document.getElementById(linkid).style.color = "#c56d66";
        document.getElementById(menuid).style.backgroundColor = "#932219";
    }
    if (linkid.indexOf("AboutUs") != -1) {
        document.getElementById(linkid).style.color = "#f1a179";
        document.getElementById(menuid).style.backgroundColor = "#e86728";
    }
    else if (linkid.indexOf("Projects") != -1) {
        document.getElementById(linkid).style.color = "#87c5bb";
        document.getElementById(menuid).style.backgroundColor = "#55a497";
    }
    else if (linkid.indexOf("Publications") != -1) {
        document.getElementById(linkid).style.color = "#9dbae8";
        document.getElementById(menuid).style.backgroundColor = "#5276af";
    }
    else if (linkid.indexOf("Press") != -1) {
        document.getElementById(linkid).style.color = "#f9c4c7";
        document.getElementById(menuid).style.backgroundColor = "#dd9296";
    }
    else if (linkid.indexOf("Funding") != -1) {
        document.getElementById(linkid).style.color = "#a288bd";
        document.getElementById(menuid).style.backgroundColor = "#68468b";
    }
    else if (linkid.indexOf("Contact") != -1) {
        document.getElementById(linkid).style.color = "#adedfa";
        document.getElementById(menuid).style.backgroundColor = "#74c3d4";
    }
    else if (linkid.indexOf("Links") != -1) {
        document.getElementById(linkid).style.color = "#c9d379";
        document.getElementById(menuid).style.backgroundColor = "#a1b028";
    }
}

function pingpong(prefix, domain, topdomain) {
    var suffix;
    if (topdomain == 1)
        suffix = "se";
    else if (topdomain == 2)
        suffix = "edu";
    email = prefix + "@" + domain + "." + suffix;
    document.write("<a href=\"mailto:"+email+"\">"+email+"</a>");
}

