
/**
 * Sets/Unset the marker on a table cell
 *
 * @param   object   the table cell
 * @param   object   the color to use for this cell
 * @param   object   the background color
 *
 * @return  boolean  whether marker is set or not
 */
function setMarker( theCell, theMarkerColor, theNormalBgColor )
{
  
    if (theMarkerColor == '' || typeof(theCell.style) == 'undefined') {
	return false;
    }
 
    var currentColor = null;
    var newColor     = null;
    /*
     *	 This stuff makes trouble in IE on Macs    
     *	 Bernhard
     *
    // Opera does not return valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCell.getAttribute) != 'undefined' && typeof(theCell.getAttribute) != 'undefined') {
        currentColor = theCell.getAttribute('bgcolor');
        newColor     = (currentColor.toLowerCase() == theMarkerColor.toLowerCase())
                     ? theNormalBgColor
                     : theMarkerColor;
        theCell.setAttribute('bgcolor', newColor, 0);
        
    } else {
    */
        currentColor = theCell.style.backgroundColor;
        newColor     = (currentColor.toLowerCase() == theMarkerColor.toLowerCase())
                     ? theNormalBgColor
                     : theMarkerColor;
        theCell.style.backgroundColor = newColor;
    //}
    
    return true;
} // end of the 'setPointer()' function


/**
 * Sets/Unset the marker on a table cell and changes text color within the first
 * node under this cell. 
 * This function only works in IE 5 or greater!!!
 *
 * @param   object   the table cell
 * @param   object   the color to use for this cell
 * @param   object   the background color
 * @param object the new text color
 * @param object the text color
 *
 * @return  boolean  whether marker is set or not
 */
function setMarkerWithText( theCell, theMarkerColor, theNormalBgColor ) {

	if (theMarkerColor == '' || typeof(theCell.style) == 'undefined') {
		return false;
    }
 
    var currentColor = null;
    var newColor     = null;
    /*
     *	 This stuff makes trouble in IE on Macs    
     *	 Bernhard
     *
    // Opera does not return valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCell.getAttribute) != 'undefined' && typeof(theCell.getAttribute) != 'undefined') {
        currentColor = theCell.getAttribute('bgcolor');
        newColor     = (currentColor.toLowerCase() == theMarkerColor.toLowerCase())
                     ? theNormalBgColor
                     : theMarkerColor;
        theCell.setAttribute('bgcolor', newColor, 0);
        
    } else {
    */
        currentColor = theCell.style.backgroundColor;
        newColor     = (currentColor.toLowerCase() == theMarkerColor.toLowerCase())
                     ? theNormalBgColor
                     : theMarkerColor;
        theCell.style.backgroundColor = newColor;
		
		
		
    //}
	
	/* For subnodes of this cell, like links, we like to change the textcolor */
	if ( theCell.hasChildNodes ( ) ) {
		var child = theCell.firstChild;
		// works only in IE 5 and greater		
		child.style.color = theNormalBgColor;
	}
    
    return true;
} // end of the 'setPointer()' function


   

/**
 * Sets the image's src url to the given url
 *
 * @param image Image Objetct
 * @param url String containing an url to an image resource
 * @return true on success
 */
function setImage ( image, url ) {

  if ( image== null || typeof(image) == "undefined" ) {
    return false;
  } else {
    image.src=url;
  }
  return true;
}

/**
 * Gets the formular object defined by the given name or id
 *
 * @param name or id for some formular
 * @return a formular object corresponding to the name or id or false, when not found
 */
function getFormular ( id ) {

  var formular;
  //alert ("typeof: "+ typeof ( (document.getElementById) ) );
  if ( "undefined" == typeof ( document.getElementById ) )
    formular = document.forms[id];
  else
    formular = document.getElementById ( id );
  
  if ( formular )
    return formular;
  else 
    return false;
}





