function externalLinks(){
	if(!document.getElementsByTagName)return;
	var anchors= document.getElementsByTagName("a");
	for(var i=0; i<anchors.length; i++){
		var anchor= anchors[i];
		if(anchor.getAttribute("href") && anchor.getAttribute("rel") == "ext")anchor.target= "_blank";
	}
}
function activateMenu(nav){
	/* currentStyle restricts the Javascript to IE only */
	if(document.all && document.getElementById(nav).currentStyle){
		var navroot=document.getElementById(nav);
		/* Get all the list items within the menu */
		var lis=navroot.getElementsByTagName("LI");
		for(i=0; i<lis.length; i++){
			/* If the LI has another menu level */
			if(lis[i].lastChild.tagName=="UL"){
				lis[i].onmouseover=function(){this.lastChild.style.display="block";}
				lis[i].onmouseout=function(){this.lastChild.style.display="none";}
			}
		}
	}
}
window.onload= function(){externalLinks();activateMenu('nav');}

function checkEMail(fieldName){
	var x= fieldName.value;
	var filter= /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(filter.test(x))return true;
	else return false;
}

function setCookie(name,value,exp,sec,path,domain){
	var date= new Date();
	var cookie_str, expires;
	cookie_str= name+"="+escape(value)+";";
	if(exp!=null){
		expires= new Date(date.getTime()+exp);
		cookie_str+= "expires="+expires.toGMTString()+";";
	}
	if(sec!=null) cookie_str+= "secure="+sec+";";
	if(path!=null) cookie_str+= "path="+path+";";
	if(domain!=null) cookie_str+= "domain="+domain+";";
	document.cookie= cookie_str;
	return getCookies(cookie_str);
}
function getCookies(cookie_str){
	var cookies= new Object();
	var cList, name, value;
	cList= cookie_str.split(";");  
	for(var i=0; i<cList.length; i++){
		name= cList[i].substring(0,cList[i].indexOf("="));
		value= unescape(cList[i].substring(cList[i].indexOf("=")+1));
		cookies[name]= value;
	}
	return cookies;
}
