﻿/*
Module: DisplayOptions.js

*/

/*
    Variable: displayOptionsIndex
    .

    Variable: currPanel
    .

    Variable: currObj
    .

    Variable: isDisplayOptionsVisible
    .

    Variable: isAnnotationVisible
    .

    Variable: displayOptions
    .

*/
var displayOptionsIndex = 9;
var currPanel = 1;
var currObj = '';
var isDisplayOptionsVisible = false;
var isAnnotationVisible = false;

var displayOptions = new Array(2);  // DisplayOptions object - initialized at pageLoad

	function initializeDisplayOptions()
	{
    displayOptions[0] = new DisplayOptions(false, false, false, false, false);
    displayOptions[1] = new DisplayOptions(false, false, false, false, false);
	}



/*
   Class: DisplayOptions
   maintain the state of the display options for both panels.

   class DisplayOptions()
   property Crossref boolean
   property Footnotes boolean
   property Usernotes boolean
   property Strongs boolean
   property RedLetterOn boolean

   property HasCrossref boolean
   property HasFootnotes boolean
   property HasStrongs boolean
   property HasRedLetter boolean
   property ParentId string

   method setCrossref  boolean
   method setFootnotes  boolean
   method setUsernotes  boolean
   method setStrongs  boolean
   method setRedletteron  boolean
   method setNonCrossref  boolean
   method setNonFootnotes  boolean
   method setNonUsernotes  boolean
   method setNonStrongs  boolean
   method getCrossref  boolean
   method getFootnotes  boolean
   method getUsernotes  boolean
   method getStrongs  boolean
   method getRedletteron  boolean

*/
function DisplayOptions(crossref, footnotes, usernotes, strongs, redletteron) 
{
        this.Crossref = crossref;
        this.Footnotes = footnotes;
        this.Usernotes = usernotes;
        this.Strongs = strongs;
        this.RedLetterOn = redletteron;

        this.HasCrossref = false;
        this.HasFootnotes = false;
        this.HasStrongs = false;
        this.HasRedLetter = false;
        this.ParentId="";

        this.setCrossref=function(bool) {
            this.Crossref = bool;
        }
        this.setFootnotes=function(bool) {
            this.Footnotes = bool;
        }
        this.setUsernotes=function(bool) {
            this.Usernotes = bool;
        }
        this.setStrongs=function(bool) {
            this.Strongs = bool;
        }
        this.setRedletteron=function(bool) {
            this.RedLetterOn = bool;
        }

        this.setNonCrossref=function() {
            this.Crossref = !this.Crossref;
        }
        this.setNonFootnotes=function() {
            this.Footnotes = !this.Footnotes;
        }
        this.setNonUsernotes=function() {
            this.Usernotes = !this.Usernotes;
        }
        this.setNonStrongs=function() {
            this.Strongs = !this.Strongs;
        }

        this.getCrossref=function() {
            return this.Crossref;
        }
        this.getFootnotes=function() {
            return this.Footnotes;
        }
        this.getUsernotes=function() {
            return this.Usernotes;
        }
        this.getStrongs=function() {
            return this.Strongs;
        }
        this.getRedletteron=function() {
            return this.RedLetterOn;
        }
}


/*
    Function: enableDisplayOptions
    Enables the bubble window to every span tag, which name contains 'displayOptions'.

    Parameters:
        id      - element id.
        panel   - panel index (integer)
        hascr   - true if a translation has cross-references.
        hasfn   - true if a translation has footnotes
        hasst   - true if a translation has strongs
        hasrl   - true if a translation has red-letters
        hasnote - true if a translation has usernotes

    Returns:
        nothing.

    See Also:
        <PrepareDisplayOptions(el)>
*/
function enableDisplayOptions(id, panel, hascr, hasfn, hasst, hasrl, hasnote)
{
    if(!document.getElementById || !document.getElementsByTagName) return;

    var h=document.createElement("span");
    h.id="btc";
    h.setAttribute("id","btc");
    h.style.position="absolute";
    document.getElementsByTagName("body")[0].appendChild(h);

    var link = document.getElementById(id);
    link.setAttribute("panel",panel);
    PrepareDisplayOptions(link, panel, hascr, hasfn, hasst, hasrl, hasnote);
    return;
}


/*
    Function: PrepareDisplayOptions
    Creates a bubble window with data.

    Parameters:
        id      - element id.
        panel   - panel index (integer)
        hascr   - true if a translation has cross-references.
        hasfn   - true if a translation has footnotes
        hasst   - true if a translation has strongs
        hasrl   - true if a translation has red-letters
        hasnote - true if a translation has usernotes

    Returns:
        nothing.

    See Also:
        <showDisplayOptions(event)>
        <hideDisplayOptions(event)>
        <LocateDisplayOptions(event, object)>
        <displayOptionsCrossRef(obj,panelindex)>
        <displayOptionsFootnotes(obj,panelindex)>
        <displayOptionsUsernotes(obj,panelindex)>
        <displayOptionsStrongs(obj,panelindex)>
        <displayOptionsRedletter(obj,panelindex)>
*/
function PrepareDisplayOptions(el, panel, hascr, hasfn, hasst, hasrl, hasnote)
{
    var displayoptions = CreateEl("span", "displayOptions");

    var strHascr="block";
    var strHasfn="block";
    var strHasst="block";
    var strHasrl="block";
    if (hascr.toLowerCase()=='false') strHascr="none"; else displayOptions[panel-1].HasCrossref = true;
    if (hasfn.toLowerCase()=='false') strHasfn="none"; else displayOptions[panel-1].HasFootnotes = true;
    if (hasst.toLowerCase()=='false') strHasst="none"; else displayOptions[panel-1].HasStrongs = true;
    if (hasrl.toLowerCase()=='false') strHasrl="none"; else displayOptions[panel-1].HasRedLetter = true;

    var tmp = '<table border="0" cellspacing="0" cellpadding="0" width="128px" >';  //
    // Cross References
    tmp += '<tr id="trHascr" style="display:'+strHascr + ';" >';
    tmp += '<td width="20px" align="center" class="iconcrossref"></td>';
    tmp += '<td width="100px">' + LocalStrings.CrossReferences + '</td>';
    tmp += '<td width="20px"><input name="chkCrossRef" type=checkbox id="chkCrossRef" onclick="displayOptionsCrossRef(this,'+panel+')" title="' + LocalStrings.CrossReferences + '" value="Cross References" /></td>';
    tmp += '</tr>';

    //Footnotes
    tmp += '<tr id="trHasfn" style="display:' +strHasfn + ';" >';
    tmp += '<td width="20px" align="center" class="iconfootnotes"></td>';
    tmp += '<td width="100px">' + LocalStrings.Footnotes + '</td>';
    tmp += '<td width="20px"><input name="chkFootnotes" type=checkbox id="chkFootnotes" onclick="displayOptionsFootnotes(this,'+panel+')" title="' + LocalStrings.Footnotes + '" value="Footnotes" /></td>';
    tmp += '</tr>';

    if (hasnote) {
        //Usernotes
        tmp += '<tr style="display:block;">';
        tmp += '<td width="20px" align="center" class="iconusernotes"></td>';
        tmp += '<td width="100px">' + LocalStrings.Notes + '</td>';
        tmp += '<td width="20px"><input name="chkUsernotes" type=checkbox id="chkUsernotes" onclick="displayOptionsUsernotes(this,'+panel+')" title="' + LocalStrings.Notes + '" value="Notes" /></td>';
        tmp += '</tr>';
    }

    //Strongs number
    tmp += '<tr id="trHasst" style="display:' +strHasst + ';" >';
    tmp += '<td width="20px" align="center" class="iconstrongs"></td>';
    tmp += '<td width="100px">' + LocalStrings.Strongs + '</td>';
    tmp += '<td width="20px"><input name="chkStrongs" type=checkbox id="chkStrongs" onclick="displayOptionsStrongs(this,'+panel+')" title="' + LocalStrings.Strongs + '" value="Strongs" /></td>';
    tmp += '</tr>';

    //Redletter
    tmp += '<tr id="trHasrl" style="display:' +strHasrl + ';" >';
    tmp += '<td width="20px" align="center" class="iconredletter"></td>';
    tmp += '<td width="100px">' + LocalStrings.RedLetter + '</td>';
    tmp += '<td width="20px"><input name="chkRedletter" type=checkbox id="chkRedletter" onclick="displayOptionsRedletter(this,'+panel+')" title="' + LocalStrings.RedLetter + '" value="Redletter" /></td>';
    tmp += '</tr>';

    tmp += '</table>';

    displayoptions.innerHTML = tmp;

    setOpacity(displayoptions);
    el.tooltip=displayoptions;
    el.onclick=showDisplayOptions;
    displayOptions[panel-1].ParentId = el;

}


/*
    Function: processDisplayOptions
    Sets the "displayOptions" object with the translation data (footnotes, cross-references, user-notes, and red-letters).

    Parameters:
        panel   - panel index (integer)
        hascr   - true if a translation has cross-references.
        hasfn   - true if a translation has footnotes
        hasst   - true if a translation has strongs
        hasrl   - true if a translation has red-letters
        hasnote - true if a translation has usernotes

    Returns:
        nothing.
*/
function processDisplayOptions(panel, hascr, hasfn, hasst, hasrl) {
    if (hascr.toLowerCase()=='false')
        displayOptions[panel-1].HasCrossref = false;
    else
        displayOptions[panel-1].HasCrossref = true;

    if (hasfn.toLowerCase()=='false')
        displayOptions[panel-1].HasFootnotes = false;
    else
        displayOptions[panel-1].HasFootnotes = true;

    if (hasst.toLowerCase()=='false')
        displayOptions[panel-1].HasStrongs = false;
    else
        displayOptions[panel-1].HasStrongs = true;

    if (hasrl.toLowerCase()=='false')
        displayOptions[panel-1].HasRedLetter = false;
    else
        displayOptions[panel-1].HasRedLetter = true;
}

/*remove this*/
function fnonclick(e) {
    //alert('fnonclick ' + e);
}
/*remove this*/
function fnonblur() {
    //alert('fnonblur');
}
/*remove this*/
function fnonmouseover() {
    //alert('fnonmouseover');
}


/*
    Function: showDisplayOptions
    Shows the bubble window.

    Parameters:
        e - event.

    Returns:
        nothing.

    See Also:
        <hideDisplayOptions(e)>
*/
function showDisplayOptions(e)
{
    var panel = this.getAttribute("panel");
    
			
    if (isDisplayOptionsVisible)
    {
        isDisplayOptionsVisible = false;
        if (!isBubbleWinVisible)
					hideDisplayOptions(e);
    }
    else 
    {
        currObj = this.id
        currPanel = panel;
        isAnnotationVisible = false;
        isDisplayOptionsVisible = true;

        var panelindex = this.getAttribute("panel");
        var imgsource = displayOptions[panelindex-1].ParentId.src;
        if (imgsource.indexOf('_inactive') != -1 ) return;
        displayOptionsIndex = this.getAttribute("panel");
        hideDisplayOptions(e);
        document.getElementById("btc").appendChild(this.tooltip);
        LocateDisplayOptions(e, this);
        document.getElementById("chkCrossRef").checked = displayOptions[panelindex-1].getCrossref();//crossref;
        document.getElementById("chkFootnotes").checked = displayOptions[panelindex-1].getFootnotes();//footnotes;
        if (document.getElementById("chkUsernotes"))
					document.getElementById("chkUsernotes").checked = displayOptions[panelindex-1].getUsernotes();//usernotes;
        document.getElementById("chkStrongs").checked = displayOptions[panelindex-1].getStrongs();//strongs;
        document.getElementById("chkRedletter").checked = displayOptions[panelindex-1].getRedletteron();//redletteron;

        var strHascr = 'block';
        var strHasfn = 'block';
        var strHasst = 'block';
        var strHasrl = 'block';
        if (displayOptions[panel-1].HasCrossref==false) strHascr='none';
        if (displayOptions[panel-1].HasFootnotes==false) strHasfn='none';
        if (displayOptions[panel-1].HasStrongs==false) strHasst='none';
        if (displayOptions[panel-1].HasRedLetter==false) strHasrl='none';
        var trHascr= document.getElementById("trHascr");
        var trHasfn= document.getElementById("trHasfn");
        var trHasst= document.getElementById("trHasst");
        var trHasrl= document.getElementById("trHasrl");
        trHascr.style.display = strHascr;
        trHasfn.style.display = strHasfn;
        trHasst.style.display = strHasst;
        trHasrl.style.display = strHasrl;

        isBubbleWinVisible = true;

    }
    return;

}


/*
    Function: hideDisplayOptions
    Hides the bubble window.

    Parameters:
        e - event.

    Returns:
        nothing.

    See Also:
        <showDisplayOptions(event)>
*/
function hideDisplayOptions(e)
{
    var d=document.getElementById("btc");
    try 
    {
      if (d.firstChild != null)
				d.removeChild(d.firstChild);
      isBubbleWinVisible = false;
    }
    catch(err) { }
    return;
}


/*
    Function: LocateDisplayOptions
    Locates the bubble window.

    Parameters:
        e   - event.
        obj - object name

    Returns:
        nothing.
*/
function LocateDisplayOptions(e, obj)
{
    var objLeftPad=parseFloat(obj.style.paddingLeft);
    var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	document.getElementById("btc").style.top=curtop+20+"px";
    document.getElementById("btc").style.left=curleft+1+objLeftPad+"px";

    return;
}


/*
    Function: displayOptionsCrossRef
    Shows/or hides the cross-reference icons.

    Parameters:
        obj        - object name.
        panelindex - panel index (1 or 2).

    Returns:
        nothing.

    See Also:
        <enableTooltips()>
*/
function displayOptionsCrossRef(obj,panelindex) {
    if (obj != null) displayOptions[panelindex-1].setNonCrossref();
    var links=document.getElementById("mybstversesdisplay"+panelindex).getElementsByTagName("img");
    for(i=0;i<links.length;i++)
    {
        var name = links[i].id;
        var idx = name.indexOf( 'iconpopupCrossref' );
        if ( idx != -1 ) {
            if (displayOptions[panelindex-1].getCrossref()) {
                if (window.getComputedStyle) {
                    links[i].style.display='-moz-inline-block'; }
                links[i].style.display='inline-block';//}
            }
            else {
                links[i].style.display='none'; }
        }
    }
    if (obj != null) enableTooltips();
    return;
}


/*
    Function: displayOptionsFootnotes
    Shows/or hides the footnote icons.

    Parameters:
        obj        - object name.
        panelindex - panel index (1 or 2).

    Returns:
        nothing.

    See Also:
        <enableTooltips()>
*/
function displayOptionsFootnotes(obj,panelindex) {
    if (obj != null) displayOptions[panelindex-1].setNonFootnotes();
    var links=document.getElementById("mybstversesdisplay"+panelindex).getElementsByTagName("img");
    for(i=0;i<links.length;i++)
    {
        var name = links[i].id;
        var idx = name.indexOf( 'iconpopupFootnote' );
        if ( idx != -1 ) {
            if (displayOptions[panelindex-1].getFootnotes()) {
                if (window.getComputedStyle) {
                    links[i].style.display='-moz-inline-block'; }
                links[i].style.display='inline-block';
            }
            else
                links[i].style.display='none';
        }
    }
    if (obj != null) enableTooltips();
    return;
}


/*
    Function: displayOptionsUsernotes
    Shows/or hides the user-note icons.

    Parameters:
        obj        - object name.
        panelindex - panel index (1 or 2).

    Returns:
        nothing.

    See Also:
        <enableTooltips()>
*/
function displayOptionsUsernotes(obj,panelindex)
{
    if (obj != null) displayOptions[panelindex-1].setNonUsernotes();
    var links=document.getElementById("mybstversesdisplay"+panelindex).getElementsByTagName("img");
    for(i=0;i<links.length;i++)
    {
        var name = links[i].id;
        var idx = name.indexOf( 'iconpopupUserNote' );
        if ( idx != -1 ) {
            if (displayOptions[panelindex-1].getUsernotes()) {
                if (window.getComputedStyle) {
                    links[i].style.display='-moz-inline-block'; }
                links[i].style.display='inline-block';
            }
            else
                links[i].style.display='none';
        }
    }
    if (obj != null) enableNotesWindow();
    return;
}


/*
    Function: displayOptionsStrongs
    Shows/or hides the strongs icons.

    Parameters:
        obj        - object name.
        panelindex - panel index (1 or 2).

    Returns:
        nothing.

    See Also:
        <enableTooltips()>
*/
function displayOptionsStrongs(obj,panelindex)
{
    if (obj != null) displayOptions[panelindex-1].setNonStrongs();
    var links=document.getElementById("mybstversesdisplay"+panelindex).getElementsByTagName("img");
    for(i=0;i<links.length;i++)
    {
        var name = links[i].id;
        var idx = name.indexOf( 'iconStrongs' );
        if ( idx != -1 ) {
            if (displayOptions[panelindex-1].getStrongs()) {
                if (window.getComputedStyle) {
                    links[i].style.display='-moz-inline-block'; }
                links[i].style.display='inline-block';
            }
            else {
                links[i].style.display='none'; }
        }
    }
    if (obj != null) enableTooltips();
    return;
}


/*
    Function: displayOptionsRedletter
    Shows/or hides the red-letters.

    Parameters:
        obj        - object name.
        panelindex - panel index (1 or 2).

    Returns:
        nothing.

    See Also:
        <enableTooltips()>
*/
function displayOptionsRedletter(obj,panelindex) 
{
    if (obj != null) 
			displayOptions[panelindex-1].setRedletteron(!displayOptions[panelindex-1].RedLetterOn);
			
    var links=document.getElementById("mybstversesdisplay"+panelindex).getElementsByTagName("span");
    var htmlValue = document.getElementById("mybstversesdisplay"+panelindex).innerHTML;
    var displayredletter = false;
    
    for(i=0;i<links.length;i++)
    {
        if(obj == null) 
        {
            displayredletter = displayOptions[panelindex-1].RedLetterOn;
        }
        else 
        {
            displayredletter = obj.checked;
        }
        if (displayredletter) 
        {
            if (links[i].className == 'redletteroff') 
            {
                htmlValue = htmlValue.replace("redletteroff","redletteron");
            }
        }
        else 
        {
            if (links[i].className == 'redletteron') 
            {
                htmlValue = htmlValue.replace("redletteron","redletteroff");
            }
        }
    }

    document.getElementById("mybstversesdisplay"+panelindex).innerHTML = htmlValue;
    if (obj != null) 
    { 
			enableTooltips();  
			enableNotesWindow(); 
		}
}


/*
    Variable: colorStyle
    .
*/
var colorStyle = '';


/*
    Function: enableAnnotation
    Enables the bubble window to these image tags: imgForeColor1, imgForeColor2, imgHiliteColor1, and imgHiliteColor2.

    Parameters:
        id        - element id.
        panel     - panel index.
        forecolor - text-color/or hilite color falgs.

    Returns:
        nothing.

    See Also:
        <PrepareAnnotation(el)>
*/
function enableAnnotation(id, panel, forecolor)
{
    if(!document.getElementById || !document.getElementsByTagName) return;

    var h=document.createElement("span");
    h.id="btc";
    h.setAttribute("id","btc");
    h.style.position="absolute";
    h.style.zIndex=12;
    document.getElementsByTagName("body")[0].appendChild(h);

    var link = document.getElementById(id);
    link.setAttribute("panel",panel);
    PrepareAnnotation(link, panel, forecolor);
    return;
}



/*
    Function: PrepareAnnotation
    Creates a bubble window with data.

    Parameters:
        id        - element id.
        panel     - panel index.
        forecolor - text-color/or hilite color falgs.

    Returns:
        nothing.

    See Also:
        <showAnnotation(event)>
        <hideAnnotation(event)>
        <locateAnnotation(event, object)>
*/
function PrepareAnnotation(el, panel, forecolor)
{
    var annotation = CreateEl("span", "annotation");

	/* Why the iframe?  It fixes an IE5/6 bug where the drop down that shows all the bible versions overlaps thes
	color picker drop down always.  It's annoying, but placing an iframe between the two lets us mask the drop down. */
    var tmp = '<iframe frameborder="0"></iframe>';
    tmp += '<table cellpadding="0" cellspacing="0"  >';

    if (forecolor) {
        tmp += '<tr><td id="RTE_333333" style="background:#333333" onmouseover="over(this)" onmouseout="out(this)" onmousedown="down(this, ' + panel + ')" >&nbsp;</td></tr>';
        tmp += '<tr><td id="RTE_800000" style="background:#800000" onmouseover="over(this)" onmouseout="out(this)" onmousedown="down(this, ' + panel + ')" >&nbsp;</td></tr>';
        tmp += '<tr><td id="RTE_336600" style="background:#336600" onmouseover="over(this)" onmouseout="out(this)" onmousedown="down(this, ' + panel + ')" >&nbsp;</td></tr>';
        tmp += '<tr><td id="RTE_3333cc" style="background:#3333cc" onmouseover="over(this)" onmouseout="out(this)" onmousedown="down(this, ' + panel + ')" >&nbsp;</td></tr>';
        tmp += '<tr><td id="RTE_000080" style="background:#000080" onmouseover="over(this)" onmouseout="out(this)" onmousedown="down(this, ' + panel + ')" >&nbsp;</td></tr>';
    }
    else {
        tmp += '<tr><td id="RTE_ffb4b4" style="background:#ffb4b4" onmouseover="over(this)" onmouseout="out(this)" onmousedown="down(this, ' + panel + ')" >&nbsp;</td></tr>';
        tmp += '<tr><td id="RTE_ffcc80" style="background:#ffcc80" onmouseover="over(this)" onmouseout="out(this)" onmousedown="down(this, ' + panel + ')" >&nbsp;</td></tr>';
        tmp += '<tr><td id="RTE_ffff80" style="background:#ffff80" onmouseover="over(this)" onmouseout="out(this)" onmousedown="down(this, ' + panel + ')" >&nbsp;</td></tr>';
        tmp += '<tr><td id="RTE_ccff80" style="background:#ccff80" onmouseover="over(this)" onmouseout="out(this)" onmousedown="down(this, ' + panel + ')" >&nbsp;</td></tr>';
        tmp += '<tr><td id="RTE_b4e6ff" style="background:#b4e6ff" onmouseover="over(this)" onmouseout="out(this)" onmousedown="down(this, ' + panel + ')" >&nbsp;</td></tr>';
    }
    tmp += '</table>';

    annotation.innerHTML = tmp;
    setOpacity(annotation);
    el.tooltip=annotation;
    el.onclick=showAnnotation;

}


/*
    Function: showAnnotation
    Shows the bubble window.

    Parameters:
        e - event.

    Returns:
        nothing.

    See Also:
        <hideAnnotation(e)>
*/
function showAnnotation(e)
{
    var panel = this.getAttribute("panel");
    if (isAnnotationVisible)
    {
        isAnnotationVisible = false;
        if (!isBubbleWinVisible)
					hideAnnotation(e);
    }
    else 
    {
        currObj = this.id;
        var imgsource = this.src;
        if (imgsource.indexOf('_inactive') != -1 ) return;

        isDisplayOptionsVisible = false;
        isAnnotationVisible = true;
        hideAnnotation(e);
        document.getElementById("btc").appendChild(this.tooltip);
        LocateAnnotation(e, this);
        isBubbleWinVisible = true;
    }
}


/*
    Function: hideAnnotation
    Hides the bubble window.

    Parameters:
        e - event.

    Returns:
        nothing.

    See Also:
        <showAnnotation(event)>
*/
function hideAnnotation(e)
{
    var d=document.getElementById("btc");
    try {
        if(d.childNodes.length>0) d.removeChild(d.firstChild);
        isBubbleWinVisible = false;
    }
    catch(err) {
    }
    return;
}


/*
    Function: LocateAnnotation
    Locates the bubble window.

    Parameters:
        e   - event.
        obj - object name

    Returns:
        nothing.
*/
function LocateAnnotation(e, obj)
{
    var temp = obj.id.toLowerCase();
    temp=temp.replace('img','');
    temp=temp.replace('1','');
    temp=temp.replace('2','');
    colorStyle = temp;
    var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	document.getElementById("btc").style.top=curtop+25+"px";
    document.getElementById("btc").style.left=curleft+"px";

    return;
}


/*
    Function: over
    Changes the cursor-style when the mouse is over the object.

    Parameters:
        ob - object-name.

    Returns:
        nothing.

    See Also:
        <out(ob)>
        <down(ob,panel)>
*/
function over(ob) {
	ob.style.border = '1px solid #ffffff';
	ob.style.cursor = 'hand';
	ob.style.cursor = 'pointer';
}


/*
    Function: out
    Resets the cursor-style to the default-cursor.

    Parameters:
        ob - object-name.

    Returns:
        nothing.

    See Also:
        <over(ob)>
        <down(ob,panel)>
*/
function out(ob) {
	ob.style.border = '1px solid #000000';
	ob.style.cursor = 'default';
}


/*
    Function: down
    Calls the method "annotateClick()" to change the color (text-color or hilite color).

    Parameters:
        ob    - object-name.
        panel - panel index.

    Returns:
        nothing.

    See Also:
        <over(ob)>
        <out(ob)>
        <annotateClick(panel,colorStyle,color)>
*/
function down(ob, panel) 
{
	var color = '#' + ob.id.replace('RTE_', '');
	isAnnotationVisible = false;
	var d=document.getElementById("btc");
	if(d.childNodes.length>0) 
		d.removeChild(d.firstChild);
	annotateClick(panel,colorStyle,color);
}


