//
// acceptation
//
acceptation = {
 disclaimerID: 'disclaimer',
 restrictedID: 'main',
 cookieContent: 'accepted12=true',
 //Style: '<style type="text/css">html body #¶1{display:none;} html body #¶2{display:block;}<\/style>',
Style: '<style type="text/css">html body #disclaimer {display:none;}<\/style>',
 cookieTest: function() {
  var testCookie = "cookieTest=ok";
  document.cookie = testCookie;
  if ( document.cookie.indexOf(testCookie) > -1 ) {
   if ( document.cookie.indexOf(acceptation.cookieContent) > -1 || navigator.userAgent.indexOf('screenshot-generator') > -1) {
 //   swapDisplay(acceptation.disclaimerID);
 //   acceptation.Style = acceptation.Style.replace(/¶1/,acceptation.disclaimerID);
 //   acceptation.Style = acceptation.Style.replace(/¶2/,acceptation.restrictedID);
      acceptation.Style = '<style type="text/css">html body #disclaimer {display:none;}<\/style>';
   } else {
 //   swapDisplay(acceptation.restrictedID);
 //   acceptation.Style = acceptation.Style.replace(/¶1/,acceptation.restrictedID);
 //   acceptation.Style = acceptation.Style.replace(/¶2/,acceptation.disclaimerID);
      acceptation.Style = '<style type="text/css">html body #disclaimer {display:block;position:fixed;z-index:1000;top:0px;bottom:0px;left:0px;right:0px;height:100%;width:100%;}<\/style>'
   }
  }
 },
 accept: function() {
  document.cookie = acceptation.cookieContent;
  document.getElementById("disclaimer").style.display = 'none';
  //swapDisplay( acceptation.disclaimerID, acceptation.restrictedID );
 }
}
acceptation.cookieTest();
document.writeln(acceptation.Style);
//
// swapDisplay()
//
function swapDisplay() {
 values = ['none','block']
 for ( var i = 0; i < arguments.length; i++ ) {
  el = getObject(arguments[i]);
  if ( el ) {
   elStyle = getStyle(el,'display');
   if ( elStyle) {
    if ( elStyle == values[0] ) {
     el.style.display = values[1];
    }
    else if (elStyle == values[1]) {
     el.style.display = values[0];
    }
   }
  }
 }
}
//
// getObject(param)
//
function getObject(param) {
 var rtrn = false;
 if ( typeof(param) == 'object' ) {
  rtrn = param;
 }
 else if ( typeof(param) == 'string' ) {
  if ( document.getElementById(param) ) {
   rtrn = document.getElementById(param);
  }
  else if ( document.getElementsByTagName(param)[0] ) {
   rtrn = document.getElementsByTagName(param)[0];
  }
 }
 return rtrn
}
//
// getStyle(oElm, strCssRule)
// by Robert Nyman
// http://www.robertnyman.com/2006/04/24/get-the-rendered-style-of-an-element/
//
function getStyle(oElm, strCssRule){
 var strValue = "";
 if(document.defaultView && document.defaultView.getComputedStyle){
  strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
 }
 else if(oElm.currentStyle){
  strCssRule = strCssRule.replace(/-(w)/g, function (strMatch, p1){
   return p1.toUpperCase();
  });
  strValue = oElm.currentStyle[strCssRule];
 }
 return strValue;
}
