function Home() 
{
  history.go(0);
}
var currentID = "none";
var busy = false;
function Clicked(what) 
{
  if (busy)
    return;
  var theID = '#' + what.id;
  Activate(theID);
  if (currentID != "none") 
  {
    Deactivate(currentID);
    HideTab(currentID + "Tab", theID + "Tab");
  }
  else
    ShowTab(theID+"Tab");
  currentID = theID;
}
var hoverID = "none";
var normalColor = "none";
function MouseOver(what) 
{
  hoverID = '#' + what.id;
  normalColor = $(hoverID).css("color");
  $(hoverID).css("color", "#fcf204");
  $(hoverID).css("cursor", "pointer");
}
function MouseOut(what) 
{
  if (currentID != hoverID)
    $(hoverID).css("color", normalColor);
  $(hoverID).css("cursor", "default");
}
function ShowTab(theID) {
  busy = true;
  $(theID).show("drop", { direction: "up", easing: "easeInOutBounce" }, 1400,
    function () { FadeInText(theID); });
}
function FadeInText(theID) 
{
  busy = false;
  var textID = theID + "Text";
  $(textID).fadeIn(1000);
}
function HideTab(hideID, showID) {
  busy = true;
  $(hideID).contents().find(".loginText").val('');
  $(hideID).contents().find(".loginTextWide").val('');
  $(hideID).contents().find(".magic").html(''); var textID = hideID + "Text";
  $(textID).fadeOut(600,
    function () { HideTextBox(hideID, showID); });
}
function HideTextBox(hideID, showID) 
{
  $(hideID).hide("drop", { direction: "up" }, 1200,
    function () { ShowTab(showID); });
}
function Activate(linkID) 
{
  $(linkID).css("color", "#fcf204");
}
function Deactivate(linkID) 
{
  $(linkID).css("color", normalColor);
}
function Login() 
{
  var username = $('#clientName').val();
  var password = $('#clientPassword').val();
  var request = "ValidatePassword.php?u=" + username + "&p=" + password;
  $.get(request, function (data) {
    $('#validate').val(data);
    AjaxReturn(data);
  });
}
function AjaxReturn(data) 
{
  if (data.indexOf('url:') == 0) 
  {
    var url = data.substring(4);
    var minutes = new Date();
    minutes = minutes / 60000;
    var min = parseInt(minutes);
    var bfr = '<a href="' + url + '?m=' + min + '" target="_blank">Access your site</a>';
    $('#loginInfo').html(bfr);
  }
  else
    $('#loginInfo').html(data);
}

function Email()
{
  var contactName = $('#contactName').val();
  var contactEmail = $('#contactEmail').val();
  var message = $('#emailMessage').val();
  var request = "http://www.entiro.com/wf_sendmail.php";
  $.get(request, { name: contactName, email: contactEmail, message: message },
   function (data) {
     $('#emailRtn').html(data);
   });
   // $('#emailRtn').html("We will get back to you - thank-you.");
  }

function PageWidth() 
{
  var width = 0;
  if (typeof (window.innerWidth) == 'number')
    width = window.innerWidth;
  else if (document.documentElement && document.documentElement.clientWidth)
    width = document.documentElement.clientWidth;
  else if (document.body && document.body.clientWidth)
    width = document.body.clientWidth;
  return width;
}
function PageHeight() {
  var height = 0;
  if (typeof (window.innerHeight) == 'number')
    height = window.innerHeight;
  else if (document.documentElement && document.documentElement.clientHeight)
    height = document.documentElement.clientHeight;
  else if (document.body && document.body.clientHeight)
    height = document.body.clientHeight;
  return height;
} 

