﻿

// Email obfuscator script 2.1 by Tim Williams, University of Arizona
// Random encryption key feature by Andrew Moulden, Site Engineering Ltd
// This code is freeware provided these four comment lines remain intact
// A wizard to generate this code is at http://www.jottings.com/obfuscator/
function displayEmail() { 
  coded = "qpeGN@qpeGNxyyB2pe.Rpz"
  key = "G9jwMkFNOdYxTJzB7oDStyXfquVH1ngA4Usc5Z0paPKLbrQhv36eWEmi2RIC8l"
  shift=coded.length
  link=""
  for (i=0; i<coded.length; i++) {
    if (key.indexOf(coded.charAt(i))==-1) {
      ltr = coded.charAt(i)
      link += (ltr)
    }
    else {     
      ltr = (key.indexOf(coded.charAt(i))-shift+key.length) % key.length
      link += (key.charAt(ltr))
    }
  }
document.write("<a href='mailto:"+link+"'>"+link+"</a>")
}

// For projects ("13 Card Game")
function toggleClassDiagram() {
    var obj = document.getElementById("classDiagram");
    
    if(obj.style.visibility == "hidden" || obj.style.visibility == "") {
        document.getElementById("classDiagram").style.visibility = "visible";
    } else {    
        document.getElementById("classDiagram").style.visibility = "hidden";
    }
}

// Custom hit log (JS for faster page load times)
function hit() {
    // quit if this function has already been called
    if (arguments.callee.done) return;  
    // flag this function so we don't do the same thing twice
    arguments.callee.done = true;    

	var ref = (document.referrer == "") ? 'unknown' : document.referrer;		
	var query = 'web.php?web=' + escape(ref) + '&data=' + escape(location.pathname);
	
	document.getElementById('web').innerHTML = '<img height="1" width="1" style="visibility:hidden;" src="' + query + '">';
}

// Fire hit when DOM is loaded
// for Mozilla 
if (document.addEventListener) {
   document.addEventListener("DOMContentLoaded", hit, false);
}

window.onload = hit;