var d=document;var w=window;var p=parent;var Pref;
var agent=navigator.userAgent;
var browser='';

if (agent.toLowerCase().indexOf("msie")!=-1)
{   browser='ie';}
if (agent.toLowerCase().indexOf("opera")!=-1)
{   browser='opera';}
if (agent.toLowerCase().indexOf("firefox")!=-1)
{   browser='firefox';}


if(document.getElementById && navigator.userAgent.indexOf('Opera') < 0)
 Pref = 'document.getElementById(Id)';
else Pref = 'document.all[Id]';

function Wid(Id,Contents){eval(Pref+'.innerHTML = Contents;');}
 
function Widv(Id,Contents){eval(Pref+'.value = Contents');}
 
function Rido(Id){
 if(eval(Pref) != null)
  if(eval(Pref+'.selectedIndex')!=null && eval(Pref+'.selectedIndex') >= 0)
   return eval(Pref+'.options['+eval(Pref+'.selectedIndex')+'].text');
  else return null;
 else return null;}

function Ridv(Id){
 if(eval(Pref) != null)
  return eval(Pref+'.value');
 else return null;}

function Ridi(Id){
 if(eval(Pref) != null)
  return eval(Pref+'.innerHTML');
 else return null;}

function RTag(Id){
 if(eval(Pref) != null)
  return eval(Pref+'.tagName');
 else return null;}


function WStyle(Id,Name,Value)
{
 if(eval(Pref) != null){
  if(document.getElementById)
   eval(Pref+'.style.'+Name+' = "'+Value+'"');
  else if(d.layers)
   eval('document.'+Id+'.'+Name+' = "'+Value+'"');
  else
   eval(Id+'.'+Name+' = "'+Value+'"');}
 else return null;}

function RStyle(Id,Name)
{
 if(eval(Pref) != null){
   return eval(Pref+'.style.'+Name)
 }
 else return null}

function ChImgSrc(Id,Src)
{
 if(eval(Pref) != null){
   pref = new Image();
   eval(Pref+'.src = "'+Src+'";');
 }
 else return null}

function SwapNav(id,act)
{
var dsp;
if (act == '') {
if (RStyle(id,'display')=='none'){
dsp = 'block';
if(RTag(id)=='TR') 
 {if(navigator.userAgent.indexOf('Gecko') >= 0 || navigator.userAgent.indexOf('Opera') >= 0){dsp = 'table-row';}}
}
else {dsp = 'none';}
}
else {
 if (act != 'show') {
  dsp = 'none';
 }
 else {
  dsp = 'block';
  if(RTag(id)=='TR') 
   {if(navigator.userAgent.indexOf('Gecko') >= 0 || navigator.userAgent.indexOf('Opera') >= 0){dsp = 'table-row';}}
 }
}
WStyle(id,'display',dsp);
}

/*добавить в Избранное*/
function bookmark(title,url)
{
  if (!url) url = location.href;
  if (!title) title = document.title;
  //FF
  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel (title, url, "");
  //IE4+
  else if (typeof window.external == "object") window.external.AddFavorite(url, title);
  //Opera7+
  else if (window.opera && document.createElement)
  {
    var a = document.createElement('A');
    if (!a) return false; //IF Opera 6
    a.setAttribute('rel','sidebar');
    a.setAttribute('href',url);
    a.setAttribute('title',title);
    a.click();
  }
  else return false;
  return true;
}

function homepage(objSrc,url)
{
  if (browser=='ie' && objSrc.style.behavior)    
  {
     objSrc.setHomePage(url);    
  }
  if (browser=='opera')
  {  alert('Ваш браузер Opera.\n Для изменения стартовой страницы войдите в меню "Инструменты" -> "Настройки", на закладке "Общие" в строке "Домашняя страница" напишите: www.cotka.ru, затем нажмите ОК.\n');}
  if (browser=='firefox')
  {  alert('Ваш браузер Mozilla Firefox.\n Для изменения стартовой страницы войдите в меню "Инструменты" -> "Настройки", на закладке "Основные" в строке "Домашняя страница" напишите: www.cotka.ru, затем нажмите ОК');}

}


