function redirect(url)  {
  window.location.href=url;
}
var activeToolTipId = null;
var activeFlagId = null;

function showTooltip(toolTipId,flagId)
{
  if( activeToolTipId != null) {
    $("#" + activeToolTipId).fadeOut(600); 
  }
  if( activeFlagId != null) {
    $("#" + activeFlagId).fadeIn(600); 
  }
  $("#" + toolTipId).fadeIn(600); 
  $("#" + flagId).fadeOut(600); 
  activeToolTipId = toolTipId;
  activeFlagId = flagId;
}

function hideTooltip(toolTipId,flagId)
{
  $("#" + toolTipId).fadeOut(300); 
  $("#" + flagId).fadeIn(600); 
  activeToolTipId = null;
  activeFlagId = nullse;
}


var langCookieName = "userLanguage";

function getLangFromCookie() 
{ 
  return getCookieValue(langCookieName );
}

function setLangToCookie(lang) 
{ 
  document.cookie = langCookieName + "=" + lang + "; expires=Thu, 13 Sep 3007 14:07:07 GMT; path=/";
}

function getCookieValue(name) 
{
    if(typeof (name)=="undefined" ) return "";
    var cookie = " " + document.cookie;
    var search = " " + name + "=";
    var setStr = null;
    var offset = 0;
    var end = 0;
    if (cookie.length > 0) 
    {
        offset = cookie.indexOf(search);
        if (offset != -1) 
        {
            offset += search.length;
            end = cookie.indexOf(";", offset)
            if (end == -1) end = cookie.length;
            setStr = unescape(cookie.substring(offset, end));
        }
    }
    return setStr;
}

var input_labels = [];

$(document).ready(function() {

    // setup getintouch panel

    $("#getintouch-toggle").click(function () {
    $("#getintouch-content").slideToggle(400);
	return false; });

    initInputLabel("search-input");
	
});

function initInputLabel(id) {
    if( input_labels[id] == null ) {
      input_labels[id] = $("#" + id).val();
    }
    $("#" + id).focus(function() {
      if ($("#" + id).val() == input_labels[id] ) {
        $("#" + id).val('');
      }
    });
    $("#" + id).blur(function() {
      if ($("#" + id).val() == '') {
        $("#" + id).val(input_labels[id]);
      }
    });
}

