$(document).ready(function () {
  $("#DocRel").show();
  if ($("#CorrectionValues").size()) {
    $("#Sidenotes").hide();
    $("#CorrectionValues a").tooltip({
      bodyHandler: function () {
        return $($(this).attr("href")).html()
      },
      showURL: false,
      left: -180
    });
    $("#CorrectionValues a").bind({
      click: function () {
        return false
      }
    })
  }
  


  if ($.browser.msie && $.browser.version == 6) {
    $("#Hero").css("position", "relative")
  }
  
  jQuery("#HeroEnlarge a").bind({
    click: function () {}
  });
  
  jQuery("#DocRel").show();
  
  var b = null;
  if (document.referrer && (document.referrer.search("misterspex.de") > 0 || document.referrer.search("misterspex.zz") > 0)) {
    $("#backToOverview span").text("Zurück");
    $("#backToOverview").attr("title", "Zurück");
    $("#backToOverview").click(function () {
      history.back()
    })
  } else {
    var c = window.location.pathname.split("/");
    var b = null;
    if (c[1] == "brillen" || c[1] == "sonnenbrillen" || c[1] == "sportbrillen") {
      b = $("#Brand .figure a").attr("href")
    } else {
      if (c[1] == "kontaktlinsen") {
        b = "/search.html?FilterSearch=" + URLEncode($("#Brand > dl > dd").html())
      }
    }
    if (b != null) {
      $("#backToOverview span").text("Zur Übersicht");
      $("#backToOverview").click(function () {
        window.location.href = b
      })
    } else {
      $("#backToOverview").click(function () {
        history.back()
      })
    }
  }
});

function URLEncode(g) {
  var c = "";
  var a = 0;
  g = g.toString();
  var f = /(^[a-zA-Z0-9_.]*)/;
  while (a < g.length) {
    var d = f.exec(g.substr(a));
    if (d != null && d.length > 1 && d[1] != "") {
      c += d[1];
      a += d[1].length
    } else {
      if (g[a] == " ") {
        c += "+"
      } else {
        var b = g.charCodeAt(a);
        var e = b.toString(16);
        c += "%" + (e.length < 2 ? "0" : "") + e.toUpperCase()
      }
      a++
    }
  }
  return c
};

$(document).ready(function(){
	
	$(".tooltip").bind({
		mouseover:function(){
      var tip = $(this).attr("href");
			$(tip).show();
		},mouseleave:function(){
      var tip = $(this).attr("href");
			$(tip).hide()
		}
	})
});

