var xmlhttp = null;
// Timer Variables
var c = 0;
var t = 0;
var gSrcFieldNameArr = new Array();
var gValueField;
var gTextField;
var gRefreshFieldName;
var gRefreshFieldNameArr = new Array();
var gGetTagName;
var gElementName = "SELECT";
var gNoDataFound = -1403;
var gSelectedValue = '';
var gErrorMessage  = '';
var gAlertShowInd  = true;
var gResultText    = '';

 /* A function which calls a servlet  named AjaxServlet to get XmlData using XmlHttpObject */
 function refreshElementAjax( inUrl )
 {
      //alert('inUrl '+inUrl);

      //----------------------------------------------------------
      // INITIALIZE GLOBAL VARIABLES
      //----------------------------------------------------------
      gAlertShowInd = true;
      gNoDataFound  = '';
      //gErrorMessage = '';
      //----------------------------------------------------------

      lSearchStringFrom = '';
      lSearchStringTo   = '';

      lSearchStringFrom = '&fieldList=';
      lSearchStringTo   = '&destFieldList=';
      lFieldList        = inUrl.substring(inUrl.indexOf(lSearchStringFrom)+lSearchStringFrom.length ,inUrl.indexOf(lSearchStringTo));

      //----------------------------------------------------------
      gSrcFieldNameArr  = lFieldList.split(',');
      //gValueField       = lFieldList.substring(0,lFieldList.indexOf(','));
      //gTextField        = lFieldList.substring(lFieldList.indexOf(',')+1);
      //alert( 'lFieldList '+lFieldList );

      var lLastIndexOf  = 0;
      var lSearchString = ' AS ';
      //-------------------------------
      lLastIndexOf      = gSrcFieldNameArr[0].indexOf( lSearchString );
      if ( lLastIndexOf > 0  )
        gValueField     = gSrcFieldNameArr[0].substring( lLastIndexOf + lSearchString.length );
      else
        gValueField     = gSrcFieldNameArr[0];
      //-------------------------------

      //-------------------------------
      if ( gSrcFieldNameArr.length > 1 )
      {
        lLastIndexOf      = gSrcFieldNameArr[1].indexOf( lSearchString );
        if ( lLastIndexOf > 0  )
          gTextField        = gSrcFieldNameArr[1].substring( lLastIndexOf + lSearchString.length );
        else
          gTextField        = gSrcFieldNameArr[1];
      }
      //-------------------------------

      //alert( 'gValueField & gTextField '+gValueField + ' ' + gTextField );
      //----------------------------------------------------------

      lSearchStringFrom = '&destFieldList=';
      lSearchStringTo   = '&getTagName=';
      gRefreshFieldName = inUrl.substring(inUrl.indexOf(lSearchStringFrom)+lSearchStringFrom.length ,inUrl.indexOf(lSearchStringTo));
      gRefreshFieldNameArr=gRefreshFieldName.split(',');

      lSearchStringFrom = '&getTagName=';
      lSearchStringTo   = '&elementName=';
      gGetTagName       = inUrl.substring(inUrl.indexOf(lSearchStringFrom)+lSearchStringFrom.length ,inUrl.indexOf(lSearchStringTo));

      lSearchStringFrom = '&elementName=';
      if ( inUrl.indexOf( '&others' ) < 0 )
        gElementName      = inUrl.substring(inUrl.indexOf(lSearchStringFrom)+lSearchStringFrom.length);
      else
      {
        lSearchStringTo   = '&others=';
        gElementName      = inUrl.substring(inUrl.indexOf(lSearchStringFrom)+lSearchStringFrom.length ,inUrl.indexOf(lSearchStringTo));
      }

      //alert('lFieldList '+lFieldList);
      //alert('lFieldList '+gValueField+' '+gTextField);
      //alert('gRefreshFieldName '+gRefreshFieldName);
      //alert('gRefreshFieldNameArr.length '+gRefreshFieldNameArr.length);
      //alert('gGetTagName '+gGetTagName);
      //alert('gElementName '+gElementName);
      
      xmlhttp = null
      // code for initializing XmlHttpRequest Object On Browsers like  Mozilla, etc.
      if (window.XMLHttpRequest)
      { xmlhttp = new XMLHttpRequest() }
      // code for initializing XmlHttpRequest Object On Browsers like IE
      else 
      if (window.ActiveXObject) 
      { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP") }
      if (xmlhttp != null)
      {
         //Setting the Servlet url to get XmlData
         //Course of Action That Should be Made if their is a change in XmlHttpRequest Object ReadyState 
         //NOTE : it is 4 when it         has got request from CGI
         //if ( gElementName == 'LOV' )
         //  xmlhttp.onreadystatechange = getResponseActionForLOV;
         //else
         if ( gElementName == 'SELECT' )
         {
           xmlhttp.onreadystatechange = getResponseActionForDD;
           //Open the Request by passing Type of Request & CGI URL
           xmlhttp.open("GET",inUrl,true);
           //Sending URL Encoded Data
           //xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
           xmlhttp.send(null);
         }
         else
         if ( gElementName == 'TEXT' )
         {
           //alert(gSrcFieldNameArr.length+ ' ' + gRefreshFieldNameArr.length);
           if ( gSrcFieldNameArr.length != gRefreshFieldNameArr.length )
           { alert('Source and Target Field List should match'); }
           //alert(gRefreshFieldNameArr[gRefreshFieldNameArr.length-1]);
           if ( gRefreshFieldNameArr != null && gRefreshFieldNameArr.length > 1 )
           {
             xmlhttp.onreadystatechange = getResponseActionForTextArr;
           }
           else
           {
             xmlhttp.onreadystatechange = getResponseActionForText;
             /*
             //----------------------------------------------
             if ( gAlertShowInd )
             {
               alert('gAlertShowInd gNoDataFound '+gNoDataFound)
               if ( gNoDataFound == -1403 )
               {
                 alert('gNoDataFound '+gNoDataFound)
                 if ( gErrorMessage != null && gErrorMessage.length > 0 )
                   alert( gErrorMessage );
                 else
                   alert('NO DATA FOUND');
               }
             }
             //----------------------------------------------
             */
           }
           //Open the Request by passing Type of Request & CGI URL
           xmlhttp.open("GET",inUrl,true);
           //Sending URL Encoded Data
           //xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
           xmlhttp.send(null);
         }
         else
         if ( gElementName == 'HTML' )
         {
           if ( gRefreshFieldNameArr != null && gRefreshFieldNameArr.length > 1 )
             xmlhttp.onreadystatechange = getResponseActionForHtmlArr;
           else
             xmlhttp.onreadystatechange = getResponseActionForHtml;
           //Open the Request by passing Type of Request & CGI URL
           xmlhttp.open("GET",inUrl,true);
           //Sending URL Encoded Data
           //xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
           xmlhttp.send(null);
         }
         else
         if ( gElementName == 'TAHE' ) // TEXTAREA WITH HTML EDITOR (FOR WITHOUT EDITOR HTML parameter can be used)
         {
           if ( gRefreshFieldNameArr != null && gRefreshFieldNameArr.length > 1 )
             xmlhttp.onreadystatechange = getResponseActionForTAHtmlArr;
           else
             xmlhttp.onreadystatechange = getResponseActionForTAHtml;
           //Open the Request by passing Type of Request & CGI URL
           xmlhttp.open("GET",inUrl,true);
           //Sending URL Encoded Data
           //xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
           xmlhttp.send(null);
         }
         else
         if ( gElementName == 'FILE_UPLOAD' )
         {
           if ( gRefreshFieldNameArr != null && gRefreshFieldNameArr.length > 1 )
             xmlhttp.onreadystatechange = getResponseActionForHtmlArr;
           else
             xmlhttp.onreadystatechange = getResponseActionForHtml;
           //Open the Request by passing Type of Request & CGI URL
           xmlhttp.open("GET",inUrl,true);
           //Sending URL Encoded Data
           xmlhttp.setRequestHeader('Content-Type', 'multipart/form-data');
           xmlhttp.send(null);
         }
      }
      else
      {
         // Only Broswers like IE 5.0,Mozilla & all other browser which support XML data Supports AJAX Technology
         // In the Below case it looks as if the browser is not compatiable
         //alert("Your browser does not support XMLHTTP.")
         jAlert("Your browser does not support XMLHTTP.")
      }
      //alert( 'refreshCombo ends ');
 }


 /* Used for verifing right ReadyState & Status of XmlHttpRequest Object returns true if it is verified */
 function verifyReadyState(inObj)
 {
    // 0 Object is not initialized
    // 1 Loading object is loading data
    // 2 Loaded object has loaded data
    // 3 Data from object can be worked with
    // 4 Object completely initialized
    //if (inObj.readyState != 4) { return false; }

    //alert('verifyReadyState - starts '+inObj.readyState+' '+inObj.status);
    // As Said above if XmlHttp.ReadyState == 4 then the Page Has got Response from WebServer
    if(inObj.readyState == 4)
    {
      // Similarly if XmlHttp.status == 200 it means that we have got a Valid response from the WebServer
      if(inObj.status == 200)
      { return true }
      else
      {
        jAlert("Problem retrieving XML data, Probably your session has expired");
        //IS_SESSION_ALIVE=false;
      }
    }
    //alert('verifyReadyState - end ');
 }
 
 ///////////////////// TEXT Method Starts /////////////////////
 /* Action that has to take place after getting reponse */
 function getResponseActionForText()
 {
   try
   {
   //alert('getResponseActionForText - starts');
   gNoDataFound = 0;
   if ( verifyReadyState(xmlhttp) == true )
   {
     //alert('getResponseActionForText - ReadyState');

     var response = xmlhttp.responseXML.documentElement;
     //alert( gSrcFieldNameArr[0].toUpperCase() );
     var lFieldNameNodeList  = response.getElementsByTagName(gSrcFieldNameArr[0].toUpperCase());

     //alert( gSrcFieldNameArr[0].toUpperCase() );
     if ( lFieldNameNodeList != null && lFieldNameNodeList.length > 0 )
     {
       //alert('getResponseActionForText - ReadyState Nodelist');
       //var lFieldNameByTagName = response.getElementsByTagName(gSrcFieldNameArr[0].toUpperCase())[0].childNodes[0].nodeValue;
       if ( gRefreshFieldName != '_blank' )
         document.getElementById(gRefreshFieldName).value=
         response.getElementsByTagName(gSrcFieldNameArr[0].toUpperCase())[0].childNodes[0].nodeValue;
       else
         gResultText = response.getElementsByTagName(gSrcFieldNameArr[0].toUpperCase())[0].childNodes[0].nodeValue;
     }
     else
     {
       //alert('getResponseActionForText - else ReadyState Nodelist');
       gNoDataFound = -1403;
       document.getElementById(gRefreshFieldName).value='';
       throw 'NO DATA FOUND';
     }
   }
   else
   {
     gNoDataFound = -1403;
     document.getElementById(gRefreshFieldName).value='';
   }
   //alert('getResponseActionForText - gNoDataFound : '+gNoDataFound);

   //alert('getResponseActionForText - ends');
   }
   catch ( exception )
   {
     //if ( exception.description == null )
     //{
     //  alert('ERROR : '+exception.message  );
     //  gNoDataFound = -1403;
     //}
     //else
     //  alert('ERROR : '+exception.description  );

     //----------------------------------------------
     if ( gAlertShowInd )
     {
       //alert('gAlertShowInd gNoDataFound '+gNoDataFound)
       if ( gNoDataFound == -1403 )
       {
         //alert('gNoDataFound '+gNoDataFound)
         if ( gErrorMessage != null && gErrorMessage.length > 0 )
           //alert( gErrorMessage );
           jAlert( gErrorMessage );
         else
           //alert('NO DATA FOUND');
           jAlert('NO DATA FOUND');
       }
     }
     //----------------------------------------------

   }
 }
 ///////////////////// TEXT Method Ends /////////////////////

 ///////////////////// TEXTAREA Method Starts /////////////////////
 /* Action that has to take place after getting reponse */
 function getResponseActionForTAHtml()
 {
   //alert('getResponseActionForTAHtml - starts');
   //alert('getResponseActionForTAHtml - starts-'+document.getElementById(gRefreshFieldName).innerHTML);
   if ( verifyReadyState(xmlhttp) == true )
   {
     //alert('getResponseActionForTAHtml - true '+document.getElementById(gRefreshFieldName).id+' '+xmlhttp.responseText);
     if ( gRefreshFieldName != '_blank' )
     {
       $("textarea#"+gRefreshFieldName).attr('value', xmlhttp.responseText);
     }
     else
     {
       $("textarea#"+gRefreshFieldName).attr('value', xmlhttp.responseText);
       gResultText = xmlhttp.responseText;
     }
     $("textarea#"+gRefreshFieldName).htmlarea();
   }
   else
   {
     if ( document.getElementById(gRefreshFieldName) )
       document.getElementById(gRefreshFieldName).innerHTML = '';
     gNoDataFound = -1403;
   }
   //alert('getResponseActionForTAHtml - ends');
 }
 ///////////////////// TEXTAREA Method Ends /////////////////////


 ///////////////////// HTML Method Starts /////////////////////
 /* Action that has to take place after getting reponse */
 function getResponseActionForHtml()
 {
   //alert('getResponseActionForHtml - starts');
   //alert('getResponseActionForHtml - starts-'+document.getElementById(gRefreshFieldName).innerHTML);
   if ( verifyReadyState(xmlhttp) == true )
   {
     //alert('getResponseActionForHtml - true '+xmlhttp.responseText);
     if ( gRefreshFieldName != '_blank' )
       document.getElementById(gRefreshFieldName).innerHTML = xmlhttp.responseText;
     else
     {
       document.getElementById(gRefreshFieldName).innerHTML = xmlhttp.responseText;
       gResultText = xmlhttp.responseText;
     }
   }
   else
   {
     //alert('getResponseActionForHtml - false '+gRefreshFieldName +' '+document.getElementById(gRefreshFieldName).innerHTML);
     //if ( gRefreshFieldName == '_blank' )
     if ( document.getElementById(gRefreshFieldName) )
       document.getElementById(gRefreshFieldName).innerHTML = '';
     gNoDataFound = -1403;
   }
   //alert('getResponseActionForHtml - ends');
 }
 ///////////////////// HTML Method Ends /////////////////////


 ///////////////////// HTML Method Starts /////////////////////
 /* Action that has to take place after getting reponse */
 function getResponseActionForHtmlArr()
 {
   //alert('getResponseActionForHtmlArr - starts');
   if( verifyReadyState(xmlhttp) == true )
   {
      gNoDataFound = 0;
      var response = xmlhttp.responseXML.documentElement;

      for ( lFieldCnt = 0; lFieldCnt < gRefreshFieldNameArr.length; lFieldCnt++)
      {

        gRefreshFieldName = gRefreshFieldNameArr[lFieldCnt];
        //alert(gRefreshFieldName); 
        //Deleting all the Present Elements in the Drop-Down Box
        drRemove();
        // Checking for the Root Node Tag ('result')[0].firstChild.data
        //alert( gSrcFieldNameArr[lFieldCnt].toUpperCase() );
        //alert( 'response.XML '+response.xml );
        //alert( response.getElementsByTagName(gSrcFieldNameArr[lFieldCnt].toUpperCase())[0].childNodes[0].nodeValue );
        var lGetTagName = response.getElementsByTagName(gGetTagName);
        if ( lGetTagName != null && lGetTagName.length > 0 )
        {
          document.getElementById(gRefreshFieldNameArr[lFieldCnt]).innerHTML=
          (response.getElementsByTagName(gSrcFieldNameArr[lFieldCnt].toUpperCase())[0].childNodes[0].nodeValue)
          .replace(/#LFTTAG#/g, "<").replace(/#RHTTAG#/g, ">"); // NOW OBSOLETE
          //;
        }
        else
        {
          if ( gErrorMessage != null && gErrorMessage.length > 0 )
            //alert( gErrorMessage );
            jAlert( gErrorMessage );
          else
          {
            document.getElementById(gRefreshFieldName).innerHTML='NDF-2';
            gNoDataFound = -1403;
          }
          break;
        }
      }
   }
   else
   {
      gNoDataFound = -1403;
      for ( lFieldCnt = 0; lFieldCnt < gRefreshFieldNameArr.length; lFieldCnt++)
        document.getElementById(gRefreshFieldNameArr[lFieldCnt]).innerHTML='NDF-2';
   }

   //alert('getResponseActionForHtmlArr - ends');
 }
 ///////////////////// HTML Method Ends /////////////////////



 ///////////////////// TEXT List Method Starts /////////////////////
 function getResponseActionForTextArr()
 {
   //alert('getResponseActionForTextArr - starts');
   if( verifyReadyState(xmlhttp) == true )
   {
      gNoDataFound = 0;
      var response = xmlhttp.responseXML.documentElement;

      for ( lFieldCnt = 0; lFieldCnt < gRefreshFieldNameArr.length; lFieldCnt++)
      {

        gRefreshFieldName = gRefreshFieldNameArr[lFieldCnt];
        //alert(gRefreshFieldName); 
        //Deleting all the Present Elements in the Drop-Down Box
        drRemove();
        // Checking for the Root Node Tag
        //alert( gSrcFieldNameArr[lFieldCnt].toUpperCase() );
        var lGetTagName = response.getElementsByTagName(gGetTagName);
        if ( lGetTagName != null && lGetTagName.length > 0 )
        {
          document.getElementById(gRefreshFieldNameArr[lFieldCnt]).value=
          response.getElementsByTagName(gSrcFieldNameArr[lFieldCnt].toUpperCase())[0].childNodes[0].nodeValue;
        }
        else
        {
          if ( gErrorMessage != null && gErrorMessage.length > 0 )
            //alert( gErrorMessage );
            jAlert( gErrorMessage );
          else
          {
            //if ( gAlertShowInd ) alert('NO DATA FOUND');
            if ( gAlertShowInd ) jAlert('NO DATA FOUND');
          }
          break;
        }
      }
   }
   else
   {
      gNoDataFound = -1403;
      for ( lFieldCnt = 0; lFieldCnt < gRefreshFieldNameArr.length; lFieldCnt++)
        document.getElementById(gRefreshFieldNameArr[lFieldCnt]).value='';
   }
   //alert('getResponseActionForTextArr - ends '+gNoDataFound);
 }
 ///////////////////// TEXT List Method Ends /////////////////////

 ///////////////////// DD Method Starts /////////////////////
 function getResponseActionForDD()
 {
   //alert( 'getResponseActionForDD starts ' +gValueField+'-'+gTextField );
   // Verifying State & Status
   if( verifyReadyState(xmlhttp) == true )
   {
      // Building a DOM parser from Response Object
      var response = xmlhttp.responseXML.documentElement;

      for ( lFieldCnt = 0; lFieldCnt < gRefreshFieldNameArr.length; lFieldCnt++)
      {
        gRefreshFieldName = gRefreshFieldNameArr[lFieldCnt];
        //alert(gRefreshFieldName); 
        //Deleting all the Present Elements in the Drop-Down Box
        drRemove();
        // Checking for the Root Node Tag
        var lGetTagName = response.getElementsByTagName(gGetTagName);
        if ( lGetTagName != null && lGetTagName.length > 0 )
          ;//alert('lGetTagName.length '+lGetTagName.length);
        else
        {
          if ( gErrorMessage != null && gErrorMessage.length > 0 )
            //alert( gErrorMessage );
            jAlert( gErrorMessage );
          else
          {
            //if ( gAlertShowInd ) alert('NO DATA FOUND');
            if ( gAlertShowInd ) jAlert('NO DATA FOUND');
          }
          break;
        }
        
        var lValue;
        var lText;
        var lCreTagName;

        ///////////////  WRITE ZEROTH ELEMENT //////////////

        //if ( lGetTagName != null &&  ( lGetTagName.length > 1 || lGetTagName.length == 0 ) )
        var gRefreshFieldNameObj = document.getElementById(gRefreshFieldName);
        if ( gRefreshFieldNameObj )
        {
          lCreTagName       = document.createElement("OPTION");
          lValue            = lGetTagName[0].getElementsByTagName(gValueField);
          lCreTagName.value = '';
          lText             = lGetTagName[0].getElementsByTagName(gTextField);
          lCreTagName.text  = 'SELECT';
          document.getElementById(gRefreshFieldName).options.add(lCreTagName);
        }

        ///////////////  WRITE ALL ELEMENT //////////////
        //lCreTagName       = document.createElement("OPTION");
        //lValue            = lGetTagName[0].getElementsByTagName(gValueField);
        //lCreTagName.value = 'ALL';
        //lText             = lGetTagName[0].getElementsByTagName(gTextField);
        //lCreTagName.text  = 'ALL';
        //document.getElementById(gRefreshFieldName).options.add(lCreTagName);

        ///////////////  WRITE OTHER VALID VALUES ELEMENT //////////////
        for ( var i = 0; i < lGetTagName.length; i++ )
        {
          lCreTagName = document.createElement("OPTION");
          var lError;
          // Checking for the tag which holds the value of the Drop-Down combo element
          lValue = lGetTagName[i].getElementsByTagName(gValueField);
          {
            try
            {
              // Assigning the value to a Drop-Down Set Element
              lCreTagName.value = lValue[0].firstChild.data;
            } 
            catch(lError) { }
          }
          // Checking for the tag which holds the Text of the Drop-Down combo element
          lText = lGetTagName[i].getElementsByTagName(gTextField);
          {
            try
            {
              // Assigning the Text to a Drop-Down Set Element
              lCreTagName.text = lText[0].firstChild.data;
            } 
            catch(lError)
            { }
          }
          // Adding the Set Element to the Drop-Down


          /////////////////////////////////////////////////////////////////////
          //alert( gSelectedValue+' - '+lCreTagName.value+' - '+lCreTagName.text+' - '+gRefreshFieldName );
          if ( gSelectedValue != null 
            && gSelectedValue.length > 0 
            && gSelectedValue == lCreTagName.value )
          {
            lCreTagName.selected = true;
            gSelectedValue = null;
            //alert( lCreTagName.selected );
            //break;
          }
          else
          {
            lCreTagName.selected = false;
          }
          //gSelectedValue = null;
          /////////////////////////////////////////////////////////////////////

          if ( gRefreshFieldNameObj ) document.getElementById(gRefreshFieldName).options.add(lCreTagName);
        }
      }
   }
   //alert( 'getResponseActionForDD ends ' );
 }
 ///////////////////// DD Method Ends /////////////////////


 ///////////////////// LOV Method Starts /////////////////////
 function getResponseActionForLOV()
 {
   //alert( 'getResponseActionForLOV starts ' +gValueField+'-'+gTextField );
   //alert( 'getResponseActionForLOV ends ' );
   return 0;
 }
 ///////////////////// LOV Method Ends /////////////////////



 /* Function removes all the elements in the Drop-Down */
 function drRemove()
 {
    var lRefreshFieldNameObj = document.getElementById(gRefreshFieldName);
    if ( lRefreshFieldNameObj )
    for(var i = document.getElementById(gRefreshFieldName).length - 1 ; i >= 0  ; i--)
    {
       lRefreshFieldNameObj.remove(i)
    }
 }
 
function invokeRefreshField(inWhereText, inServletName, inAjaxAction, inFieldList, inDestFieldList, inGetTagName , inElementName)
{
  //gResultText = '';

 
  //alert('invokeRefreshField - starts');
  //alert('inWhereText - '+inWhereText);
  //alert('inServletName - '+inServletName);
  //alert('inAjaxAction - '+inAjaxAction);
  //alert('inFieldList - '+inFieldList);
  //alert('inDestFieldList - '+inDestFieldList);
  //alert('inGetTagName - '+inGetTagName);
  //alert('inElementName - '+inElementName);

  var lElementName = '';
  lSearchStringTo = '&others=';
  if ( inElementName.indexOf( '&others' ) < 0 )
    lElementName = inElementName;
  else
  {
    lElementName = inElementName.substring(0 ,inElementName.indexOf(lSearchStringTo));
  }

  if ( lElementName != 'HTML' )
  {
    //alert('refreshElementAjax => lElementName - '+lElementName);
    refreshElementAjax
    ( '../servlet/'+inServletName
    + '?ajaxAction='+inAjaxAction
    + '&ajaxFlag=true'
    + '&whereText='+inWhereText
    + '&fieldList='+inFieldList
    + '&destFieldList='+inDestFieldList
    + '&getTagName='+inGetTagName
    + '&elementName='+inElementName);
  }
  else
  {
    //alert('jQuery.load => lElementName - '+lElementName+' '+inElementName+' '+inWhereText);
    $("#"+inDestFieldList).load
    ( '../servlet/'+inServletName
    + '?ajaxAction='+inAjaxAction
    + '&ajaxFlag=true'
    + '&whereText='+inWhereText
    + '&fieldList='+inFieldList
    + '&destFieldList='+inDestFieldList
    + '&getTagName='+inGetTagName
    + '&elementName='+inElementName);
    var lDestFieldList = document.getElementById( inDestFieldList );
    if ( lDestFieldList ) gResultText = lDestFieldList.innerHTML;
    //alert(gResultText);
  }

  //alert( gResultText );
  /*
  //TODO : Write below onchange code required field on JSP
  out.println(" <select "
             +" name=\"hospital_id\" "
             +" id=\"hospital_id\" "
             +" onchange=\""
             +" { "
             +"   var lWhereText='hospital_id=\\''+this.value+'\\'';"
             +"   invokeRefreshField"
             +"     ( lWhereText, 'ees_hostel', 'get_branch_code', 'HOSPITAL_ID,BRANCH_ID','branch','option', 'SELECT' ); "
             +" }"
             +" \">");
  GENERAL CONDITION : 
  - SOURCE DB FIELDS must be always in CAPS
  - name of SOURCE field must be valid DB field
  - name of TARGET field must be valid page tag name
  - IF there are two invokes (for diff DB tables) on same event
    , alert should be written between invokes

  SUPPORT_FOR : 
   1. Single D/D Desitnation Field (single table)
      a. on<event> of D/D source field source field
      b. on<event> of TEXT source field
   2. Single TEXT Desitnation Field (single table)
      a. on<event> of D/D source field source field
      b. on<event> of TEXT source field
   3. Multiple D/D OR TEXT Desitnation Field ( two DB queries in processReq)
      a. on<event> of D/D source field source field
      b. on<event> of TEXT source field
      CONDITION : alert between invokes (as work around)
   4. Multiple Desitnation Fields ( TEXT or D/D or TEXT+D/D) (single table)
      a. on<event> of D/D source field source field
      b. on<event> of TEXT source field
      CONDITION : 
        - num & seq of SOURCE DB FIELDS and TARGET PAGE FIELDS must be same
    //alert('invokeRefreshField - ends');
  */
}



/*

<form>
<input type="button" value="Push this button to open an alert box in 1250 milliseconds" onClick="setTimeout('alert(\'hello\')',1250);">
</form>


<script language="javascript">

// www.sean.co.uk

function pausecomp(millis)
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); }
while(curDate-date < millis);
}

</script>

*/

