function showObject(div_name) {
    var dS = document.getElementById(div_name);    
    dS.style.display = 'inline';
}

function hideObject(div_name) {    
    var dS = document.getElementById(div_name);    
    dS.style.display = 'none';
}

function menus_init() { 
     if (document.all&&document.getElementById) { 
          menuList = document.getElementsByTagName("UL"); 
          if (menuList.length > 0) 
          { 
               for (x=0; x<menuList.length; x++) 
               { 
                    menuRoot = menuList[x]; 
                    for (i=0; i<menuRoot.childNodes.length; i++) { 
                         menuNode = menuRoot.childNodes[i]; 
                         if (menuNode.nodeName=="LI") { 
                              if (menuNode.className == "dropdown") 
                              { 
                                   menuNode.onmouseover=function() { 
                                        this.className+=" over"; 
                                   } 
                                   menuNode.onmouseout=function() { 
                                        this.className=this.className.replace(" over", ""); 
                                   } 
                              } 
                         } 
                    } 
               } 
          } 
     } 
} 
addEvent(window, "load", menus_init); 
 
// scott andrew (www.scottandrew.com) wrote this function. thanks, scott! 
// adds an eventListener for browsers which support it. 
function addEvent(obj, evType, fn){ 
  if (obj.addEventListener){ 
    obj.addEventListener(evType, fn, true); 
    return true; 
  } else if (obj.attachEvent){ 
     var r = obj.attachEvent("on"+evType, fn); 
    return r; 
  } else { 
     return false; 
  } 
}

function checkDomainForm(form) {
	
	var theForm = document.getElementById(form);
	
	if(theForm.ddomain.value == '') {
		alert('Vul een domeinnaam met extensie (.nl, .com...) in om deze te kunnen checken\n');
	} else { 
		theForm.submit();
	}
}
function explodeArray(theArray,delimiter) {
	tempArray=new Array(1);
	var Count=0;
	var tempstring=new String(theArray);

	while (tempstring.indexOf(delimiter)>0) {
		tempArray[Count]=tempstring.substr(0,tempstring.indexOf(delimiter));
		tempstring=tempstring.substr(tempstring.indexOf(delimiter)+1,tempstring.length-tempstring.indexOf(delimiter)+1);
		Count=Count+1
	}

	tempArray[Count]=tempstring;
	return tempArray;
} 



function submitWebmail(locale) {

	var domain = this.explodeArray(document.getElementById('imapuser').value, '@');
	if(domain[1]) {
		document.getElementById('webmailForm').action = 'http://webmail.'+domain[1]+'/horde/imp/redirect.php';
		document.getElementById('webmailForm').submit();
	} else {
		if(locale == 'en_UK') {
			alert('Please fill in your complete/valid emailaddress and your password to login.');
		} else {
			alert('Vul uw volledige e-mailadres in en uw wachtwoord om in te loggen.');
		}
	}

}

function submitCP(locale) {
	var domain = document.getElementById('domain_name').value;
	if(domain) {
		document.getElementById('controlPanel').action = 'https://'+domain+':8443/login_up.php3';
		document.getElementById('controlPanel').submit();
	} else {
		if(locale == 'en_UK') {
			alert('Please fill in a valid domain name.');
		} else {
			alert('Vul een geldige domeinnaam in.');
		}
	}
}


