function check_ubs() 
{
  objUBS = document.getElementById('ubs');
  objUBS.innerHTML = '';
  if (
      current_page == 606 && current_channel == 'TSI2'
      ) {
    
    c = check_cookie();
    
    if (c == "yes")
    {
      hide_layer();
    } else if (c == "no")
    {
      objUBS.style.display = 'block';
      show_error();
    }
    else
    {
      objUBS.style.display = 'block';
      load_disc("/ubs/it.html");
    }
    
  } else {
    objUBS.style.display = 'none';
  }
}

function hide_layer()
{
  objUBS = document.getElementById('ubs');
  objUBS.style.display = 'none';
  document.cookie="ubs=yes;";
}

function show_error()
{
  objUBS = document.getElementById('ubs');
  load_disc("/ubs/error_it.html");
  document.cookie="ubs=no;";  
}

function check_cookie()
{
  if(document.cookie)
  {
    c = document.cookie.split(";");
    for (idx = 0; idx < c.length; idx++)
    {
      tmp = c[idx].split("=");
      if (tmp[0] == "ubs")
      {
        return tmp[1];
      }
    }
  }
  return "undef";
}

function load_disc(url)
{
  var xmlhttp=false;
  /*@cc_on @*/
  /*@if (@_jscript_version >= 5)
   try {
   xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
   try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   } catch (E) {
   xmlhttp = false;
   }
   }
   @end @*/
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  xmlhttp.open("GET", url,true);
  xmlhttp.onreadystatechange=function()
  {
    if (xmlhttp.readyState==4)
    {
      objUBS = document.getElementById('ubs');
      objUBS.innerHTML = xmlhttp.responseText;
    }
  }
  xmlhttp.send(null)
}
