
/**
 * Sets/unsets the pointer and marker
 *
 * @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

<tr onmouseover="setPointer(this, 'over', '#DDDDDD', '#CCFFCC');"
onmouseout="setPointer(this, 0, 'out', '#DDDDDD', '#CCFFCC');"
onmousedown="showDetails();">
*/

function moo(theRow,moi){
    var theCells = null;

    if (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;
    }

    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        domDetect    = true;
    } else {
        domDetect    = false;
    }

    var rowCellsCnt  = theCells.length;
    if (moi != 0) {
      newCursor              = "hand";
      newColor="#F2F2F2";
    } else {
      newCursor              = "default";
      newColor="#FFFFFF";
    }

    //alert("Cursor: "+currentCursor);

        /*var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute("cursor", newCursor, 0);
                theCells[c].setAttribute("bgcolor", newColor, 0);
            } // end for
	    theRow.setAttribute("cursor",newCursor,0);
        }
        // 5.2 ... with other browsers
        else {*/
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.cursor = newCursor;
                theCells[c].bgColor = newColor;
            /*}*/
        }

    return true;
}

function setPointer(theRow, theDefaultColor, thePointerColor)
{
    var theCells = null;

    if (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('cursor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.cursor;
        domDetect    = false;
    } // end 3

    // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it
    if (currentColor.indexOf("rgb") >= 0) 
    {
        var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1,
                                     currentColor.indexOf(')'));
        var rgbValues = rgbStr.split(",");
        currentColor = "#";
        var hexChars = "0123456789ABCDEF";
        for (var i = 0; i < 3; i++)
        {
            var v = rgbValues[i].valueOf();
            currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16);
        }
    }

    // 4. Defines the new color
    // 4.1 Current color is the default one
    
    alert(currentColor);
    if (currentColor != "#FFFFFF") {
      newColor              = '#F2F2F2';
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase() ){
      newColor              = '#FFFFFF';
    }

    // 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('cursor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.cursor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function

function sp(p5,p6){
  search.cat.value=p5;
  search.scat.value=p6;
  search.shp.value=(search.shpx.checked?"1":"0");
  search.submit();
}

function sd(id,cat){
  nav.id.value=id;
  nav.cat.value=cat;
  nav.submit();
}

var subwnd=null;
 
function subshow(url,wndname,typ) {
  var height=400;
  switch (typ) {
    case 0: height=600;break;
    case 1: height=450;break;
  }
  if (subwnd!=null && !subwnd.closed) {
    subwnd.navigate(url);
    subwnd.focus();
    subwnd.blur();
  } else {
    //if (subwnd!=null && !subwnd.closed) {subwnd.close();}
    window.open(url,wndname,'toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=800,height='+height);
    }
} 