function setOvCookie() {
//var expdate = new Date();
//expdate.setDate(expdate.getDate()+7);
//document.cookie = 'DidUmzug=true;expires='+expdate.toGMTString()+';path=/';
document.cookie = 'DidUmzug=true;path=/';
return true ;
}

function getCookie(value) {
var dc = document.cookie;
var prefix = value + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else {
begin += 2;
}
var end = document.cookie.indexOf(";", begin);
if (end == -1) {
end = dc.length;
}
return dc.substring(begin + prefix.length, end);
}

function getRealPageHeight(){
var test1 = document.body.scrollHeight;
var test2 = document.body.offsetHeight
if (test1 > test2) return test1; else return test2; 
}
  
function styleElement(xel) {
xel.style.visibility = "hidden";
xel.style.position = "absolute"; 
xel.style.left = "0px"; 
xel.style.top = "0px"; 
xel.style.width = "100%"; 
xel.style.height = "100%";
xel.style.zIndex = "1000"; 
xel.style.textAlign = "center";
return true ;
}  
  
function showHideOverlay() {
  var el ;
  var dl ;

	el = document.getElementById("mb-overlay");
  if (el == null) {
    teaserText = "<div id=\"mb-olinner\" style=\"width:500px; margin:100px auto; background-color: #fff; border:8px solid #aaa; padding:10px 20px; text-align:left; z-index: 1001;-o-border-radius:12px; -moz-border-radius:12px;border-radius:12px;-moz-box-shadow:3px 3px 10px #222; -o-box-shadow:3px 3px 10px #222;-webkit-box-shadow:3px 3px 10px #222; box-shadow:3px 3px 10px #222;\"><a style=\"float:right;background:#444;padding:1px 4px;border:1px solid #222;text-decoration:none;color:#fff;-o-border-radius:4px; -moz-border-radius:4px;border-radius:4px;margin-right:-10px;\" onclick=\"setOvCookie();showHideOverlay();return false;\" href=\"#\">X</a>" ; 

    //Hier den HTML-Inhalt der Meldung maskiert einfuegen...
    teaserText += "<h1>Wir sind umgezogen...</h1>\n<p>... nur ein paar Ecken weiter! Unsere neue Adresse seit dem 1.1.2012:</p>\n<p>Groove!institute<br />\nMonschauer Str. 6<br />\n41068 Mönchengladbach</p>\n<p><iframe width=\"500\" height=\"300\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"http://maps.google.de/maps?f=d&amp;source=s_d&amp;saddr=Waldnieler+Stra%C3%9Fe+247,+M%C3%B6nchengladbach&amp;daddr=Monschauer+Stra%C3%9Fe+6,+D-41068+M%C3%B6nchengladbach&amp;hl=de&amp;geocode=FVQyDQMdBsVhACk7tTNhaau4RzGEbOnAKMBFbg%3BFXcqDQMdjs9hACmpGbtNaKu4RzFALe5bN_BkZg&amp;aq=t&amp;sll=51.194245,6.41078&amp;sspn=0.004727,0.012413&amp;vpsrc=6&amp;gl=de&amp;mra=ls&amp;ie=UTF8&amp;t=m&amp;ll=51.19567,6.409192&amp;spn=0.004706,0.008583&amp;z=16&amp;output=embed\"></iframe>\n<br /><small style=\"line-height:2.5em;font-size:0.8em;\"><a href=\"http://maps.google.de/maps?f=d&amp;source=embed&amp;saddr=Waldnieler+Stra%C3%9Fe+247,+M%C3%B6nchengladbach&amp;daddr=Monschauer+Stra%C3%9Fe+6,+D-41068+M%C3%B6nchengladbach&amp;hl=de&amp;geocode=FVQyDQMdBsVhACk7tTNhaau4RzGEbOnAKMBFbg%3BFXcqDQMdjs9hACmpGbtNaKu4RzFALe5bN_BkZg&amp;aq=t&amp;sll=51.194245,6.41078&amp;sspn=0.004727,0.012413&amp;vpsrc=6&amp;gl=de&amp;mra=ls&amp;ie=UTF8&amp;t=m&amp;ll=51.19567,6.409192&amp;spn=0.004706,0.008583&amp;z=16\" style=\"color:#666;text-align:left\">Größere Kartenansicht</a></small></p>";

    teaserText += "\n<p style=\"text-align:right; z-index: 1001; font-size:0.9em; margin-bottom:5px;\"><a style=\"background:#444;padding:4px 12px;border:1px solid #222;text-decoration:none;color:#fff;-o-border-radius:4px; -moz-border-radius:4px;border-radius:4px;-moz-box-shadow:2px 2px 8px #444; -o-box-shadow:2px 2px 8px #444;                 -webkit-box-shadow:2px 2px 8px #444; box-shadow:2px 2px 8px #444;margin-right:-10px;\" href=\'#\' onclick=\'setOvCookie();showHideOverlay();return false;\'>Schlie&szlig;en</a></p>\n</div>\n";

    el = document.createElement('div');
    el.setAttribute('id','mb-overlay');
    styleElement(el) ;
    el.innerHTML = teaserText;
    document.body.appendChild(el);
  }

  dl = document.getElementById("mb-overlay_vi");
  if (dl == null) {
    dl = document.createElement('div');
    dl.setAttribute('id','mb-overlay_vi');
    styleElement(dl) ;
    dl.style.background = "#444"; 
    dl.style.filter = "alpha(opacity:80)";
    dl.style.KhtmlOpacity = "0.8";
    dl.style.MozOpacity = "0.8";
    dl.style.opacity = "0.8"; 
    dl.style.zIndex = "999";    
    document.body.appendChild(dl);
  }  
  
  ovZeigen = (el.style.visibility == "visible") ? "hidden" : "visible"; 
  if (ovZeigen === 'visible') { dl.style.height = getRealPageHeight()+'px'; } ;
	dl.style.visibility = ovZeigen;
	el.style.visibility = ovZeigen ;
  return (ovZeigen === 'visible') ;
}

function startSessionOverlay() {
  if (getCookie("DidUmzug") != 'true') { showHideOverlay() ; }
  return false ;
}

