/************************************
 * Datei      	:   rowMark.js
 * Projekt   	:   emisweb
 * Beschreibung	:	Zeilenmarkierung
 * Author    	:   mario alves/511
 ************************************/

 
function rowMark(overColor, markedColor, overMarked, onClick)
{	
    /**
     * Set class properties
     * @access private
     */		
    this.overColor = overColor;
    this.markedColor = markedColor;
    this.overMarked = overMarked;
    this.onClick = onClick;

    /**
     * dynamic properties
     * @access private
     */
    this.oldColor = '';
    this.oldColorMarked = '';
    this.markedRow = '';

    /**
     * Define class methods
     * @access private
     */
    this.over = rowMark_over;
    this.out = rowMark_out;
    this.click = rowMark_click;

    /**
     * Browsercheck
     * @access private
     */
    this.browser = '';
	this.specialrow = '';

}

/**
 * rowMark::over()
 * @param object oRow table row object
 */
function rowMark_over(oRow) {
	if (oRow == null)
	{
		return;
	}
	
    if ( oRow.style.backgroundColor != this.markedColor ) {
        this.oldColor = oRow.style.backgroundColor;
    }
    
    if ( oRow.style.backgroundColor == this.markedColor ) {
        oRow.style.backgroundColor = this.overMarked;
    } else {
        oRow.style.backgroundColor = this.overColor;
    }
    
}

/**
 * rowMark::out()
 * @param object oRow table row object
 */
function rowMark_out(oRow) {

    if (oRow == this.markedRow) {
        oRow.style.backgroundColor = this.markedColor;
    } else {
        oRow.style.backgroundColor = this.oldColor;
    }
    
}

/**
 * rowMark::over()
 * @param object oRow table row object
 */
function rowMark_click(oRow) 
{
	this.specialrow = oRow.id;
	if (oRow == null)
	{
		return;
	}

    if (typeof this.markedRow != "object") 
    {
        oRow.style.backgroundColor = this.markedColor;
        this.markedRow = oRow;
        this.oldColorMarked = this.oldColor;
        
        if ( "" != this.onClick ) {
            eval( this.onClick );
        }
        
    } else if (this.markedRow != oRow)
    {
        this.markedRow.style.backgroundColor = this.oldColorMarked;
        oRow.style.backgroundColor = this.markedColor;
        this.markedRow = oRow;
        this.oldColorMarked = this.oldColor;
        
        if ( "" != this.onClick ) 
        {
            eval(this.onClick);
        }
    } 
}


/**
rowMark instances 
**/

/* rowMark instance for the
   general use */
row = new rowMark('#fff', '#f4f2c2', '#fff');
row2 = new rowMark('#fff', '#f4f2c2', '#fff');
row3 = new rowMark('#fff', '#f4f2c2', '#fff');
/*row = new rowMark('#D7F0AF', '#D7F0AF', '#D7F0AF');*/

/* rowMark instance for the
   Subnavigation */
//sub = new rowMark('#c6c6d5', '#a9aec2', '#c6c6d5');
sub = new rowMark('#fff', '#fff', '#fff');

