crir = 
 {
  init: 
  function() 
  {
   arrLabels = document.getElementsByTagName('label');
   searchLabels:
   for(var i = 0; i < arrLabels.length; i++)
   {      
    // get the input element based on the for attribute of the label tag
    if(arrLabels[i].getAttributeNode('for') && arrLabels[i].getAttributeNode('for').value != '')
    {
     labelElementFor = arrLabels[i].getAttributeNode('for').value;       
     inputElement = document.getElementById(labelElementFor);
    }
    else
    {        
     continue searchLabels;
    } 
    inputElementClass = inputElement.className; 
    // if the input is specified to be hidden intiate it
    if(inputElementClass == 'crirHiddenJS')
    {
     inputElement.className = 'crirHidden';
     inputElementType = inputElement.getAttributeNode('type').value; 
     // add the appropriate event listener to the input element
     if(inputElementType == "checkbox")
     {
      inputElement.onclick = crir.toggleCheckboxLabel;
     }
     else
     {
      inputElement.onclick = crir.toggleRadioLabel;
     }
     // set the initial label state
     if(inputElement.checked)
     {
      if(inputElementType == 'checkbox') { arrLabels[i].className = 'checkbox_checked'}
      else                               { arrLabels[i].className = 'radio_checked' }
     }
     else
     {
      if(inputElementType == 'checkbox') { arrLabels[i].className = 'checkbox_unchecked'}
      else                               { arrLabels[i].className = 'radio_unchecked' }
     }
    }
    else if(inputElement.nodeName != 'SELECT' && inputElement.getAttributeNode('type').value == 'radio')
    {
     // this so even if a radio is not hidden but belongs to a group of hidden radios it will still work.
     arrLabels[i].onclick = crir.toggleRadioLabel;
     inputElement.onclick = crir.toggleRadioLabel;
    }
   }     
  },  
  
  findLabel:
  function(inputElementID) 
  {
   arrLabels = document.getElementsByTagName('label');
   searchLoop:
   for (var i = 0; i < arrLabels.length; i++)
   {
    if(arrLabels[i].getAttributeNode('for') && arrLabels[i].getAttributeNode('for').value == inputElementID)
    {
     return arrLabels[i];
     break searchLoop;       
    }
   }   
  },  
  
  toggleCheckboxLabel:
  function()
  {
   labelElement = crir.findLabel(this.getAttributeNode('id').value);
  
   if(labelElement.className == 'checkbox_checked')
   {
    labelElement.className = "checkbox_unchecked";
   }
   else
   {
    labelElement.className = "checkbox_checked";
   }
  },  
  
  toggleRadioLabel: 
  function()
  {
   clickedLabelElement = crir.findLabel(this.getAttributeNode('id').value);
   clickedInputElement = this;
   clickedInputElementName = clickedInputElement.getAttributeNode('name').value;
   arrInputs = document.getElementsByTagName('input');
   // uncheck (label class) all radios in the same group
   for(var i = 0; i < arrInputs.length; i++)
   {
    inputElementType = arrInputs[i].getAttributeNode('type').value;
    if(inputElementType == 'radio')
    {
     inputElementName = arrInputs[i].getAttributeNode('name').value;
     inputElementClass = arrInputs[i].className;
     // find radio buttons with the same 'name' as the one we've changed and have a class of chkHidden
     // and then set them to unchecked
     if(inputElementName == clickedInputElementName && inputElementClass == 'crirHidden')
     {
      inputElementID = arrInputs[i].getAttributeNode('id').value;
      labelElement = crir.findLabel(inputElementID);
      labelElement.className = 'radio_unchecked';
     }
    }
   }
   // if the radio clicked is hidden set the label to checked
   if(clickedInputElement.className == 'crirHidden')
   {
    clickedLabelElement.className = 'radio_checked';
   }
  },
  addEvent:
  function(element, eventType, doFunction, useCapture)
  {
   if(element.addEventListener) 
   {
    element.addEventListener(eventType, doFunction, useCapture);
    return true;
   }
   else if (element.attachEvent)
   {
    var r = element.attachEvent('on' + eventType, doFunction);
    return r;
   }
   else
   {
    element['on' + eventType] = doFunction;
   }
  }
 }
crir.addEvent(window, 'load', crir.init, false);
//----------------------------------------------------------------------------------------------

function putSchemas(sel)
{
 var sch = sel.value;
 var div = document.all ? document.all('schems_td') : document.getElementById ? document.getElementById('schems_td') : null;
 if(sch == 0) { div.innerHTML = div.innerHTML = '&nbsp;'; return; }
 var d_cnt = 0;
 var m_cnt = 0;
 var f_cnt = 0;
 var about = '';
 if(     sch ==  1) { d_cnt = 7; m_cnt = 2; f_cnt = 1; about = ''; }
 else if(sch ==  2) { d_cnt = 6; m_cnt = 3; f_cnt = 1; about = ''; }
 else if(sch ==  3) { d_cnt = 6; m_cnt = 2; f_cnt = 2; about = ''; }
 else if(sch ==  4) { d_cnt = 5; m_cnt = 4; f_cnt = 1; about = ''; }
 else if(sch ==  5) { d_cnt = 5; m_cnt = 3; f_cnt = 2; about = ''; }
 else if(sch ==  6) { d_cnt = 5; m_cnt = 2; f_cnt = 3; about = ''; }
 else if(sch ==  7) { d_cnt = 4; m_cnt = 4; f_cnt = 2; about = ''; }
 else if(sch ==  8) { d_cnt = 4; m_cnt = 5; f_cnt = 1; about = ''; }
 else if(sch ==  9) { d_cnt = 4; m_cnt = 3; f_cnt = 3; about = ''; }
 else if(sch == 10) { d_cnt = 3; m_cnt = 6; f_cnt = 1; about = ''; }
 else if(sch == 11) { d_cnt = 3; m_cnt = 5; f_cnt = 2; about = ''; }
 else if(sch == 12) { d_cnt = 3; m_cnt = 4; f_cnt = 3; about = ''; }
 else if(sch == 13) { d_cnt = 3; m_cnt = 3; f_cnt = 4; about = ''; }
 else if(sch == 14) { d_cnt = 4; m_cnt = 2; f_cnt = 4; about = ''; }
 else if(sch == 15) { d_cnt = 3; m_cnt = 2; f_cnt = 5; about = ''; }
 var d_about = aboutCount(d_cnt, 'D');
 var m_about = aboutCount(m_cnt, 'M');
 var f_about = aboutCount(f_cnt, 'F');
 div.innerHTML = '<table width=100%><tr><td>Защита</td><td>' + d_about+'</td></tr><tr><td>Полузащита</td><td>'+m_about+'</td><tr><td>Нападение</td><td>'+f_about+'</td></tr></table>';
}

function checkData()
{
 var sError = '';
 var obj = document.getElementById('price');
 if(isNumber(obj.value) == false)
 {
  sError += 'Неправильная цена билета: ' + obj.value + '<br>';
 }
 else if(obj.value < 1 || obj.value > 100)
 {
  sError += 'Неправильная цена билета: ' + obj.value + '<br>';
 }
 if(r_captain == 0) sError += 'Не назначен капитан<br>';
 if(r_corner  == 0) sError += 'Не назначен исполнитель угловых<br>';
 if(r_kick    == 0) sError += 'Не назначен исполнитель штрафных<br>';
 if(r_penalty == 0) sError += 'Не назначен исполнитель пенальти<br>';
 var gk=0, ld=0, cd=0, rd=0, lm=0, cm=0, rm=0, lf=0, cf=0, rf=0, subs=0, pwr=0, pwr2=0, sTactics='---';
 var obj2;
 var dd=0, mm=0, ff=0, alls=0;
 for (var i=0; i < arPlayers.length; i++)
 {
  obj = document.all ? document.all('gamePos['+arPlayers[i]+']') : document.getElementById ? document.getElementById('gamePos['+arPlayers[i]+']') : null;
  if(obj != null)
  {
   if(     obj.value == -1) { subs++; }
   else if(obj.value ==  1) { gk++; }
   else if(obj.value ==  2) { ld++; dd++; }
   else if(obj.value ==  3) { cd++; dd++; }
   else if(obj.value ==  4) { rd++; dd++; }
   else if(obj.value ==  5) { lm++; mm++; }
   else if(obj.value ==  6) { cm++; mm++; }
   else if(obj.value ==  7) { rm++; mm++; }
   else if(obj.value ==  8) { lf++; ff++; }
   else if(obj.value ==  9) { cf++; ff++; }
   else if(obj.value == 10) { rf++; ff++; }
   if(obj.value > 0)
   {
    obj = document.all ? document.all('pwr_td_'+arPlayers[i]) : document.getElementById ? document.getElementById('pwr_td_'+arPlayers[i]) : null;
    pwr += eval(obj.innerHTML.substring(0, obj.innerHTML.length - 6));
    obj = document.all ? document.all('pwr2_td_'+arPlayers[i]) : document.getElementById ? document.getElementById('pwr2_td_'+arPlayers[i]) : null;
    pwr2 += eval(obj.innerHTML.substring(0, obj.innerHTML.length - 6));
   }
  }
 }
 alls = gk + dd + mm + ff;
 obj = document.all ? document.all('total_td') : document.getElementById ? document.getElementById('total_td') : null;
 obj.innerHTML = '&nbsp;'+(gk+ld+cd+rd+lm+cm+rm+lf+cf+rf)+' ('+pwr+'/'+pwr2+')';
 obj = document.all ? document.all('subs_td') : document.getElementById ? document.getElementById('subs_td') : null;
 obj.innerHTML = '&nbsp;'+subs;
 obj = document.all ? document.all('rast_td') : document.getElementById ? document.getElementById('rast_td') : null;
 obj.innerHTML = '&nbsp;'+(ld+cd+rd)+'-'+(lm+cm+rm)+'-'+(lf+cf+rf);
 if(gk < 1)      { sError += 'Не выбран вратарь<br>'; }
 else if(gk > 1) { sError += 'Выбрано более одного вратаря<br>'; }
 if(alls < 11)      { sError += 'Не выбрано 11 игроков основы<br>'; }
 else if(alls > 11) { sError += 'Выбрано более 11 игроков<br>'; }
 else
 {
  if((dd == 7 && mm == 2 && ff == 1) || (dd == 6 && mm == 3 && ff == 1)) { sTactics = 'все в защиту'; }
  else if((dd == 6 && mm == 2 && ff == 2) || (dd == 5 && mm == 4 && ff == 1) || (dd == 5 && mm == 3 && ff == 2))
  {
   sTactics = 'защитная';
  }
  else if((dd == 4 && mm == 3 && ff == 3) || (dd == 3 && mm == 4 && ff == 3) || (dd == 4 && mm == 2 && ff == 4))
  {
   sTactics = 'атакующая';
  }
  else if((dd == 3 && mm == 2 && ff == 5) || (dd == 3 && mm == 3 && ff == 4)) { sTactics = 'все в атаку'; }
  else { sTactics = 'нормальная'; }
  if(posErrors(ld, cd, rd, 1) == false) { sError += 'Расстановка защитников не соответствует схеме<br>'; }
  if(posErrors(lm, cm, rm, 2) == false) { sError += 'Расстановка полузащитников не соответствует схеме<br>'; }
  if(posErrors(lf, cf, rf, 3) == false) { sError += 'Расстановка нападающих не соответствует схеме<br>'; }
 }
 obj = document.all ? document.all('settings_td') : document.getElementById ? document.getElementById('settings_td') : null;
 obj.innerHTML = '&nbsp;'+sTactics;
 if(subs > 5) { sError += 'Выбрано более 5 замен<br>'; }
 var err = document.all ? document.all('error_td') : document.getElementById ? document.getElementById('error_td') : null;
 if(sError == '') { err.innerHTML = '&nbsp;Ошибок нет'; }
 else             { err.innerHTML = '<font color=red>'+sError+'</font>'; }
}

function posErrors(l, c, r, iType)
{
 var lcr = l + c + r;
 var rcl = l*100 + c*10 + r;
 if ((iType == 1) && (lcr < 3)) return false;
 if ((iType == 1) && (lcr > 7)) return false;
 if ((iType == 2) && (lcr < 2)) return false;
 if ((iType == 2) && (lcr > 6)) return false;
 if ((iType == 3) && (lcr < 1)) return false;
 if ((iType == 3) && (lcr > 5)) return false;

 if (lcr == 7) return ((rcl == 331) || (rcl == 133) || (rcl == 241) || (rcl == 232) || (rcl == 142) || (rcl == 151));
 if (lcr == 6) return ((rcl == 222) || (rcl == 231) || (rcl == 132) || (rcl == 141));
 if (lcr == 5) return ((rcl == 212) || (rcl == 221) || (rcl == 122) || (rcl == 131));
 if ((lcr == 4) && (iType == 2)) return ((rcl == 112) || (rcl == 211) || (rcl == 121));
 if (lcr == 4) return (rcl == 121);
 if (lcr == 3) return (rcl == 111);
 if ((lcr == 2) && (iType == 2)) return ((rcl == 20) || (rcl == 101));
 if ((lcr == 2) && (iType == 3)) return ((rcl == 110) || (rcl == 101) || (rcl == 11) || (rcl == 20));
 if ((lcr == 1) && (iType == 3)) return ((rcl == 100) || (rcl == 10) || (rcl == 1));
 return (rcl == 10);
}

function aboutCount(cnt, sType)
{
 if(cnt == 7)                 return '2L' + sType + '+3C' + sType + '+2R' + sType + ', 3L' + sType + '+3C' + sType + '+R' + sType + ', L' + sType + '+3C' + sType + '+3R' + sType + ', 2L' + sType + '+4C' + sType + '+R' + sType + ', L' + sType + '+4C' + sType + '+2R' + sType + ', L' + sType + '+5C' + sType + '+R' + sType;
 if(cnt == 6)                 return '2L' + sType + '+2C' + sType + '+2R' + sType + ', 2L' + sType + '+3C' + sType + '+R' + sType + ', L' + sType + '+3C' + sType + '+2R' + sType +  ', L' + sType + '+4C' + sType + '+R' + sType;
 if(cnt == 5)                 return '2L' + sType +  '+C' + sType + '+2R' + sType + ', 2L' + sType + '+2C' + sType + '+R' + sType + ', L' + sType + '+2C' + sType + '+2R' + sType +  ', L' + sType + '+3C' + sType + '+R' + sType;
 if(cnt == 4 && sType == 'M') return '2LM+CM+RM, LM+2CM+RM, LM+CM+2RM';
 
 ;
 if(cnt == 4) return  'L' + sType + '+2C' + sType +  '+R' +sType;
 if(cnt == 3) return  'L' + sType +  '+C' + sType +  '+R' +sType;
 if(cnt == 2 && sType == 'M') return '2CM, LM+RM';
 if(cnt == 2 && sType == 'F') return 'LF+CF, LF+RF, CF+RF, 2CF';
 if(cnt == 1 && sType == 'F') return 'LF, CF, RF';
 return 'C' + sType;
}

function isNumber(data)
{
 var nums = '0123456789';
 var chars;
 var counter = 0;
 for(var i=0; i < data.length; i++)
 {
  chars = data.substring(i, i+1);
  if(nums.indexOf(chars) != -1) counter++;
 }
 return (counter == data.length);
}

var cap = new Array();
var cor = new Array();
var kck = new Array();
var pen = new Array();

function doIt(id, Cntrl, tcol)
{
 //alert(id + Cntrl + tcol)
 cap[tcol-1] = document.getElementById('Captain'+id);
 cor[tcol-1] = document.getElementById('Corner'+id); 
 kck[tcol-1] = document.getElementById('Kick'+id); 
 pen[tcol-1] = document.getElementById('Penalty'+id); 
 
 tdcol = tcol;
 if((Cntrl.value == 0) || (Cntrl.value == -1))
 {
  if(cap[tdcol-1].checked) cap[tdcol-1].checked = false;
  if(r_captain == id) r_captain = 0;
  if(r_corner  == id) r_corner  = 0;
  if(r_kick    == id) r_kick    = 0;
  if(r_penalty == id) r_penalty = 0;
  if(cor[tdcol-1].checked) cap[tdcol-1].checked = false;
  if(kck[tdcol-1].checked) cap[tdcol-1].checked = false;
  if(pen[tdcol-1].checked) cap[tdcol-1].checked = false;
  if(cap[tdcol-1].style.visibility != 'hidden') cap[tdcol-1].style.visibility = 'hidden';  //kck[tdcol-1].style.visibility = "hidden";
  if(cor[tdcol-1].style.visibility != 'hidden') cor[tdcol-1].style.visibility = 'hidden';  //kck[tdcol-1].style.visibility = "hidden";
  if(kck[tdcol-1].style.visibility != 'hidden') kck[tdcol-1].style.visibility = 'hidden';  //kck[tdcol-1].style.visibility = "hidden";
  if(pen[tdcol-1].style.visibility != 'hidden') pen[tdcol-1].style.visibility = 'hidden';  //kck[tdcol-1].style.visibility = "hidden";
 }
 else if(Cntrl.value == 1)
 {
  if(cor[tdcol-1].checked) cor[tdcol-1].checked = false;
  if(kck[tdcol-1].checked) kck[tdcol-1].checked = false;
  if(pen[tdcol-1].checked) pen[tdcol-1].checked = false;
  if(r_corner  == id) r_corner  = 0;
  if(r_kick    == id) r_kick    = 0;
  if(r_penalty == id) r_penalty = 0;
  if(cap[tdcol-1].style.visibility != 'visible') cap[tdcol-1].style.visibility = 'visible';
  if(cor[tdcol-1].style.visibility != 'hidden')  cor[tdcol-1].style.visibility = 'hidden';
  if(kck[tdcol-1].style.visibility != 'hidden')  kck[tdcol-1].style.visibility = 'hidden';
  if(pen[tdcol-1].style.visibility != 'hidden')  pen[tdcol-1].style.visibility = 'hidden';
 }
 else
 {
  if(cap[tdcol-1].style.visibility != 'visible') cap[tdcol-1].style.visibility = 'visible';
  if(cor[tdcol-1].style.visibility != 'visible') cor[tdcol-1].style.visibility = 'visible';
  if(kck[tdcol-1].style.visibility != 'visible') kck[tdcol-1].style.visibility = 'visible';
  if(pen[tdcol-1].style.visibility != 'visible') pen[tdcol-1].style.visibility = 'visible';
 }
  //substitues-------------------------
  var SubstIn = new Array();
  var SubstOut = new Array();
  var SubstInID = new Array();
  var SubstOutID = new Array();
  var SubstOutPos = new Array();
  var out_i = 0;
  var in_i = 0;
  var PlayerIdx;
  var cntSubs = 10;
  var el;

  for (var i=0; i < arPlayersName.length; i++)
  {
   obj = document.all ? document.all('gamePos[' + arPlayers[i] + ']') : document.getElementById ? document.getElementById('gamePos[' + arPlayers[i] + ']') : null;
   if(obj != null)
   {
    PlayerIdx = obj.value;
    if(PlayerIdx == -1)
    {
     SubstIn[in_i] = arPlayersName[i];
     SubstInID[in_i] = arPlayers[i];
     in_i++;
    }
    if(PlayerIdx > 0)
    {
     SubstOut[out_i] = arPlayersName[i];
     SubstOutID[out_i] = arPlayers[i];
     SubstOutPos[out_i] = PlayerIdx;//edo test
     out_i++;
    }
   }
  }
  for(z = 1; z <= cntSubs; z++)
  {
   iSelIndex = 0;
   iSelText = "";
   el = document.all ? document.all('player_out[' + z + ']') : document.getElementById ? document.getElementById('player_out[' + z + ']') : null;
   if(el != null)
   {
    if(el.options.length > 0)
    {
     iSelText = el.options[el.selectedIndex].text;
     for(i = el.options.length; i > 0; i--) el.options[i] = null;
     el.options.length = 0;;
    }
    el.options[0] = new Option("          ");
    for(i = 0; i < SubstOut.length; i++)
    {
     if(iSelText == SubstOut[i]) iSelIndex = i+1;
     el.options[i + 1] = new Option(SubstOut[i]);
     el.options[i+1].value = SubstOutID[i];
     //el.options[i+1].value = SubstOutID[i] + ' :: ' + SubstOutPos[i];//edo test
    }
    el.options[iSelIndex].selected = true;
   }
  }
  
  for(z = 1; z <= cntSubs; z++)
  {
   iSelIndex = 0;
   iSelText = "";
   el = document.all ? document.all('player_in[' + z + ']') : document.getElementById ? document.getElementById('player_in[' + z + ']') : null;
   if(el != null)
   {
    if(el.options.length > 0)
    {
     iSelText = el.options[el.selectedIndex].text;
     for(i = el.options.length; i > 0; i--)
      el.options[i] = null;
     el.options.length = 0;;
    }
    el.options[0] = new Option("          ");
    for(i = 0; i < SubstIn.length; i++) 
    {
     if(iSelText == SubstIn[i]) iSelIndex = i+1;
     el.options[i+1] = new Option(SubstIn[i]);
     el.options[i+1].value = SubstInID[i];
    }
    el.options[iSelIndex].selected = true;
   }
  }
  //-----------------------------------
}

function confirmLink(theLink, theSqlQuery)
{
 if (typeof(window.opera) != 'undefined') { return true; }
 var is_confirmed = confirm(theSqlQuery);
 if (is_confirmed) { theLink.href += '&jsc=1'; }
 return is_confirmed;
}

function SubmitControl(tocheack){
 if (document.all || document.getElementById){
     for (i=0; i < tocheack.length;i++){
          if(tocheack.elements[i].type.toLowerCase()=="submit"||tocheack.elements[i].type.toLowerCase()=="reset") {
             tocheack.elements[i].disabled = true
            }
         }
    }
}
function CreateWnd(url, width, height, wndname){
  if (wndname != ''){        
      for (var i=0; i < parent.frames.length; i++){
           if (parent.frame[i].name == wndname){                 
               parent.frame[i].focus();
               return;
              }                
          }
    }
  window.open(url, wndname,'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=yes,status=yes');
}        
function Formchecker(tocheck){
  if (tocheck.post != null &&tocheck.post.value.length == 0){
      alert('Пожалуйста, введите текст сообщения!!');
      return false;
      }
  if (tocheck.membername != null &&tocheck.membername.value.length == 0){
      alert('Пожалуйста, введите ваше имя!!');
      return false;
     }
}

function pasteN(text){
  if (text != '') document.postform.post.value = document.postform.post.value + "[b]" + text + "[/b]\n";
}

if (document.selection||document.getSelection) {Q=true} else {var Q=false} 
var txt=''

function copyQ() { 
txt='' 
if (document.getSelection) {txt=document.getSelection()} 
else if (document.selection) {txt=document.selection.createRange().text;} 
txt='[q]'+txt+'[/q]\n'
} 
function pasteQ() { 
document.postform.post.value=document.postform.post.value+txt; 
} 



function SelectAll (chbox, chtext){        
 for(var i =0; i < chbox.form.elements.length; i++){
     if(chbox.form.elements[i].name.indexOf(chtext) == 0){
        chbox.form.elements[i].checked = chbox.checked;
       }
    }
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function getcookievalue(name){
    var temp=document.cookie+";";
    var Pos=temp.indexOf("=",temp.indexOf(name+"="));
    if (temp.indexOf(name+"=")==-1) return "";
    return temp.substring(Pos+1,temp.indexOf(";",Pos));      
}

function printform (){   
    var memname = getcookievalue("amembernamecookie");
    var pass = getcookievalue("apasswordcookie");
    if ((document.cookie)&&(memname != null)){
        document.postform.membername.value = unescape(memname); 
        if (pass != null) document.postform.password.value = unescape(pass);
    }  
}
function printpass (){  
    var pass = getcookievalue("apasswordcookie");   
    if (pass != null) document.postform.password.value = unescape(pass);
}

var marked_row = new Array;

/**
 * Sets/unsets the pointer and marker in browse mode
 *
 * @param   object    the table row
 * @param   interger  the row number
 * @param   string    the action calling this script (over, out or click)
 * @param   string    the default background color
 * @param   string    the color to use for mouseover
 * @param   string    the color to use for marking a row
 *
 * @return  boolean  whether pointer is set or not
 */
function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == '' || currentColor == null
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function
