// JavaScript Document

//checke exkplorer type
var dom = (document.getElementById) ? true : false;
var ns5 = (!document.all && dom || window.opera) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ie4 && !ie5 && !dom) ? true : false;
function getIds(arg)
{
  return document.getElementById && document.getElementById(arg) || document.all && document.all[arg] || null;
}

sdiak = "áäčďéěíĺľňóô öŕšťúů üýřžÁÄČĎÉĚÍĹĽŇÓÔ ÖŔŠŤÚŮ ÜÝŘŽ";
bdiak = "aacdeeillnoo orstuu uyrzAACDEEILLNOO ORSTUU UYRZ";
function html2entity(strr)
{
  strr=strr.replace(/[/]/g,"");
  strr=strr.replace(/[<>]/g,"");
  return strr;
}
function uvodzovky(strr)
{
  strr=strr.replace(/WW/g,"'");
  strr=strr.replace(/QQ/g,'"');
  return strr;
}
function bezdiaks(txt)
{
  tx = "";
  for(p = 0; p < txt.length; p++)
  {
    if (sdiak.indexOf(txt.charAt(p)) != -1)
    {
      tx += bdiak.charAt(sdiak.indexOf(txt.charAt(p)));
    }
    else tx += txt.charAt(p);
  }
  return (tx);
}

// get tag ID

function Set_Cookie( name, value, expires, path, domain, secure )
{
  var today = new Date();
  today.setTime( today.getTime() );
  if ( expires ) {expires = expires * 1000 * 60 * 60 * 24;}
  var expires_date = new Date( today.getTime() + (expires) );
  document.cookie = name + "=" +escape( value ) +
  ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
  ( ( path ) ? ";path=" + path : "" ) +
  ( ( domain ) ? ";domain=" + domain : "" ) +
  ( ( secure ) ? ";secure" : "" );
}
function Set_Cookie_test( nname, nvalue, expires, path, domain, secure )
{

  var today = new Date();
  today.setTime( today.getTime() );
  if ( expires ) {expires = expires * 1000 * 60 * 60 * 24;}
  var expires_date = new Date( today.getTime() + (expires) );
  document.cookie = nname + "=" +escape( nvalue ) +
  ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
  ( ( path ) ? ";path=" + path : "" ) +
  ( ( domain ) ? ";domain=" + domain : "" ) +
  ( ( secure ) ? ";secure" : "" );
}

function Get_Cookie(check_name)
{
  var a_all_cookies = document.cookie.split( ';' );
  var a_temp_cookie = '';
  var cookie_name = '';
  var cookie_value = '';
  var b_cookie_found = false;
  for ( i = 0; i < a_all_cookies.length; i++ )
  {
    a_temp_cookie = a_all_cookies[i].split( '=' );
    cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
    if ( cookie_name == check_name )
    {
      b_cookie_found = true;
      if ( a_temp_cookie.length > 1 )
      {
        cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
      }
      return cookie_value;
      break;
    }
    a_temp_cookie = null;
    cookie_name = '';
  }
  if ( !b_cookie_found )
  {
    return null;
  }
}

function Delete_Cookie( name, path, domain )
{
  if ( Get_Cookie( name ) ) document.cookie = name + "=" +
  ( ( path ) ? ";path=" + path : "") +
  ( ( domain ) ? ";domain=" + domain : "" ) +
  ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

