var focusedControll=null;

//Vytvoreni transparentnosti u prvku
function GetOpacity(id,opacity)
{
  var hasFocus=false;
  if(focusedControll==id)
  {
   opacity=100;
   hasFocus=true;
  }
  if((document.getElementById(id)!=null && focusedControll!=id)||(hasFocus && document.getElementById(id)!=null))
  {
    if (navigator.appName.indexOf("Netscape")!=-1 && parseInt(navigator.appVersion)>=5 && navigator.appVersion.indexOf("Chrome")==-1)
    {
      document.getElementById(id).style.MozOpacity=opacity/100;
    }
    else
    {
     if(navigator.appName.indexOf("Microsoft")!= -1 && parseInt(navigator.appVersion)>=4)
     {
      document.getElementById(id).filters.alpha.opacity=opacity;
     }
     else
     {
      try
      {
       if(document.getElementById(id).style.opacity!=null)
       {
          document.getElementById(id).style.opacity=opacity/100;
       }
      }
      catch(err){}
     }
    }
  }
}

//nastaveni focusu
function GetFocus(id)
{
  focusedControll=id;
}

//Vytvoreni pozadi u prvku TextArea
function GetTextBackground(id,focused,name)
{
  var hasFocus=false;
  if(focusedControll==name)
  {
   hasFocus=true;
  }

  if(focused || hasFocus)
  {
    id.className="tc100ta";
  }
  else
  {
    id.className="tc50ta";
  }
}

//Vytvoreni pozadi u prvku TextArea
function GetTextBackground2(id,focused,name,valid)
{
  var hasFocus=false;
  if(focusedControll==name)
  {
   hasFocus=true;
  }

  if(focused || hasFocus)
  {
    id.className="tc100ta";
  }
  else
  {
    if(valid)
    {
      id.className="tc50ta";
    }
    else
    {
      id.className="tc75ta";
    }
  }
}

//Nastaveni vychozi stranky
function setHome()
{
    if (document.all)
    {
     document.body.style.behavior='url(#default#homepage)';
     document.body.setHomePage('http://www.yugie.com');

    }
    else if (window.sidebar)
    {
         if(window.netscape)
         {
          try
          {
          netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
          }
          catch(e)
          {
            alert("Funkce byla zakázána prohlížečem, pokud ji chcete povolit, napište do adresního řádku about:config a nastavte hodnotu signed.applets.codebase_principal_support na true.");
          }
         }
          var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
          prefs.setCharPref('browser.startup.homepage','http://www.yugie.com');
    }
}

//Pridani stranky do oblibenych
function CreateBookmarkLink()
{
 title = "HTML editor Yugie";
 url = "http://www.yugie.com";

  if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
   } else if( window.external ) { // IE Favorite
		window.external.AddFavorite(url, title); }
   else if(window.opera && window.print) { // Opera Hotlist
		return true;
   }
 }
