/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		education_over = newImage("images_home/education.jpg");
		sustainable_fuel_over = newImage("images_home/sustainable-fuel.jpg");
		urban_over = newImage("images_home/urban.jpg");
		preloadFlag = true;
		startup();
	}
}



function fadeIn(id, startfade, endfade)
	{
	timer = 0;
	if (startfade < endfade)
		{

		for (i = startfade; i <= endfade; i++)
			{
			setTimeout("elementOpacity(" + i + ",'"+ id + "')", (timer * 20));
			timer++;
			}
		}
	};

function elementOpacity(opacity, id)
	{
	var el = document.getElementById(id).style;
	el.opacity = (opacity / 100);
	el.MozOpacity = (opacity / 100);
	el.KhtmlOpacity = (opacity / 100);
	el.filter = "alpha(opacity=" + opacity + ")";
	};
	
var ids=new Array('urbanDiv','educationDiv','sustainableDiv','projDiv','unHome','unServ','unMemb','unAbout','unNews','unFound');

function startup() {
	showdiv('grContainer');
	fadeIn('grContainer', 0, '99.99');
}

function switchid(id, fade){
	hideallids();
	document.getElementById(id).style.display = 'block';
	if(fade=="fade") {
	fadeIn(id, '0', '60');
	}
	else elementOpacity(100,id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
		elementOpacity(0,id);
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		/* if (getElementById(id).style.display ! ('none'))
			{
			document.getElementById(id).style.display = 'none';
			}
		else */
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function underline(width,id)
{
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		/* if (getElementById(id).style.display ! ('none'))
			{
			document.getElementById(id).style.display = 'none';
			}
		else */
		document.getElementById(id).style.display = 'block';
		document.getElementById(id).style.width = width;
		elementOpacity(100,id);
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}


//Contents for menu 1
var urbMenu=new Array()
urbMenu[0]='<a href="http://www.ssrdinternational.com/urban.html"><img src="images_home/urban.jpg" border="0"/></a>'

var edMenu=new Array()
edMenu[0]='<a href="http://www.ssrdinternational.com/education.html"><img src="images_home/education.jpg" border="0""/></a>'

var susMenu=new Array()
susMenu[0]='<a href="http://www.ssrdinternational.com/sustainable.html"><img src="images_home/sustainable-fuel.jpg" border="0"/></a>'

var projMenu=new Array()
projMenu[0]='<a href="http://www.ssrdinternational.com/sustainable.html">sustainable fuels</a>'
projMenu[1]='<a href="http://www.ssrdinternational.com/education.html">education</a>'
projMenu[2]='<a href="http://www.ssrdinternational.com/urban.html">urban sustainability</a>'

/*
var urban=new Array()
urban[0]='<a href="http://www.ssrdinternational.com/urban.html"><img src="images_home/urban.jpg" alt="urban sustainability" border="0" /></a>'
urban[1]='<a href="http://www.ssrdinternational.com/urban.html">urban sustainability</a>'
*/

var uM=new Array()
uM[0]='&nbsp;'

var menuwidth='165px' //default menu width
var menubgcolor='white'  //menu bgcolor
var disappeardelay=300  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editing needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

/* if (ie4||ns6) {
document.write('<div id="urbanDiv" class="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';opacity:0; filter:alpha(opacity = 0);background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')
document.write('<div id="educationDiv" class="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';opacity:0; filter:alpha(opacity = 0);background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')
document.write('<div id="sustainableDiv" class="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';opacity:0; filter:alpha(opacity = 0);background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

}*/

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth, whichdiv, fade){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.display=="none" || e.type=="mouseover")
 {switchid(whichdiv, fade);
 }
else if (e.type=="click")
obj.display="none"
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth, whichdiv, fade){
if (window.event) event.cancelBubble=true;
else if (e.stopPropagation) e.stopPropagation();
if (typeof delayhide!="undefined")
clearTimeout(delayhide);
dropmenuobj=document.getElementById? document.getElementById(whichdiv) : whichdiv;
populatemenu(menucontents);

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth, whichdiv, fade)

dropmenuobj.x=getposOffset(obj, "left");
dropmenuobj.y=getposOffset(obj, "top");
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px";
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px";
}
return clickreturnvalue();
}

function clickreturnvalue(){
if (ie4||ns6) return false;
else return true;
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.display="none"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(whichdiv)
{
fadeIn(whichdiv,60,'99.99'); 
if (typeof delayhide!="undefined")
clearTimeout(delayhide);
if (hidemenu_onclick=="yes")
document.onclick=hidemenu;
}
