/*
CompareDates(date1,date2)  
Accepts both dates in mm/dd/yyyy format
if (date1>date2) return 1
if (date1==date2) return 0
if (date1<date2) return -1


*/
function CompareDates(date1,date2) 
{ 
   var str1  = date1;
   var str2  = date2;
   try
   {
	   var dt1   = parseInt(str1.substring(0,2),10); 
	   var mon1  = parseInt(str1.substring(3,5),10);
	   var yr1   = parseInt(str1.substring(6,10),10); 
	   var dt2   = parseInt(str2.substring(0,2),10); 
	   var mon2  = parseInt(str2.substring(3,5),10); 
	   var yr2   = parseInt(str2.substring(6,10),10); 
	   var date1 = new Date(yr1, mon1, dt1); 
	   var date2 = new Date(yr2, mon2, dt2); 
	
	   if(date2 > date1)
	   {
		  return -1; 
	   } 
	   else 
	   { 
		  if (date2==date1)
		  {      
			return 0;
		  }
		  else
		  {
			  return 1;
		  }
	   } 
   }
   catch(ex)
   {
	   alert('Wrong date format');return;
   }
} 

function numbersonly(e)
{
	var unicode=e.charCode? e.charCode : e.keyCode
	if (unicode!=8){ //if the key isn't the backspace key (which we should allow)
	if (unicode<48||unicode>57) //if not a number
	{
		alert("Enter Numbers Only");
		return false //disable key press
	}
	}
}
		
//******************************************************************* added for the Phone 	
	function KeyPressLoc(what,e,max,action) {
    if (document.layers) {
        if (e.target.value.length >= max)
            eval(action);
    }
    else if (document.all) {
        if (what.value.length > (max-1))
            eval(action);
    }
//*************
	}
/*********************************************************************************
*	FUNCTION:		isBetween
*	PARAMETERS:		val		AS any value
*					lo		AS Lower limit to check
*					hi		AS Higher limit to check
*	CALLS:			NOTHING
*	RETURNS:		TRUE if val is between lo and hi both inclusive, otherwise false.
**********************************************************************************/
function isBetween (val, lo, hi) {
	
	if ((val < lo) || (val > hi)) { return(false); }
	else { return(true); }
}
function maxChars(mchars,e)
{
	ch=e.srcElement.value.length;
	if (mchars-ch<0)	
	{
		//document.getElementById(id).innerHTML = 0;
		e.srcElement.value=e.srcElement.value.substring(0,mchars);
		return false;
	}
	//BackSpace , Ctrl , Shift , Alt ,   RArrow, LArrow, UArrow, DArrow , Insert , Delete , Home, End,  PageUp , PageDown, BackSpace , Caps Loc
	if (e.keyCode==8 || e.keyCode==17 || e.keyCode==16 || e.keyCode==18 || e.keyCode==37 || e.keyCode==39 || e.keyCode==40 || e.keyCode==45 || e.keyCode==46 || e.keyCode==36 || e.keyCode==35 || e.keyCode==33 || e.keyCode==34 || e.keyCode==8 || e.keyCode==20)
	{
		return true;
	}
	if (ch>=mchars)// && ((e.keyCode>=65 && e.keyCode<=90) || (e.keyCode>=48 && e.keyCode<=57) || e.keyCode==32))
	{
		return false;
	}
	return true;
}


function maxCharsComments(mchars,e,id)
{
	ch=e.srcElement.value.length;
	if (mchars-ch>=0)	
		document.getElementById(id).innerHTML = mchars - ch;
	else
	{
		document.getElementById(id).innerHTML = 0;
		e.srcElement.value=e.srcElement.value.substring(0,mchars);
		return false;
	}

	//BackSpace , Ctrl , Shift , Alt ,   RArrow, LArrow, UArrow, DArrow , Insert , Delete , Home, End,  PageUp , PageDown, BackSpace , Caps Loc
	if (e.keyCode==8 || e.keyCode==17 || e.keyCode==16 || e.keyCode==18 || e.keyCode==37 || e.keyCode==39 || e.keyCode==40 || e.keyCode==45 || e.keyCode==46 || e.keyCode==36 || e.keyCode==35 || e.keyCode==33 || e.keyCode==34 || e.keyCode==8 || e.keyCode==20)
	{
		return true;
	}
	if (ch>=mchars)// && ((e.keyCode>=65 && e.keyCode<=90) || (e.keyCode>=48 && e.keyCode<=57) || e.keyCode==32))
	{
		return false;
	}
	return true;
}
/*********************************************************************************
*	FUNCTION:		isDate checks a valid date
*	PARAMETERS:		theStr		AS String
*	CALLS:			isBetween, isInt
*	RETURNS:		TRUE if theStr is a valid date otherwise false.
**********************************************************************************/
function isDate (theStr) {

	//theStr = trim(theStr);
	
	if(theStr == null || theStr == "")
		return true;
	
	if (isBetween(theStr.length, 8, 10) == false) { return(false); }
	else {
		var the1st = theStr.indexOf('/');
		var the2nd = theStr.lastIndexOf('/');
		
		if (the1st == the2nd) { return(false); }
		else {
			var d = theStr.substring(the1st+1,the2nd);
			var m = theStr.substring(0,the1st);
			var y = theStr.substring(the2nd+1,theStr.length);
			var maxDays = 31;

			if (isInt(m)==false || isInt(d)==false || isInt(y)==false) {
				return(false); }
			else if (y.length < 4) { return(false); }
			else if (isBetween (m, 1, 12) == false) { return(false); }
			else if (m==4 || m==6 || m==9 || m==11) maxDays = 30;
			else if (m==2) {
				if (y % 4 > 0) maxDays = 28;
				else if (y % 100 == 0 && y % 400 > 0) maxDays = 28;
            	else maxDays = 29;
			}
			
			if (isBetween(d, 1, maxDays) == false) { return(false); }
			else { return(true); }
		}
	}
	
}


function isDateRange (theStr,focus,errorMessage,lo,hi) {
	if (isBetween(theStr.length, 8, 10) == false)
	{
		alert(errorMessage);
		focus.focus();	
		return(false);
	}
	else {
		var the1st = theStr.indexOf('/');
		var the2nd = theStr.lastIndexOf('/');
		
		if (the1st == the2nd) {

			alert(errorMessage);
			focus.focus();	
			return(	false);
		}
		else
		{
			var m = theStr.substring(the1st+1,the2nd);
			var d = theStr.substring(0,the1st);
			var y = theStr.substring(the2nd+1,theStr.length);
			var maxDays = 31;

			if (isInt(m)==false || isInt(d)==false || isInt(y)==false) {
					alert(errorMessage);
					focus.focus();	
					return(false); }
			else if (y.length < 4) {
					alert(errorMessage);
					focus.focus();	
					return(false);
			}
			else if (isBetween (m, 1, 12) == false) {
				alert(errorMessage);
				focus.focus();	
				return(false);
			}
			else if (m==4 || m==6 || m==9 || m==11) maxDays = 30;
			else if (m==2) {
				if (y % 4 > 0) maxDays = 28;
				else if (y % 100 == 0 && y % 400 > 0) maxDays = 28;
            	else maxDays = 29;
			}
			
			if (isBetween(d, 1, maxDays) == false) {
					alert(errorMessage);
					focus.focus();	
					return(false);
			}
			else {
				if(!isBetween(y,lo,hi))
				{
					alert(errorMessage);
					focus.focus();	
					return(false);
				}
				else
				{	return(true); }
			}
		}
	}
	
}

/*********************************************************************************
*	FUNCTION:		isDigit
*	PARAMETER:		Any Chracter
*	CALLS			isEmpty to check the NULL
*	RETURNS:		TRUE if the passed chracter is a digit, otherwise FALSE
**********************************************************************************/
function isDigit(theNum) {
	var theMask = '0123456789';
	
	if (isEmpty(theNum)) return(false);
	else if (theMask.indexOf(theNum) == -1) return(false);
	
	return(true);
}
/*********************************************************************************
*	FUNCTION:		isEmail
*	PARAMETER:		String (Email Address)
*	RETURNS:		TRUE if the String is a valid Email address
*					FALSE if the passed string is not a valid Email Address
*	EMAIL FORMAT:	AnyName@EmailServer e.g; webmaster@hotmail.com
*					@ sign can appear only once in the email address.
**********************************************************************************/
function isEmail (string) 
{
	return (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1);
}

/*********************************************************************************
*	FUNCTION	isEmpty checks if the parameter is empty or null
*	PARAMETER	str		AS String
**********************************************************************************/
function isEmpty (str) {
	if ((str==null)||(str.length==0)) return true;
	else return(false);

}

function ltrim ( s ){
  return s.replace( /^\s*/, "" );
}

//Function to trim the space in the right side of the string
function rtrim ( s ){
   return s.replace( /\s*$/, "" );
}

//*Function to trim the space in the  string
function trim(s) {
   var temp = s;
   return temp.replace(/^\s+/,'').replace(/\s+$/,'');
}

function isStringEmpty (str,focus,errorMessage) {

	str = trim(str);
	if ((str==null)||(str.length==0) || str=='None' || str==' ')
	{
		alert("Please Provide "+errorMessage);
		focus.focus();
		return true;
	}
	else return(false);
}

/*********************************************************************************
*	FUNCTION:		isInt
*	PARAMETER:		theStr	AS String 
*	RETURNS:		TRUE if the passed parameter is an integer, otherwise FALSE
*	CALLS:			isDigit
**********************************************************************************/
//Check Number Only
function formatNumber(txt){
			strX=txt.value;
			var newstr="";
			var dot=false;
			for (i=0;i<strX.length;i++)
			 {
				 	if(strX.charCodeAt(i)>=48 && strX.charCodeAt(i)<=57){						
						newstr += strX.charAt(i); 						
					}
					if(strX.charAt(i) == "." && dot==false)
						newstr += strX.charAt(i); 						
					if(strX.charAt(i) == ".")
						dot=true;

			}
			txt.value = newstr;				
}

//check float number at change event
function chkFloatNumber(txt)
{

//		alert(txt.value);
			var dot;
			dot=0;
			strX=txt.value;
			for (i=0;i<strX.length;i++)
			 {
			 	if (strX.charAt(i)==".")
				 {
				 	dot=dot+1;
					 if (dot>1) 
					   {
					   		alert("Enter Decimal Number");
							return false;
						}
				 }
						  
					 if (strX.charCodeAt(i)!=46)
						 if (strX.charCodeAt(i)>58 || strX.charCodeAt(i)<47)  
						 	{
								alert("Enter Decimal Number");
								return false;
							}
				}
}
// numbers only
function numbersonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode
if (unicode!=8){ //if the key isn't the backspace key (which we should allow)
if (unicode<48||unicode>57) //if not a number
{
	alert("Enter Number only");
	return false 
}
}
}
//Float Only
function floatonly(e,txt)
{

var strX
dot=0;
strX = txt.value;
len=strX.length

//alert(len);
//alert(strX.charAt(len-1));

var unicode=e.charCode? e.charCode : e.keyCode
//alert(unicode);

if (unicode!=46) 
{ //if the key isn't the backspace key (which we should allow)
if (unicode<48||unicode>57) //if not a number
return false //disable key press
}

for (i=0;i<strX.length;i++)
 {
 	if (strX.charAt(i)==".")
		 {
		 	dot=dot+1;
			 if (dot>1)
			 	{
					txt.value=strX.substring(0,strX.length-1)
				 	return false;
				}
		 }
}
return true;

}

//check date
function check_date(val)
{
	if (!isDate(val.value))
	{
		alert("Enter Correct Date");
		val.focus();
		return(false);
	}
}

function Round(str){
	return Math.round(str*100)/100;
}

function isNumber(theStr){
	if(isInt(theStr) || isReal(theStr,2))
		return true;
	return false;
}
function toInt(obj){

if(obj==null || isEmpty(obj))
	return 0.00;
else
	return obj;

}
function isInt (theStr) {
	var flag = true;

	if (isEmpty(theStr)) { flag=false; }
	else
	{	for (var i=0; i<theStr.length; i++) {
			if (isDigit(theStr.substring(i,i+1)) == false) {
				flag = false; break;
			}
		}
	}
	return(flag);
}

/*********************************************************************************
*	FUNCTION:		isReal
*	PARAMETER:		theStr	AS String 
					decLen	AS Integer (how many digits after period)
*	RETURNS:		TRUE if theStr is a float, otherwise FALSE
*	CALLS:			isInt
**********************************************************************************/
function isReal (theStr, decLen) {
	var dot1st = theStr.indexOf('.');
	var dot2nd = theStr.lastIndexOf('.');
	var OK = true;
	
	if (isEmpty(theStr)) return false;

	if (dot1st == -1) return(true)
	else if (dot1st != dot2nd) return (false);
	else if (dot1st==0) return (false);
	else {
		var intPart = theStr.substring(0, dot1st);
		var decPart = theStr.substring(dot2nd+1);

		if (decPart.length > decLen) return(false);
		else if (!isInt(intPart) || !isInt(decPart)) return (false);
		else if (isEmpty(decPart)) return (false);
		else return(true);
	}
}

/*********************************************************************************
*	FUNCTION:		isEmail
*	PARAMETER:		String (Email Address)
*	RETURNS:		TRUE if the String is a valid Email address
*					FALSE if the passed string is not a valid Email Address
*	EMAIL FORMAT:	AnyName@EmailServer e.g; webmaster@hotmail.com
*					@ sign can appear only once in the email address.
*********************************************************************************/
function isEmail (string) 
{
	return (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1);
}
/*********************************************************************************
*	FUNCTION:		showHelp
*	DESCRIPTION:	Opens a document in a new window.			
*	PARAMETERS:		docHelp 	Help document
*					winHeight	Height of new window
*					winWidth	Width of the new window.
*	CALLS:			NOTHING
*	RETURNS:		NOTHING
**********************************************************************************/
function showHelp (docHelp, winHeight, winWidth) {
	var winName="winHelp";
	var opt="toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1";
	opt+=",resizable=0,";
	opt+=("width="+winWidth+",height="+winHeight);
	newWin = window.open(docHelp,winName,opt);
	newWin.focus();
}

/*********************************************************************************
*	FUNCTION:		displayReport
*	DESCRIPTION:	Opens a document in a new window.			
*	PARAMETERS:		ReportName 	Report document
*	CALLS:			NOTHING
*	RETURNS:		NOTHING
**********************************************************************************/
function create_pdf(ben)
{
	displayReport('Create_Benpdf_file.asp?Empid=<%response.write Employee_Id%>&Benefit='+ben);		
}
	

function displayReport(ReportName)
{
	ReportWindow=window.open(ReportName, "Report", "toolbar=1,width=788,height=425,menubar=1,status=0,location=0,scrollbars=1,resizable=1,left=0,top=0,alwaysRaised=1");
	ReportWindow.focus();
}
/*********************************************************************************
*	FUNCTION:		closeWindow
*	DESCRIPTION:	Close Report Window
*	PARAMETERS:		Nothing
*	CALLS:			NOTHING
*	RETURNS:		NOTHING
**********************************************************************************/

function closeWindow()
{
	self.close();
}

/*********************************************************************************
*	EO_JSLib.js
**********************************************************************************/


/*******************************************************************************
           Editable dropdown code by TALIB HUSSAIN
********************************************************************************/

  function fnKeyDownHandler(getdropdown, e)
  {
  vEditableOptionIndex_C = getdropdown.options.length-1;

    fnSanityCheck(getdropdown);
    var vEventKeyCode = FindKeyCode(e);

    // Press left/right arrow keys
    if(vEventKeyCode == 37)
    {
    fnLeftToRight(getdropdown);
    }
    if(vEventKeyCode == 39)
    {
    fnRightToLeft(getdropdown);
    }

    // Delete key pressed
    if(vEventKeyCode == 46)
    {
    fnDelete(getdropdown);
    }

    // backspace key pressed
    if(vEventKeyCode == 8 || vEventKeyCode==127)
    {
    if(e.which) //Netscape
    {
      //e.which = ''; //this property has only a getter.
    }
    else //Internet Explorer
    {
      //To prevent backspace from activating the -Back- button of the browser
      e.keyCode = '';
      if(window.event.keyCode)
      {
      window.event.keyCode = '';
      }
    }
    return true;
    }

  }

  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 == vEditableOptionIndex_A)
    // if option the Editable field
    {
      getdropdown.options[getdropdown.options.selectedIndex].text = '';
      getdropdown.options[getdropdown.options.selectedIndex].value = '';
      //getdropdown.options[getdropdown.options.selectedIndex].value = ''; //Use this line only if want to change the internal value too; else this line is not required.
    }
    }
  }

  function FindKeyCode(e)
  {
    if(e.which)
    {
    keycode=e.which;  //Netscape
    }
    else
    {
    keycode=e.keyCode; //Internet Explorer
    }

    //alert("FindKeyCode"+ keycode);
    return keycode;
  }

  function FindKeyChar(e)
  {
    keycode = FindKeyCode(e);
    if((keycode==8)||(keycode==127))
    {
    character="backspace"
    }
    else if((keycode==46))
    {
    character="delete"
    }
    else
    {
    character=String.fromCharCode(keycode);
    }
    //alert("FindKey"+ character);
    return character;
  }

  function fnSanityCheck(getdropdown)
  {
    if(vEditableOptionIndex_A>(getdropdown.options.length-1))
    {
    alert("PROGRAMMING ERROR: The value of variable vEditableOptionIndex_... cannot be greater than (length of dropdown - 1)");
    return false;
    }
  }
  var vEditableOptionIndex_A = 0;

  var vEditableOptionText_A = "--?--";

  var vPreviousSelectIndex_A = 0;
  

  var vSelectIndex_A = 0;

  var vSelectChange_A = 'MANUAL_CLICK';

  function fnChangeHandler_A(getdropdown)
  {
    fnSanityCheck(getdropdown);

    vPreviousSelectIndex_A = vSelectIndex_A;
    // Contains the Previously Selected Index

    vSelectIndex_A = getdropdown.options.selectedIndex;
    // Contains the Currently Selected Index

    if ((vPreviousSelectIndex_A == (vEditableOptionIndex_A)) && (vSelectIndex_A != (vEditableOptionIndex_A))&&(vSelectChange_A != 'MANUAL_CLICK'))
    // To Set value of Index variables - Subrata Chakrabarty
    {
      getdropdown[(vEditableOptionIndex_A)].selected=true;
      vPreviousSelectIndex_A = vSelectIndex_A;
      vSelectIndex_A = getdropdown.options.selectedIndex;
      vSelectChange_A = 'MANUAL_CLICK';
      // Indicates that the Change in dropdown selected
      // option was due to a Manual Click
    }
  }

  function fnKeyPressHandler_A(getdropdown, e)
  {
    vEditableOptionIndex_C = getdropdown.options.length-1;
    fnSanityCheck(getdropdown);
    keycode = FindKeyCode(e);
    keychar = FindKeyChar(e);

    // 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

    if ((keycode>47 && keycode<59)||(keycode>62 && keycode<127) ||(keycode==32))
    {
      var vAllowableCharacter = "yes";
    }
    else
    {
      var vAllowableCharacter = "no";
    }

    //alert(window); alert(window.event);

    if(getdropdown.options.length != 0)
    // if dropdown is not empty
      if (getdropdown.options.selectedIndex == (vEditableOptionIndex_A))
      // if selected option the Editable option of the dropdown
      {

        var vEditString = getdropdown[vEditableOptionIndex_A].text;

        // make Editable option Null if it is being edited for the first time
        if((vAllowableCharacter == "yes")||(keychar=="backspace"))
        {
          if (vEditString == vEditableOptionText_A)
            vEditString = "";
        }
        if (keychar=="backspace")
        // To handle backspace - Subrata Chakrabarty
        {
          vEditString = vEditString.substring(0,vEditString.length-1);
          // Decrease length of string by one from right

          vSelectChange_A = 'MANUAL_CLICK';
          // Indicates that the Change in dropdown selected
          // option was due to a Manual Click

        }
        //alert("EditString2:"+vEditString);

        if (vAllowableCharacter == "yes")
        // To handle addition of a character - Subrata Chakrabarty
        {
          vEditString+=String.fromCharCode(keycode);
                   var i=0;
          var vEnteredChar = String.fromCharCode(keycode);
          var vUpperCaseEnteredChar = vEnteredChar;
          var vLowerCaseEnteredChar = vEnteredChar;


          if(((keycode)>=97)&&((keycode)<=122))
          // if vEnteredChar lowercase
            vUpperCaseEnteredChar = String.fromCharCode(keycode - 32);
            // This is UpperCase


          if(((keycode)>=65)&&((keycode)<=90))
          // if vEnteredChar is UpperCase
            vLowerCaseEnteredChar = String.fromCharCode(keycode + 32);
            // This is lowercase

          if(e.which) //For Netscape
          {
         
            for (i=0;i<=(getdropdown.options.length-1);i++)
            {
              if(i!=vEditableOptionIndex_A)
              {
                var vReadOnlyString = getdropdown[i].text;
                var vFirstChar = vReadOnlyString.substring(0,1);
                if((vFirstChar == vUpperCaseEnteredChar)||(vFirstChar == vLowerCaseEnteredChar))
                {
                  vSelectChange_A = 'AUTO_SYSTEM';
                  // Indicates that the Change in dropdown selected
                  // option was due to System properties of dropdown
                  break;
                }
                else
                {
                  vSelectChange_A = 'MANUAL_CLICK';
                  // Indicates that the Change in dropdown selected
                  // option was due to a Manual Click
                }
              }
            }
          }
        }

        // Set the new edited string into the Editable option
        getdropdown.options[vEditableOptionIndex_A].text = vEditString ;
        getdropdown.options[vEditableOptionIndex_A].value = vEditString;
        //getdropdown.options[vEditableOptionIndex_A].value = vEditString; //Use this line only if want to change the internal value too; else this line is not required.

        return false;
      }
    return true;
  }

  function fnKeyUpHandler_A(getdropdown, e)  
  {
    vEditableOptionIndex_C = getdropdown.options.length-1;
    fnSanityCheck(getdropdown);

    if(e.which) // Netscape
    {
      if(vSelectChange_A == 'AUTO_SYSTEM')
      {
        // if editable dropdown option jumped while editing
        // (due to typing of a character which is the first character of some other option)
        // then go back to the editable option.
        getdropdown[(vEditableOptionIndex_A)].selected=true;
      }

      var vEventKeyCode = FindKeyCode(e);
      // if [ <- ] or [ -> ] arrow keys are pressed, select the editable option
      if((vEventKeyCode == 37)||(vEventKeyCode == 39))
      {
        getdropdown[vEditableOptionIndex_A].selected=true;
      }
    }
  }

  var vEditableOptionIndex_B = 0;
  var vEditableOptionText_B = "--?--";
  var vPreviousSelectIndex_B = 0;
  var vSelectIndex_B = 0;
  var vSelectChange_B = 'MANUAL_CLICK';
  function fnChangeHandler_B(getdropdown)
  {
    fnSanityCheck(getdropdown);

    vPreviousSelectIndex_B = vSelectIndex_B;
    // Contains the Previously Selected Index

    vSelectIndex_B = getdropdown.options.selectedIndex;
    // Contains the Currently Selected Index

    if ((vPreviousSelectIndex_B == (vEditableOptionIndex_B)) && (vSelectIndex_B != (vEditableOptionIndex_B))&&(vSelectChange_B != 'MANUAL_CLICK'))
    // To Set value of Index variables - Subrata Chakrabarty
    {
      getdropdown[(vEditableOptionIndex_B)].selected=true;
      vPreviousSelectIndex_B = vSelectIndex_B;
      vSelectIndex_B = getdropdown.options.selectedIndex;
      vSelectChange_B = 'MANUAL_CLICK';
      // Indicates that the Change in dropdown selected
      // option was due to a Manual Click
    }
  }

  function fnKeyPressHandler_B(getdropdown, e)
  {
  vEditableOptionIndex_C = getdropdown.options.length-1;
    fnSanityCheck(getdropdown);
    keycode = FindKeyCode(e);
    keychar = FindKeyChar(e);

    // 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

    if ((keycode>47 && keycode<59)||(keycode>62 && keycode<127) ||(keycode==32))
    {
      var vAllowableCharacter = "yes";
    }
    else
    {
      var vAllowableCharacter = "no";
    }

    //alert(window); alert(window.event);

    if(getdropdown.options.length != 0)
    // if dropdown is not empty
      if (getdropdown.options.selectedIndex == (vEditableOptionIndex_B))
      // if selected option the Editable option of the dropdown
      {

        var vEditString = getdropdown[vEditableOptionIndex_B].text;

        // make Editable option Null if it is being edited for the first time
        if((vAllowableCharacter == "yes")||(keychar=="backspace"))
        {
          if (vEditString == vEditableOptionText_B)
            vEditString = "";
        }
        if (keychar=="backspace")
        // To handle backspace - Subrata Chakrabarty
        {
          vEditString = vEditString.substring(0,vEditString.length-1);
          // Decrease length of string by one from right

          vSelectChange_B = 'MANUAL_CLICK';
          // Indicates that the Change in dropdown selected
          // option was due to a Manual Click

        }
        //alert("EditString2:"+vEditString);

        if (vAllowableCharacter == "yes")
        // To handle addition of a character - Subrata Chakrabarty
        {
          vEditString+=String.fromCharCode(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 vEnteredChar = String.fromCharCode(keycode);
          var vUpperCaseEnteredChar = vEnteredChar;
          var vLowerCaseEnteredChar = vEnteredChar;


          if(((keycode)>=97)&&((keycode)<=122))
          // if vEnteredChar lowercase
            vUpperCaseEnteredChar = String.fromCharCode(keycode - 32);
            // This is UpperCase


          if(((keycode)>=65)&&((keycode)<=90))
          // if vEnteredChar is UpperCase
            vLowerCaseEnteredChar = String.fromCharCode(keycode + 32);
            // This is lowercase

          if(e.which) //For Netscape
          {
            // Compare the typed character (into the editable option)
            // with the first character of all the other
            // options (non-editable).

            // To note if the jump to the non-editable option was due
            // to a Manual click (i.e.,changed on purpose by user)
            // or due to System properties of dropdown
            // (i.e.,user did not change the option in the dropdown;
            // instead an automatic jump happened due to inbuilt
            // dropdown properties of browser on typing of a character )

            for (i=0;i<=(getdropdown.options.length-1);i++)
            {
              if(i!=vEditableOptionIndex_B)
              {
                var vReadOnlyString = getdropdown[i].text;
                var vFirstChar = vReadOnlyString.substring(0,1);
                if((vFirstChar == vUpperCaseEnteredChar)||(vFirstChar == vLowerCaseEnteredChar))
                {
                  vSelectChange_B = 'AUTO_SYSTEM';
                  // Indicates that the Change in dropdown selected
                  // option was due to System properties of dropdown
                  break;
                }
                else
                {
                  vSelectChange_B = 'MANUAL_CLICK';
                  // Indicates that the Change in dropdown selected
                  // option was due to a Manual Click
                }
              }
            }
          }
        }

        // Set the new edited string into the Editable option
        getdropdown.options[vEditableOptionIndex_B].text = vEditString;
        getdropdown.options[vEditableOptionIndex_B].value = vEditString;
        //getdropdown.options[vEditableOptionIndex_B].value = vEditString; //Use this line only if want to change the internal value too; else this line is not required.

        return false;
      }
    return true;
  }

  function fnKeyUpHandler_B(getdropdown, e)
  {
    vEditableOptionIndex_C = getdropdown.options.length-1;
    fnSanityCheck(getdropdown);

    if(e.which) // Netscape
    {
      if(vSelectChange_B == 'AUTO_SYSTEM')
      {
        // if editable dropdown option jumped while editing
        // (due to typing of a character which is the first character of some other option)
        // then go back to the editable option.
        getdropdown[(vEditableOptionIndex_B)].selected=true;
      }

      var vEventKeyCode = FindKeyCode(e);
      // if [ <- ] or [ -> ] arrow keys are pressed, select the editable option
      if((vEventKeyCode == 37)||(vEventKeyCode == 39))
      {
        getdropdown[vEditableOptionIndex_B].selected=true;
      }
    }
  }

  var vEditableOptionIndex_C = 0;
  var vEditableOptionText_C = "--?--";


  var vPreviousSelectIndex_C = 0;
  var vSelectIndex_C = 0;
  var vSelectChange_C = 'MANUAL_CLICK';
  function fnChangeHandler_C(getdropdown)
  {
    fnSanityCheck(getdropdown);

    vPreviousSelectIndex_C = vSelectIndex_C;
    // Contains the Previously Selected Index

    vSelectIndex_C = getdropdown.options.selectedIndex;
    // Contains the Currently Selected Index

    if ((vPreviousSelectIndex_C == (vEditableOptionIndex_C)) && (vSelectIndex_C != (vEditableOptionIndex_C))&&(vSelectChange_C != 'MANUAL_CLICK'))
    // To Set value of Index variables - Subrata Chakrabarty
    {
      getdropdown[(vEditableOptionIndex_C)].selected=true;
      vPreviousSelectIndex_C = vSelectIndex_C;
      vSelectIndex_C = getdropdown.options.selectedIndex;
      vSelectChange_C = 'MANUAL_CLICK';
      // Indicates that the Change in dropdown selected
      // option was due to a Manual Click
    }
  }

  function fnKeyPressHandler_C(getdropdown, e)
  {
  vEditableOptionIndex_C = getdropdown.options.length-1;
    fnSanityCheck(getdropdown);

    keycode = FindKeyCode(e);
    keychar = FindKeyChar(e);

    // 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

    if ((keycode>47 && keycode<59)||(keycode>62 && keycode<127) ||(keycode==32))
    {
      var vAllowableCharacter = "yes";
    }
    else
    {
      var vAllowableCharacter = "no";
    }

    //alert(window); alert(window.event);

    if(getdropdown.options.length != 0)
    // if dropdown is not empty
      if (getdropdown.options.selectedIndex == (vEditableOptionIndex_C))
      // if selected option the Editable option of the dropdown
      {

        var vEditString = getdropdown[vEditableOptionIndex_C].text;

        // make Editable option Null if it is being edited for the first time
        if((vAllowableCharacter == "yes")||(keychar=="backspace"))
        {
          if (vEditString == vEditableOptionText_C)
            vEditString = "";
        }
        if (keychar=="backspace")
        // To handle backspace - Subrata Chakrabarty
        {
          vEditString = vEditString.substring(0,vEditString.length-1);
          // Decrease length of string by one from right

          vSelectChange_C = 'MANUAL_CLICK';
          // Indicates that the Change in dropdown selected
          // option was due to a Manual Click

        }
        //alert("EditString2:"+vEditString);

        if (vAllowableCharacter == "yes")
        // To handle addition of a character - Subrata Chakrabarty
        {
          vEditString+=String.fromCharCode(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 vEnteredChar = String.fromCharCode(keycode);
          var vUpperCaseEnteredChar = vEnteredChar;
          var vLowerCaseEnteredChar = vEnteredChar;


          if(((keycode)>=97)&&((keycode)<=122))
          // if vEnteredChar lowercase
            vUpperCaseEnteredChar = String.fromCharCode(keycode - 32);
            // This is UpperCase


          if(((keycode)>=65)&&((keycode)<=90))
          // if vEnteredChar is UpperCase
            vLowerCaseEnteredChar = String.fromCharCode(keycode + 32);
            // This is lowercase

          if(e.which) //For Netscape
          {
            // Compare the typed character (into the editable option)
            // with the first character of all the other
            // options (non-editable).

            // To note if the jump to the non-editable option was due
            // to a Manual click (i.e.,changed on purpose by user)
            // or due to System properties of dropdown
            // (i.e.,user did not change the option in the dropdown;
            // instead an automatic jump happened due to inbuilt
            // dropdown properties of browser on typing of a character )

            for (i=0;i<=(getdropdown.options.length-1);i++)
            {
              if(i!=vEditableOptionIndex_C)
              {
                var vReadOnlyString = getdropdown[i].text;
                var vFirstChar = vReadOnlyString.substring(0,1);
                if((vFirstChar == vUpperCaseEnteredChar)||(vFirstChar == vLowerCaseEnteredChar))
                {
                  vSelectChange_C = 'AUTO_SYSTEM';
                  // Indicates that the Change in dropdown selected
                  // option was due to System properties of dropdown
                  break;
                }
                else
                {
                  vSelectChange_C = 'MANUAL_CLICK';
                  // Indicates that the Change in dropdown selected
                  // option was due to a Manual Click
                }
              }
            }
          }
        }
      getdropdown.options[vEditableOptionIndex_C].text = vEditString;
        getdropdown.options[vEditableOptionIndex_C].value = vEditString;
        return false;
      }
    return true;
  }

  function fnKeyUpHandler_C(getdropdown, e)
  {
  vEditableOptionIndex_C = getdropdown.options.length-1;
    fnSanityCheck(getdropdown);

    if(e.which) // Netscape
    {
      if(vSelectChange_C == 'AUTO_SYSTEM')
      {
        // if editable dropdown option jumped while editing
        // (due to typing of a character which is the first character of some other option)
        // then go back to the editable option.
        getdropdown[(vEditableOptionIndex_C)].selected=true;
      }

      var vEventKeyCode = FindKeyCode(e);
      // if [ <- ] or [ -> ] arrow keys are pressed, select the editable option
      if((vEventKeyCode == 37)||(vEventKeyCode == 39))
      {
        getdropdown[vEditableOptionIndex_C].selected=true;
      }
    }
  }

  var vEditableOptionIndex_D = 6;
  var vEditableOptionText_D = "--?--";
  var vPreviousSelectIndex_D = 0;
  var vSelectIndex_D = 0;
  var vSelectChange_D = 'MANUAL_DLICK';
  function fnChangeHandler_D(getdropdown)
  {
    fnSanityCheck(getdropdown);

    vPreviousSelectIndex_D = vSelectIndex_D;
    // Contains the Previously Selected Index

    vSelectIndex_D = getdropdown.options.selectedIndex;
    // Contains the Currently Selected Index

    if ((vPreviousSelectIndex_D == (vEditableOptionIndex_D)) && (vSelectIndex_D != (vEditableOptionIndex_D))&&(vSelectChange_D != 'MANUAL_DLICK'))
    // To Set value of Index variables - Subrata Chakrabarty
    {
      getdropdown[(vEditableOptionIndex_D)].selected=true;
      vPreviousSelectIndex_D = vSelectIndex_D;
      vSelectIndex_D = getdropdown.options.selectedIndex;
      vSelectChange_D = 'MANUAL_DLICK';
      // Indicates that the Change in dropdown selected
      // option was due to a Manual Click
    }
  }

  function fnKeyPressHandler_D(getdropdown, e)
  {
  vEditableOptionIndex_C = getdropdown.options.length-1;
    fnSanityCheck(getdropdown);

    keycode = FindKeyCode(e);
    keychar = FindKeyChar(e);

    // 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

    if ((keycode>47 && keycode<59)||(keycode>62 && keycode<127) ||(keycode==32))
    {
      var vAllowableCharacter = "yes";
    }
    else
    {
      var vAllowableCharacter = "no";
    }

    //alert(window); alert(window.event);

    if(getdropdown.options.length != 0)
    // if dropdown is not empty
      if (getdropdown.options.selectedIndex == (vEditableOptionIndex_D))
      // if selected option the Editable option of the dropdown
      {

        var vEditString = getdropdown[vEditableOptionIndex_D].text;

        // make Editable option Null if it is being edited for the first time
        if((vAllowableCharacter == "yes")||(keychar=="backspace"))
        {
          if (vEditString == vEditableOptionText_D)
            vEditString = "";
        }
        if (keychar=="backspace")
        // To handle backspace - Subrata Chakrabarty
        {
          vEditString = vEditString.substring(0,vEditString.length-1);
          // Decrease length of string by one from right

          vSelectChange_D = 'MANUAL_DLICK';
          // Indicates that the Change in dropdown selected
          // option was due to a Manual Click

        }
        //alert("EditString2:"+vEditString);

        if (vAllowableCharacter == "yes")
        // To handle addition of a character - Subrata Chakrabarty
        {
          vEditString+=String.fromCharCode(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 vEnteredChar = String.fromCharCode(keycode);
          var vUpperCaseEnteredChar = vEnteredChar;
          var vLowerCaseEnteredChar = vEnteredChar;


          if(((keycode)>=97)&&((keycode)<=122))
          // if vEnteredChar lowercase
            vUpperCaseEnteredChar = String.fromCharCode(keycode - 32);
            // This is UpperCase


          if(((keycode)>=65)&&((keycode)<=90))
          // if vEnteredChar is UpperCase
            vLowerCaseEnteredChar = String.fromCharCode(keycode + 32);
            // This is lowercase

          if(e.which) //For Netscape
          {
            // Compare the typed character (into the editable option)
            // with the first character of all the other
            // options (non-editable).

            // To note if the jump to the non-editable option was due
            // to a Manual click (i.e.,changed on purpose by user)
            // or due to System properties of dropdown
            // (i.e.,user did not change the option in the dropdown;
            // instead an automatic jump happened due to inbuilt
            // dropdown properties of browser on typing of a character )

            for (i=0;i<=(getdropdown.options.length-1);i++)
            {
              if(i!=vEditableOptionIndex_D)
              {
                var vReadOnlyString = getdropdown[i].text;
                var vFirstChar = vReadOnlyString.substring(0,1);
                if((vFirstChar == vUpperCaseEnteredChar)||(vFirstChar == vLowerCaseEnteredChar))
                {
                  vSelectChange_D = 'AUTO_SYSTEM';
                  // Indicates that the Change in dropdown selected
                  // option was due to System properties of dropdown
                  break;
                }
                else
                {
                  vSelectChange_D = 'MANUAL_DLICK';
                  // Indicates that the Change in dropdown selected
                  // option was due to a Manual Click
                }
              }
            }
          }
        }

        // Set the new edited string into the Editable option
        getdropdown.options[vEditableOptionIndex_D].text = vEditString;
        getdropdown.options[vEditableOptionIndex_D].value = vEditString;
        //getdropdown.options[vEditableOptionIndex_D].value = vEditString; //Use this line only if want to change the internal value too; else this line is not required.

        return false;
      }
    return true;
  }

  function fnKeyUpHandler_D(getdropdown, e)
  {
  vEditableOptionIndex_C = getdropdown.options.length-1;
    fnSanityCheck(getdropdown);

    if(e.which) // Netscape
    {
      if(vSelectChange_D == 'AUTO_SYSTEM')
      {
        // if editable dropdown option jumped while editing
        // (due to typing of a character which is the first character of some other option)
        // then go back to the editable option.
        getdropdown[(vEditableOptionIndex_D)].selected=true;
      }

      var vEventKeyCode = FindKeyCode(e);
      // if [ <- ] or [ -> ] arrow keys are pressed, select the editable option
      if((vEventKeyCode == 37)||(vEventKeyCode == 39))
      {
        getdropdown[vEditableOptionIndex_D].selected=true;
      }
    }
  }

  var vEditableOptionIndex_E = 6;
  var vEditableOptionText_E = "--?--";
  var vPreviousSelectIndex_E = 0;
  var vSelectIndex_E = 0;
  var vSelectChange_E = 'MANUAL_ELICK';
  function fnChangeHandler_E(getdropdown)
  {
    fnSanityCheck(getdropdown);

    vPreviousSelectIndex_E = vSelectIndex_E;
    // Contains the Previously Selected Index

    vSelectIndex_E = getdropdown.options.selectedIndex;
    // Contains the Currently Selected Index

    if ((vPreviousSelectIndex_E == (vEditableOptionIndex_E)) && (vSelectIndex_E != (vEditableOptionIndex_E))&&(vSelectChange_E != 'MANUAL_ELICK'))
    // To Set value of Index variables - Subrata Chakrabarty
    {
      getdropdown[(vEditableOptionIndex_E)].selected=true;
      vPreviousSelectIndex_E = vSelectIndex_E;
      vSelectIndex_E = getdropdown.options.selectedIndex;
      vSelectChange_E = 'MANUAL_ELICK';
      // Indicates that the Change in dropdown selected
      // option was due to a Manual Click
    }
  }

  function fnKeyPressHandler_E(getdropdown, e)
  {
  vEditableOptionIndex_C = getdropdown.options.length-1;
    fnSanityCheck(getdropdown);

    keycode = FindKeyCode(e);
    keychar = FindKeyChar(e);

    // 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

    if ((keycode>47 && keycode<59)||(keycode>62 && keycode<127) ||(keycode==32))
    {
      var vAllowableCharacter = "yes";
    }
    else
    {
      var vAllowableCharacter = "no";
    }

    //alert(window); alert(window.event);

    if(getdropdown.options.length != 0)
    // if dropdown is not empty
      if (getdropdown.options.selectedIndex == (vEditableOptionIndex_E))
      // if selected option the Editable option of the dropdown
      {

        var vEditString = getdropdown[vEditableOptionIndex_E].text;

        // make Editable option Null if it is being edited for the first time
        if((vAllowableCharacter == "yes")||(keychar=="backspace"))
        {
          if (vEditString == vEditableOptionText_E)
            vEditString = "";
        }
        if (keychar=="backspace")
        // To handle backspace - Subrata Chakrabarty
        {
          vEditString = vEditString.substring(0,vEditString.length-1);
          // Decrease length of string by one from right

          vSelectChange_E = 'MANUAL_ELICK';
          // Indicates that the Change in dropdown selected
          // option was due to a Manual Click

        }
        //alert("EditString2:"+vEditString);

        if (vAllowableCharacter == "yes")
        // To handle addition of a character - Subrata Chakrabarty
        {
          vEditString+=String.fromCharCode(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 vEnteredChar = String.fromCharCode(keycode);
          var vUpperCaseEnteredChar = vEnteredChar;
          var vLowerCaseEnteredChar = vEnteredChar;


          if(((keycode)>=97)&&((keycode)<=122))
          // if vEnteredChar lowercase
            vUpperCaseEnteredChar = String.fromCharCode(keycode - 32);
            // This is UpperCase


          if(((keycode)>=65)&&((keycode)<=90))
          // if vEnteredChar is UpperCase
            vLowerCaseEnteredChar = String.fromCharCode(keycode + 32);
            // This is lowercase

          if(e.which) //For Netscape
          {
            // Compare the typed character (into the editable option)
            // with the first character of all the other
            // options (non-editable).

            // To note if the jump to the non-editable option was due
            // to a Manual click (i.e.,changed on purpose by user)
            // or due to System properties of dropdown
            // (i.e.,user did not change the option in the dropdown;
            // instead an automatic jump happened due to inbuilt
            // dropdown properties of browser on typing of a character )

            for (i=0;i<=(getdropdown.options.length-1);i++)
            {
              if(i!=vEditableOptionIndex_E)
              {
                var vReadOnlyString = getdropdown[i].text;
                var vFirstChar = vReadOnlyString.substring(0,1);
                if((vFirstChar == vUpperCaseEnteredChar)||(vFirstChar == vLowerCaseEnteredChar))
                {
                  vSelectChange_E = 'AUTO_SYSTEM';
                  // Indicates that the Change in dropdown selected
                  // option was due to System properties of dropdown
                  break;
                }
                else
                {
                  vSelectChange_E = 'MANUAL_ELICK';
                  // Indicates that the Change in dropdown selected
                  // option was due to a Manual Click
                }
              }
            }
          }
        }

        // Set the new edited string into the Editable option
        getdropdown.options[vEditableOptionIndex_E].text = vEditString;
        getdropdown.options[vEditableOptionIndex_E].value = vEditString;
        //getdropdown.options[vEditableOptionIndex_E].value = vEditString; //Use this line only if want to change the internal value too; else this line is not required.

        return false;
      }
    return true;
  }

  function fnKeyUpHandler_E(getdropdown, e)
  {
  vEditableOptionIndex_C = getdropdown.options.length-1;
    fnSanityCheck(getdropdown);

    if(e.which) // Netscape
    {
      if(vSelectChange_E == 'AUTO_SYSTEM')
      {
        // if editable dropdown option jumped while editing
        // (due to typing of a character which is the first character of some other option)
        // then go back to the editable option.
        getdropdown[(vEditableOptionIndex_E)].selected=true;
      }

      var vEventKeyCode = FindKeyCode(e);
      // if [ <- ] or [ -> ] arrow keys are pressed, select the editable option
      if((vEventKeyCode == 37)||(vEventKeyCode == 39))
      {
        getdropdown[vEditableOptionIndex_E].selected=true;
      }
    }
  }

  var vEditableOptionIndex_F = 6;

  var vEditableOptionText_F = "--?--";
  var vPreviousSelectIndex_F = 0;
  // Contains the Previously Selected Index, set to 0 by default

  var vSelectIndex_F = 0;
  // Contains the Currently Selected Index, set to 0 by default

  var vSelectChange_F = 'MANUAL_FLICK';
  function fnChangeHandler_F(getdropdown)
  {
    fnSanityCheck(getdropdown);

    vPreviousSelectIndex_F = vSelectIndex_F;
    // Contains the Previously Selected Index

    vSelectIndex_F = getdropdown.options.selectedIndex;
    // Contains the Currently Selected Index

    if ((vPreviousSelectIndex_F == (vEditableOptionIndex_F)) && (vSelectIndex_F != (vEditableOptionIndex_F))&&(vSelectChange_F != 'MANUAL_FLICK'))
    // To Set value of Index variables - Subrata Chakrabarty
    {
      getdropdown[(vEditableOptionIndex_F)].selected=true;
      vPreviousSelectIndex_F = vSelectIndex_F;
      vSelectIndex_F = getdropdown.options.selectedIndex;
      vSelectChange_F = 'MANUAL_FLICK';
      // Indicates that the Change in dropdown selected
      // option was due to a Manual Click
    }
  }

  function fnKeyPressHandler_F(getdropdown, e)
  {
  vEditableOptionIndex_C = getdropdown.options.length-1;
    fnSanityCheck(getdropdown);

    keycode = FindKeyCode(e);
    keychar = FindKeyChar(e);

    // 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

    if ((keycode>47 && keycode<59)||(keycode>62 && keycode<127) ||(keycode==32))
    {
      var vAllowableCharacter = "yes";
    }
    else
    {
      var vAllowableCharacter = "no";
    }

    //alert(window); alert(window.event);

    if(getdropdown.options.length != 0)
    // if dropdown is not empty
      if (getdropdown.options.selectedIndex == (vEditableOptionIndex_F))
      // if selected option the Editable option of the dropdown
      {

        var vEditString = getdropdown[vEditableOptionIndex_F].text;

        // make Editable option Null if it is being edited for the first time
        if((vAllowableCharacter == "yes")||(keychar=="backspace"))
        {
          if (vEditString == vEditableOptionText_F)
            vEditString = "";
        }
        if (keychar=="backspace")
        // To handle backspace - Subrata Chakrabarty
        {
          vEditString = vEditString.substring(0,vEditString.length-1);
          // Decrease length of string by one from right

          vSelectChange_F = 'MANUAL_FLICK';
          // Indicates that the Change in dropdown selected
          // option was due to a Manual Click

        }
        //alert("EditString2:"+vEditString);

        if (vAllowableCharacter == "yes")
        // To handle addition of a character - Subrata Chakrabarty
        {
          vEditString+=String.fromCharCode(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 vEnteredChar = String.fromCharCode(keycode);
          var vUpperCaseEnteredChar = vEnteredChar;
          var vLowerCaseEnteredChar = vEnteredChar;


          if(((keycode)>=97)&&((keycode)<=122))
          // if vEnteredChar lowercase
            vUpperCaseEnteredChar = String.fromCharCode(keycode - 32);
            // This is UpperCase


          if(((keycode)>=65)&&((keycode)<=90))
          // if vEnteredChar is UpperCase
            vLowerCaseEnteredChar = String.fromCharCode(keycode + 32);
            // This is lowercase

          if(e.which) //For Netscape
          {
            // Compare the typed character (into the editable option)
            // with the first character of all the other
            // options (non-editable).

            // To note if the jump to the non-editable option was due
            // to a Manual click (i.e.,changed on purpose by user)
            // or due to System properties of dropdown
            // (i.e.,user did not change the option in the dropdown;
            // instead an automatic jump happened due to inbuilt
            // dropdown properties of browser on typing of a character )

            for (i=0;i<=(getdropdown.options.length-1);i++)
            {
              if(i!=vEditableOptionIndex_F)
              {
                var vReadOnlyString = getdropdown[i].text;
                var vFirstChar = vReadOnlyString.substring(0,1);
                if((vFirstChar == vUpperCaseEnteredChar)||(vFirstChar == vLowerCaseEnteredChar))
                {
                  vSelectChange_F = 'AUTO_SYSTEM';
                  // Indicates that the Change in dropdown selected
                  // option was due to System properties of dropdown
                  break;
                }
                else
                {
                  vSelectChange_F = 'MANUAL_FLICK';
                  // Indicates that the Change in dropdown selected
                  // option was due to a Manual Click
                }
              }
            }
          }
        }

        // Set the new edited string into the Editable option
        getdropdown.options[vEditableOptionIndex_F].text = vEditString;
        getdropdown.options[vEditableOptionIndex_F].value = vEditString;
        //getdropdown.options[vEditableOptionIndex_F].value = vEditString; //Use this line only if want to change the internal value too; else this line is not required.

        return false;
      }
    return true;
  }

  function fnKeyUpHandler_F(getdropdown, e)
  {
  vEditableOptionIndex_C = getdropdown.options.length-1;
    fnSanityCheck(getdropdown);

    if(e.which) // Netscape
    {
      if(vSelectChange_F == 'AUTO_SYSTEM')
      {
        // if editable dropdown option jumped while editing
        // (due to typing of a character which is the first character of some other option)
        // then go back to the editable option.
        getdropdown[(vEditableOptionIndex_F)].selected=true;
      }

      var vEventKeyCode = FindKeyCode(e);
      // if [ <- ] or [ -> ] arrow keys are pressed, select the editable option
      if((vEventKeyCode == 37)||(vEventKeyCode == 39))
      {
        getdropdown[vEditableOptionIndex_F].selected=true;
      }
    }
  }
function message(str){
	alert(str);
}
