		function initpop()
		{
			var p=document.getElementById('prev');
			if(!p){return;}		
			p.onclick=function()
			{
				var ga=document.getElementById('gallery');
				if(!ga){return;}
				var newp=document.createElement('div');
				newp.id='popup';
				var newimg=document.createElement('img');
				var oldsrc=p.getElementsByTagName('img')[0].src;
				newimg.src=oldsrc.replace(/pr/gi,'la');
				newa=document.createElement('a');
				newa.appendChild(newimg);
				newa.href='#';
				newa.title='click to close picture';
				newp.appendChild(newa);
				ga.appendChild(newp);
				newa.onclick=function()
				{
					this.parentNode.removeChild(this);
					return false;
				}
				return false;
			}
		}
		function rollmagic()
		{
			var bodyid=document.getElementsByTagName('body')[0].id;
			var n=document.getElementById('nav');
			var n1=document.getElementById('n1');
			var n2=document.getElementById('n2');
			var n3=document.getElementById('n3');
			switch(bodyid)
			{
				case 'index':
					n3.onmouseover=function()
					{
						n.style.background='top right url(img/gallery_con_rollover.gif)';
					}
					n3.onmouseout=function()
					{
						n.style.background='top right url(img/gallery_default.gif)';
					}
					n2.onmouseover=function()
					{
						n.style.background='top right url(img/gallery_comm_rollover.gif)';
					}
					n2.onmouseout=function()
					{
						n.style.background='top right url(img/gallery_default.gif)';
					}
				break;
				case 'comms':
					n1.onmouseover=function()
					{
						n.style.background='top right url(img/comm_gallery_rollover.gif)';
					}
					n1.onmouseout=function()
					{
						n.style.background='top right url(img/comm_default.gif)';
					}
					n3.onmouseover=function()
					{
						n.style.background='top right url(img/comm_contact_rollover.gif)';
					}
					n3.onmouseout=function()
					{
						n.style.background='top right url(img/comm_default.gif)';
					}
				break;
				case 'contact':
					n1.onmouseover=function()
					{
						n.style.background='top right url(img/contact_gallery_rollover.gif)';
					}
					n1.onmouseout=function()
					{
						n.style.background='top right url(img/contact_default.gif)';
					}
					n2.onmouseover=function()
					{
						n.style.background='top right url(img/contact_comm_rollover.gif)';
					}
					n2.onmouseout=function()
					{
						n.style.background='top right url(img/contact_default.gif)';
					}
				break;
			}
		}
		window.onload=function()
		{
			initpop();
			rollmagic();			
		}

