//Global variables

var posx = 0;
var posy = 0;


//Initialize variables

wmtt = null;
details = null;
detailsimg = null;
calendar = null;


//Show help-hint if visitor clicks into search-input field

function getHelper(input,helper) {
  var dieses = document.getElementById(helper);
  dieses.style.display = "block";
  input.style.border = "1px solid #408e05";
}


//Hide help-hint if visitor clicks somewhere else

function deleteHelper(input,helper) {
  var dieses = document.getElementById(helper);
  dieses.style.display = "none";
  input.style.border = "1px solid #f3ca66";
}


//Refresh mouseover-hint position

function updateWMTT(e) {
 if (!e) var e = window.event;
 if (e.pageX || e.pageY) {
 posx = e.pageX;
 posy = e.pageY;
 }
 else if (e.clientX || e.clientY) {
 posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
 posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
 }
 if (wmtt != null) {
 wmtt.style.left = (posx + 20) + "px";
 wmtt.style.top = (posy + 20) + "px";
 }
} 


//Show mouseover-hint div

function showWMTT(id) {
  wmtt = document.getElementById(id);
  wmtt.style.display = "block";
}


//Hide mouseover-hint div

function hideWMTT() {
  wmtt.style.display = "none";
}


//Show or hide table with media-details

function mediaDetails(id1,id2,id3) {
  details = document.getElementById(id1);
  detailsimg = document.getElementById(id2);
  tablediv = document.getElementById(id3);

  if (details.style.display != "block") {    
    details.style.display = "block"; 
    detailsimg.style.background = "url(img/icons/arrow_down.gif) no-repeat left";
    tablediv.style.marginBottom = "9px"; 
  }
  else {
    details.style.display = "none";
    detailsimg.style.background = "url(img/icons/arrow_right.gif) no-repeat left";
    tablediv.style.marginBottom = "30px";
  }
}


//Show or hide calendar

function showCalendar(id) {
  calendar = document.getElementById(id);
 
  calendar.style.left  = (posx - 210) + "px";
  calendar.style.top = (posy + 5) + "px";  
  
  if (calendar.style.display != "block") {
    calendar.style.display = "block";
  }
  else {
    calendar.style.display = "none";
  }
}
