var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;

function hideLayer(lay){
  parent.document.getElementById(lay).style.visibility = "hidden";
}

function showLayer(lay){
  document.getElementById(lay).style.visibility = "visible";
}

function setCookie(){
  var validity = new Date();
  validity = new Date(validity.getTime() + 1000*60*60*24*365);
  validity = validity.toGMTString();
  document.cookie="visited=yes; path=/; expires="+validity+";" +location.href;
}

function writeCookie(name, value, hours) {
     var expire = "";
     if(hours != null) {
         expire = new Date((new Date()).getTime() + hours * 3600000);
         expire = "; expires=" + expire.toGMTString();
     }
     document.cookie = name + "=" + escape(value) + ";path=/" + expire;
 }

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

function pop(url, w, h) {
    l = (screen.width) ? (screen.width-w)/2 : 0;
    t = (screen.height) ? (screen.height-h)/2 : 0;
    l = 50;
    t = 50;
    settings = 'width=' + w + ',height=' + h + ',top=' + t + ', left=' + l + ', location=no,menubar=no,resizable=yes,scrollbars=yes';
    win = window.open(url, "Bosch", settings);
    win.focus();
}

function noThanks(lay){
  hideLayer(lay);
  writeCookie('wp_visited', 'yes', 744);
}

function Thanks(lay){
  writeCookie('wp_visited', 'yes', 744);
  pop('http://survey.internetwork-bosch.com/layer/start_ch.php','620','600');
  hideLayer(lay);
}

function startLayer(lay){
  var x = readCookie('wp_visited');
  if (x != ''){
    hideLayer(lay);
    return;
  }
  if (x != 'yes') {
    showLayer(lay);
    return;
  }
}
