﻿
 // open the client email with the specified address
function sendEmail(mailto)
{
var encodedEmail = encodedemail(mailto);

  // do the mailto: link
  location.href = "mailto:" + decodeEmail(encodedEmail);
}

function encodedemail(mailto)
{
if (mailto == "admin")
    { 
        var encodedEmail = "67696C65734073746461766964732D69742E636F2E756B"
    }
if (mailto == "stdavids")
    { 
        var encodedEmail = "6B696D6265726C65794073746461766964732D706F756C7472797465616D2E636F2E756B"
    }
if (mailto == "scitech")
    { 
        var encodedEmail = "726F622E6861727269736F6E40736369746563682D6C6162732E636F6D"
    }
return encodedEmail

}



// display the email address in the statusbar
function displayStatus(mailto)
{
var encodedEmail = encodedemail(mailto);
window.status = "mailto:" + decodeEmail(encodedEmail);
}

// clear the statusbar message
function clearStatus()
{
  window.status = "";
}

// return the decoded email address
function decodeEmail(encodedEmail)
{
  // The encodedEmail is a string that contains the email address.
  // Each character in the email address has been converted into 
  // a two digit number (hex / base16). This function converts the
  // series of numbers back into the real email address.

  // holds the decoded email address
  var email = "";

  // go through and decode the email address
  for (i=0; i < encodedEmail.length;)
  {
    // holds each letter (2 digits)
    var letter = "";
    letter = encodedEmail.charAt(i) + encodedEmail.charAt(i+1)

    // build the real email address
    email += String.fromCharCode(parseInt(letter,16));
    i += 2;
  }
  
  return email;
}

//
//Side Menu
//
function ToggleMenu(itemName)
{
//document.cookie="menuitem"+"="+itemName+";"
	var elm = document.getElementById(itemName);
	var i,others = document.getElementById('SectionMenu');
	for(i=0; i < others.childNodes.length; i++)
	{
		var other = others.childNodes[i];
		if ((other.className == 'MenuGroup') && (other != elm)) other.style.display='none';
	}
	if (elm.style.display == 'block') elm.style.display='none';
	else elm.style.display='block';
	return false;
}
function OpenMenuItem(subCat,section)
{
	var i,menuelms = document.getElementById('SectionMenu');
	for(i=0; i < menuelms.childNodes.length; i++)
	{
		var menuelm = menuelms.childNodes[i];
		if ((menuelm.className == 'MenuGroup') && (menuelm.id == 'SubCat'+subCat.toString()))
		{
			menuelm.style.display = 'block';
			for(j=0; j < menuelm.childNodes.length; j++)
			{
				var subelm = menuelm.childNodes[j];
				if ((subelm.className == 'MI') && (subelm.id == 'Section'+section.toString()))
				{
					subelm.style.className='MIS';
					break;
				}
			}
			break;
		}
	}
	return false;
}

//
//Top Menu
//
var menu=function(){
	var t=10,z=50,s=6,a;
	function dd(n){this.n=n; this.h=[]; this.c=[]}
	dd.prototype.init=function(p,c){
		a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0;
		for(i;i<l;i++){
			var h=s[i].parentNode; this.h[i]=h; this.c[i]=s[i];
			h.onmouseover=new Function(this.n+'.st('+i+',true)');
			h.onmouseout=new Function(this.n+'.st('+i+')');
		}
	}
	dd.prototype.st=function(x,f){
		var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0];
		clearInterval(c.t); c.style.overflow='hidden';
		if(f){
			p.className+=' '+a;
			if(!c.mh){c.style.display='block'; c.style.height=''; c.mh=c.offsetHeight; c.style.height=0}
			if(c.mh==c.offsetHeight){c.style.overflow='visible'}
			else{c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1)},t)}
		}else{p.className=p.className.replace(a,''); c.t=setInterval(function(){sl(c,-1)},t)}
	}
	function sl(c,f){
		var h=c.offsetHeight;
		if((h<=0&&f!=1)||(h>=c.mh&&f==1)){
			if(f==1){c.style.filter=''; c.style.opacity=1; c.style.overflow='visible'}
			clearInterval(c.t); return
		}
		var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s), o=h/c.mh;
		c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')';
		c.style.height=h+(d*f)+'px'
	}
	return{dd:dd}
} ();

        function toggleMe(a) {
            var e = document.getElementById(a);
            if (!e) return true;
            if (e.style.display == "none") {
                e.style.display = "block"
            } else {
                e.style.display = "none"
            }
        }