function loadflash2(params){
  var s = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+params.width+'" height="'+params.height+'">\
<param name="movie" value="'+params.src+'?"'+params.vars+'>\
<param name="flashvars" value="'+params.vars+'">\
<param name="allowscriptaccess" value="always">\
<param name="wmode" value="window">\
<embed allowscriptaccess="always" wmode="window" src="'+params.src+'" flashvars="'+params.vars+'" width="'+params.width+'" height="'+params.height+'"></embed>\
</object>';
  var pelem = document.createElement('div');
  pelem.id = params.id;
  document.body.appendChild(pelem);
  with(document.getElementById(params.id)){
    style.position = 'absolute';
    if(!(/MSIE (6|7|8)/.test(navigator.userAgent)))
      style.position = 'fixed';
    style.top = '0px';
    style.left = '0px';
    style.padding = '20px';
    style.backgroundColor = 'white';
    innerHTML = s;
  }
};

function setCookie(c_name, value, expiredays){
  var exdate=new Date();
  exdate.setDate(exdate.getDate() + expiredays);
  document.cookie = c_name + "=" + escape(value) + (expiredays==null ? "" : ";expires="+exdate.toGMTString()+";path=/");
};

function getCookie(c_name){
  if (document.cookie.length>0){
    c_start=document.cookie.indexOf(c_name + "=");
    if (c_start!=-1){
      c_start=c_start + c_name.length+1;
      c_end=document.cookie.indexOf(";",c_start);
      if (c_end==-1) c_end=document.cookie.length;
      return unescape(document.cookie.substring(c_start,c_end));
    }
  }
  return false;
};

function windowdim(){
  var w = 0, h = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    w = window.innerWidth;
    h = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    w = document.documentElement.clientWidth;
    h = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    w = document.body.clientWidth;
    h = document.body.clientHeight;
  }
  return {height:h, width:w};
};

function closeflash(id){
  id = fullscreen.id;
  if(document.getElementById(id))
    document.getElementById(id).parentNode.removeChild(document.getElementById(id));
};

if(document.cookie && getCookie('fullscreen_banner')!=1){
  if(/MSIE (6|7|8)/.test(navigator.userAgent))
    window.attachEvent('onload',function(){
      loadflash2({
        width: windowdim().width - 40,
        height: windowdim().height - 40,
        src: fullscreen.flash,
        vars: 'flink='+fullscreen.link+'&fid='+fullscreen.id,
        id: fullscreen.id
      });
      var exdate=new Date();
      exdate.setDate(exdate.getDate() + 1);
      document.cookie = 'fullscreen_banner=1;expires='+exdate.toGMTString()+";path=/";
      setTimeout(function(){
        closeflash(fullscreen.id);
      },7000);
    });
  else
    window.addEventListener('DOMContentLoaded',function(){
      loadflash2({
        width: windowdim().width - 40,
        height: windowdim().height - 40,
        src: fullscreen.flash,
        vars: 'flink='+fullscreen.link+'&fid='+fullscreen.id,
        id: fullscreen.id
      });
    },false);
  if(!(/MSIE (6|7|8)/.test(navigator.userAgent)))
    setCookie('fullscreen_banner',1,1);
}

setTimeout(function(){
  closeflash(fullscreen.id);
},7000);