
/**
 * Function which checks a string against a regular expression (based on the given pattern type)
 * and returns either true or false
 * @param {String} type
 * @param {String} input
 * @return {Boolean}
 * @author Boye Oomens
 */
function isValidInput(type, input) {
	var patterns = {
		'email' : '^[_a-z0-9&+-]+(\\.[_a-z0-9&+-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,6})$',
		'postal' : '^([0-9]{4})([A-Z]{2})$',
		'date' : '^([1-9]|0[1-9]|[12][0-9]|3[01])[- /.]([1-9]|0[1-9]|1[012])[- /.](19[0-9]{2}|20[0-9]{2})$',
		'numeric' : '^[0-9]+$',
		'phone' : '^([a-z0-9 +()-/:,]{9,})$',
		'hexvalue' : '^#?([a-f0-9]{6}|[a-f0-9]{3})$',
		'url' : '^(https?:\\/\\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w \\.-]*)*\\/?$',
		'ip' : '^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'
	},		
	regex = new RegExp(patterns[type], 'i');
	
	return regex.test(input);
}
	
function toggleBox(szDivID, iState) { // 1 visible, 0 hidden
	if(document.layers) { //NN4+
		document.layers[szDivID].visibility = iState ? "show" : "hide";
	} else if(document.getElementById) { //gecko(NN6) + IE 5+
		var obj = document.getElementById(szDivID);
		obj.style.visibility = iState ? "visible" : "hidden";
	} else if(document.all) { // IE 4
		document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
	}
}

startList = function() {
   if (document.all&&document.getElementById) {
      navRoot = document.getElementById("nav");
      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;