﻿<!--

function confirmSubmitProfile(objElementID) {
var agree=confirm('Are you sure you want to submit your profile?');

    if (agree) {
        return true;
    }
    else {
        return false ;
    }
}


function toggle(id) 
{
    var state = document.getElementById(id).style.display;

    if (state == 'none') 
    {

        document.getElementById(id).style.display = 'block';
    } else 
    {

        document.getElementById(id).style.display = 'none';
    }
}


function ecmPopUpWindow(url, hWind, nWidth, nHeight, nScroll, nResize) {
 var popupwin,  cToolBar;
cToolBar = 'toolbar=0,location=0,directories=0,status=' + nResize + ',menubar=0,scrollbars=' + nScroll + ',resizable=' + nResize + ',width=' + nWidth + ',height=' + nHeight;
popupwin = window.open(url, hWind, cToolBar);
return popupwin;
}

// RADA - JS - API version 2.0
// Author: Ryan Moynan (NVisage)
// Last updated: 11-08-2008


// The class name of toggle objects which will be initially hidden
var toggleDivClassName = "contentArea";
// This controls how slowly the div initially starts moving.
// Lower values case a slower initial move speed. Must be > 1
var toggleDivSpeedMultiplier = 2;
// The delay between each move. 
var toggleDivDelay = 30;

// If you only want one toggle DIV to be open at any time, set this to true
var toggleDivOnlyOneOpen = false;

// An array to hold references to all toggleDiv objects on the page
var toggleDivs = new Array();
// Contains the IDs of divs currently being toggled, so you can't stop one mid-open or close
var togglingDivs = new Object();

var t;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;

//---------------------------------------------------------------->
//BEGIN: PAGE ONLOAD EVENT CALLS
//---------------------------------------------------------------->
window.onload=function() {

//Detect flash - global check
if(document.getElementById('Flash') != null)
{
flashDetect();
}


// sets the initial 
Set_panels();
//* The value at the end of the mouseover event is the time wait before the expand is executed
if(document.getElementById('home_latestBox_link') != null)
{
   obj2=document.getElementById('home_latestBox_link');
    //obj1.onclick=function() {TimeOut_expand_panel('home_tandpBox_content','open',1200);}

    obj2.onclick=function() {
        var d = document.getElementById('home_latestBox_content');
        if (d.style.visibility=="hidden") {
            TimeOut_expand_panel('home_latestBox_content','open',600);
        }
        else {
            TimeOut_expand_panel('home_latestBox_content','close',600);            
        }
    //obj2.onclick=function() {clearTimeout(t);}
    }
}
if(document.getElementById('home_latestBox_content_close') != null)
{
obj21=document.getElementById('home_latestBox_content_close');
obj21.onclick=function() { toggleDiv('home_latestBox_content','close'); }
}



if(document.getElementById('home_tandpBox_link') != null)
{
    obj1=document.getElementById('home_tandpBox_link');
    //obj1.onclick=function() {TimeOut_expand_panel('home_tandpBox_content','open',1200);}

    obj1.onclick=function() {
        var d = document.getElementById('home_tandpBox_content');
        if (d.style.visibility=="hidden") {
            TimeOut_expand_panel('home_tandpBox_content','open',600);
        }
        else {
            TimeOut_expand_panel('home_tandpBox_content','close',600);            
        }
    //obj1.onclick=function() {clearTimeout(t);}
    }
}
if(document.getElementById('home_tandpBox_content_close') != null)
{
obj12=document.getElementById('home_tandpBox_content_close');
obj12.onclick=function() { toggleDiv('home_tandpBox_content','close'); }
}


if(document.getElementById('home_AandPBox_link') != null)
{
    obj3=document.getElementById('home_AandPBox_link');
    //obj1.onclick=function() {TimeOut_expand_panel('home_AandPBox_content','open',1200);}

    obj3.onclick=function() {
        var d = document.getElementById('home_AandPBox_content');
        if (d.style.visibility=="hidden") {
            TimeOut_expand_panel('home_AandPBox_content','open',600);
        }
        else {
            TimeOut_expand_panel('home_AandPBox_content','close',600);            
        }
    //obj3.onclick=function() {clearTimeout(t);}
    }
}
if(document.getElementById('home_AandPBox_content_close') != null)
{
    obj32=document.getElementById('home_AandPBox_content_close');
    obj32.onclick=function(){toggleDiv('home_AandPBox_content','close'); }
}


if(document.getElementById('home_whatsOn_link') != null)
{
    obj4=document.getElementById('home_whatsOn_link');  
    //obj4.onclick=function() {TimeOut_expand_panel('home_whatsOn_content','open',1200);}

    obj4.onclick=function() {
        var d = document.getElementById('home_whatsOn_content');
        if (d.style.visibility=="hidden") {
            TimeOut_expand_panel('home_whatsOn_content','open',600);
        }
        else {
            TimeOut_expand_panel('home_whatsOn_content','close',600);            
        }
    //obj4.onclick=function() {clearTimeout(t);}
    }
}
if(document.getElementById('home_events_content_close') != null)
{
    obj42=document.getElementById('home_events_content_close');
    obj42.onclick=function(){toggleDiv('home_whatsOn_content','close'); }
}




// Global search box --------------------------------------/
if(document.getElementById('txtSearch') != null)
{
obj5=document.getElementById('txtSearch');
obj5.onclick=function() { clear_input_text('txtSearch','search...'); }
obj5.onblur=function() {  clear_input_text('txtSearch','search...'); }
}
// Profiles login box --------------------------------------/
if(document.getElementById('txtPRusername') != null)
{
obj6=document.getElementById('txtPRusername');
obj6.onclick=function() { clear_input_text('txtPRusername','USER NAME'); }
obj6.onblur=function() {  clear_input_text('txtPRusername','USER NAME'); }
}
if(document.getElementById('txtPRpassword') != null)
{
obj7=document.getElementById('txtPRpassword');
obj7.onclick=function() { clear_input_text('txtPRpassword','PASSWORD'); }
obj7.onblur=function() {  clear_input_text('txtPRpassword','PASSWORD'); }
}

}




//---------------------------------------------------------------->
//BEGIN: SMOOTH EXPAND \ RETRACT FUNCTIONS
//---------------------------------------------------------------->

// The initial function that handles the request to toggle a DIV
function toggleDiv(divId,action) {
    
    var sMainDivID  = divId;
    var sMainLinkID = sMainDivID.replace("_content","_link");
    
	var d = document.getElementById(divId);
	
	var h = document.getElementById(sMainLinkID);
	
	if (d==null || d.tagName!="DIV" || !d.offsetHeight || togglingDivs[divId]) { return; }

	d.style.overflow = "hidden";
	if (action=="open" || (typeof(action)=="undefined" && d.style.visibility=="hidden") ) {
	    if (readCookie(divId + "_panel") != 'selected'){
		    if (toggleDivOnlyOneOpen) {
			    setTimeout("closeAllToggleDivsExcept('"+divId+"')",5);
		    }
		    // open it
		    var originalHeight = readCookie(divId + "_height"); //d.offsetHeight;
		    var height = 1;
		    d.style.height = height+"px";
		    d.style.visibility = "visible";
		    d.style.position="static";
		    togglingDivs[divId] = true;
		    setTimeout("toggleObject('"+divId+"','open',"+originalHeight+","+height+")",toggleDivDelay);
		    h.className = "boxHeader selected";
		    createCookie(divId + "_panel",'selected',1);
		    
		    //if latest set overflow to auto so we can scroll
		    if (divId == "home_latestBox_content") {
		       
		       document.getElementById("scrollContent").style.overflow="hidden";
		      /*if(isIE){
		        document.getElementById("scrollContent").style.overflow='hidden';
		       }else{
		        document.getElementById("scrollContent").style.display="block";
		       }*/
		       
                
                document.getElementById("scrollContent").style.height="85px";
            }
		}
	}
	else if (action=="close" || (typeof(action)=="undefined" && d.style.visibility=="visible")) {
		// close it
		var originalHeight = d.offsetHeight;
		var height = originalHeight;
		togglingDivs[divId] = true;
		setTimeout("toggleObject('"+divId+"','close',"+originalHeight+","+height+")",toggleDivDelay);
		
		

		
		eraseCookie(divId + "_panel");
	}	
}


// This function closes all DIVs except the given ID, for use when only one DIV should be open at any time
function closeAllToggleDivsExcept(divId) {
	for (var i=0; toggleDivs!=null && i<toggleDivs.length; i++) {
		if (toggleDivs[i].id!=divId) {
			toggleDiv(toggleDivs[i].id,'close');
		}
	}
}

// The function that is called repeatedly until the toggle is done
function toggleObject(divId, openClose, originalHeight, height) { 

    var sMainDivID  = divId;
    var sMainLinkID = sMainDivID.replace("_content","_link");
    
	var d = document.getElementById(divId);
	var h = document.getElementById(sMainLinkID);

	if (d==null || d.tagName!="DIV") { return; }
	
	if (openClose=="open") {
		height = height * toggleDivSpeedMultiplier;
		if (height > originalHeight) {
			d.style.height = originalHeight+"px";
			delete togglingDivs[divId];
		}
		else {
			d.style.height = height+"px";
			setTimeout("toggleObject('"+divId+"','"+openClose+"',"+originalHeight+","+height+")",toggleDivDelay);
		}
	}
	else {
		height = height * (1/toggleDivSpeedMultiplier);
		if (height <= 1) {
			d.style.position = "absolute";
			d.style.visibility = "hidden";
			d.style.height = originalHeight+"px";
			delete togglingDivs[divId];
			h.className = "boxHeader";
		}
		else {
			d.style.height = height+"px";
			setTimeout("toggleObject('"+divId+"','"+openClose+"',"+originalHeight+","+height+")",toggleDivDelay);
		}
	}
}

// A function which is called onload of the window, to hide all the toggle divs initially. This is done
// so that non-JS browsers will see the divs rather than have them be hidden.
function hideToggleDivs() {
	var divs = document.getElementsByTagName("DIV");
	for (var i=0; divs!=null && i<divs.length; i++) {
		if (divs[i].className.indexOf(toggleDivClassName)>-1) {
			toggleDivs[toggleDivs.length] = divs[i];
			var s = divs[i].style;
			s.position="absolute";
			s.visibility="hidden";
		}
	}
}

// A general function to add an event handler
function addHandler(obj, evt, newhandler, captures) {
	if (obj.attachEvent) {
		obj.attachEvent('on' + evt, newhandler);
	}
	else if (obj.addEventListener) {
		obj.addEventListener(evt, newhandler, captures);
	}
	else {
		var oldhandler;
		if (oldhandler = obj['on' + evt]) {
			obj['on' + evt] = function() {
				oldhandler();
				newhandler();
			}
		}
		else {
			obj['on' + evt] = newhandler;
		}
	}
}

// Attach an onLoad handler to the window to initially hide all the toggle DIV objects.
// Only do it if sufficient JS capability is present in the browser
if (document.getElementById && document.getElementsByTagName) {
	addHandler(window,'load',hideToggleDivs,false);
}

function Set_panels()
{
    // collapse all home expandable layers and apply styles
 
   if(document.getElementById('home_latestBox_content') != null)
   {
        document.getElementById('home_latestBox_link').className = "boxHeader";      
        createCookie("home_latestBox_content_height",document.getElementById('home_latestBox_content').offsetHeight,1)
        eraseCookie("home_latestBox_content_panel");
   }
    
   if(document.getElementById('home_tandpBox_content') != null)
   {
        document.getElementById('home_tandpBox_link').className = "boxHeader";     
        createCookie("home_tandpBox_content_height",document.getElementById('home_tandpBox_content').offsetHeight,1)
        eraseCookie("home_tandpBox_content_panel");
   }

   if(document.getElementById('home_AandPBox_content') != null)
   {
        document.getElementById('home_AandPBox_link').className = "boxHeader";      
        createCookie("home_AandPBox_content_height",document.getElementById('home_AandPBox_content').offsetHeight,1)
        eraseCookie("home_AandPBox_content_panel");
   }

   if(document.getElementById('home_whatsOn_content') != null)
   {
        document.getElementById('home_whatsOn_link').className = "boxHeader"; 
        createCookie("home_whatsOn_content_height",document.getElementById('home_whatsOn_content').offsetHeight,1)
        eraseCookie("home_whatsOn_content_panel");
   }
        

        
}      

function TimeOut_expand_panel(sPanel,bExpand,nTime)
{
  // if no time is supplied set default half a second timeout
  if(nTime==''){
    nTime = 500;
  }
    // do we want to expand or collapse
    t = setTimeout("toggleDiv('" + sPanel + "','" + bExpand + "');",nTime); 
 
}



//---------------------------------------------------------------->
//BEGIN: COOKIE FUNCTIONS
//---------------------------------------------------------------->
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


//--------------------------------------------------------------------------->
//BEGIN: IMAGE ROLLOVER FUNCTIONS - (currently not used but there just incase)
//--------------------------------------------------------------------------->

function Rollover_image(sFieldID, sPath, sImg)
{ 
   document.getElementById(sFieldID).src=sPath + sImg;
}

function addLoadEvent(func)
{
var oldonload = window.onload;
	if (typeof window.onload != 'function')
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
		{
			oldonload();
			func();
		}
	}
}

function mangle()
{
    var links = document.getElementsByTagName("a");
	for (i = 0; i < links.length; i++)
	{
		if ( (links[i].className == "a_scramble_email") || (links[i].className == "a_scramble_email_rel") || (links[i].className == "a_scramble_email_rada"))
		{
			var rel = links[i].getAttribute("title");
			var params = rel.split(",");
			var email = null;
			var text = "contact us";
			
			if (params[0])
			{
				email = params[0] + "@";
			}
							
			if (params[2])
			{
				email += params[2];
			}
			else
			{
			    if (links[i].className == "a_scramble_email_rel") 
		        {
		            email += "radaenterprises.org"
		        }
		        if (links[i].className == "a_scramble_email_rada")
		        {
		            email += "rada.ac.uk"
		        }		        
			}
			
			if (params[1])
			{
				text = params[1];
			}
			else
			{
			    text = email;
			}
			
			links[i].setAttribute("href", 'mailto:' + email);
			links[i].setAttribute("title", text);
			links[i].innerHTML = text;
		}
	}
}

addLoadEvent(mangle);




-->