// JavaScript Document

startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
    if (navRoot) {
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
//          if (document.getElementById('logintype')) document.getElementById('logintype').style.visibility = 'hidden';
			  }
			  node.onmouseout=function() {
				  this.className=this.className.replace(" over", "");
//          if (document.getElementById('logintype')) document.getElementById('logintype').style.visibility = 'visible';
				}
			}
			for (j=0; j<node.childNodes.length; j++) {
				subnode = node.childNodes[j];
				if (subnode.nodeName=="UL") {
					for (k=0; k<subnode.childNodes.length; k++) {
						ssubnode = subnode.childNodes[k];
						if (ssubnode.nodeName=="LI") {
							ssubnode.onmouseover=function() {
								this.className+=" over";
                if (oActive) oActive.src = sHover;
						  }

						  ssubnode.onmouseout=function() {
							  this.className=this.className.replace(" over", "");
                if (oActive) oActive.src = sNormal;
							}
						}
					}
				}
			}
		}
    }

    navRoot = document.getElementById("subnav");
    if (navRoot) {
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";

			  }
			  node.onmouseout=function() {
				  this.className=this.className.replace(" over", "");
				}
			}
    }
    }
	}
}

window.onload=startList;

function doChange(self, whmail, kundesenter, partnerweb) {
  if (self.value == 'webmail') {
    if (whmail) {
      document.getElementById('whmailform').style.display = "block";
      document.getElementById('partnerform').style.display = "none";
      document.getElementById('kundesenterform').style.display = "none";
      document.getElementById('loginform').style.display = "none";
    }
    else {
      document.getElementById('rightlogon').action = '/perl/whmail/login';
      showLoginBox();
    }
  }

  if (self.value == 'whmail2') {
    document.getElementById('rightlogon').action = 'https://eu1.easierdays.com/login/validate';
    showLoginBox();
  }

  else if (self.value == 'kontrollpanel') {
    if (kundesenter) {
      document.getElementById('whmailform').style.display = "none";
      document.getElementById('partnerform').style.display = "none";
      document.getElementById('kundesenterform').style.display = "block";
      document.getElementById('loginform').style.display = "none";
    }

    else {
      document.getElementById('rightlogon').action = '/perl/kundesenter/login';
      showLoginBox();
    }
  }

  else if (self.value == 'partnerweb') {
    if (partnerweb) {
      document.getElementById('whmailform').style.display = "none";
      document.getElementById('partnerform').style.display = "block";
      document.getElementById('kundesenterform').style.display = "none";
      document.getElementById('loginform').style.display = "none";
    }

    else {
      document.getElementById('rightlogon').action = '/perl/partnerweb/login';
      showLoginBox();
    }
  }
}

function showLoginBox () {
  document.getElementById('loginform').style.display = "block";
  document.getElementById('partnerform').style.display = "none";
  document.getElementById('whmailform').style.display = "none";
  document.getElementById('kundesenterform').style.display = "none";
}

function fixLoginDropdown() {
  if (document.getElementById('logintype')) {
    var url = document.location.href;
    if ( (url.indexOf('/8/') != -1) || (url.indexOf('kundesenter') != -1)) {
      document.getElementById('logintype').value = 'kontrollpanel';
      document.getElementById('rightlogon').action = '/perl/kundesenter/login';
    }
    else if ( (url.indexOf('/84/') != -1) || (url.indexOf('partnerweb') != -1)) {
      document.getElementById('logintype').value = 'partnerweb';
      document.getElementById('rightlogon').action = '/perl/partnerweb/login';
    }
  }
}
