
var d = document;

var ns6 = (!document.all && document.getElementById); 
var ie4 = (document.all);
var ns4 = (document.layers);
var ie6 = (document.documentElement);








function getElement(i)
{ 
 var ob = d.all?d.all[i]:d.layers?d.layers[i]:d.getElementById(i); 
 return ob; 
} 








function changeDIVcontent(div_id, content, doc)
{ 
 if (doc=='') doc=document;
 
 if(doc.layers)
 with(doc.layers[div_id+""].document)
  {
   write(content);
   close();
  }
 else
  {
   if(doc.getElementById)
    doc.getElementById(div_id+"").innerHTML=content;
   
   else
    if(doc.all)
     doc.all[div_id+""].innerHTML=content;
  }
}








function currentDTmarker()
{
 dtm = new Date();
 
 return dtm.getDate()+''+dtm.getMonth()+''+dtm.getFullYear()+''+dtm.getHours()+''+dtm.getMinutes()+''+dtm.getSeconds();
}








function chTrBgColor(el, ev)
{
 if (ev=='over') el.style.background = '#ffcc66';
 else            el.style.background = '';
}








function divShow(el)
{
 getElement(el).style.display = 'block';
}








function divHide(el)
{
 getElement(el).style.display = 'none';
}






function divManage(el)
{
 if (getElement(el).style.display == 'block') getElement(el).style.display = 'none';
 else                                         getElement(el).style.display = 'block';
}








function trKeywords(i, id)
{
 if (ie4) disp = 'block';
 else     disp = 'table-row';
 
 if (trs[i]=='open')
   {
    getElement('rtr'+id).style.display = 'none';
    
    changeDIVcontent('rtd'+id, '', '');
    
    trs[i] = '';
   }
 else
   {
    changeDIVcontent('rtd'+id, '<center><img src="gfx/loader.gif" width="220" height="19" border="0" /></center>', '');
    
    url = 'dynamic_actions.php?mod=keywords&action=getList&domain_id='+id+'&tm'+currentDTmarker();
    
    frames["ifract"].location.href = url;
    
    getElement('rtr'+id).style.display = disp;
    
    trs[i] = 'open';
   }
}








function showNewKeywordForm(id)
{
 getElement('nkp'+id).style.display = 'none';
 getElement('nki'+id).style.display = 'block';
 
 getElement('f_nk'+id).focus();
}








function hideNewKeywordForm(id)
{
 getElement('nki'+id).style.display = 'none';
 getElement('nkp'+id).style.display = 'block';
}








function addNewKeyword(id)
{
 if (getElement('f_nk'+id).value!='')
   {
    url = 'dynamic_actions.php?mod=keywords&action=addNew&newkeyword='+getElement('f_nk'+id).value+'&domain_id='+id+'&tm'+currentDTmarker();
    
    frames["ifract"].location.href = url;
     
   }
 else alert('empty string');
}








