function obf_email(coded,key,elementID)
{
    //NOTE: go to http://www.jottings.com/obfuscator/ and generate the coded and key strings

    // 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/
  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))
    }
  }
  var foundElement = document.getElementById(elementID);
  if(foundElement!==null)
  {
    foundElement.innerHTML="<a href='mailto:"+link+"'>"+link+"</a>";
  }
}

function linkTargetExternalToBlank()
{
    var anchors = document.getElementsByTagName("a");
    for (var i=0; i<anchors.length; i++)
    {
        if((anchors[i].href!='') && anchors[i].rel == "external")
        {
            anchors[i].target = "_blank";
        }
    }
}

function linkEventCustomAddThisToolbox(elID){
    var el=$('#'+elID).get(0);
    if(el.style.display==='block'){
        fadeCustomAddThisToolbox(elID,'out');
    }else{
        fadeCustomAddThisToolbox(elID,'in');
    }
}

function fadeCustomAddThisToolbox(elName,type){
    if(type==='in'){
        $('#'+elName).fadeTo('fast',1,function(){
            this.style.display='block';
            if(this.fadeOutTimer!==undefined){
                clearTimeout ( this.fadeOutTimer );
            }
            this.fadeOutTimer=setTimeout("fadeCustomAddThisToolbox('"+elName+"','out')",2000);
        });

    }else{
        $('#'+elName).fadeTo('fast',0,function(){this.style.display='none'});
    }
}

function prepareCustomAddThisToolbox(elName){
    var tbx = document.getElementById(elName);
    if(tbx!==null)
    {
        var innHTML = '<div class="addThisContainer">';
        svcs = {
            twitter: 'Tweet This',
            facebook: 'Send to Facebook',
            email: 'Email a Friend',
            google: 'Send to Google',
            digg:'Digg',
            delicious:'Delicious',
            stumbleupon:'StumbleUpon',
            favorites:'Save to Favorites'
        };

        var url = window.location.href;
        for (var s in svcs) {

             innHTML += '<a class="addthis_button_'+s+'" addthis:url="'+url+'" title="'+svcs[s]+'"></a>';
        }
        tbx.innerHTML = innHTML+'</div>';
        addthis.toolbox("#"+elName);

        $('#'+elName).mouseenter(
            function(){
                if(this.fadeOutTimer!==undefined){
                    clearTimeout ( this.fadeOutTimer );
                }
            }
        );
        $('#'+elName).mouseleave(
            function(){
                if(this.fadeOutTimer!==undefined){
                    clearTimeout ( this.fadeOutTimer );
                }
                this.fadeOutTimer=setTimeout("fadeCustomAddThisToolbox('"+elName+"','out')",2000);
            }
        );
    }
}

$(function() {
    //replace all links with rel="external" to target blank (validation replacement for strict mode)
    linkTargetExternalToBlank();

    //email in privacy policy.
    obf_email("ZCZiCzd@zJpPi2UzCUJzod.62Z","IS7gydtAJPUYcEkvxGlzfVmDeiRXBqhoWMj95N6FOsK3anw1Z4CpH0QrT28Lub","obf_email_privmem");

});
