function parentroll()
{
	var d=document.getElementById('mn');
	if(d)
	{
		var lis=d.getElementsByTagName('li');

		for(var i=0;i<lis.length;i++)
		{
			lis[i].onmouseover=function(){document.getElementById('metanav').className=this.id;}
			lis[i].onmouseout=function(){document.getElementById('metanav').className='mn_'+document.body.id;}
		}	
	}
	document.getElementById('metanav').className='mn_'+document.body.id;
}
function externallinks()
{
	var c=document.getElementById('content');
	if(c)
	{
		var ls=c.getElementsByTagName('a');
		for(var i=0;i<ls.length;i++){
			if(ls[i].getAttribute('rel')=='external')
			{
//				ls[i].className+=ls[i].className?' extlink':'extlink';
				ls[i].title+='(opens in new window)';
				ls[i].onclick=function(){window.open(this.href);return false}
			}
		}
	}
}

function peekaboo(){
	var sp=document.getElementById('specials');
	var co=document.getElementById('content');
	if(sp && co)
	{
		var newp=document.createElement('p');
		var newa=document.createElement('a');
		newa.href="#";
		newa.onclick=function()
		{
			if(sp.style.display!='none')
			{
				sp.style.display='none';
				this.firstChild.nodeValue='<Show Side Bar';
				co.style.marginRight=0;
			} else {
				sp.style.display='block';
				this.firstChild.nodeValue='Hide Side Bar>';
				co.style.marginRight='14em';
			}

		}	
		newa.appendChild(document.createTextNode('Hide Side Bar>'));
		newp.appendChild(newa);
		newp.className='skip';
		co.insertBefore(newp,co.firstChild);
	}
}

		// validates form
		function validate(f){
			var errorlist='';
			var man=document.getElementById('mandatory').value.split(',');
			for (var i=0;i<man.length;i++){
				if (document.getElementById(man[i]).value=='')
				{
					document.getElementById(man[i]).style.background='#f99';
					errorlist+='<li>Please enter a '+man[i]+'</li>';
				}
			}
			if (!isEmailAddr(document.getElementById('email').value))
			{
				document.getElementById('email').style.background='#f99';
				errorlist+='<li>Your email seems to be invalid</li>';
			}
			if(errorlist=='')
			{
				return true;
			} else {
				var errmsg='<h3><a id="errorheader">I encountered the following errors:</a></h3>';
				errmsg+='<ul>'+errorlist+'</ul>';
				document.getElementById('error').innerHTML=errmsg;
				document.getElementById('errorheader').focus();
				return false;
			}
		}
		function isEmailAddr(str) 
		{
		    return str.match(/^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/);
		}

window.onload=function(){
	if(!document.getElementById && !document.createTextNode){return;}
//	parentroll();
	externallinks();
//	peekaboo();
}

