<!--

//Highlight form element- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and TOS,
//visit http://www.dynamicdrive.com

var highlightcolor="white";
var texthighlightcolor="red";

var boxbgcolor="#D7E5F2";
var boxtextcolor="#102132";


var ns6=(document.getElementById&&!document.all);
var prev='';
var eventobj;

//Regular expression to highlight only form elements
var intended=/INPUT|TEXTAREA|SELECT|OPTION/;


//Function to check whether element clicked is form element
function checkel(which)
{
    if (which.style&&intended.test(which.tagName))
	{
        if (ns6&&eventobj.nodeType==3)
            eventobj=eventobj.parentNode.parentNode;
        return true;
    }
    else
       return false;
}

//Function to highlight form element
function formhighlight(e)
{
   eventobj=(ns6 ? e.target : event.srcElement);
   if (prev!='')
   {
      if (checkel(prev))
	  {
          prev.style.backgroundColor=boxbgcolor;
		  prev.style.color=boxtextcolor;
	  }
      prev=eventobj;
      if (checkel(eventobj))
	  {
          eventobj.style.backgroundColor=highlightcolor;
          eventobj.style.color=texthighlightcolor;
	  }
   }
   else
   {
      if (checkel(eventobj))
	  {
          eventobj.style.backgroundColor=highlightcolor;
          eventobj.style.color=texthighlightcolor;
	  }
      prev=eventobj;
   }
}


/**
 * This array is used to remember mark status of rows in browse mode
 */
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.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
        }
    }
    // 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


// ----------------------------------------------

var nav1highlightcolor = '';
var nav1originalcolor  = '';
var nav2highlightcolor = '';
var nav2originalcolor  = '';

function NsHighLiteColor()
{
    nav1highlightcolor = '#cccc99';
	nav1originalcolor  = '#999999';
	
    nav2highlightcolor = '#cccc99';
	nav2originalcolor  = '#e4ddc3';

//  bee_td_nav1_HighColor
	//$cfg['bee_td_nav1_selected']   = '#e4ddc3';  // the color to use for HighLite nav1 selected section
   // $cfg['bee_td_nav1_default']   = '#999999';  // the color to use for Normal color nav1 section option
}


function changetoNS(e)
{


//   var highlightcolor = '#FFCC99';
//   var originalcolor  = '#DDDDDD';
     NsHighLiteColor();
	 
	if (document.layers) 
	{
        //alert( 'doc layers event = ' + event +'\n');
	
	} //old IE browsers:
	else if (document.all) 
	{
 	    source=event.srcElement
	} //W3C standard:
	else 
	{
	    source = eval(e);  //  (typeof(eval(source).target.getAttribute('id')) != 'undefined' ) &&
        if (typeof(eval(source).target.getAttribute) != 'undefined' )
		    vID = eval(source).target.getAttribute('id');
        goTarget = false;
		goAmenu = false;

//        alert( 'target.getAttribute(id) event = ' + eval(source).target.getAttribute('id') +'\n');
//      alert( 'source.target.nodeName event = ' + eval(source).target.nodeName +'\n');
	  
//        alert( 'e.target event = ' + eval(e).target +'\n');
//        alert( 'e.target.style.backgroundColor event = ' + eval(e).target.style.backgroundColor +'\n');
//		dumpProps(eval(e));
//	    while(source.tagName!="TD")
//		      source=source.parentNode;
//		dumpProps(eval(source).target.getAttribute('id'));

		if ( vID != null ) 
		{
		   if (vID.indexOf('amenu')!=-1)   goAmenu = true;
		   else if ( vID.indexOf('menu')!=-1 ) goTarget = true;

	       if (vID.indexOf('nav1')!=-1) 
		   {
		      highlightcolor = nav1highlightcolor;
		   }
		   else 
		   {
		      highlightcolor = nav2highlightcolor;
		   }
		}
//        alert( 'vID.indexOf(menu) event = ' + vID.indexOf('menu') +'\n');

		
		if ( ( eval(source).target.nodeName == 'TD' && goTarget)  || ( eval(source).target.nodeName == 'A' && goAmenu) )  
		{
           if (goTarget) 
		   {  
//      alert( 'source.target.getAttribute event = ' + source.target.getAttribute('bgcolor') +'\n');
//      alert( 'highlightcolor  = ' + highlightcolor +'\n');
//		dumpProps(eval(source).target);
               
		       if ( source.target.getAttribute('bgcolor') != highlightcolor )
                    source.target.setAttribute('bgcolor', highlightcolor);
//      alert( 'AFTER source.target.getAttribute event = ' + source.target.getAttribute('bgcolor') +'\n');
		   }
		   else 
		   {
//      alert( 'source.target.parentNode.getAttribute event = ' + source.target.parentNode.getAttribute('bgcolor') +'\n');
//      alert( 'highlightcolor  = ' + highlightcolor +'\n');
		        if ( source.target.parentNode.getAttribute('bgcolor') != highlightcolor )
                     source.target.parentNode.setAttribute('bgcolor', highlightcolor);
//      alert( 'AFTER source.target.parentNode.getAttribute event = ' + source.target.parentNode.getAttribute('bgcolor') +'\n');
		   }
	    }
		else if ( source.target.parentNode.nodeName == 'TD' )
		{
		     pID = eval(source).target.parentNode.getAttribute('id');
             goPTarget = false;
		     if ( pID != null ) 
			 {
		        if ( pID.indexOf('menu')!=-1 ) goPTarget = true;
		     }

             if (goPTarget) 
			 {
		        if ( source.target.parentNode.getAttribute('bgcolor') != highlightcolor )
                     source.target.parentNode.setAttribute('bgcolor', highlightcolor);
			 }
		}
	}
    return routeEvent(e);
}


function changebkNS(e)
{
//   var highlightcolor = '#FFCC99';
//   var originalcolor  = '#DDDDDD';
     NsHighLiteColor();
		      originalcolor = nav2originalcolor;

	if (document.layers) 
	{
        //alert( 'doc layers event = ' + event +'\n');
	} //old IE browsers:
	else if (document.all) 
	{
 	    source=event.srcElement
	} //W3C standard:
	else
	{
	    source = eval(e);
        if (typeof(eval(source).target.getAttribute) != 'undefined' )
		    vID = eval(source).target.getAttribute('id');
        goTarget = false;
		goAmenu = false;
		tst = eval(vID);
//		alert( 'tst = ' + tst +'\n');
		
        if (tst != null )

		{
		   if (vID.indexOf('amenu')!=-1)   goAmenu = true;
		   else if ( vID.indexOf('menu')!=-1 ) goTarget = true;

	       if (vID.indexOf('nav1')!=-1) 
		   {
		      originalcolor = nav1originalcolor;
		   }
		   else
		   {
		      originalcolor = nav2originalcolor;
		   }
		}
		if ( ( eval(source).target.nodeName == 'TD' && goTarget)  || ( eval(source).target.nodeName == 'A' && goAmenu) )  
		{
           if (goTarget) 
		   {
		       if ( source.target.getAttribute('bgcolor') != originalcolor )
                    source.target.setAttribute('bgcolor', originalcolor);
		   }
		   else 
		   {
		        if ( source.target.parentNode.getAttribute('bgcolor') != originalcolor )
                     source.target.parentNode.setAttribute('bgcolor', originalcolor);
		   }
	    }
		else if ( source.target.parentNode.nodeName == 'TD' )
		{
		     pID = eval(source).target.parentNode.getAttribute('id');
             goPTarget = false;
		     if ( pID != null ) 
			 {
		        if ( pID.indexOf('menu')!=-1 ) goPTarget = true;
		     }

             if (goPTarget) 
			 {
		         if ( source.target.parentNode.getAttribute('bgcolor') != originalcolor )
                      source.target.parentNode.setAttribute('bgcolor', originalcolor);
			 }
		}
	}
    return routeEvent(e);
}

/*
 |
 | changeto(highlightcolor) 
 | 
 */
function changeto(highlightcolor)
{
	if (document.layers) 
	{
        //alert( 'doc layers event = ' + event +'\n');
	
	} //old IE browsers:
	else if (document.all) 
	{

 	    var source=event.srcElement
		//alert( 'source.tagName = ' + source.tagName +'\n');
	    if (source.tagName=="TR"||source.tagName=="TABLE")
		    return
	    while(source.tagName!="TD")
		      source=source.parentElement;
		//alert( 'source.tagName = ' + source.tagName +'\n'+'source.id = ' + source.id +'\n'+'source.style.backgroundColor = ' + source.style.backgroundColor +'\n');

	    if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore" &&source.id.indexOf('menu')!=-1)
		     source.style.backgroundColor=highlightcolor
	} 
    return true; 
}


/*
 |
 | changeback(originalcolor) 
 | 
 */
function changeback(originalcolor)
{
   //alert('nav type = '+ navigator.userAgent + '\n');
   if ( navigator.userAgent.indexOf("MSIE")!=-1 ) 
   {
	   var osource=event.srcElement
	   if (event.fromElement.contains(event.toElement)||osource.contains(event.toElement)||osource.id=="ignore")
		   return
	   if (osource.tagName=="TR"||osource.tagName=="TABLE"||osource.id=="ignore")
		   return
	    while(osource.tagName!="TD")
		      osource=osource.parentElement;
	   if (event.toElement!=osource&&osource.id.indexOf('menu')!=-1)
		   osource.style.backgroundColor=originalcolor
   }
}

var nofocus = 0;
function cancelFocus()
{
  nofocus = 1;
}

/*
 |
 | setFocus()
 | 
 */
 var submit_active = 0;
function setFocus(formName, input_type) 
{

   if (nofocus) return;
   //d.forms[1][formName]
   //dumpProps(top.document.forms);
   //alert("SETFOCUS = "+document.forms[1][formName].length+"\n");

//   alert("SETFOCUS formName = "+document.forms[i].name+"\n");
    //alert("SETFOCUS input_type = "+input_type+"\n");
   
     if (document.forms.length > 0) 
	 {
         x = 0;
         for (j=0;j<document.forms.length;j++) 
		 {
//   alert("SETFOCUS = "+document.forms[i].name+"\n");
		     if (document.forms[j].name == formName) {
			    x = j;
   //alert("SETFOCUS found = "+document.forms[j].name+"\n");
				//dumpProps(document.forms[j]);
			}
		 }
     //   alert("SETFOCUS = "+top.code.clviewActive+"\n");
        //   alert("ici doFocus = "+top.code.doFocus+"\n");
		submit_active = submit_active - 1;
		if (submit_active < 0) submit_active = 0;
        //  alert('submit_active = '+submit_active+'\n');
  // alert("SETFOCUS found x = "+document.forms[x].name+"\n");
        var el, type, i = 0, j, els = document.forms[x].elements;
        while (el = els[i++]) 
	    {
				//dumpProps(el.attributes.type);
             //alert("el.attributes.type.nodeValue = "+el.attributes.type+"\n");

            if ( (typeof(el.attributes.type.nodeValue) != 'undefined')  && (typeof(el.attributes.type.nodeValue) != 'null') )
			{
	           if (el.attributes.type.nodeValue == input_type)
			   {
                  ///alert("attr found = "+el.attributes.type.nodeValue+"\n");
				  return el.focus();
			    }
		    }
          } // end while (el = els[i++]) 
		
     } // end if (document.forms.length > 0 && top.code.clviewActive == 0 && top.code.doFocus) 
}

function MM_jumpMenu(targ,selObj,restore)
{ //v3.0
   eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
   if (restore) selObj.selectedIndex=0;
}


/*
 |
 | dumpProps(obj, parent) 
 | 
 */
function dumpProps(obj, parent) {
	for (var i in obj) {
		if (parent) { msg = parent + "." + i + "\n" + obj[i]; } else { var msg = i + "\n" + obj[i]; }
		if (!confirm(msg)) { return; }
		if (typeof obj[i] == "object") { 
			if (parent) { dumpProps(obj[i], parent + "." + i); } else { dumpProps(obj[i], i); }
		}
	}
}


// ------------------------------------------------


if ( (navigator.userAgent.indexOf("Mozilla")!=-1) && (navigator.userAgent.indexOf("Opera")==-1) && (navigator.userAgent.indexOf("MSIE")==-1)) 
{
   //alert("navigator.userAgent = "+navigator.userAgent+"\n");
   
   if (!window.event && window.captureEvents) {
       // set up event capturing for mouse events (add or subtract as desired)
       window.captureEvents(Event.MOUSEOUT|Event.MOUSEOVER|Event.KEYUP|Event.CLICK);
       // set window event handlers (add or subtract as desired)
//       window.onmouseout = changebkNS;
//	   window.onmouseover = changetoNS;
       window.onkeyup = formhighlight;
	   window.onclick= formhighlight;

       // create an object to store the event properties 
       window.event = new Object;
    }
}


// remove frmeset if there
if (top.frames.length > 0)
{
    top.location.href = location.href;
}

//-->
