/*
  This function helps protect the email address from the evil spam-bots that scan 
  web pages for email addresses. Instead of using the email address directly, the 
  encoded value is stored in the html and decoded when required.
*/
function sendEmail(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 email address and displays the 
  // email client with the mailto: protocol.

  // 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;
  }

  // do the mailto: link
  location.href = "mailto:" + email;
}

function openWin(url, name, w, h, resize, scrolls, tool) {
	if (tool == "") tool = "no";
	var popupWin = window.open(url, name, "width=" + w + ",height=" + h + ",history=yes,resizable=" + resize + ",status=no,scrollbars=" + scrolls + ",menubar=no,toolbar=" + tool);
}

function checkBrowser() {
    if ($.browser.msie && $.browser.version.substr(0, 1) < 7) {
        //alert($.browser.version);
        var msg = "Questo sito non è compatibile con il tuo browser. Ti consigliamo di aggiornarlo all'ultima versione disponibile." +
			"<br/><b>» <a href=\"http://www.microsoft.com/italy/windows/internet-explorer/worldwide-sites.aspx\" target=\"_blank\">Aggiorna il browser</a> «</b>";

        var a = $("<div id=\"notification\"></div>").html(msg)
        a.css({ 'background': '#ffffcc', 'border': '2px dotted #fff', 'width': '100%', 'height': '40px', 'line-height': '20px', 'padding': '8px 0px', 'z-index': '9999', 'text-align': 'center', 'font': '14px Verdana,Arial' });
        $("body").prepend(a);
    }
}
