function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


    /*------------------------------------------------

	EDITABLE DROP DOWN MENU
    Variables required for 
    fnChangeHandler_First() & fnKeyPressHandler_First() 
    for Editable Dropdowns
    -------------------------- Subrata Chakrabarty 3.Jan.2003 
    */


    var PreviousSelectIndex_First = 0;       
    /* Contains the Previously Selected Index */
    
    var SelectIndex_First = 0;               
    /* Contains the Currently Selected Index  */
    
    var SelectChange_First = 'MANUAL_CLICK'; 
    /* Indicates whether Change in dropdown selected value */
    /* was due to a Manual Click                           */
    /* or due to System properties of dropdown             */
    



    /*------------------------------------------------
    Functions required for  Editable Dropdowns
    -------------------------- Subrata Chakrabarty 3.Jan.2003 */
    
    
    

    function fnChangeHandler_First(getdropdown)
    {
      PreviousSelectIndex_First = SelectIndex_First;       
      /* Contains the Previously Selected Index */
      
      SelectIndex_First = getdropdown.options.selectedIndex;
      /* Contains the Currently Selected Index  */
      
      if ((PreviousSelectIndex_First == (0)) && (SelectIndex_First != (0))&&(SelectChange_First != 'MANUAL_CLICK')) 
      /* To Set value of Index variables - Subrata Chakrabarty 3.Jan.2003 */
      {
        getdropdown[(0)].selected=true;
        PreviousSelectIndex_First = SelectIndex_First;
        SelectIndex_First = getdropdown.options.selectedIndex;
        SelectChange_First = 'MANUAL_CLICK';         
        /* Indicates that the Change in dropdown selected 
			value was due to a Manual Click */
      }
    }
    
    
    
    

    function fnKeyPressHandler_First(getdropdown)
    {
      if(getdropdown.options.length != 0)
      /*if dropdown is not empty*/
        if (getdropdown.options.selectedIndex == (0))
        /*if option the Editable field i.e. the FIRST option */
        {
          var EditString = EditMe_First.innerText;    
          /* Contents of Editable Option */
          
          if (EditString == "your searchterms")            
          /* On backspace on default value of Editable option make Editable option Null */
            EditString = "";
            
          if ((window.event.keyCode==8 || window.event.keyCode==127)) 
          /* To handle backspace - Subrata Chakrabarty 3.Jan.2003 */
          {
            EditString = EditString.substring(0,EditString.length-1); 
            /* Decrease length of string by one from right */
            
            SelectChange_First = 'MANUAL_CLICK';      
            /* Indicates that the Change in dropdown selected 
				value was due to a Manual Click */
            
          }
          
          
          /* Check for allowable Characters  */
          /*
          The various characters allowable for entry into Editable option..
          may be customized by minor modifications in the code (if condition below)
          (you need to know the keycode/ASCII value of the  character to be allowed/disallowed.
          - Subrata Chakrabarty 3.Jan.2003
          */
          
          if ((window.event.keyCode==46) || (window.event.keyCode>47 && window.event.keyCode<59)||(window.event.keyCode>62 && window.event.keyCode<127) ||(window.event.keyCode==32)) 
          /* To handle addition of a character - Subrata Chakrabarty 3.Jan.2003 */
          {
            EditString+=String.fromCharCode(window.event.keyCode);
            /*Concatenate Enter character to Editable string*/

            /* The following portion handles the "automatic Jump" bug*/
            /*
            The "automatic Jump" bug (Description):
               If a alphabet is entered (while editing)
               ...which is contained as a first character in one of the read-only options
               ..the focus automatically "jumps" to the read-only option
               (-- this is a common property of normal dropdowns
                ..but..is undesirable while editing).
            */
            
            var i=0;
            var EnteredChar = String.fromCharCode(window.event.keyCode);
            var UpperCaseEnteredChar = EnteredChar;
            var LowerCaseEnteredChar = EnteredChar;
            
            
            if(((window.event.keyCode)>=97)&&((window.event.keyCode)<=122))
            /*if EnteredChar lowercase*/
              UpperCaseEnteredChar = String.fromCharCode(window.event.keyCode - 32); 
              /*This is UpperCase*/
              
              
            if(((window.event.keyCode)>=65)&&((window.event.keyCode)<=90))
            /*if EnteredChar is UpperCase*/            
              LowerCaseEnteredChar = String.fromCharCode(window.event.keyCode + 32); 
              /*This is lowercase*/
              
              
            for (i=0;i<(getdropdown.options.length-1);i++)
            { var ReadOnlyString = getdropdown[i].innerText;
              var FirstChar = ReadOnlyString.substring(0,1);
              if((FirstChar == UpperCaseEnteredChar)||(FirstChar == LowerCaseEnteredChar))
              {
                SelectChange_First = 'AUTO_SYSTEM';   
                /* Indicates that the Change in dropdown selected 
                value was due to System properties of dropdown */
                break;
              }
              else
              {
                SelectChange_First = 'MANUAL_CLICK';   
                /* Indicates that the Change in dropdown selected 
                value was due to a Manual Click */
              }
            }
          }
          
          /*Set new value of edited string into the Editable field */
          EditMe_First.innerText = EditString;
          EditMe_First.value = EditString;
          return false;
        }
      return true;
    }
   /*-------------------------------------------------------------------------------------------- Subrata Chakrabarty 3.Jan.2003 */

function fnLeftToRight(getdropdown)
{
  getdropdown.style.direction = "ltr";
}

function fnRightToLeft(getdropdown)
{
  getdropdown.style.direction = "rtl";
}

function fnDelete(getdropdown)
{
      if(getdropdown.options.length != 0)
      /*if dropdown is not empty*/
        if (getdropdown.options.selectedIndex == (0))
        /*if option the Editable field i.e. the FIRST option */
        {
			getdropdown.options[getdropdown.options.selectedIndex].text = '';
        }
}
