

//Function to open pop up window
function NewWindow(url, w, h)
{

	if(w > screen.width || h > screen.width)
	{
		if(w > screen.width && h <= screen.height)
		{
			var nw = screen.width - 70;
			var nh = parseInt(h) + 40;
		}
		if(h > screen.height && w <= screen.width)
		{
			var nh = screen.height - 66;
			var nw = parseInt(w) + 36;
		}
		if(w > screen.width && h <= screen.height)
		{
			var nw = screen.width - 70;
			var nh = screen.height - 66;
		}

	   window.open(url, "_blank", "width=" + nw + ", height=" + nh + ", left=0, top=0, scrollbars=yes, resizeable=yes");
	}
	else
	{
		var nh = parseInt(h) + 34;
		var nw = parseInt(w) + 36;

		window.open(url, "_blank", "width=" + nw + ", height=" + nh + ", left=0, top=0, scrollbars=yes, resizeable=yes");
	}


}

//Function to open pop up window
function PhotoGalleryNewWindow(url, w, h)
{

	if(w > screen.width || h > screen.width)
	{
		if(w > screen.width && h <= screen.height)
		{
			var nw = screen.width - 70;
			var nh = parseInt(h) + 40;
		}
		if(h > screen.height && w <= screen.width)
		{
			var nh = screen.height - 66;
			var nw = parseInt(w) + 36;
		}
		if(w > screen.width && h <= screen.height)
		{
			var nw = screen.width - 70;
			var nh = screen.height - 66;
		}

	   window.open(url, "_blank", "width=" + nw + ", height=" + nh + ", left=0, top=0, scrollbars=yes, resizeable=yes");
	}
	else
	{
		var nh = parseInt(h) + 34;
		var nw = parseInt(w) + 36;

		window.open(url, "_blank", "width=" + nw + ", height=" + nh + ", left=0, top=0, scrollbars=yes, resizeable=yes");
	}


}

//Function to open link in main window
function openInMainWin(winLocation){
	window.opener.location.href = winLocation
	window.opener.focus();
	window.close();
}

function go()
{
	box = document.getElementById('nav');
	destination = box.options[box.selectedIndex].value;
	if (destination) location.href = destination;
}


//Function to open pop up window
function winOpener(theURL, winName, scrollbars, resizable, width, height) {
	
	winFeatures = 'left=' + (screen.availWidth-10-width)/2 + ',top=' + (screen.availHeight-30-height)/2 + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',width=' + width + ',height=' + height + ',toolbar=0,location=0,status=1,menubar=0'
  	window.open(theURL, winName, winFeatures);
}

//Function to hover button icon
function overIcon(iconItem){	

	iconItem.style.backgroundColor='#CCCCCC';
	iconItem.style.border = '#000000 1px solid';
}

//Function to moving off button icon
function outIcon(iconItem){
	iconItem.style.backgroundColor='#FFFFFF';
	iconItem.style.border = '#000000 1px solid';
}
		
function RightImageClick(date, name, email) 
{
	var message= date + ' Copyright, ' + name + ', All Rights Reserved.\n\nMaterial/Photos cannot be removed from this site without authorisation.\n\nPlease contact us with your request. Our email address is ' + email + '.';	

		oncontextmenu = function()
		{
			alert(message);
			return false;
		}
		
		if(document.layers) 
		{
		    window.captureEvents(Event.MOUSEDOWN);
		    window.onmousedown = function(e)
		    {
			if(e.target==document)
			{
				alert(message); 
				return false;
			}
		    }
		}
		else 
		{
		    document.onmousedown = function()
		    {
			return false
			alert(message); 
		    }
		}

		if (document.all) 
		{
			if (event.button ==2||event.button==3) 
			{
				alert(message); 
				return false; 
			} 
		}

		if (document.layers) 
		{ 
			if (e.which == 3) 
			{
				alert(message); 
				return false; 
			} 
		}
}

function RTEenabled()
{
	var browser = navigator.appName;
	var version = navigator.appVersion;
	var RTE;
	
	//***** Windows Internet Explorer *****
	
	if(version.indexOf("MSIE") >=0 && version.indexOf("Win") >= 0 && browser.indexOf("opera") == -1) 
	{
		if(version.indexOf("5.5") >=0)
		{
			RTE = "winIE";
		}
		else if(version.indexOf("6") >=0)
		{
			RTE = "winIE";
		}
		else
		{
			RTE = "false";
		}
	}	
	//***** Mozilla Firebird *****
	else if(browser.indexOf("Firebird")>=0)
	{
		if(version>="0.6.1")
		{
			RTE = "Gecko";
		}
		else
		{
			RTE = "false";
		}
	}	
	//***** Mozilla Firefox/Seamonkey/Netscape *****
	else if(browser.indexOf("Gecko")>=0 && browser.indexOf("Firebird")>=0)
	{
		if(version=="1.3" || version>="7.1")
		{
			RTE = "Gecko";
		}
		else
		{
			RTE = "false";
		}
	
	}
	//***** Mozilla Firefox 5.0
	else if(browser.indexOf("Netscape")>=0)
	{
		if(version.indexOf("5.0")>=0)
		{
			RTE = "Gecko";
		}
		
	}
	//***** Non RTE Enabled Browser *****
	else
	{
		RTE = "false";
	}

	return RTE;
	
}

function imgDate_onclick(loc) 
{
	window.open('/calendar/default.aspx?textbox=' + loc,'','width=270,height=210,left=270,top=180');
}


/* Menu */

activateMenu = function(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"){
            
                /* assign the function to the LI */
             	lis[i].onmouseover=function() {	
                
                   /* display the inner menu */
                   this.lastChild.style.display="block";
                }
                lis[i].onmouseout=function() {                       
                   this.lastChild.style.display="none";
                }
            }
        }
    }
}
window.onload= function(){
    /* pass the function the id of the top level UL */
    /* remove one, when only using one menu */
   activateMenu('nav');  
}

/* End Menu */

