// Load jQuery
//google.load("jquery", "1.3");
//google.load("jqueryui", "1.5");

google.setOnLoadCallback(function() {
  $.fn.hoverClass = function(c) {
    return this.each(function(){
      $(this).hover(
        function() { $(this).addClass(c);  },
        function() { $(this).removeClass(c); }
      );
    });
  };

  $('#source').val(window.location.href);
  if (typeof(readyLoad) == "function") {
    readyLoad();
  }
});

var lang_index  = 1;
var lang_logout = "";
var lang_redirect = "";

function showMenu(id_menu) {
  var my_menu = document.getElementById(id_menu);
  if (my_menu.style.display == "none" || my_menu.style.display == "") {
    my_menu.style.display = "block";
  } else {
    my_menu.style.display = "none";
  }
}
function showDialog(title, content, redirect) {
  if (typeof(redirect) == "string") {
    //content += "<br/><br/>" + lang_redirect + '<br/><a href="' + redirect + '">' + redirect + '</a>.';
    content += "<br/><br/><span style='font-size:12px;font-weight:normal;'>" + lang_redirect + '</span>';
    $("#dialog").clone().html(content).attr("title", title).dialog();
    window.setTimeout('closeDialog("' + redirect + '")', 2000);
  } else {
    $("#dialog").clone().html(content).attr("title", title).dialog({buttons:{"Close":function(){$(this).dialog("close");}}});
  }
}
function closeDialog(redirect) {
  $(this).dialog("close");
  if (typeof(redirect) == "string") {
    window.location.replace(redirect);
  }
}
function getValLen(val) {
  return val.replace(/\s/g, '').replace(/[^\x00-\xff]/g,'***').length;
}
function ifValNotEmpty(val) {
  return 1 < getValLen(val);
}
function ifValLenRange(val, min, max) {
  var l = getValLen(val);
  var o = true;
  if ((l < min) || (max && l > max)) {o = false;}
  return o;
}
function ifValIntRange(val, min, max) {
  var n = parseInt(val);
  var o = true;
  if ((n < min) || (max && n > max)) {o = false;}
  return o;
}
function ifValEqu(v1, v2) {
  return v1 == v2;
}
function ifValIsEmail(val) {
  return /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(val);
}
