/*
  Functions provided by MacroMedia Dreamweaver
*/

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}


/*
  A set of functions that help protect email addresses
  from spam-bots. Instead of using the email address directly, the 
  encoded value is stored in the html and decoded when required.
*/

// open the client email with the specified address
function sendEmail(encodedEmail,parms)
{
  // do the mailto: link
  location.href = "mailto:" + decodeEmail(encodedEmail) + parms;
}

// display the email address in the statusbar
function displayStatus(encodedEmail)
{
  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)
    letter = encodedEmail.charAt(i)
    if (letter == "A"){
    letter = "@";
}
    else if (letter == "@"){
    letter = "A";
}
    else if (letter == "s"){
    letter = "x";
}
    else if (letter == "i"){
    letter = "g";
}
    else if (letter == "n"){
    letter = "a";
}
    else if (letter == "f"){
    letter = "t";
}
    else if (letter == "o"){
    letter = "e";
}
    else if (letter == "g"){
    letter = "i";
}
    else if (letter == "a"){
    letter = "n";
}
    else if (letter == "t"){
    letter = "f";
}
    else if (letter == "e"){
    letter = "o";
}
    else if (letter == "x"){
    letter = "s";
}

    // build the real email address
    //email += String.fromCharCode(parseInt(letter,16));
    //i += 2;
    email += letter;
    i += 1;
  }
  
  return email;
}

