var flagVar = 'false';
var GlobalTabString;
var LovGlobalTabString;
var nameLabelstr;
var isPopup = false;
var pathPrefix = "../../";
document.onkeyup    = detectKeyup;
var firstErrorField="";
var isMultiSubAllowed = true;

////JOADOCDOC These are the array variables which are used
//JOADOC to populate/show different types of messages
//JOADOC info_arr	    : Array to store information msg
//JOADOC error_arr	    : Array to store error values
//JOADOC warn_arr	    : Array to store warnings messages
//JOADOC fatal_arr	    : Array to store fatal error msg
//JOADOC infoCtx_arr      : Array to store information context
//JOADOC warnCtx_arr      : Array to store warning context
//JOADOC serverErr_arr    : Array to store server generated errors
//JOADOC serverErrCtx_arr : Array to store server generated errors context

var info_arr         = new Array();
var infoCtx_arr      = new Array();
var error_arr        = new Array();
var warn_arr         = new Array();
var warnCtx_arr      = new Array();
var fatal_arr        = new Array();
var serverErr_arr    = new Array();
var serverErrCtx_arr = new Array();
var windowObject     = new Object();

//JOADOC Function : showErrors
//JOADOC purpose  : To show error pop-ups.
function showErrors()
{
  
  hideBlink();
  var str ="<html>";
  str+="<head>";
  str+="<META http-equiv='Content-Type' content='text/html; charset=UTF-8'>";
  str+="<link href='" + jsWebPath + "css/pofstylesheet.css' type='text/css' rel='stylesheet'>";
  str+="<script language='JavaScript' src='" + jsWebPath + "js/Joa.js'></script>";
  str+="<script language='JavaScript' src='" + jsWebPath + "js/ErrorMsgs.js'></script>";
  str+="<title>";
  str+="Information/Errors/Warning window";
  str+="</title>";
  str+="</head>";
  str+="<br>";
  str+="<body>";
  str+="<form name='dummy' action='dummyAction'>"
  // if fatal error has occurred then show fatal error pop-up
  if ( fatal_arr.length > 0 )
  {
    str+="<table class='Messages' align=center cellspacing=1 cellpadding=0>";
    str+="  <tr  width='100%' class='RowDataHdr2'>";
    str+="    <td  width='100%' class='RowDataHdr2'>";
    str+="      <table class='RowDataHdr2' width=100%>";
    str+="        <tr >";
    str+="          <td width=10%><img src='" + jsWebPath + "images/erroricon_pagetitle.gif'</td>";
    str+="          <td>Fatal Errors</td>";
    str+="        </tr>";
    str+="      </table>";
    str+="    </td>";
    str+="  </tr>";
    str+="  <tr class='RowDataAlt' bgcolor='#FF0000'>";
    str+="    <td class='Field'><font size=2><B>Following fatal errors have occured. Please contact your system administrator:</font></td>";
    str+="  </tr>";

    for(var i = 0; i < fatal_arr.length ; i++)
    {
      str+="  <tr class='RowData'>";
      str+="    <td>";
      str+= fatal_arr[i] ;
      str+="    </td>";
      str+="  </tr>";
    }
    str+="</table>";
    str+="<p>";
  }

  // shows error if no fatal errors have occurred
  if ( error_arr.length > 0 )
  {
    str+="<table class='Messages' align=center cellspacing=1 cellpadding=0>";
    str+="  <tr  width='100%' class='RowDataHdr2'>";
    str+="    <td width='100%' class='RowDataHdr2'>";
    str+="      <table class='RowDataHdr2' width=100%>";
    str+="        <tr >";
    str+="          <td width=10%><img src='" + jsWebPath + "images/erroricon_pagetitle.gif'</td>";
    str+="          <td>Errors</td>";
    str+="        </tr>";
    str+="      </table>";
    str+="    </td>";
    str+="  </tr>";
    str+="  <tr class='RowDataAlt' bgcolor='#FF0000'>";
    str+="    <td class='Field'><font size=2><B>Following errors have occured while submitting the page:</font></td>";
    str+="  </tr>";

    for(var i = 0; i < error_arr.length ; i++)
    {
      str+="  <tr class='RowData'>";
      str+="    <td>";
      str+=error_arr[i];
      str+="    </td>";
      str+="  </tr>";
    }
    str+="</table>";
    str+="<p>";
  }
  // shows warnings
  if ( warn_arr.length > 0 )
  {
    str+="<table class='Messages' align=center cellspacing=1 cellpadding=0>";
    str+="  <tr  width='100%' class='RowDataHdr2'>";
    str+="    <td  width='100%' class='RowDataHdr2'>";
    str+="      <table class='RowDataHdr2'width=100%>";
    str+="        <tr >";
    str+="          <td width=10%><img src='" + jsWebPath + "images/warningicon_pagetitle.gif'</td>";
    str+="          <td>Warnings</td>";
    str+="        </tr>";
    str+="      </table>";
    str+="    </td>";
    str+="  </tr>";
    str+="  <tr class='RowDataAlt' bgcolor='#FF0000'>";
    str+="    <td class='Field'><font size=2><B>Following warnings have occured while submitting the page:</font></td>";
    str+="  </tr>";

    for(var i = 0; i < warn_arr.length ; i++)
    {
      str+="  <tr class='RowData'>";
      str+="    <td>";
      str+=warn_arr[i];
      str+="    </td>";
      str+="  </tr>";
    }
    str+="</table>";
    str+="<p>";
  }

  // shows information
  if ( info_arr.length > 0 )
  {
    str+="<table class='Messages' align=center cellspacing=1 cellpadding=0>";
    str+="  <tr  width='100%' class='RowDataHdr2'>";
    str+="    <td  width='100%' class='RowDataHdr2'>";
    str+="      <table class='RowDataHdr2'width=100%>";
    str+="        <tr>";
    str+="          <td width=10% ><img src='" + jsWebPath + "images/infoicon_pagetitle.gif'</td>";
    str+="          <td>Information</td>";
    str+="        </tr>";
    str+="      </table>";
    str+="    </td>";
    str+="  </tr>";
    str+="  <tr class='RowDataAlt' bgcolor='#FF0000'>";
    str+="    <td class='Field'><font size=2><B>Some information below:</font></td>";
    str+="  </tr>";

    for(var i = 0; i < info_arr.length ; i++)
    {
      str+="  <tr class='RowData'>";
      str+="    <td>";
      str+=info_arr[i];
      str+="    </td>";
      str+="  </tr>";
    }
    str+="</table>";
    str+="<p>";
  }

  str+="<table cellpadding='0' cellspacing='0' border='0' align='center'>";
  str+="  <tr><td class='PageButtonsBefore'></td></tr>";
  str+="  <tr> ";

  // displays button bar for fatal and error pop-up
  if ( fatal_arr.length != 0 || error_arr.length != 0 )
  {
    str+="    <td class='PageBtnSpacing'></td>";
    str+="    <td><img alt='' src='" + jsWebPath + "images/bigbtn_left.gif' border='0'></td>";
    str+="    <td nowrap='nowrap' background='" + jsWebPath + "images/bigbtn_body.gif' class='LargeBtnText' >";
    str+="      <a class='LargeBtnText' href='#' onclick='javascript:pageLevelSubmit(this, \"cancelError\", \"false\")'>";
    str+="        Close";
    str+="      </a>";
    str+="    </td>";
    str+="    <td nowrap='nowrap'><img alt='' src='" + jsWebPath + "images/bigbtn_right.gif' border='0'></td>";
  }

  // displays button bar warnings
  else if ( warn_arr.length != 0 )
  {
    str+="    <td class='PageBtnSpacing'></td>";
    str+="    <td><img alt='' src='" + jsWebPath + "images/bigbtn_left.gif' border='0'></td>";
    str+="    <td nowrap='nowrap' background='" + jsWebPath + "images/bigbtn_body.gif' class='LargeBtnText'>";
    str+="      <a class='LargeBtnText' href='#' onclick='javascript:pageLevelSubmit(this, \"continueError\", \"false\")'>";
    str+="       Continue";
    str+="      </a>";
    str+="    </td>";
    str+="    <td nowrap='nowrap'><img alt='' src='" + jsWebPath + "images/bigbtn_right.gif' border='0'></td>";

    str+="    <td class='PageBtnSpacing'></td>";
    str+="    <td><img alt='' src='" + jsWebPath + "images/bigbtn_left.gif' border='0'></td>";
    str+="    <td nowrap='nowrap' background='" + jsWebPath + "images/bigbtn_body.gif' class='LargeBtnText'>";
    str+="      <a class='LargeBtnText' href='#' onclick='javascript:pageLevelSubmit(this, \"cancelError\", \"false\")'>";
    str+="        Close";
    str+="      </a>";
    str+="    </td>";
    str+="    <td nowrap='nowrap'><img alt='' src='" + jsWebPath + "images/bigbtn_right.gif' border='0'></td>";
  }
  // displays button bar for information
  else if ( info_arr.length != 0 )
  {
    str+="    <td class='PageBtnSpacing'></td>";
    str+="    <td><img alt='' src='" + jsWebPath + "images/bigbtn_left.gif' border='0'></td>";
    str+="    <td nowrap='nowrap' background='" + jsWebPath + "images/bigbtn_body.gif' class='LargeBtnText'>";
    str+="      <a class='LargeBtnText' href='#' onclick='javascript:pageLevelSubmit(this, \"cancelError\", \"false\")'>";
    str+="        Close";
    str+="      </a>";
    str+="    </td>";
    str+="    <td nowrap='nowrap'><img alt='' src='" + jsWebPath + "images/bigbtn_right.gif' border='0'></td>";
  }
  str+="  </tr>";
  str+="</table>";
  str+="</form>"
  str+="</body>";
  str+="</html>";
  hideBlink();
  flagVar='false';
  showModalWin("",475,200,"yes","yes","no",str); // call show modal dialog for modal window
  if(firstErrorField!="")
  {
    var errorObj = document.getElementById(firstErrorField);
	firstErrorField="";
	if(errorObj){
    errorObj.focus();
	}
  }
  else
  {
    focusOnFirstElement(); // after closing the pop-up
  }
 // focusOnFirstElement(); // after closing the pop-up
}

//JOADOC This function will check whether there are any changes in the page
//JOADOC block.It will return true if the page is dirty false otherwise
function checkDirtyPage()
{
 
  theForm = document.forms[0];
  var tableId;
  var dirty =  false;
  var tableCounter;
  for(tableCounter=1;;tableCounter++)
  {
    tableId  = "list"+tableCounter;
    tableObj = document.getElementById(tableId);
    if(tableObj!=null)
    {
      setRowStatus(tableObj, tableId);
      if(isTableDirty(tableObj, tableId))
      {
        return true;
      }
    }
    else
    {
       break;
    }
  }//end of for
  for(blockCounter=1;;blockCounter++)
  {
    tableId  = "DataBlock"+blockCounter;
    tableObj = document.getElementById(tableId);
    if(tableObj!=null && isDirty(tableObj))
    {
      return true;
    }
    else
    {
      break;
    }
  } //end of for
  return false;
}//end of checkDirtyPage



//JOADOC Function Name: modalWin()
//JOADOC Description:   This function can be used to open a modal window.
//JOADOC                It takes three parameters, url of the page to be opened,
//JOADOC                width of the window, height of the window.
//JOADOC                The child window that will be opened using this function
//JOADOC                must call focusWindow() function on the onLoad event of the
//JOADOC                BODY tag.

function modalWin(url, width, height)
{
  
  if (!windowObject.win || (windowObject.win && windowObject.win.closed))
  {
    windowObject.width = width;
    windowObject.height = height;
    windowObject.name = (new Date()).getSeconds().toString();
    windowObject.left = (screen.width - windowObject.width) / 2;
    windowObject.top = (screen.height - windowObject.height) / 2;
    var windowAttributes = 'left=' + windowObject.left + ',top=' + windowObject.top + ',resizable=yes,width='+
                            windowObject.width +  ',height=' + windowObject.height +',scrollbars=yes';
    windowObject.url = url;
    windowObject.win=window.open(windowObject.url, windowObject.name, windowAttributes);
    return windowObject.win;
  }
  else
  {
    return windowObject.win;
  }
}


//JOADOC  function : showModalWin()
//JOADOC  purpose  : opens a modal dialog box for errro pop-ups(client side)
function showModalWin(url, width, height,resizable,scroll,status,arguments)
{
  var param = "dialogHeight:"+height+"px;dialogWidth:"+width+"px;center:yes;resizable:"+resizable+";status:"+status+";scroll:"+scroll+";help:no";
  xshowModalDialog("/"+contextRoot+"/joa/html/dummy.htm",arguments,param);
  after_close();
}


//JOADOC Method to put the message passed
//JOADOC to the end of array

//Changed by MCACross
dFeatures = 'dialogHeight: 600px; dialogWidth: 200px; dialogTop: 600px; dialogLeft: 4px; edge: Raised; center: Yes; help: Yes; resizable: no; status: no;';//default features 


function xshowModalDialog( sURL, vArguments, sFeatures ) 
{
modalWin1 = ""; 
//	alert("arguments in xshowmodalwin"+vArguments);
if (sURL==null||sURL=='') 
{ 
alert ("Invalid URL input."); 
return false; 
} 
if (vArguments==null||vArguments=='') 
{ 
vArguments=''; 
} 
if (sFeatures==null||sFeatures=='') 
{ 
sFeatures=dFeatures; 
} 
if (window.navigator.appVersion.indexOf("MSIE")!=-1) 
{ 
window.showModalDialog ( sURL, vArguments, sFeatures ); 
return false; 
} 
sFeatures = sFeatures.replace(/ /gi,''); 
aFeatures = sFeatures.split(";"); 
sWinFeat = "directories=0,menubar=0,titlebar=0,toolbar=0,"; 
for ( x in aFeatures ) 
{ 
aTmp = aFeatures[x].split(":"); 
sKey = aTmp[0].toLowerCase(); 
sVal = aTmp[1]; 
switch (sKey) 
{ 
case "dialogheight": 
sWinFeat += "height="+sVal+","; 
pHeight = sVal; 
break; 
case "dialogwidth": 
sWinFeat += "width="+sVal+","; 
pWidth = sVal; 
break; 
case "dialogtop": 
sWinFeat += "screenY="+sVal+","; 
break; 
case "dialogleft": 
sWinFeat += "screenX="+sVal+","; 
break; 
case "resizable": 
sWinFeat += "resizable="+sVal+","; 
break; 
case "status": 
sWinFeat += "status="+sVal+","; 
break; 
case "center": 
if ( sVal.toLowerCase() == "yes" ) 
{ 
sWinFeat += "screenY="+((screen.availHeight-pHeight)/2)+","; 
sWinFeat += "screenX="+((screen.availWidth-pWidth)/2)+","; 
} 
break; 
} 
} 
modalWin1=window.open(String(sURL),"",sWinFeat);
if (vArguments!=null&&vArguments!='') 
{ 	
  modalWin1.dialogArguments=vArguments; 
}
//window.clearTimeout(id);//Added by MCACross
}

function checkFocus() 
{ 
if (window.navigator.appVersion.indexOf("MSIE")==-1) 
{ 
if (modalWin1!=null && !modalWin1.closed) 
{ 
self.blur(); 
modalWin1.focus(); 
} 
} 
}

//JOADOC Method to put the message passed
//JOADOC to the end of array
function push()
{
  var sub = this.length;
  for (var i = 0; i <push.arguments.length; i++)
  {
    this[sub] = push.arguments[i];
    sub++;
  }
}

//JOADOC Method to set the Erro message Context
//JOADOC into Error Context array
function setErrCtx(info)
{
  serverErrCtx_arr.push(info);
}

//JOADOC Method to set the server Error message
//JOADOC into error array
function setServerErr(info)
{
  serverErr_arr.push(info);
}

//JOADOC Method to set the information message
//JOADOC into information array
function setInfo(info)
{
  info_arr.push(info);
}

//JOADOC Method to set the information message
//JOADOC into information array
function setInfoCtx(infoCtx)
{
  infoCtx_arr.push(infoCtx);
}

//JOADOC Method to set the error message
//JOADOC into error key and value arrays
//function setError(key, value)
function setError(value)
{
    error_arr.push(value);
}

//JOADOC Method to set the warning message
//JOADOC into warning array
function setWarn(warn)
{
  warn_arr.push(warn);
}

//JOADOC Method to set the warning message
//JOADOC into warning array
function setWarnCtx(warnCtx)
{
  warnCtx_arr.push(warnCtx);
}
//JOADOC Method to set the fatal error message
//JOADOC into fatal message array
function setFatal(fatal)
{
  fatal_arr.push(fatal);
}


//JOADOC  This method will be called on Click of any page level
//JOADOC  button.
//JOADOC
function pageLevelSubmit(anchorObj, method, validate,taskID)
{
  startBlink(); // to start the processing blinker
  stripMethod();
  if(taskID != null)
  addTaskId(taskID);
  if(validate=='true')
  {
    /*
      Initialise all the array length to zero
    */
    info_arr.length=0;
    error_arr.length=0;
    infoCtx_arr.length=0;
    warnCtx_arr.length=0;
    fatal_arr.length=0;
    serverErr_arr.length=0;
    serverErrCtx_arr.length=0;
    warn_arr.length=0;

    /*
      Invoke any validations re
    */
    if(!eval("pre_"+method+"()"))
    {
      hideBlink();
      return;
    }
  }
  
  //Processing for the click of cancel Button
  if(method=='cancel' || method == 'newQuery')
  {
    if(method=='cancel')
    {
      var cancelObj = document.getElementById("cancel");
      if(cancelObj==null)
      {
        alert(COM00111);
        hideBlink();
        return;
      }
    }
    /*
      Following loop will check for dirty bit
    */
    dirty = false;
    theForm = document.forms[0];
    var tableId;
    for(tableCounter=1;;tableCounter++)
    {
      tableId  = "list"+tableCounter;
      tableObj = document.getElementById(tableId);
      if(tableObj!=null)
      {
        setRowStatus(tableObj, tableId);
        if(isTableDirty(tableObj, tableId))
        {
        	dirty=true;
        }
      }
      else
      {
        break;
      }
    }
    for(blockCounter=1;;blockCounter++)
    {
      tableId  = "DataBlock"+blockCounter;
      tableObj = document.getElementById(tableId);
      if(tableObj!=null)
      {
        if(isDirty(tableObj))
        {
        	dirty =true;
        }
      }
      else
      {
        break;
      }
    }
    hideBlink(); //blinking stops here.
    if(dirty)
    {
      var message = "Are you sure you want to discard the changes ?";
      var response = confirm(message);
      if(response)
      {
        theForm = document.forms[0];
		theForm.method.value=method;
//        theForm.action+="?method="+method
        if(!isMultiSubAllowed)
        {
          disableLinks(theForm);
        }
        
        theForm.submit();
        return;
      }
      else
      {
        return;
      }
    }
    /*else
    {
      theForm = document.forms[0];
      theForm.action+="?method="+method
      theForm.submit();
      return;
    }*/
    else
    {
      theForm = document.forms[0];
	  theForm.method.value=method;
     // theForm.action="http://localhost:9080/DCAPortalWeb/joa/jsp/try.jsp";
//	  theForm.action+="?method="+method
      
 //     theForm.target='rightfull';
	  if(!isMultiSubAllowed)
      {
        disableLinks(theForm);
      }
	
      theForm.submit();
      return;
    }
    
  }
  //Processing for the click of save Button
  else if(method=='save' || method=='saveNclose')
  {
    saveScreen(method);
  }
  else if(method == 'closeError')
  {
	window.opener.focus();
    ipElements = window.opener.document.getElementsByTagName("INPUT");
    for(cunt = 0; cunt < ipElements.length; cunt++)
    {
	    ipObj = ipElements[cunt];
	    if( ipObj.type != "hidden")
	    break;
	}
    if ( ( ipObj.type != "radio") && ( ipObj.type != "checkbox"))
    {
    	window.opener.focusOnFirstElement();
    }
    window.self.close();
	window.opener.after_close();
  }
  else if(method == 'cancelError')
  {
    window.self.close();
  }
  else if (method == 'continueError')
  {
    openerObj = window.opener;
    param     = openerObj.location;
    theForm = openerObj.document.forms[0];
    theForm.action = param + "&continueError=Y";
    if(!isMultiSubAllowed)
    {
       disableLinks(theForm);
    }
    theForm.submit();
    openerObj.focus();
    self.close();
  }
  /*
    This method is invoked when select button from LOV is clicked
  */
  else if(method == 'lovSelect')
  {
    if(anchorObj.nodeName =='TR')
    {
      inputObj = anchorObj.getElementsByTagName("INPUT");
      inputObj[0].click();
    }
    if(rowNumber==-1)
    {
      alert(COM00069)
      hideBlink();
      return ;
    }

    if(rowNumber == 0)
    {
      if(document.forms[0].radSelect[0])
      {
        radElement = document.forms[0].radSelect[rowNumber];
      }
      else
      {
        radElement = document.forms[0].radSelect;
      }
    } // if() of rowNumber==0 ends
    else
    {
      radElement = document.forms[0].radSelect[rowNumber];
    }
    /*
      Get Object reference of child LOV window and Parent window.
    */
    theForm         = self.opener.document.forms[0];
    childForm       = self.document.forms[0];

    /*
       Get the field sting to be fetched from the LOV
       i.e column and field name
    */
    var fieldString0= childForm.stFieldName0.value;
    var fieldString1= childForm.stFieldName1.value;
    var fieldString2= childForm.stFieldName2.value;
    var fieldString3= childForm.stFieldName3.value;
    var fieldString4= childForm.stFieldName4.value;

    /*
       Separate the field string from column to separate column values
       and field values
    */
    var filedVal0   = getToken(fieldString0,":",2);
    var filedVal1   = getToken(fieldString1,":",2);
    var filedVal2   = getToken(fieldString2,":",2);
    var filedVal3   = getToken(fieldString3,":",2);
    var filedVal4   = getToken(fieldString4,":",2);
     
     
     
    var col0         =getToken(fieldString0,":",1)
    var col1         =getToken(fieldString1,":",1)
    var col2         =getToken(fieldString2,":",1)
    var col3         =getToken(fieldString3,":",1)
    var col4         =getToken(fieldString4,":",1)



    //col = radElement.parentElement; // get the parent of the selected radio button
	col     = radElement.parentNode; //added by MCACross
    nextCol = col.nextSibling; // get its next sibling
    var colValuesArray = new Array();
    colValuesArray[0]  = "";
    var i=1;
    /*
      Iterate a loop to get all the columns in a row and populate in an array
    */
    while(nextCol != null )
    {
      // if child node is of type input then get its value
	  if(nextCol.childNodes[0] && nextCol.childNodes[0].nodeName=="INPUT")
      {
        colValuesArray[i] = trim(nextCol.childNodes[0].value)
        if(colValuesArray[i] == undefined)
        {
          colValuesArray[i] ='';
        }
      }
      else
      {
        colValuesArray[i] ='';
      }
      i++;
      nextCol = nextCol.nextSibling; // go to next sibling
    }

    /*
     since number of columns in a lov cannot be more than 5 (assumtion as in UIS)
     Iterate loop to get the value of a field corresponding to the column id specified
     in parent jsp
    */
    for(i = 0;i<5 ;i++)
    {
      /*
         get the form element name from the parent jsp whose value is to be fetched
         from the lov .
      */
      var formElementName = "filedVal"+i;
      var colIndex        = "col"+i; // column corresponding to which the element will be fetched
      fieldName = eval(formElementName);
      if(fieldName.length >0)
      {
        formElement = eval("theForm."+fieldName);
        if(formElement!=null && formElement!= undefined)
        {
          formElement.value = colValuesArray[eval(colIndex)] // populate the parent filed from the value fetched
          
          if(i==0)
          {
            formElement.fireEvent("onChange");
          }
        }
      }
      else
      {
        break;
      }
    }
	if(theForm.moduleID)
	{
		if (theForm.moduleID.value == "REPORTS")
		{
			theForm.target = "_self";
			theForm.method.value = "load";
			theForm.taskID.value = "6000";
	        if(!isMultiSubAllowed)
	        {
	        	disableLinks(theForm);
	        }
			theForm.submit();
		}
	if (theForm.moduleID.value == "PRC")
		{
		theForm.target = "_self";
		theForm.method.value = "getProsecutionSection";
		theForm.taskID.value = "1501";
        if(!isMultiSubAllowed)
        {
        	disableLinks(theForm);
        }
		theForm.submit();
		}
	
	}
	window.self.close();
  } // else if(method == 'lovSelect')
else if(method == 'cinSelect')
{
    if(anchorObj.nodeName =='TR')
    {
      inputObj = anchorObj.getElementsByTagName("INPUT");
      inputObj[0].click();
    }
    if(rowNumber==-1)
    {
      alert(COM00069)
      hideBlink();
      return ;
    }

    if(rowNumber == 0)
    {
      if(document.forms[0].radSelect[0])
      {
        radElement = document.forms[0].radSelect[rowNumber];
      }
      else
      {
        radElement = document.forms[0].radSelect;
      }
    } // if() of rowNumber==0 ends
    else
    {
      radElement = document.forms[0].radSelect[rowNumber];
    }
    /*
      Get Object reference of child LOV window and Parent window.
    */
    theForm         = self.opener.document.forms[0];
    childForm       = self.document.forms[0];

    /*
       Get the field sting to be fetched from the LOV
       i.e column and field name
    */
    var fieldString0= childForm.stFieldName0.value;
    var fieldString1= childForm.stFieldName1.value;
    var fieldString2= childForm.stFieldName2.value;
    var fieldString3= childForm.stFieldName3.value;
    var fieldString4= childForm.stFieldName4.value;
    /*
       Separate the field string from column to separate column values
       and field values
    */
    var filedVal0   = getToken(fieldString0,":",2);
    var filedVal1   = getToken(fieldString1,":",2);
    var filedVal2   = getToken(fieldString2,":",2);
    var filedVal3   = getToken(fieldString3,":",2);
    var filedVal4   = getToken(fieldString4,":",2);
     
     
     
    var col0         =getToken(fieldString0,":",1)
    var col1         =getToken(fieldString1,":",1)
    var col2         =getToken(fieldString2,":",1)
    var col3         =getToken(fieldString3,":",1)
    var col4         =getToken(fieldString4,":",1)



    //col = radElement.parentElement; // get the parent of the selected radio button
    col = radElement.parentNode; //parentNode added by MCACross
    nextCol = col.nextSibling; // get its next sibling
    var colValuesArray = new Array();
    colValuesArray[0]  = "";
    var i=1;
    /*
      Iterate a loop to get all the columns in a row and populate in an array
    */
    var mcaCross = 0;
    while(nextCol != null )
    {
      // if child node is of type input then get its value
	  mcaCross = 0;
		if(nextCol.nodeName != '#text')
		{
			var first_node = nextCol.childNodes[0];
			while(first_node.nodeName == '#text')
			{
			  first_node = first_node.nextSibling;
			  mcaCross++;
			}
			  if(nextCol.childNodes[mcaCross] && nextCol.childNodes[mcaCross].nodeName=="INPUT")
			  {
				colValuesArray[i] = trim(nextCol.childNodes[mcaCross].value);
				if(colValuesArray[i] == undefined)
				{
				  colValuesArray[i] ='';
				}
			  }
			  else
			  {
				colValuesArray[i] ='';
			  }
			  i++;
			  nextCol = nextCol.nextSibling; // go to next sibling
		}

		  else
		  {
			  nextCol = nextCol.nextSibling; // go to next sibling
		  }

    }

    /*
     since number of columns in a lov cannot be more than 5 (assumtion as in UIS)
     Iterate loop to get the value of a field corresponding to the column id specified
     in parent jsp
    */
      //changed by chandan
    //for(i = 1;i>=0 ;i--)
	for(i = 4;i>=0 ;i--)
    {
      /*
         get the form element name from the parent jsp whose value is to be fetched
         from the lov .
      */
      var formElementName = "filedVal"+i;
      
      var colIndex        = "col"+i; // column corresponding to which the element will be fetched
      fieldName = eval(formElementName);
      
      var flagCmpName = false;
      if(fieldName.length >0)
      {
       // formElement = eval("theForm."+fieldName);
	   var inputElements  = self.opener.document.getElementsByTagName("INPUT");
       for(counterInput =  0;counterInput<inputElements.length; counterInput++)
		  {
		    htmlObj = inputElements[counterInput];
       
		    if(htmlObj)
		    {
		    if (htmlObj.id==fieldName)
		    {
        
		    	formElement =inputElements[counterInput];
		    	flagCmpName = true;
		    }
		   	}
		  }
		if(flagCmpName && formElement!=null && formElement!= undefined)
        {
          formElement.value = colValuesArray[eval(colIndex)] // populate the parent filed from the value fetched
          if(i==0)
          {
            //Added by MCACross for fireEvent is not supported by other major browsers
			//For others a combination of createEvent and dispatchEvent has been used
			if(formElement.fireEvent)
			  {
				formElement.fireEvent("onChange"); 
			  }
			else 
			  {
					oEvent = document.createEvent( "MouseEvents" );
					oEvent.initMouseEvent("onChange", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 3, formElement);
					formElement.dispatchEvent( oEvent );
			  }
          }
        }
      }
      else
      {
       // break;
      }
    }
	window.self.close();
}

  /*
    This method is invoked when select button is pressed in multiselect LOV.
  */
  else if(method == 'lovMultiSelect')
  {
    theForm         = self.opener.document.forms[0];
    childForm       = self.document.forms[0];
    var fieldVal    = childForm.prtFieldName;
    var fieldName   = new Array();
    var colId       = new Array();
    if(fieldVal.length)
    {
      for(var i=0;i<fieldVal.length;i++)
      {
        fieldName[i] = getToken(fieldVal[i].value,":",2);
        colId[i]     = getToken(fieldVal[i].value,":",1);
      }
      cbObj     = childForm.checkSelect; // get array of check boxes
      var len   = cbObj.length; // get the length of array of checkboxes
      if(len == undefined) // if length is undefined then a single checkbox is selected
      {
        var tempVar=0;
        /*
          if check box is checked the iterate in that row and all
          column values and populate it in parent window.
        */
        if(cbObj.checked)
        {
           preEle   = cbObj.parentElement;
           nextEle  = preEle.nextSibling;
           var j=0;
           var temp=1;
           // loop to iterate in the row
           while(nextEle != null && nextEle.childNodes[0] )
           {
             if(colId[j] == temp)
             {
               if(nextEle.childNodes[0].nodeName=="INPUT")
                {
                 /*
                   Get the first editable column of the parent jsp from where to start the population of the
                   selected rows
                 */
                 fname = eval("theForm."+ fieldName[j]);
                 fname[tempVar].value =trim(nextEle.childNodes[0].value); // populate the value serially
                 j++;
                }
             }
             temp++;
             nextEle = nextEle.nextSibling;
          } //end while
          tempVar++;
       }
     }
      var k=0;
      for(var i=0; i<len ; i++) // if more than one checkbox is selected
      {
        if(cbObj[i].checked)
        {
         preEle   = cbObj[i].parentElement;
         nextEle  = preEle.nextSibling;
         var j=0;
         var temp=1;
         while(nextEle != null && nextEle.childNodes[0] )
         {
           if(colId[j] == temp)
           {
             if(nextEle.childNodes[0].nodeName=="INPUT")
              {
               fname = eval("theForm."+ fieldName[j]);
               fname[k].value =trim(nextEle.childNodes[0].value); // pupulate serially into successive rows
               j++;
              }
           }
           temp++;
           nextEle = nextEle.nextSibling;
         } //end while
         k++;
       }// end if
       else
       {
         continue;
       }
     }// end for
   } // end if of fieldName.length

   /*
     Following code is the repetition of the above two loops incase the
     parent jsp have text fields in which the data is to be populated instead
     of #text.
   */
   else
   {
     fieldName = getToken(fieldVal.value,":",2);
     colId     = getToken(fieldVal.value,":",1);
     cbObj     = childForm.checkSelect;
	   var len   = cbObj.length;
     if(len == undefined)
     {
       var tempVar=0;
       if(cbObj.checked)
       {
          preEle   = cbObj.parentElement;
          nextEle  = preEle.nextSibling;
          var j=0;
          var temp=1;
          while(nextEle != null && nextEle.childNodes[0] )
          {
             if(colId[j] == temp)
             {
               if(nextEle.childNodes[0].nodeName=="INPUT")
                {
                 fname = eval("theForm."+ fieldName[j]);
                 fname[tempVar].value =trim(nextEle.childNodes[0].value);
                 j++;
                }
             }
             else if(colId[j] == undefined && colId == temp)
             {
               if(nextEle.childNodes[0].nodeName=="INPUT")
                {
                 fname = eval("theForm."+ fieldName);
                 fname[tempVar].value =trim(nextEle.childNodes[0].value);
                }
             }
             temp++;
             nextEle = nextEle.nextSibling;
          } //end while
          tempVar++;
       }
     }
	   var k = 0;
     for(var i=0; i<len ; i++)
     {
   	   var temp = 1;
       if(cbObj[i].checked)
       {
         preEle   = cbObj[i].parentElement;
         nextEle  = preEle.nextSibling;
         while(nextEle != null && nextEle.childNodes[0] )
         {
           if(colId == temp)
           {
             if(nextEle.childNodes[0].nodeName=="INPUT")
              {
               fname = eval("theForm."+ fieldName);
               fname[k].value =trim(nextEle.childNodes[0].value);
              }
           }
           temp++;
           nextEle = nextEle.nextSibling;
         } //end while
         k++;
       } // end if
       else
        continue;
      }// end for
   } // end else if fieldval = undefined
   window.self.close();
  }// end else if lovMultiselect
  else
  {
  	
	  theForm = document.forms[0];
      info_arr.length=0;
      error_arr.length=0;
      infoCtx_arr.length=0;
      warnCtx_arr.length=0;
      fatal_arr.length=0;
      serverErr_arr.length=0;
      serverErrCtx_arr.length=0;
      warn_arr.length=0;
	  validateflag=false;
    if(showErrorOnSubmit(theForm))
    {
      stripMethod();
      before_submit();
	  theForm.method.value=method;
      if(isPopup)
      {
        theForm.action+="&popup=true";
        hideBlink();
        isPopup=false;
      }
      if(!isMultiSubAllowed)
      {
        disableLinks(theForm);
      }
      if(dateFormatFlip){
      	replaceDates();
      }
      theForm.submit();
      if(dateFormatFlip){
      	replaceDatesReverse()
      }
      //setTimeout("replaceDatesReverse()",200);
    }
  }
  /*else
  {
    return;
  }*/
} // end of function pageLevelSumbit()


//JOADOC  This method will be called This method will be called on submit of any button. 
//JOADOC  This method will be used to replace slashes with hyphens in date values

function replaceDates(){
	var inputs=document.getElementsByTagName("INPUT");
	for(var i=0;i<inputs.length;i++){
		var value=inputs[i].value;
		if((/\d\d\/\d\d\/\d\d\d\d/).test(value)){
			value=value.replace("/","-");
			value=value.replace("/","-");
			inputs[i].value=value;
		}
	}
	inputs=document.getElementsByTagName("HIDDEN");
	for(var j=0;j<inputs.length;j++){
		var value=inputs[j].value;
		if((/\d\d\/\d\d\/\d\d\d\d/).test(value)){
			value=value.replace("/","-");
			value=value.replace("/","-");
			inputs[j].value=value;
		}
	}
}
 
function replaceDatesReverse(){
	var inputs=document.getElementsByTagName("INPUT");
	for(var i=0;i<inputs.length;i++){
		var value=inputs[i].value;
		if((/\d\d\-\d\d\-\d\d\d\d/).test(value)){
			value=value.replace("-","/");
			value=value.replace("-","/");
			inputs[i].value=value;
		}
	}
	inputs=document.getElementsByTagName("HIDDEN");
	for(var j=0;j<inputs.length;j++){
		var value=inputs[j].value;
		if((/\d\d\/\d\d\/\d\d\d\d/).test(value)){
			value=value.replace("-","/");
			value=value.replace("-","/");
			inputs[j].value=value;
		}
	}
}


//JOADOC  This method will be called on submit of any button or
//JOADOC  hyperlink
//JOADOC
function callJoaMethod(button, value, blockid, functionid)
{
 
  startBlink();
  stripMethod();
  
  
  if(value=='checkChildNode')
  {
    if(!checkChildNode())
    {
	  hideBlink();
      return;
    }
  }
  // RowCount Link Code
  switch(button)
  {
    case 'RowCount' :  // OnClick of RowCount Link
       theForm = document.forms[0];
      
       var objSaveMode = eval("theForm.hidSaveMode_"+blockid);
       if(eval("DataRecord_"+blockid)==0 || (objSaveMode!=null && objSaveMode.value == 'New'))
       {
         alert("Row Count not available");
  	     hideBlink();
         return;
       }
       if(theForm.blockId)
       {
         theForm.blockId.value=blockid;
       }
       //if checkDirtyPage() returns true then Confirmation is asked.
       if(checkDirtyPage())
       {
         var response = confirm(COM00106);
         if(response == false)
         {
           hideBlink();
           return;
         }
       }
	   theForm.method.value=value;
      // theForm.action = theForm.action +"?method="+value;
      if(!isMultiSubAllowed)
      {
        disableLinks(theForm);
      }
       
       theForm.submit();
       break;
    case 'CsvExport' :  // OnClick of CsvExport Icon
      if(eval("DataRecord_"+blockid)==0)
      {
        alert(COM00111);
        hideBlink();
        return;
      }
      printCSV(blockid);
      hideBlink();
      break;
    case 'Clone' :     // OnClick of Clone Button
      theForm = document.forms[0];
      var objSaveMode = eval("theForm.hidSaveMode_"+blockid);
      if(objSaveMode != null && objSaveMode.value != 'New')
      {
      	alert("This operation is available only in New Mode");
		    hideBlink();
        return;
      }
      var arSelectedIndex = isRowSelected(blockid);
      if ( arSelectedIndex.length <= 0 )
      {
        alert(COM00112);
        hideBlink();
        return;
      }
      var rowSelected = arSelectedIndex[0];
      var tableObj = document.getElementById(blockid);
      var rows     = tableObj.getElementsByTagName('TR');
      var i = 0;
      var noOfRows = rows.length;
      var isAvailable = false;
      var availableRow = -1;
      rowSelected = convertStringToNumber(rowSelected);
      for(i = rowSelected+2 ; i < noOfRows ;i++)
      {
      	rowToProcess = rows[i];
      	isAvailable  = isRowAvailable(rows[i]);
      	if(isAvailable)
      	{
      	  availableRow = i;
      	  break
      	}
      }
      if(isAvailable)
      {
      	cloneRow(rows[rowSelected+1], rows[availableRow]);
      	hideBlink();
      }
      else
      {
      	alert("No more empty rows available!");
      	hideBlink();
      }
      break;

    case 'Clear' :     // OnClick of Clear Button
      if(!pre_Clear())
      {
        hideBlink();
        return;
      }
      if(blockid.indexOf("list")!= -1)
      {
        var objSaveMode = eval("document.forms[0].hidSaveMode_"+blockid);
        if(objSaveMode)
        {
          if(objSaveMode.value=="Delete" || objSaveMode.value=='')
          {
            joaDeleteClear(blockid);
            joaListClear(blockid);
          }
          else if(objSaveMode.value=="New")
          {
            joaNew(blockid);
          }
        }
      }
      else if(blockid.indexOf("Data")!= -1)
      {
    	// Code for resettting the particular Data Block should be
    	// Written here
        joaClear(blockid);
      }
      hideBlink();
      break;
//JOADOC else if block for  NEW button
//JOADOC if value is 'new' then it will clear the present table
//JOADOC else it will invoke method of the ActionClass specified
//JOADOC by parameter value
    case 'New' :  // OnClick of New Button
      if(!pre_New(blockid))
      {
        hideBlink();
        return;
      }
      theForm = document.forms[0];
      if(blockid.indexOf("Tree")==-1)
      {
        var tableObj = document.getElementById(blockid);
        setRowStatus(tableObj, blockid);
        if(isTableDirty(tableObj, blockid))
        {
          var message = "Are you sure you want to discard the changes ?";
          var response = confirm(message);
          if(!response)
          {
            hideBlink();
            return;
          }
        }
      }
      if(value =='new')
      {
        joaNew(blockid);
      }
      else
      {
        if(theForm.blockId)
        {
          theForm.blockId.value = blockid;
        }
      // Validation for allowing the user to open the screen
      // Still needs to be done . It will be done  either in
      // the pre processing function or if there is any common
      // validation that will be done here itself.
      //  theForm.action = theForm.action +"?method="+value;
		  theForm.method.value=value;
		if(!isMultiSubAllowed)
      	{
        	disableLinks(theForm);
      	}
		  
        theForm.submit();
      }
      break;
    case 'View' :  // OnClick of View Button
      theForm = document.forms[0];
      var objSaveMode = eval("theForm.hidSaveMode_"+blockid);
       
      if( blockid.indexOf("Tree")==-1 &&
          (eval("DataRecord_"+blockid)==0 || objSaveMode.value == 'New'))
      {
        alert(COM00111);
        hideBlink();
        return;
      }
      if(!pre_View(blockid))
      {
        hideBlink();
        return;
      }
      if(blockid.indexOf("Tree")==-1)
      {
        theForm = document.forms[0];
        var arSelectedIndex = isRowSelected(blockid);
        len = arSelectedIndex.length;
        if ( arSelectedIndex.length <= 0 )
        {
          alert(COM00112);
          hideBlink();
          return;
        }
      }
      if(theForm.blockId)
      {
        theForm.blockId.value = blockid;
      }
	  theForm.method.value=value;
    //  theForm.action = theForm.action +"?method="+value;
      if(!isMultiSubAllowed)
      {
        disableLinks(theForm);
      }
      
      theForm.submit();
      break;
    case 'Delete' :  // OnClick of Delete Button
      if(blockid.indexOf("Tree")==-1)
      {
        if(!pre_Delete(blockid))
        {
          hideBlink();
          return;
        }
        joaDelete(button, value, blockid);
      }
      else
      {
        if(!pre_Delete(blockid))
        {
          hideBlink();
          return;
        }
        theForm = document.forms[0];
		theForm.method.value=value;
    //    theForm.action = theForm.action +"?method="+value;
        if(!isMultiSubAllowed)
        {
          disableLinks(theForm);
        }
        
        theForm.submit();
      }
      break;
    case 'Sync' :  // OnClick of Sync Button
      if(!pre_Delete(blockid))
      {
        hideBlink();
        return;
      }
      theForm = document.forms[0];
	  theForm.method.value=value;
//      theForm.action = theForm.action +"?method="+value;
      if(!isMultiSubAllowed)
      {
        disableLinks(theForm);
      }
      
      theForm.submit();
      break;
    case 'Edit' : // OnClick of Edit Button
      theForm = document.forms[0];
      if(blockid.indexOf("Tree")==-1)
      {
        var tableObj = document.getElementById(blockid);
        setRowStatus(tableObj, blockid);
        if(isTableDirty(tableObj, blockid))
        {
          var message = "Are you sure you want to discard the changes ?";
          var response = confirm(message);
          if(!response)
          {
            hideBlink();
            return;
          }
        }
      info_arr.length=0;
      error_arr.length=0;
      infoCtx_arr.length=0;
      warnCtx_arr.length=0;
      fatal_arr.length=0;
      serverErr_arr.length=0;
      serverErrCtx_arr.length=0;
      warn_arr.length=0;
	  validateflag=false;
	   
        if(showErrorOnSubmit(theForm))
        {
          if(pre_Edit(blockid))
          {
            var arSelectedIndex = isRowSelected(blockid);
            if ( arSelectedIndex.length <= 0 )
            {
              alert(COM00112);
              hideBlink();
              return;
            }
            var selectedRec = arSelectedIndex[0];
            var rowModifiedObj = eval("document.forms[0].rowModified_"+blockid);
            if(rowModifiedObj[selectedRec].value=='Deleted')
            {
              alert("Record is already deleted");
              hideBlink();
              return;
            }
			theForm.method.value=value;
//            theForm.action = theForm.action +"?method="+value;
			theForm.target='rightfull';
			 var radSelectObj = eval("document.forms[0].radSelect_"+blockid);
            if(!isMultiSubAllowed)
      		{
        		disableLinks(theForm);
      		}
            
            theForm.submit();
          }
          else
          {
            hideBlink();
            return;
          }
        }
      }
      else if(blockid.indexOf("Tree")!=-1)
      {
        if(pre_Edit(blockid))
        {
			theForm.method.value=value;
//          theForm.action = theForm.action +"?method="+value;
             if(!isMultiSubAllowed)
      		{
        		disableLinks(theForm);
      		}
          
          theForm.submit();
        }
        else
        {
          hideBlink();
        }
      }
      else
      {
        hideBlink();
        return;
      }
      break;
    case  'Next'    :    // OnClick of Next/NextAll Button
    case  'NextAll' :
      theForm = document.forms[0];
      theForm.target='_self';
   
      if(theForm.name!='LovForm' && theForm.name!='CinForm' && theForm.name!='DINLookupForm'&& theForm.name!='LLPCompanyForm')
      {
        var tableObj = document.getElementById(blockid);
        setRowStatus(tableObj, blockid);
        if(isTableDirty(tableObj, blockid))
        {
          var message = "Are you sure you want to discard the changes ?";
          var response = confirm(message);
          if(!response)
          {
            hideBlink();
            return;
          }
        }
      }

      var objSaveMode = eval("theForm.hidSaveMode_"+blockid);
      if(eval("DataRecord_"+blockid)==0 || ( objSaveMode&& objSaveMode.value == 'New'))
      {
        hideBlink();
        return;
      }
     
      if(theForm.stNextEnabled[0])
      {
        blockNumber  = blockid.substring(4);
        if(theForm.stNextEnabled[blockNumber-1].value == 'false')
        {
          hideBlink();
        }
        else
        {
          theForm.blockId.value=blockid;
		  theForm.method.value=value;
//          theForm.action = theForm.action +"?method="+value;
          theForm.submit();
        }
      }
      else
      {
        if(theForm.stNextEnabled.value == 'false')
        {
          hideBlink();
        }
        else
        {
          if(theForm.blockId)
          {
            theForm.blockId.value=blockid;
          }
		  theForm.method.value=value;
//          theForm.action = theForm.action +"?method="+value;
          disableLinks(theForm);
          theForm.submit();
        }
      }
      break;
     
     // added by Puneet for 'Page' case for iterating page wise 
      case 'page'   :    // OnClick of page Link
    // alert("hiooooooooooo");
      theForm = document.forms[0];
      theForm.target='_self';
      var pgNo = value.substring(4);
     
 		
     
      if(theForm.name!='LovForm' && theForm.name!='CinForm' && theForm.name!='DINLookupForm'&& theForm.name!='LLPCompanyForm')
      {
        var tableObj = document.getElementById(blockid);
        setRowStatus(tableObj, blockid);
      
        if(isTableDirty(tableObj, blockid))
        {
          var message = "Are you sure you want to discard the changes ?";
          var response = confirm(message);
          if(!response)
          {
            hideBlink();
            return;
          }
        }
      }

      var objSaveMode = eval("theForm.hidSaveMode_"+blockid);
      if(eval("DataRecord_"+blockid)==0 || ( objSaveMode&& objSaveMode.value == 'New'))
      {
     
        hideBlink();
        return;
      }
    
      if(theForm.stNextEnabled[0] || theForm.stPreviousEnabled[0])
      {
        blockNumber  = blockid.substring(4);
        if(theForm.stNextEnabled[blockNumber-1].value == 'false'||theForm.stPreviousEnabled[blockNumber-1].value == 'false')
        {
            hideBlink();
        }
        else
        {
      
          theForm.blockId.value=blockid;
          theForm.radSelect.value = pgNo;
		  theForm.method.value='page';
//          theForm.action = theForm.action +"?method="+value;
          theForm.submit();
        }
	//	alert(theForm.radSelect.value+"if")
      }
      else
      {
		 //  alert("111212121212");
        if(theForm.stNextEnabled.value == 'false'&& theForm.stPreviousEnabled.value == 'false')
        {
          
          hideBlink();
        }
        else
        {
          if(theForm.blockId)
          {
            theForm.blockId.value=blockid;
          }
         
		  theForm.method.value='page';
		   theForm.radSelect.value = pgNo;
//          theForm.action = theForm.action +"?method="+value;
          disableLinks(theForm);
		//  alert(theForm.radSelect.value+"else")
          theForm.submit();
        }
      }
	  
      break;
     
     // Ends Here Page  Wise
     
     
     
    case 'Previous'    :   // OnClick of Previous/PreviousAll Button
    case 'PreviousAll' :
      theForm = document.forms[0];
	  theForm.target='_self';
      if(theForm.name!='LovForm' && theForm.name!='CinForm' && theForm.name!='DINLookupForm' && theForm.name!='LLPCompanyForm')
      {
        var tableObj = document.getElementById(blockid);
        setRowStatus(tableObj, blockid);
        if(isTableDirty(tableObj, blockid))
        {
          var message = "Are you sure you want to discard the changes ?";
          var response = confirm(message);
          if(!response)
          {
            hideBlink();
            return;
          }
        }
      }
      var objSaveMode = eval("theForm.hidSaveMode_"+blockid);
      if(eval("DataRecord_"+blockid)==0 || ( objSaveMode&& objSaveMode.value == 'New'))
      {
        alert(COM00111);
        hideBlink();
        return;
      }
      if(theForm.stPreviousEnabled[0])
      {
        blockNumber  = blockid.substring(4);
        if(theForm.stPreviousEnabled[blockNumber-1].value == 'false')
        {
          alert(COM00037);
          hideBlink();
        }
        else
        {
        
          theForm.blockId.value=blockid;
		  theForm.method.value=value;
//          theForm.action = theForm.action +"?method="+value;
          theForm.submit();
        }
      }
      else
      {
        if(theForm.stPreviousEnabled.value == 'false')
        {
          alert(COM00037);
          hideBlink();
        }
        else
        {
          if(theForm.blockId)
          {
            theForm.blockId.value=blockid;
          }
           
		  theForm.method.value=value;
//          theForm.action = theForm.action +"?method="+value;
          disableLinks(theForm);
          theForm.submit();
        }
      }
      break;
    case 'Find' :  // OnClick of Find Button
      theForm = document.forms[0];
      info_arr.length=0;
      error_arr.length=0;
      infoCtx_arr.length=0;
      warnCtx_arr.length=0;
      fatal_arr.length=0;
      serverErr_arr.length=0;
      serverErrCtx_arr.length=0;
      warn_arr.length=0;
      if(pre_Find(blockid))
      {
        info_arr.length=0;
        error_arr.length=0;
        infoCtx_arr.length=0;
        warnCtx_arr.length=0;
        fatal_arr.length=0;
        serverErr_arr.length=0;
        serverErrCtx_arr.length=0;
        warn_arr.length=0;
        validateflag=false;
        if(showErrorOnSubmit(theForm))
        {
          if(theForm.name != 'LovForm' &&
             theForm.name != 'MNT1040SForm' &&
             theForm.name != 'MNT1050SForm' )
          {
      	    findQuery(theForm);
          }
		  theForm.method.value=value;
//          theForm.action = theForm.action +"?method="+value;
          disableWindow();
          if(!isMultiSubAllowed)
      	  {
        	disableLinks(theForm);
      	  }
          
          theForm.submit();
        }
      }
      break;
    case 'Reorder' :  // OnClick of Reorder Button
      if(!pre_Reorder(blockid))
      {
        hideBlink();
        return;
      }
      theForm = document.forms[0];
	  theForm.method.value=value;
//      theForm.action = theForm.action +"?method="+value;
      if(!isMultiSubAllowed)
      {
        disableLinks(theForm);
      }
      
      theForm.submit();
      break;
  }
  hideBlink();
}

//JOADOC
//JOADOC
var SUCCESS = 1;
var FAILURE = 0;
function checkDataType( data, type )
{
  if(!data)
  {
    return;
  }
  var status = SUCCESS;
  var n_dataStr  = "+-0123456789.";
  var dt_dataStr = "0123456789\/";
  var char_dataStr = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ: ";
  var dataTypeStr;
  var thisChar;
  var i;
  if (data == "")
    return SUCCESS;
  if (type == "N")
  {
    dataTypeStr = n_dataStr;
  }
  else if(type == "D")
  {
    dataTypeStr = dt_dataStr;
  }
  else if(type == "C")
  {
    dataTypeStr = char_dataStr;
  }
  for ( i=0; i<data.length; i++)
  {
    thisChar = data.substring( i, i+1 );
    if (dataTypeStr.indexOf( thisChar ) == -1)
    {
      status = FAILURE;
      break;
    }
  }
  return status;
}

//JOADOC This function changes the stylesheet class of the object passed
//JOADOC with the class supplied as parameter.
//JOADOC This function returns nothing.
function changeClass(objectCurrent, newClassName)
{
 objectCurrent.className= newClassName;
}

//JOADOC Being user for Editable Table
//JOADOC
//JOADOC
var currentEditableObjectClass;
function makeEditable(currentObject)
{
  var srcElement = undefined;
  if(currentObject.nodeName==undefined)
  {
    srcElement = window.event.srcElement;
    if(srcElement.nodeName=='INPUT' ||srcElement.nodeName=='SELECT')
    {
      currentObject=srcElement.parentElement.parentElement;
    }
    else if(srcElement.nodeName=='TR')
    {
      currentObject=srcElement;
    }
    else if(srcElement.nodeName=='TD')
    {
      currentObject = srcElement.parentElement;
    }
    else if(srcElement.nodeName=='IMG')
    {
      return;
    }
  }
  // To check whether to make this row editable or not
  // To check confirm this whether the 'rowModofied field is disabled
  // or not. If it is disabled return from here else make it editable
  inputs   = currentObject.getElementsByTagName('input');
  if(currentObject.className =='RowDataS')
  {
    return;
  }
  for(i = 0; i<inputs.length; i++)
  {
    elemName = inputs[i].getAttribute('Name')
    if(elemName.indexOf('radSelect_')!=-1 || elemName.indexOf('chkSelect_')!=-1)
    {
      if(inputs[i].disabled)
      {
      	return;
      }
      else
      {
      	if(inputs[i].type=='radio')
      	{
          inputs[i].checked=true;
        }
      	break;
      }
    }
  }
  // Code to check whether to make editable or not ends here
  // Added by dheeraj
  if(currentObject.className != 'RowDataS')
  {
    currentEditableObjectClass = currentObject.className;
  }
  //Addition ends here
  makeRowsReadonly(currentObject);
  changeClass(currentObject, 'RowDataS');
  makeRowEditable(currentObject);
}

//JOADOC Being user for Editable Table
//JOADOC
//JOADOC
function makeRowsReadonly(currentObject)
{
  rows = currentObject.parentElement.children;

  for ( i = 0 ; i < rows.length ; i++ )
  {
    if ( rows[i].className == 'RowDataS' )
    {
      if ( ( i% 2) == 0)
      {
        changeClass(rows[i], 'RowDataAlt');
        assignColClass1(rows[i], 1);
      }
      else
      {
        changeClass(rows[i], 'RowData');
        assignColClass1(rows[i], 0);
      }
      break;
    }
  }
}
//JOADOC Being user for Editable Table
//JOADOC
//JOADOC
function makeRowEditable(row)
{
  assignColClassE(row);
  var anchorId;
  anchors = row.getElementsByTagName('a');
  for ( y = 0 ; y < anchors.length ; y++ )
  {
    if(anchors[y].id.indexOf('imageDiv')!= -1)
    {
      anchorId= anchors[y].id;
      var ancObj = document.getElementById(anchorId);
      var textObj = ancObj.previousSibling.previousSibling;
      if(!textObj.disabled)
      {
        ancObj.style.visibility='visible';
      }
    }
  }
}
//JOADOC This function is used  to build and array of Data in updateable list
//JOADOC at client Side. The is maintained in the form of two dimensional array.
//JOADOC
function changeTables()
{

  
  focusOnFirstElement();
  var tableid;
  var tableObj;
  for(tablCounter=1;;tablCounter++)
  {
    tableid  = "list"+tablCounter;
    tableObj = document.getElementById(tableid);
    if(tableObj!=null)
    {
      var varId= "Data_"+tableid;
      buildArray(tableObj, varId);
      // Mark Deleted record as deleted if error comes in the operation
      var rowModifiedObj = eval("document.forms[0].rowModified_"+tableid);
      var noOfRows = 0;
      if(rowModifiedObj)
      {
        noOfRows = rowModifiedObj.length;
      }
      var i=0;
      for(i=0;i<noOfRows;i++)
      {
      	if(rowModifiedObj[i].value=='Deleted')
      	{
      	  var rowObj = rowModifiedObj[i].parentElement.parentElement;
      	  deleteRow(rowObj, tableid);
      	}
      }
    }
    else
    {
      break;
    }
  }
}


//JOADOC Being user for Editable Table
//JOADOC
//JOADOC
function changeLovTables()
{
  tables = document.getElementsByTagName('table');
  for ( index = 0 ; index < tables.length ; index++ )
  {
    tableId = tables[index].id;
    if ( tableId.indexOf('list') != -1 )
    {
      changeTable(tables[index]);
    }
  }
}

//JOADOC Being used for Editable Table
//JOADOC
function changeTable(currentObject)
{
  
  rows = currentObject.getElementsByTagName('tr');
  rows[0].className='RowDataHdr';
  var type = new Array();
  if(rows[1])
  {
    type = getTypes(rows[1]);
  }
  assignColClass(type, rows[0], 0)

  for ( j = 1 ; j < rows.length ; j++)
  {
    if ( j % 2  == 0 )
    {
      rows[j].className = 'RowDataAlt';
      assignColClass(type, rows[j], 1);
    }
    else
    {
      rows[j].className = 'RowData';
      assignColClass(type, rows[j], 0);
    }
  }
}
//JOADOC Being user for Editable Table
//JOADOC
//JOADOC
function assignColClass(cellTypes, row, isAlt)
{
  columns = row.getElementsByTagName('td');
  var mcaCross1 = 0;
  for ( k = 0 ; k < columns.length; k++ )
  {
	//Added by MCACross as children has to be replaced by childNodes to make the function cross browser compatible
	// #text are being removed with the code written below
		mcaCross1 = 0;
		var first_column = columns[k].childNodes[0];
		while(first_column.nodeName == '#text')
		{
			first_column = first_column.nextSibling;
			mcaCross1++;  
		}
		
		if ( cellTypes[k] == 0 )
		{		
		  if ( columns[k].childNodes[mcaCross1] && isAlt == 1)
		  {
			columns[k].childNodes[mcaCross1].className = 'tableNumAltR';
		  }
		  else if (columns[k].childNodes[mcaCross1] && isAlt == 0)
		  {
			columns[k].childNodes[mcaCross1].className = 'tableNumR';
		  }
	//      columns[k].className = 'NUM';
		}
		else if ( cellTypes[k] == 1)
		{		
		  if ( columns[k].childNodes[mcaCross1] && isAlt == 1)
		  {
			columns[k].childNodes[mcaCross1].className = 'tableTextAltR';
		  }
		  else if (columns[k].childNodes[mcaCross1] && isAlt == 0)
		  {
			columns[k].childNodes[mcaCross1].className = 'tableTextR';
		  }
	//      columns[k].className = 'Field';
		}
		else if ( cellTypes[k] == 3)
		{
		  columns[k].className = 'CheckBox';
	     }
   } // end for loop
}
//JOADOC Being user for Editable Table
//JOADOC
//JOADOC
function assignColClass1(row, isAlt)
{
  var columns = row.getElementsByTagName('td');
  var fields  = row.getElementsByTagName('input');
  for ( k = 0 ; k < columns.length; k++ )
  {
    if(columns[k].children[0])
    {
      var clsName = columns[k].children[0].className
      if(clsName.indexOf("Num")!=-1)
      {
        if (isAlt == 1)
        {
          columns[k].children[0].className = 'tableNumAltR';
        }
        else if (columns[k].children[0] && isAlt == 0)
        {
          columns[k].children[0].className = 'tableNumR';
        }
      }
      else if(clsName.indexOf("Text")!=-1)
      {
        if(isAlt == 1)
        {
          columns[k].children[0].className = 'tableTextAltR';
        }
        else if(isAlt == 0)
        {
          columns[k].children[0].className = 'tableTextR';
        }
      }
    }
  }
  anchors = row.getElementsByTagName('a');
  for ( y = 0 ; y < anchors.length ; y++ )
  {
    if(anchors[y].id.indexOf('imageDiv')!= -1)
    {
      anchorId= anchors[y].id;
      eval("document.all['"+anchorId+"'].style.visibility='hidden';");
    }
  }
}
//JOADOC Being user for Editable Table
//JOADOC
//JOADOC
function assignColClassE(row)
{
  var columns = row.getElementsByTagName('td');
  for ( k = 0 ; k < columns.length; k++ )
  {
    if (columns[k].children[0])
    {
      var clsName = columns[k].children[0].className
      if(clsName.indexOf("Num")!=-1)
      {
        if (columns[k].children[0].readOnly)
        {
          columns[k].children[0].className = 'tableNumS';
        }
        else
        {
          columns[k].children[0].className = 'tableNumE';
        }
      }
      else if(clsName.indexOf("Text")!=-1)
      {
        if (columns[k].children[0].readOnly)
        {
          columns[k].children[0].className = 'tableTextS';
        }
        else
        {
          columns[k].children[0].className = 'tableTextE';
        }
      }

    }
  }
}
//JOADOC Being user for Editable Table
//JOADOC
//JOADOC
//JOADOC 0  - Numeric
//JOADOC 1  - Alphanumeric
//JOADOC 2  - Radio Button
//JOADOC 3  - Checkbox
function getTypes(row)
{
  var type = new Array();
  var cellValue;
  var mcaCross2 = 0;
  // Changes made for making it generic for
  // for all types of element input,select list checkbox,

  cols = row.getElementsByTagName('td');
  for(i = 0; i < cols.length ; i++ )
  {
    cellValue='undefined';
    col = cols[i];
    //Code for removal of #text added by MCACross 
    if(col.childNodes[0])
    {
      htmlObj = col.childNodes[0];
	  while(htmlObj.nodeName == '#text')
	  {
		htmlObj = htmlObj.nextSibling;
        mcaCross2++;
	  }
      switch(htmlObj.nodeName)
      {

        case 'INPUT'  :  if(htmlObj.getAttribute("type") == 'text')
                         {
	                         cellValue = htmlObj.getAttribute("value");
                         }
                         break;
        case 'SELECT' :  selectobj = htmlObj;
                         if(selectobj.selectedIndex!=-1)
                         {
                     		   cellValue = selectobj[selectobj.selectedIndex].value;
                     	 }
						 break;
        case '#text'  :  cellValue = htmlObj.data;
                         break;
        case 'A'      :  cellValue= htmlObj.childNodes[0].data;
        default       :  break;
      }
      if(cellValue != 'undefined')
      {
      	// Added to remove leading and trailing spaces
      	// from numeric value to make it proper numeric
      	cellValue = trim(cellValue);
        if ( checkDataType(cellValue, 'N') )
        {
          type[i] = 0;
        }
        else
        {
          type[i] = 1;
        }
      }
      else if (col.childNodes[mcaCross2].nodeName =='INPUT' &&
               (col.childNodes[mcaCross2].getAttribute("type") == 'checkbox' ||
               col.childNodes[mcaCross2].getAttribute("type") == 'radio'))
      {
        type[i] = 3;
      }
      else
      {
      	type[i] = 2;
      }
    }
    else
    {
      type[i] = 2;
    }
  }
  return type;
}

//JOADOC ???
//JOADOC
function stripMethod()
{
  if(document.forms[0])
  {
    var action=document.forms[0].action;
    var index = action.indexOf("?");
    if ( index != -1 )
    {
      document.forms[0].action = action.substring(0, index);
    }
  }
}

//JOADOC   Function Name:  trim()
//JOADOC   Description  :  This function removes the leading & trailing spaces entered by the user
//JOADOC                   in any input element.
//JOADOC                   It takes only one parameter, string of value.
//JOADOC                   s : The string containg data.
//JOADOC   It returns the value of the object.
function trim( s )
{
  if(!s)
  {
    return;
  }
  if(s.length == 0)
  {
    return s;
  }
  var i = 0, j = s.length - 1;

  for(; i <= j; i++)
  {
    var c = s.charAt(i);
    if(c != ' ' & c != '\n' & c != '\t')
    {
      break;
    }
  }

  // If i passed j, we have an empty string
  if(i > j)
  {
    return "";
  }

  for(; j > i; j--)
  {
    var c = s.charAt(j);
    if(c != ' ' & c != '\n' & c != '\t')
    {
      break;
    }
  }

  if (i > 0 || j < s.length - 1)
  {
    return s.substring(i, j+1 );
  }
  else
  {
    return s;
  }
} /* trim end */

//JOADOC   Function Name:  joaRemoveLeadingSpaces()
//JOADOC   Description  :  This function removes the leading spaces entered by the user
//JOADOC                   in any input element.
//JOADOC                   It takes only one parameter, objCurrent.
//JOADOC                   objCurrent : The object passed  to the function.
//JOADOC   It returns the value of the object.


function joaRemoveLeadingSpaces(objCurrent)
{
  while(objCurrent.value.charAt(0)==' ')
  {
    objCurrent.value=objCurrent.value.substring(1,objCurrent.value.length);
  }
  return objCurrent.value;
}

//JOADOC   Function Name:  joaRemoveLeadingNewLineSpaces()
//JOADOC   Description  :  This function removes the leading spaces or newline characters entered by the user
//JOADOC                   in any input element.
//JOADOC                   It takes only one parameter, objCurrent.
//JOADOC                   objCurrent : The object passed  to the function.
//JOADOC   It returns the value of the object.


function joaRemoveLeadingNewLineSpaces(objCurrent)
{
  while(objCurrent.value.length >0 && objCurrent.value.substring(0,2)=="\r\n")
  {
    objCurrent.value=objCurrent.value.substring(2,objCurrent.value.length);
      while(objCurrent.value.charAt(0)==' ')
  		{
   			 objCurrent.value=objCurrent.value.substring(1,objCurrent.value.length);
  		}
    
  }
  return objCurrent.value;
}

//JOADOC   Function Name:  removeTrailingSpaces()
//JOADOC   Description  :  This function removes the trailing spaces entered by the user
//JOADOC                   in any input element.
//JOADOC                   It takes only one parameter, objCurrent.
//JOADOC                   objCurrent : The object passed  to the function.
//JOADOC   It returns the value of the object.

function removeTrailingSpaces(objCurrent)
{
  while(objCurrent.value.charAt(objCurrent.value.length-1)==' ')
  {
    objCurrent.value=objCurrent.value.substring(0,objCurrent.value.length-1);
  }
  return objCurrent.value;
}

//JOADOC   Function Name:  joaNew()
//JOADOC   Description  :  This function creates the New Rows in Updateable List
//JOADOC                   It takes only one parameter, tableId.
//JOADOC                   tableId : Table in which you want to add Row.
//JOADOC   It returns the value of the object.
function joaNew(tableId)
{
  var table=document.getElementById(tableId);
  var rows = table.getElementsByTagName('tr');
  makeRowReadonly(rows);
  var rowModifiedObj = eval("document.forms[0].rowModified_"+tableId);
  var objEvent;
  var i=0;
  var rowObj;
  var rowDelFlag =false;
  var cols;
  for(i = 1; i < rows.length ; i++ )
  {
    rowDelFlag =false;
    rowObj = rows[i];
    objEvent = rowObj.getAttribute("onclick")
    if(objEvent==null)
    {
      rowObj.attachEvent("onclick",makeEditable);
    }
    cols= rowObj.getElementsByTagName('td');
    if(rowModifiedObj[i-1].value=='Deleted')
    {
      rowDelFlag = true;
      if(i%2 == 0)
      {
        rowObj.className = "RowDataAlt";
      }
      else
      {
        rowObj.className = "RowData";
      }
    }
    rowModifiedObj[i-1].value='';
    for(j = 0; j < cols.length ; j++ )
    {
      col = cols[j];
      if(col.childNodes[0])
      {
      	var htmlObj = col.childNodes[0];
      	if(htmlObj.nodeName!='#text')
      	{
          objEvent = htmlObj.getAttribute("onfocus");
          htmlObj.attachEvent("onfocus", makeEditable);
        }
        switch(htmlObj.nodeName)
        {
          case 'INPUT'  :  if(htmlObj.type == 'text' || htmlObj.type == 'hidden')
                           {
                             htmlObj.value='';
                           }
                           else if(htmlObj.type == 'radio' ||htmlObj.type == 'checkbox')
                           {
                             htmlObj.checked = false;
                             if(objEvent==null &&
                                 (htmlObj.name.indexOf("radSelect")!=-1 ||
                                  htmlObj.name.indexOf("chkSelect")!=-1))
                             {
                               htmlObj.attachEvent("onfocus", makeEditable);
                             }
                           }
                           var editable = htmlObj.getAttribute("editable");
                           if(editable!=null  && editable.indexOf("I")==-1)
                           {
                             htmlObj.disabled= false;
                           }
                           else if(editable==null)
                           {
                             htmlObj.disabled= false;
                           }
                           if(rowDelFlag)
                           {
                             if(i%2 == 0)
                             {
                               if(htmlObj.className.indexOf('Num')!=-1)
                               {
                                 htmlObj.className ='tableNumAltR';
                               }
                               else if(htmlObj.className.indexOf('Text')!=-1)
                               {
                                 htmlObj.className ='tableTextAltR';
                               }
                             }
                             else
                             {
                               if(htmlObj.className.indexOf('Num')!=-1)
                               {
                                 htmlObj.className ='tableNumR';
                               }
                               else if(htmlObj.className.indexOf('Text')!=-1)
                               {
                                 htmlObj.className ='tableTextR';
                               }
                             }
                           }
                           break;
          case 'SELECT' :  htmlObj.setAttribute("selectedIndex",'0');
                           var editable = htmlObj.getAttribute("editable");
                           if(editable != null &&  editable.indexOf("I")==-1)
                           {
                             htmlObj.disabled= false;
                           }
                           else if(editable==null)
                           {
                             htmlObj.disabled= false;
                           }
                           if(rowDelFlag)
                           {
                             if(i%2 == 0)
                             {
                               if(htmlObj.className.indexOf('Num')!=-1)
                               {
                                 htmlObj.className ='tableNumAltR';
                               }
                               else
                               {
                                 htmlObj.className ='tableTextAltR';
                               }
                             }
                             else
                             {
                               if(htmlObj.className.indexOf('Num')!=-1)
                               {
                                 htmlObj.className ='tableNumR';
                               }
                               else
                               {
                                 htmlObj.className ='tableTextR';
                               }
                             }
                           }
                           break;
          case '#text'  :  htmlObj.data = ''
                           break;
          default       :  break;
        }
      }
      if(i == 1 && j == 0)
      {
      	 inputObj=rows[i];
      }
      rowModifiedObj[i-1].value='';
    }
  }
  var objSaveMode = eval("document.forms[0].hidSaveMode_"+tableId);
  if(objSaveMode)
  {
    objSaveMode.value = 'New';
  }
  rowCountDIVId = 'rowCount_'+ tableId ;
  rowCountSpan  = document.getElementById(rowCountDIVId);
  if(rowCountSpan)
  {
    rowCountSpan.childNodes[0].data = '0-0';
  }
  hideBlink();
  makeEditable(inputObj);
  setFocusOnFirstEditable(inputObj)

}
//JOADOC   Function Name:  setFocusOnFirstEditable()
//JOADOC         purpose:  to set the focus on the first
//                           editable field of table
function setFocusOnFirstEditable(rowObj)
{
  var col, htmlObj;
  var isFirstEditable = false;
  var cols = rowObj.getElementsByTagName('td');
  for(i = 0; i < cols.length ; i++ )
  {
    col = cols[i];
    if(col.childNodes[0])
    {
      htmlObj = col.childNodes[0];
      switch(htmlObj.nodeName)
      {
        case 'INPUT' :
          if(htmlObj.type == 'text' && !(htmlObj.isDisabled ||
             htmlObj.getAttribute("readOnly")))
          {
	          isFirstEditable = true;
          }
          break;
        case 'SELECT' :
          if(!htmlObj.isDisabled)
          {
            isFirstEditable = true;
          }
          break;
        default :
          break;
      }
    }
    if(isFirstEditable)
    {
      try
      {
        htmlObj.focus();
      }
      catch(e){}
      return;
    }
  }
}


//JOADOC   Function Name:  joaClear()
//JOADOC   Description  :  This function reset the paricular DataBlock with tableid
//JOADOC                   It takes only one parameter, tableId.
//JOADOC                   tableId : Id of table containing DataBlock.
//JOADOC
function joaClear(tableId)
{
  // Case for handling text area, and multi-list is miising
  // Need to add code for that
  objTable = document.getElementById(tableId);
  objInputArray = objTable.getElementsByTagName('INPUT');
  var inputObj;
  var objType;
  for(i = 0 ; i < objInputArray.length ; i++)
  {
    inputObj = objInputArray[i];
    objType  = inputObj.type;
    if(objType=='text' ||objType=='hidden')
    {
      if(document.forms[0].name=='LovForm')
      {
        inputObj.value = "";
      }
      else
      {
         inputObj.value=inputObj.defaultValue;
      }
    }
    else if(objType=='radio' ||objType=='checkbox')
    {

      inputObj.checked=inputObj.defaultChecked;
    }
  }
  objSelectArray = objTable.getElementsByTagName('Select');
  for(i = 0 ; i < objSelectArray.length ; i++)
  {
    var opt;
    var j=0;
    var htmlObj = objSelectArray[i];
    var hasDefault = false;
    while (opt = htmlObj.options[j])
    {
      if (opt.defaultSelected)
      {
        htmlObj.selectedIndex = j;
        hasDefault = true;
        break
      }
      j++;
    }
    if(!hasDefault)
    {
      htmlObj.selectedIndex = 0;
    }
  }
  var arTextArea = objTable.getElementsByTagName('TextArea');
  for(i = 0 ; i < arTextArea.length ; i++)
  {
    var htmlObj = arTextArea[i];
    htmlObj.value=htmlObj.defaultValue;
  }

  hideBlink();

}

//JOADOC   Build a array with Table Data on load of body.
//JOADOC   Array will be used for updateable list.
function buildArray(table,varId)
{
  var rowData= new Array();
  var i=0;
  rows = table.getElementsByTagName("TR");
  for(i = 1 ; i < rows.length ;  i++ )
  {
    var rowData= new Array();
    cols = rows[i].getElementsByTagName("TD");
    ind=0;
    for(j = 0 ; j < cols.length ;  j++)
    {
      col=cols[j];
      if(col.childNodes[0])
      {
      	htmlObj = col.childNodes[0];
      	htmlObjType= htmlObj.type;
        switch(htmlObj.nodeName)
        {
          case 'INPUT'  :  if(htmlObjType!='radio' && htmlObjType!='hidden' &&
                              htmlObjType!='checkbox')
                           {
                             rowData[ind]=htmlObj.value;
                             ind++;
                           }
                           else if(htmlObjType=='checkbox')
                           {
                             if(htmlObj.checked)
                             {
                              rowData[ind]=1;
                             }
                             else
                             {
                               rowData[ind]= 0;
                             }
                             ind++;
                           }
                           break;
          case 'SELECT' :  rowData[ind]=htmlObj.selectedIndex;
                           ind++;
                           break;
          default       :  break;
        }
      }
    }
    eval(varId)[i-1]=rowData;
  }
}

//JOADOC
//JOADOC
function compareValue(tableObj, tableId)
{
  var varId = "Data_"+tableId;
  tableObj = document.getElementById(tableId);
  var rows = tableObj.getElementsByTagName("TR");
  var i=0;
  var j=0;
  var hiddenElement;
  var cols;
  var updatedData="";
  for(i = 1 ; i < rows.length ;  i++ )
  {
    ind1=0;
    cols = rows[i].getElementsByTagName("TD");
    hiddenElement = cols[0].childNodes[1];
    for(j = 0 ; j < cols.length ;  j++)
    {
      col=cols[j];
      if(col.childNodes[0])
      {
      	var htmlObj     = col.childNodes[0];
      	var htmlObjType = htmlObj.type;
        switch(htmlObj.nodeName)
        {
          case 'INPUT'  :  if(htmlObjType!='radio' && htmlObjType!='hidden' &&
                              htmlObjType!='checkbox')
                           {
							 updatedData += htmlObj.value+",";
                             if(eval(varId)[i-1][ind1] != htmlObj.value)
                             {
                               if(hiddenElement.value=='')
                               {
                                 hiddenElement.value ='Updated';
                               }
                             }
                             ind1++;
                           }
                           else if(htmlObjType=='checkbox' &&
                                   htmlObj.name.indexOf("chkSelect")==-1)
                           {
                       	     if(htmlObj.checked)
                             {
							   updatedData +="1"+",";
                               if(eval(varId)[i-1][ind1] != 1)
                               {
                                 if(hiddenElement.value=='')
                                 {
                                   hiddenElement.value ='Updated';
                                 }
                               }
                             }
                             else
                             {
							   updatedData += "0"+",";
                               if(eval(varId)[i-1][ind1] != 0)
                               {
                                 if(hiddenElement.value=='')
                                 {
                                   hiddenElement.value ='Updated';
                                 }
                               }
                             }
                             ind1++;
                           }
                           else if(htmlObjType=='checkbox' &&
                                   htmlObj.name.indexOf("chkSelect")!=-1)
                           {
                             ind1++;
                           }
                           break;
          case 'SELECT' :
			               updatedData +=htmlObj.value+",";
                           if(eval(varId)[i-1][ind1] != htmlObj.selectedIndex)
                           {
                             if(hiddenElement.value=='')
                             {
                               hiddenElement.value ='Updated';
                             }
                           }
                           ind1++;
                           break;
          default       :  break;
        }
      }
    }
  }
document.forms[0].hidSaveMode_list1.value=updatedData;
return true;
}

//JOADOC Function Name: focusOnFirstElement()
//JOADOC Description:   This function places the focus on the first element of the
//JOADOC                form when the page loads.
//JOADOC                It should be called on the onLoad event of the BODY tag.
function focusOnFirstElement()
{
   /*
     Following code sets the tabindex of IFrame to -1 so that it is hidden
   */
  var iframeObj = document.getElementsByTagName("IFRAME");
  if(iframeObj.length != undefined && iframeObj.length == 1)
  {
    iframeObj[0].tabIndex=-1;
  }
  else if(iframeObj.length != undefined && iframeObj.length > 1)
  {
    for(var i=0;i<iframeObj.length;i++)
    {
      iframeObj[i].tabIndex=-1;
    }
  }

  var objFormElements = document.forms[0]; // get all form elements
  if(objFormElements!= undefined)
  {
	  var elemCount = objFormElements.length
	  var elem;
	  for (var i=0; i<elemCount; i++)
	  {
	    elem = objFormElements.elements[i];
	    // if element is not hidden or readonly then set the focus
	    if(!(elem.isDisabled || elem.getAttribute("readOnly") || elem.type == 'hidden'))
	    {
	      try
	      {
	        elem.focus();
	      }
	      catch(e)
	      {
	        break;
	      }
	      if(elem.name.indexOf("radSelect") != -1 || elem.name.indexOf("chkSelect")!=-1)
	      {
	          // Select the first record only if no record is selected.
	          if(isRowSelected("list1").length == 0)
	          if(elem.type != "checkbox")
		          elem.click();
	      }
	      break;
	    }
	  }
	}
}

//JOADOC Function Name: toUp()
//JOADOC Description:   This function converts to uppercase, the value entered
//JOADOC                by the user into any input element.
//JOADOC                It takes only one parameter, objCurrent.
//JOADOC                objCurrent is the object passed  to the function.
//JOADOC                It returns the value of the object.
function toUp(objCurrent)
{
  objCurrent.value = objCurrent.value.toUpperCase();
}

//JOADOC Function Name: toLow()
//JOADOC Description:   This function converts to lowercase, the value entered
//JOADOC                by the user into any input element.
//JOADOC                It takes only one parameter, objCurrent.
//JOADOC                objCurrent is the object passed  to the function.
//JOADOC                It returns the value of the object.
function toLow(objCurrent)
 {
   if(flagVar=='false')
   {
    return objCurrent.value.toLowerCase();
   }
 }

//JOADOC Function Name: enableDisableElement()
//JOADOC Description  : This function disables/enables form elements dynamically.
//JOADOC                It takes two parameters, elementId and blnFlag.
//JOADOC                elementId is the id of the element which is to be
//JOADOC                dynamically disabled/enabled.
//JOADOC                blnFlag is the flag which can be true/false for
//JOADOC                disabling/enabling any element.

function enableDisableElement()
{
  if(flagVar=='false')
  {
    var funcArgs=enableDisableElement.arguments;
    for(var i=0; i<funcArgs.length; i=i+2)
    {
      document.getElementById(funcArgs[i]).disabled = funcArgs[i+1];
    }
  }
}

//JOADOC Function Name: populateDropDown()
//JOADOC Description:   This function populates the drop down fields dynamically.
//JOADOC                It takes two parameters,objCurrent is the object passed
//JOADOC                and arrDropDown is the name of the array which will populate
//JOADOC                values in the drop down.
//JOADOC                The object, objCurrent should be passed to the function
//JOADOC                in document.formname.fieldname  format.
function populateDropDown(objCurrent,arrDropDown)
{
 if(flagVar=='false')
 {
   for(var i=0; i<arrDropDown.length; i++)
   {
    objCurrent.options[i] = new Option(arrDropDown[i],arrDropDown[i]);
   }
 }
}
//JOADOC Function Name: checkBoxCounter()
//JOADOC Description:   This function counts the number of checkboxes,
//JOADOC                checked by the user.
//JOADOC                The function returns the count of the checked boxes.
//*****
function checkBoxCounter()
{
  if(flagVar=='false')
  {
    var count = 0;
    var objForm = document.forms[0];

    for (var i=0; i<objForm.length; i++)
    {
     var objElement=  objForm.elements[i];

     if((objElement.type=='checkbox')&&(objElement.name.substring(0,2) == 'cb')&&(objElement.checked==true))
     {
      count++;
     }
    }
    return count;
  }
}

//JOADOC Function Name   :  checkBoxValue()
//JOADOC Description     :  This function dynamically checks the value of the check box
//JOADOC Input Parameters:  beanValue is value of each TD.
//JOADOC Input Parameters:  Index of the table column whose value is to set for each checkBox().
//JOADOC Input Parameters:  Name of the check box.
//JOADOC Input Parameters:  Total number of columns in the table.
var chkIndex=0;
function checkBoxValue(beanValue,columnIndex,checkBoxName,total)
{
 if(flagVar=='false')
 {
   chkIndex+= 1;
   document.write('<td>'+ beanValue + '</td>');

   if(chkIndex == columnIndex)
   {
    chkIndex=(columnIndex - total);
    document.forms[0].elements[checkBoxName].value = beanValue;
   }
  }
}

//JOADOC Function Name   :  multiChkBoxAction()
//JOADOC Description     :  To dynamically enable/disable a set of buttons depending
//JOADOC                 :  upon the number of check boxes checked by the user.
//JOADOC Input Parameters:  name of the buttons to be acted upon. checked boxes.
//*****
function multiChkBoxAction()
{
  if(flagVar=='false')
  {
    var count = 0;
    var funcArgsLength = multiChkBoxAction.arguments.length;
    var objForm = document.forms[0];
    for (var i=0; i<objForm.length; i++)
    {
      var objElement = objForm.elements[i];
      if((objElement.type == 'checkbox')&&
         (objElement.name.substring(0,2) == 'cb')&&
         (objElement.checked == true))
      {
        count++;
      }
    }
    for(j=0; j<funcArgsLength; j++)
    {
      var funcArgs = multiCbAct.arguments[j];
      if(count == 0)
      {
        document.forms[0].elements[funcArgs].disabled = true;
      }
      else if(count == 1)
      {
        document.forms[0].elements[funcArgs].disabled = false;
      }
      else if (!(funcArgs.substring(0,5) == 'multi'))
      {
        document.forms[0].elements[funcArgs].disabled = true;
      }
    }
  }
}

//JOADOC Function Name    :  setVariable()
//JOADOC Description      :  To dynamically set the value of a hidden form element
//JOADOC                  :  equal to the value of the first check box selected by the user .
//JOADOC Input Parameter  :  Object of the type of input type hidden.
//JOADOC Input Parameters :  name of the buttons to be acted upon. checked boxes.
//*****
function setVariable(targetElement)
{
  var objForm = document.forms[0];
  for (var i=0; i<objForm.length; i++)
  {
    var objElement = objForm.elements[i];
    if((objElement.type == 'checkbox')&&
       (objElement.name.substring(0,2) == 'cb')&&
       (objElement.checked == true))
    {
      break;
    }
  }
  if((objElement.type == 'checkbox')&&
     (objElement.name.substring(0,2) == 'cb'))
  {
    targetElement.value= objElement.value;
  }
}


//JOADOC Function Name    :  radioButtonAction()
//JOADOC Description      :  To dynamically enable a set of buttons onClick of
//JOADOC                  :  a radio button
//JOADOC Input Parameters :  name of the buttons to be enabled
//*****
function radioButtonAction()
{
  var objForm = document.forms[0];
  var funcArgsLength= rdAct.arguments.length;
  for (var i=0; i<objForm.length; i++)
  {
    var objElement = objForm.elements[i];
    if((objElement.type == 'radio')&&
       (objElement.name.substring(0,2) == 'rb')&&
       (objElement.checked == true))
    {
      break;
    }
 }

 for(var j=0; j<funcArgsLength; j++)
 {
  var funcArgs = rdAct.arguments[j];
  document.forms[0].elements[funcArgs].disabled = false;
 }
 }

//JOADOC  : Function to check radio button whose value matches with
//JOADOC  : with the passed object value. If Object value does not exist
//JOADOC  : then check the first radio button in the group.

function getRadioChecked(objRadio, objVal)
{
   var objRad=document.forms[0].elements[objRadio];
   var found = false;

   if (document.forms[0].elements[objVal].value.length == 0 )
   {
      objRad[0].checked=true;
      document.forms[0].elements[objVal].value = objRad[0].value;
      found = true;
   }
   else
   {
      var count = 0;
      var len = objRad.length;
      while(true)
      {
         if (len == null)
         {
            objRad.checked=true;
            document.forms[0].elements[objVal].value = objRad.value;
            found = true;
            break;
         }
         if (objRad[count].value == document.forms[0].elements[objVal].value)
         {
           objRad[count].checked = true;
           found = true;
           break;
         }
         if (++count >= len ) break;
      }
   }
   if (!found)
   {
      objRad[0].checked=true;
      document.forms[0].elements[objVal].value = objRad[0].value;
   }
}

//JOADOC Function Name    :  changeLov()
//JOADOC Description      :  To dynamically change LOV on the basis of the drop down value.
//JOADOC Input Parameters :  Domain id, field object
function changeLov(objselect,domainid)
{
  var index = objselect.selectedIndex;
  var val   = objselect.options[index].value;
  switch(domainid)
  {
    case '100':
      switch(val)
      {
        case '1' :
          lovWin("MNT0110L", "multi", null, "1:stOriginatingPort");
          break;
        case '2' :
          lovWin("MNT0110L","single", null, "1:stOriginatingPort");
          break;
      }
      break;
    case 'SITETYPE':
      switch(val)
      {
        case '1' :
          lovWin("MNT0080L", "single", null, "1:site","2:siteName")
          break;
        case '2' :
          lovWin("MNT0310L", "single", null, "1:site","2:siteName");
          break;
      }
      break;
    case 'TARGETAUDITYPE':
      switch(val)
      {
        case '1' :
          break;
        case '2' :
          lovWin("MNT0090L","single", null, "1:targetAudienceValue");
          break;
        case '3' :
          lovWin("MNT0170L","single", null, "1:targetAudienceValue");
          break;
      }
      break;
    case 'ISPRDPKGCAT:2':
      switch(val)
      {
        case '1' :
          lovWin("PNP0010L","single", null, "2:prdCatCode","3:codeDesc");
          break;
        case '3' :
          lovWin("PNP0030L","single", null, "1:prdCatCode","2:codeDesc");
          break;
      }
      break;
    case 'ISPRDPKGCAT':
      switch(val)
      {
        case '1' :
          lovWin("PNP0010L","single", null, "2:code");
          break;
        case '3' :
          lovWin("PNP0030L","single", null, "1:code");
          break;
      }
      break;
  }
}

//JOADOC Function Name    :  getValues()
//JOADOC Description      :  To get the labels and values of a drop down on the
//JOADOC                  :  on the basis of the value of other dropdown.
//JOADOC Input Parameters :  field object
function getValues(objselect)
{
  var index = objselect.selectedIndex;
  var val   = objselect.options[index].value;
  window.frames[0].document.forms[0].stFieldVal.value=val;
  window.frames[0].document.forms[0].action+="?method=getDropDnVal";
  window.frames[0].document.forms[0].submit();
}

//JOADOC Function Name    : disableElement()
//JOADOC Description      : This function disables form elements on the basis
//JOADOC                  : of a field value
//JOADOC Input Parameters : 1) condition value , on the basis of which the
//JOADOC                  :    fields have to be disabled.
//JOADOC                  : 2) element object which will disable other form elements.
//JOADOC                  : 3) List of element objects to be disabled.

function disableElement()
{
 if(flagVar=='false')
 {
  var funcArgs=disableElement.arguments;
  if(arguments[0]=="select")
   {
 	  var index		=arguments[2].selectedIndex; // get the selected index
	  var tempVal	=arguments[2].options[index].value; // ge tits value
	  if(tempVal==arguments[1]) // if value is equal to that specified then go in the if clause
	  {
      for(var i=3; i<funcArgs.length; i++)
      {
        arguments[i].disabled=true; // disable the field
      }
    }
    else
    {
      for(var i=3; i<funcArgs.length; i++)
      {
        arguments[i].disabled=false; // enable the field
      }
    }
   }
  else if(arguments[0]=="text")
  {
   var tempVal = arguments[2].value;
	  if(tempVal==arguments[1])
	  {
      for(var i=3; i<funcArgs.length; i++)
      {
        arguments[i].disabled=true;
      }
    }
    else
    {
      for(var i=3; i<funcArgs.length; i++)
      {
        arguments[i].disabled=false;
      }
    }
  }
 }
}


//JOADOC Function Name    : disableNextPrev()
//JOADOC Description      : This function disables next/nextAll/previous/previousAll
//JOADOC                  : buttons of MultiRecord List screen.
//JOADOC Input Parameters : none
//JOADOC This function should be called on Load of body of such screen
//*****
function disableNextPrev()
{
  if(document.forms[0].stNextEnabled[0])
  {
    size = document.forms[0].stNextEnabled.length ;
    for(i=0;i < size ;i++)
    {
      listid   = "list"+(i+1);
      aPrev    = document.getElementById("prev"+listid);
      aNext    = document.getElementById("next"+listid);
      aNextAll = document.getElementById("nextAll"+listid);
      aPrevAll = document.getElementById("prevAll"+listid);
      if(document.forms[0].stNextEnabled[i].value == 'false')
      {
        aNext.disabled    = true;
        aNextAll.disabled = true;
        changeClass(aNext,'InActiveButton');
        changeClass(aNextAll,'InActiveButton');
      }
      if(document.forms[0].stPreviousEnabled[i].value == 'false')
      {
        aPrev.disabled    = true;
        aPrevAll.disabled = true;
        changeClass(aPrev,'InActiveButton');
        changeClass(aPrevAll,'InActiveButton');
      }
    }
  }
  else
  {
    aPrev    = document.getElementById("prevlist1");
    aNext    = document.getElementById("nextlist1");
    aNextAll = document.getElementById("nextAlllist1");
    aPrevAll = document.getElementById("prevAlllist1");
    if(document.forms[0].stNextEnabled.value == 'false')
    {
      aNext.disabled    = true;
      aNextAll.disabled = true;
      changeClass(aNext,'InActiveButton');
      changeClass(aNextAll,'InActiveButton');
    }
    if(document.forms[0].stPreviousEnabled.value == 'false')
    {
      aPrev.disabled    = true;
      aPrevAll.disabled = true;
      changeClass(aPrev,'InActiveButton');
      changeClass(aPrevAll,'InActiveButton');
    }
  }
}

//JOADOC function name     : toggleCheckbox()
//JOADOC Input parameters  : object of the current checkbox
//JOADOC                   : object of other checkbox to be be unchecked.
//JOADOC return type       : None.

function toggleCheckbox()
{
 var tempVal = arguments.length;
 if(arguments[0].checked)
 {
   for(var i=1;i<tempVal;i++)
   {
      arguments[i].disabled=1;
   }
 }
 if(!arguments[0].checked)
 {
  for(var i=1;i<tempVal;i++)
   {
      arguments[i].disabled=0;
   }
 }
}


//JOADOC function name     : disMultiChkButton()
//JOADOC Input parameters  : object of the current group of checkboxes
//JOADOC                    :
//JOADOC return type       : None.
//JOADOC Usage             : This function will be invoked onClick of the checkbox.
function disMultiChkButton(objectCheck,buttonId)
{
  var count =0;
  var len = objectCheck.length;
  for(var i=0;i<len;i++)
  {
    if(objectCheck[i].checked)
    {
	   count++;
    }
  }
  if(count>1)
  {
    document.getElementById(buttonId).disabled=true;
    count=0;
  }
  else
  {
    document.getElementById(buttonId).disabled=false;
  }
}

//JOADOC function name     : callLovKey()
//JOADOC Input parameters  : Id of the anchor tag
//JOADOC                    :
//JOADOC return type       : None.
//JOADOC Usage             : This function will be invoked onKeyDown event handler
//JOADOC                   : when the focus is on the respective field..

function callLovKey(anchorId)
{
  if(event.keyCode==123) //123 is the ascii code for F12
  {
    document.anchors(anchorId).click();
  }
  else
  {
    return;
  }
}

//JOADOC function name     : radioClick()
//JOADOC Input parameters  : row id of the selected radio/checkbox
//JOADOC return type       : None.
//JOADOC Usage             : This function will be invoked onclick event of radio button.

var rowNumber=0;
function radioClick(value)
{
  rowNumber=value;
}

//JOADOC function name     : getToken()
//JOADOC Input parameters  : datastring,delimiter,token
//JOADOC return type       : field value
function getToken(dataString,delimChar,tokenNo)
{
	var fieldValue;
	var startPos,endPos;

	startPos = 0;
	for (var i=1; i<tokenNo; i++)
	{
		startPos = dataString.indexOf(delimChar,startPos);
		if(startPos == -1)
		{
			return('');
		}

		startPos = startPos +1;
	}
	endPos = dataString.indexOf(delimChar,startPos);
	if (endPos == -1)
	{
		endPos = dataString.length;
	}
	fieldValue = dataString.substring(startPos,endPos);
	return fieldValue;
}

//JOADOC Following are the pre processing function/stub for the standard
//JOADOC block level button. This function are being called on the click
//JOADOC of std, button. If the developer wants to perform some page specific
//JOADOC validation before the action to be completed than developer can write
//JOADOC pre processing function in the JSP and that function will be called
//JOADOC insteadof the one define here.
//JOADOC Return type of these function is true or false.

function pre_Delete()
{
  return true;
}

function pre_Sync()
{
  return true;
}

function pre_Reorder()
{
  return true;
}

function pre_Clear()
{
  return true;
}

function pre_View()
{
  return true;
}

function pre_New()
{
  return true;
}

function pre_Find()
{
  return true;
}

function pre_Edit()
{
  return true;
}
function after_close()
{
	return true;
}
//JOADOC function name     : lovWin()
//JOADOC function usage    : This function is used to poup lov
//                 Parameters: lovName - is name of the LOV which is to be opened
//                             lovType - Thisimplies wheateher LOV is single select or multi select
//                             lovWhereFldsVal - TO get the user specified where field clause.
function lovWin(lovName, lovType, lovWhereFldsVal)
{
  stripMethod();
  var theForm = document.forms[0];
  var windowObject   = new Object();
  var tempCount      = arguments.length;
  var argumentsArray = new Array();
  /*
     Following loop extracts the user specified 'where' clause which are separated by ':'
  */
  if( lovWhereFldsVal != null)
  {
    var whereFldIndex  = lovWhereFldsVal.indexOf(":");
    var startIndex     = 0          ;
    var whereFld                    ;
    var whereFldValArr = new Array();
    var fldCount       = 0          ;
    while(whereFldIndex != -1)
    {
      whereFld = lovWhereFldsVal.substring(startIndex,whereFldIndex);
      whereFldValArr[fldCount] = theForm.elements[whereFld].value;
      fldCount++;
      lovWhereFldsVal = lovWhereFldsVal.substring(whereFldIndex+1);
      whereFldIndex  = lovWhereFldsVal.indexOf(":");
      whereFld = lovWhereFldsVal.substring(startIndex,whereFldIndex);
    }
    whereFldValArr[fldCount] = theForm.elements[lovWhereFldsVal].value;
  }
  for(var i=0;i<tempCount;i++)
  {
    argumentsArray[i]=arguments[i];
  }
  width=500;
  height=500;
  windowObject.fieldnameArray = new Array();
  /*
    Opens a window with width and heigth of 500
  */
  if (!windowObject.win || (windowObject.win && windowObject.win.closed))
  {
    for(var i=0;i<(argumentsArray.length - 3);i++)
    {
      windowObject.fieldnameArray[i] = argumentsArray[i+3];
    }
    windowObject.returnedValue = '';
    windowObject.width = width;
    windowObject.height = height;

    var index        = argumentsArray[3].indexOf(":");
    var fieldObjName = argumentsArray[3].substring(index+1,argumentsArray[3].length)
    /*if(theForm.elements[fieldObjName].disabled)
    {
      hideBlink();
      return;
    }*/
    if(lovType == "single")
    {
      var fieldValue   = theForm.elements[fieldObjName].value;
      if(fieldValue=='' || fieldValue==' ')
      {
       fieldValue="undefined";
      }
    }
    else if(lovType == "multi")
    {
     var fieldValue="undefined";
    }

    windowObject.name = (new Date()).getSeconds().toString();

    windowObject.left = (screen.width - windowObject.width) / 2;
    windowObject.top = (screen.height - windowObject.height) / 2;

    var windowAttributes = 'left=' + windowObject.left + ',top=' + windowObject.top + ',resizable=no,width='+
                            windowObject.width +  ',height=' + windowObject.height; // defines the window attributes
    windowObject.url = '';
    windowObject.win=modalWin(windowObject.url,width,height);
//    window.open(windowObject.url, windowObject.name, windowAttributes);
    windowObject.win.focus();

    /*
      Following code makes the Dynamic HTML for the LOV screen. The form of this
      dynamic HTML is submitted with the values specified by the user and LOV screen
      is displayed
    */
    var tempHtml = "";
    tempHtml += "<html>";
    tempHtml += "<body>";
    tempHtml += "<form method=post action='/"+contextRoot+"/dca/ReportsLovAction.do?method=lovFind&sessioncheck=yes'>";
    tempHtml += "<input type=hidden name='stLOVName' value='" + lovName + "' >";
    tempHtml += "<input type=hidden name='stLOVType' value='" + lovType + "' >";
    tempHtml += "<input type=hidden name='stFieldVal0' value='" + fieldValue + "' >";
    if( lovWhereFldsVal != null)
    {
      for(j=0; j<whereFldValArr.length ; j++)
      {
        tempHtml += "<input type=hidden name='arStFieldVal[j]' value='" + whereFldValArr[j] + "' >";
      }
    }
    for(var j=i;j<5-i;j++)
    {
      tempHtml += "<input type=hidden name='stFieldName" +j+"' value='' >";
    }
    if(lovType == "single")
    {
      for(var i=0;i<(tempCount-3);i++)
      {
        tempHtml += "<input type=hidden name='stFieldName" +i+"' value='" + argumentsArray[i+3] + "' >";
      }
    }
    if(lovType == "multi")
    {
      for(var i=0;i<(tempCount-3);i++)
      {
        tempHtml += "<input type=hidden name='stFieldNameArray[i]' value='" + argumentsArray[i+3] + "' >";
      }
    }
    tempHtml +="Please Wait, While application is getting the desired values...";
    tempHtml += "</form>";
    tempHtml +="</body>";
    tempHtml +="</html>";
    windowObject.win.document.write(tempHtml);
    windowObject.win.document.forms[0].submit();
    windowObject.win.focus();
  }
}



function lovCin(lovName, lovType, lovWhereFldsVal)
{
  stripMethod();

  var theForm = document.forms[0];
  var windowObject   = new Object();
  var tempCount      = arguments.length;
  var argumentsArray = new Array();
  /*
     Following loop extracts the user specified 'where' clause which are separated by ':'
  */
  if( lovWhereFldsVal != null)
  {
    var whereFldIndex  = lovWhereFldsVal.indexOf(":");
    var startIndex     = 0          ;
    var whereFld                    ;
    var whereFldValArr = new Array();
    var fldCount       = 0          ;
    while(whereFldIndex != -1)
    {
      whereFld = lovWhereFldsVal.substring(startIndex,whereFldIndex);
      whereFldValArr[fldCount] = theForm.elements[whereFld].value;
      fldCount++;
      lovWhereFldsVal = lovWhereFldsVal.substring(whereFldIndex+1);
      whereFldIndex  = lovWhereFldsVal.indexOf(":");
      whereFld = lovWhereFldsVal.substring(startIndex,whereFldIndex);
    }
    whereFldValArr[fldCount] = theForm.elements[lovWhereFldsVal].value;
  }
  for(var i=0;i<tempCount;i++)
  {
    argumentsArray[i]=arguments[i];
  }
  width=500;
  height=500;
  windowObject.fieldnameArray = new Array();
  /*
    Opens a window with width and heigth of 500
  */
  if (!windowObject.win || (windowObject.win && windowObject.win.closed))
  {
    for(var i=0;i<(argumentsArray.length - 3);i++)
    {
      windowObject.fieldnameArray[i] = argumentsArray[i+3];
    }
    windowObject.returnedValue = '';
    windowObject.width = width;
    windowObject.height = height;

    var index        = argumentsArray[3].indexOf(":");
    var fieldObjName = argumentsArray[3].substring(index+1,argumentsArray[3].length)
    /*if(theForm.elements[fieldObjName].disabled)
    {
      hideBlink();
      return;
    }*/
    if(lovType == "single")
    {
      var fieldValue   = theForm.elements[fieldObjName].value;
      if(fieldValue=='' || fieldValue==' ')
      {
       fieldValue="undefined";
      }
    }
    else if(lovType == "multi")
    {
     var fieldValue="undefined";
    }

    windowObject.name = (new Date()).getSeconds().toString();

    windowObject.left = (screen.width - windowObject.width) / 2;
    windowObject.top = (screen.height - windowObject.height) / 2;

    var windowAttributes = 'left=' + windowObject.left + ',top=' + windowObject.top + ',resizable=no,width='+
                            windowObject.width +  ',height=' + windowObject.height; // defines the window attributes
    windowObject.url = '';
    windowObject.win=modalWin(windowObject.url,width,height);
//    window.open(windowObject.url, windowObject.name, windowAttributes);
    windowObject.win.focus();

    /*
      Following code makes the Dynamic HTML for the LOV screen. The form of this
      dynamic HTML is submitted with the values specified by the user and LOV screen
      is displayed
    */

    var tempHtml = "";
    tempHtml += "<html>";
    tempHtml += "<body>";
    tempHtml += "<form method=post action='/"+contextRoot+"/dca/CINLov.do?method=lovFind'>";
    tempHtml += "<input type=hidden name='stLOVName' value='" + lovName + "' >";
    tempHtml += "<input type=hidden name='stLOVType' value='" + lovType + "' >";
    tempHtml += "<input type=hidden name='stFieldVal0' value='" + fieldValue + "' >";
    if( lovWhereFldsVal != null)
    {
      for(j=0; j<whereFldValArr.length ; j++)
      {
        tempHtml += "<input type=hidden name='arStFieldVal[j]' value='" + whereFldValArr[j] + "' >";
      }
    }
    for(var j=i;j<5-i;j++)
    {
      tempHtml += "<input type=hidden name='stFieldName" +j+"' value='' >";
    }
    if(lovType == "single")
    {
      for(var i=0;i<(tempCount-3);i++)
      {
        tempHtml += "<input type=hidden name='stFieldName" +i+"' value='" + argumentsArray[i+3] + "' >";
      }
    }
    if(lovType == "multi")
    {
      for(var i=0;i<(tempCount-3);i++)
      {
        tempHtml += "<input type=hidden name='stFieldNameArray[i]' value='" + argumentsArray[i+3] + "' >";
      }
    }
    tempHtml +="Please Wait, While application is getting the desired values...";
    tempHtml += "</form>";
    tempHtml +="</body>";
    tempHtml +="</html>";
    windowObject.win.document.write(tempHtml);
    windowObject.win.document.forms[0].submit();
    windowObject.win.focus();
  }
}


//JOADOC function name     : showErrorOnSubmit()
//JOADOC function usage    : This function is to show all client side validation
//JOADOC                   : errors in an error pop-up.
//JOADOC Input parameters  : Form object.
function showErrorOnSubmit(formObj)
{
	 
  flagVar='true'; // enable all onblur event validations
  var tableObj;
  var tableId;
  error_arr    = new Array();
  mandatoryFieldCheck(formObj); // check if any mandatory field is left blank or not.

  scriptTagFlag=1;
  fileFieldValidation();
  if(flagVar=='true')
  {
    /*
      This loop iterates for all the form elements of scalar DataBlock. It evaluates
      all the onblur events on the field elements and invoke them.
    */
    for(blockCounter=1;;blockCounter++)
    {
      tableId  = "DataBlock"+blockCounter;
      tableObj = document.getElementById(tableId);
      if(tableObj!=null)
      {
        inputElements  = tableObj.getElementsByTagName("INPUT");
        for(var i=0;i<inputElements.length;i++)
        {
          if(inputElements[i].getAttribute('onblur'))
          {
				//Changed by MCACross P
				if(navigator.appName!="Microsoft Internet Explorer")
				{
				eval(inputElements[i].getAttribute('onblur'));
				}
				else
				{
				eval(inputElements[i].getAttribute('onblur')+";"+"anonymous();");
				}
			if(error_arr.length==1 && firstErrorField=="")
            {
				firstErrorField = inputElements[i].getAttribute('name');
            }
          }
        }
        inputElements  = tableObj.getElementsByTagName("textarea");
        for(var i=0;i<inputElements.length;i++)
        {
          if(inputElements[i].getAttribute('onblur'))
          {
            //Changed by MCACross
				if(navigator.appName!="Microsoft Internet Explorer")
				{
				eval(inputElements[i].getAttribute('onblur'));
				}
				else
				{
				eval(inputElements[i].getAttribute('onblur')+";"+"anonymous();");
				}
			if(error_arr.length==1 && firstErrorField=="")
            {
				firstErrorField = inputElements[i].getAttribute('name');
            }
          }
        }

      }
      else
      {
        break;
      }
    }
    /*
      This loop iterates for all the form elements of list Block. It evaluates
      all the onblur events on the field elements and invoke them.
    */

    for(tableCounter=1;;tableCounter++)
    {
      tableId  = "list"+tableCounter;
      tableObj = document.getElementById(tableId);
      if(tableObj!=null)
      {
        theForm = document.forms[0];
      	if(!eval("theForm.rowModified_"+tableId))
        {
          continue;
        }
        var rows = tableObj.getElementsByTagName('tr');
        for(i = 1; i < rows.length ; i++ )
        {
          rowModifiedObj = eval("theForm.rowModified_"+tableId)[i-1];
          if(!rowModifiedObj || rowModifiedObj.value=='')
          {
            continue;
          }
          inputElements  = rows[i].getElementsByTagName("INPUT");
          for(var j=0;j<inputElements.length;j++)
          {
            if(inputElements[j].getAttribute('onblur'))
            {
              //Changed by MCACross
				if(navigator.appName!="Microsoft Internet Explorer")
				{
				eval(inputElements[j].getAttribute('onblur'));
				}
				else
				{
				eval(inputElements[j].getAttribute('onblur')+";"+"anonymous();");
				}
            }
          }
        }
      }
      else
      {
        break;
      }
    }
    /*
       If any validation errors occur the showErrors function is invoked
       to show them.
    */
    if(error_arr.length!=0)
    {
      showErrors();
      flagVar='false'; //reset to initial value
      return false;
    }
    else
    {
     return true;
    }
  }
}


//JOADOC   Function Name  :  joaDelete()
//JOADOC   Description    :  This function will mark the selected row as deleted.
//JOADOC                     It is called on the click of Delete button
//JOADOC                     It takes four parameters, objCurrent,objectName,fieldLength and fieldPrecision.
//JOADOC                     button     :
//JOADOC                     value      :
//JOADOC                     blockid    : Blockid for which Delete button is clicked
//JOADOC  This function returns nothing.
function  joaDelete(button, value, blockid)
{
  var objSaveMode = eval("document.forms[0].hidSaveMode_"+blockid);
  if(objSaveMode.value=='' || objSaveMode.value=='Delete')
  {
    if(value=="DeleteDisabled")
    {
      return ;
    }
  }
  var arRowIndex = new Array();
  arRowIndex = isRowSelected(blockid);
  len = arRowIndex.length;
  if ( arRowIndex.length <= 0 )
  {
    alert(COM00112);
    hideBlink();
    return;
  }
  else
  {
    for(i=0; i<arRowIndex.length; i++)
    {
      rowid     = "row"+blockid+arRowIndex[i];
      rowObject = document.getElementById(rowid);
      theForm   = document.forms[0];
      var noOfInpEle;
      var noOfSelEle;
      var inputElements;
      var selectElements;
      if(objSaveMode.value=='New')
      {
        inputElements  = rowObject.getElementsByTagName("INPUT");
        noOfInpEle = inputElements.length;
        for(counterInput = 0; counterInput < noOfInpEle; counterInput++)
        {
          var inputObj = inputElements[counterInput];
          if(inputObj.type=='text' ||inputObj.type=='hidden')
          {
            inputObj.value='';
          }
          else if((inputObj.type =='radio' ||inputObj.type=='checkbox') &&
                !(inputObj.name == ('chkSelect_'+blockid) ||
                 inputObj.name == ('radSelect_'+blockid)))
          {
            inputObj.checked=false;
          }
        }
        selectElements = rowObject.getElementsByTagName("SELECT");
        noOfSelEle = selectElements.length;
        for(counterSelect = 0; counterSelect < noOfSelEle; counterSelect++)
        {
          selectElements[counterSelect].selectedIndex = 0;
        }
      }
      else if(objSaveMode.value=='' || objSaveMode.value=='Delete')
      {
        rowObject.className="RowDel"
        objSaveMode.value = 'Delete';
        rowModifiedObj = 'rowModified_'+blockid;
        inputElements  = rowObject.getElementsByTagName("INPUT");
        noOfInpEle = inputElements.length;
        for(counterInput = 0; counterInput < noOfInpEle; counterInput++)
        {
          var inputObj = inputElements[counterInput];
          if((inputObj.name == ('chkSelect_'+blockid) ||
              inputObj.name == ('radSelect_'+blockid)))
          {
            inputObj.checked=false;
          }
          inputObj.disabled= true;
          if(inputObj.name == rowModifiedObj)
          {
            inputObj.value='Deleted';
            inputObj.disabled= false;
          }
          if(inputObj.className.indexOf('Num')!=-1)
          {
            inputObj.className ='tblNumDel';
          }
          else if(inputObj.className.indexOf('Text')!=-1)
          {
            inputObj.className ='tblTextDel';
          }
          if(inputObj.nextSibling.nextSibling &&
             inputObj.nextSibling.nextSibling.nodeName == 'A')
          {
            inputObj.nextSibling.nextSibling.style.visibility = "hidden";
          }
        }
        selectElements = rowObject.getElementsByTagName("SELECT");
        noOfSelEle = selectElements.length;
        for(counterSelect = 0; counterSelect < noOfSelEle; counterSelect++)
        {
          if(selectElements[counterSelect].className.indexOf('Num')!=-1)
          {
            selectElements[counterSelect].className ='tblNumDel';
          }
          else
          {
            selectElements[counterSelect].className ='tblTextDel';
          }
          selectElements[counterSelect].disabled = true;
        }
      }
    }
  }
  hideBlink();
}//JOADOC   Function Name  :  selectAll()
//JOADOC   Description    :  This function will make all checkbox checked or unchecked in a
//JOADOC                     multi-record multi-select table depending upon whether the
//JOADOC                     checked box was checked or unchecked earlier.
//JOADOC                     It takes only one parameter, objName.
//JOADOC                     objName    : Name of the Checkbox element.
//JOADOC  This function returns nothing
function selectAll(objName)
{
  chkObject = document.forms[0].elements[objName];
  var len   = chkObject.length;
  if(AllChecked(chkObject, len))
  {
    clearAll(chkObject, len)
  }
  else
  {
    checkAll(chkObject, len)
  }
}


//JOADOC   Function Name  :  AllChecked()
//JOADOC   Description    :  This function will check whether the checkbox are checked or
//JOADOC                     unchecked
//JOADOC                     It takes two parameters, obj and len
//JOADOC                     obj        : Checkbox object.
//JOADOC                     len        : length of checkbox array.
//JOADOC  This function returns returns true if all checkbox are checked else it
//JOADOC  will return false.

function AllChecked(obj,len)
{
  if(len > 0)
  {
	  for(var i = 0 ; i < len ; i++)
	  {
		if(obj[i].disabled)
		{
		  break;
		}
		if (!obj[i].checked )
		{
		  return false;
		}
	  }
  }
  else
  {
	  if(!obj.disabled)
	  {
		if (!obj.checked )
		{
		  return false;
		}
	  }
  }
  return true;
}

//JOADOC   Function Name  :  clearAll()
//JOADOC   Description    :  This function will make all checkbox unchecked in a multi-record
//JOADOC                     multi-select table
//JOADOC                     It takes only two parameter, chkObject and len.
//JOADOC                     chkObject    : Checkbox object which needs to be unchecked.
//JOADOC                     len          : Length of checkbox array.
//JOADOC  This function returns nothing

function clearAll(chkObject, len)
{
  if (len > 0)
  {
	  for (var i = 0; i < len; i++)
	  {
		var chk = chkObject[i];
		if(chk.disabled)
		{
		  break;
		}
		else
		{
		  chk.checked = false;
		}
	  }
  }
  else
  {
	  if(!(chkObject.disabled))
		chkObject.checked = false;
  }
}

//JOADOC   Function Name  :  checkAll()
//JOADOC   Description    :  This function will make all checkbox checked in a multi-record
//JOADOC                     multi-select table
//JOADOC                     It takes only two parameter, chkObject and len.
//JOADOC                     chkObject    : Checkbox object which needs to be checked.
//JOADOC                     len          : Length of checkbox array.
//JOADOC   This function returns nothing
function checkAll(chkObject, len)
{
  if(len > 0)
  {
	  for (var i = 0; i < len; i++)
	  {
		  var chk = chkObject[i];
		if(chk.disabled)
		{
		  break;
		}
		else
		{
		  chk.checked = true;
		}
	  }
  }
  else
  {
	   if(!(chkObject.disabled))
		chkObject.checked = true;

  }
}

//JOADOC   Function Name  :  isRowSelected()
//JOADOC   Description    :  This function will perform a necessary check for record selection
//JOADOC                     in case of multi record list where there is a need for record
//JOADOC                     to be selected. This will check for both radio button and
//JOADOC                     and checkbox
//JOADOC                     It takes only one paramete, blockid.
//JOADOC                     blockid      : Id of the block on which operation is being performed
//JOADOC   This function returns nothing

function isRowSelected(blockid)
{
  radSelObj = "radSelect_"+blockid;
  chkSelObj = "chkSelect_"+blockid;
  obj       = eval("document.forms[0]."+radSelObj);
  if(obj==null)
  {
    obj = eval("document.forms[0]."+chkSelObj);
  }
  value = new Array() ;
  if ( obj != null )
  {
    if ( obj.length )
    {
      count=0;
      for ( i = 0; i < obj.length; i++ )
      {
        if ( obj[i].checked )
        {
          value[count] = obj[i].value;
          count++;
        }
      }
    }
    else
    {
      if ( obj.checked )
      {
        value[0] = obj.value;
      }
    }
  }
  return value;
}

//JOADOC  Function Name  :  joaDeleteClear()
//JOADOC  Description    :  This function will mark the deleted row(s) as
//JOADOC                    undeleted.
//JOADOC  This function take only one argument, blockid
//JOADOC  This function returns nothing.
function  joaDeleteClear(blockId)
{
  var rowModifiedObj   = 'rowModified_'+blockId;
  var rowModified          = eval("document.forms[0]."+rowModifiedObj);
  var editable;
  var objSaveMode;
  var rowId;
  var inputObj;
  for(i=0; i<rowModified.length; i++)
  {
    if(rowModified[i].value=='Deleted')
    {
      objSaveMode = eval("document.forms[0].hidSaveMode_"+blockId);
      objSaveMode.value  = '';
      rowId      = "row"+blockId+i;
      rowObject      = document.getElementById(rowId);
      if(i%2 == 0)
      {
        rowObject.className = "RowData";
      }
      else
      {
        rowObject.className = "RowDataAlt";
      }
      inputElements  = rowObject.getElementsByTagName("INPUT");
      for(counterInput = 0; counterInput < inputElements.length; counterInput++)
      {
      	inputObj = inputElements[counterInput];

        if(inputObj.getAttribute("name")==rowModifiedObj)
        {
          inputObj.value='';
        }
        if(i%2 == 0)
        {
          if(inputObj.className.indexOf('Num')!=-1)
          {
            inputObj.className ='tableNumR';
          }
          else if(inputObj.className.indexOf('Text')!=-1)
          {
            inputObj.className ='tableTextR';
          }
        }
        else
        {
          if(inputObj.className.indexOf('Num')!=-1)
          {
            inputObj.className ='tableNumAltR';
          }
          else if(inputObj.className.indexOf('Text')!=-1)
          {
            inputObj.className ='tableTextAltR';
          }
        }
        editable = inputObj.getAttribute("editable");
        if(editable && editable.indexOf("U")==-1)
        {
          inputObj.disabled= false;
        }
        else if(!editable)
        {
          inputObj.disabled= false;
        }
      }
      selectElements = rowObject.getElementsByTagName("SELECT");
      var selObj;
      var selEleLen = selectElements.length;
      for(counterSelect = 0; counterSelect < selEleLen; counterSelect++)
      {
        selObj = selectElements[counterSelect]
        editable = selObj.getAttribute("editable");
        if(!editable || (editable && editable.indexOf("U")==-1))
        {
          selObj.disabled= false;
        }

        if(i%2 == 0)
        {
          if(selObj.className.indexOf('Num')!=-1)
          {
            selObj.className ='tableNumAlt';
          }
          else
          {
            selObj.className ='tableTextR';
          }
        }
        else
        {
          if(selObj.className.indexOf('Num')!=-1)
          {
            selObj.className ='tableNumAltR';
          }
          else
          {
            selObj.className ='tableTextAltR';
          }
        }
      }
    }
  }
}

//JOADOC  Function Name  :  markRows()
//JOADOC  Description    :  This function will mark the row's rowModified field as
//JOADOC                    New if there is some data in any of the editable field
//JOADOC                    of the row
//JOADOC  This function take only one argument, tableid
//JOADOC  This function returns nothing.
function markRows(tableId)
{
  var objSaveMode = eval("document.forms[0].hidSaveMode_"+tableId);
  if(objSaveMode.value=='New')
  {
    var valueEntered = false;
    var fieldVal;
    var cols;
    var i=0;
    var table=document.getElementById(tableId);
    var rows = table.getElementsByTagName('tr');
    for(i = 1; i < rows.length ; i++ )
    {
      valueEntered = false;
      cols= rows[i].getElementsByTagName('td');
      for(ind = 0; ind < cols.length ; ind++ )
      {
        col = cols[ind];
        if(col.childNodes[0])
        {
      	  htmlObj = col.childNodes[0];
          switch(htmlObj.nodeName)
          {
            case 'INPUT'  :  if(htmlObj.type == 'text')
	                     {
	                       fieldVal = htmlObj.value;
	                       fieldVal = trim(fieldVal);
	                       if(fieldVal!='' && fieldVal!=undefined)
	                       {
                                 valueEntered = true;
	                       }
	                     }
	                     else if(htmlObj.type == 'checkbox')
	                     {
	                       if(htmlObj.checked)
	                       {
	                         valueEntered = true;
	                       }
	                     }
                             break;
            case 'SELECT' :  selectobj = htmlObj;
                             if(selectobj.selectedIndex>0)
                             {
                               valueEntered = true;
                             }
                             break;
            default       :  break;
          }
          if(valueEntered)
          {
            var inputElements  = rows[i].getElementsByTagName("INPUT");
            var len            = inputElements.length;
            for(counterInput = 0; counterInput < len; counterInput++)
            {
              elem = inputElements[counterInput];
              if(elem.type=='hidden' &&  elem.name.indexOf("rowModified")!=-1)
              {
                elem.value = 'New';
                break;
              }
            }
            break;
          }
        }
      }
    }
  }
}

//JOADOC   Function Name:  joaListClear()
//JOADOC   Description  :  This function will reset the Updateable List.
//JOADOC                   It takes only one parameter, tableId.
//JOADOC                   tableId : Table in which you want to add Row.
//JOADOC   It returns nothing
function joaListClear(tableId)
{
  table=document.getElementById(tableId);
  var varId = "Data_"+tableId;
  rows = table.getElementsByTagName('tr');
  for(i = 1; i < rows.length ; i++ )
  {
  	ind1=0;
    cols= rows[i].getElementsByTagName('td');
    for(j = 0; j < cols.length ; j++ )
    {
      col = cols[j];
      if(col.childNodes[0])
      {
      	var htmlObj = col.childNodes[0];
        switch(htmlObj.nodeName)
        {
          case 'INPUT'  :  if(htmlObj.getAttribute("type") == 'text')
                           {
                             htmlObj.setAttribute("value",eval(varId)[i-1][ind1]);
                             ind1++;
                           }
                           else if(htmlObj.getAttribute("type") == 'checkbox')
                           {
                             if(eval(varId)[i-1][ind1] == 1)
                             {
                               htmlObj.setAttribute("checked",true);
                             }
                             else
                             {
                             	 htmlObj.setAttribute("checked",false);
                             }
                             ind1++;
                           }
                           break;
          case 'SELECT' :  htmlObj.setAttribute("selectedIndex",eval(varId)[i-1][ind1]);
                           ind1++;
                           break;
          default       :  break;
        }
      }
    }
  }
  var objSaveMode = eval("document.forms[0].hidSaveMode_"+tableId);
  if(objSaveMode)
  {
    objSaveMode.value = '';
  }
}

//JOADOC This method is used in List screen for Lov.
//JOADOC This method converts the field labels passed to it
//JOADOC to point to specific row in the list using the row-index
//JOADOC passed to it. It then calls lovWin mthod
//JOADOC Parameters passed are
//JOADOC index	          : Index of row selected in the list
//JOADOC lovName	        : Name of Lov
//JOADOC lovType	        : Type of Lov(Single/Multi)
//JOADOC lovWhereFldsVal	: List of field properties which would  be used
//                            in where clause
function listLovWin(rowIndex, lovName, lovType, lovWhereFldsVal)
{
  var theForm        = document.forms[0];
  var windowObject   = new Object();
  var tempCount      = arguments.length;
  var argumentsArray = new Array();

  if( lovWhereFldsVal != null)
  {
    var fldCount       = 0;
    var whereFldValArr = new Array();
    var whereFld;
    if(lovWhereFldsVal.indexOf(":")!=-1)
    {
       while(true)
       {
         whereFld = getToken(lovWhereFldsVal,":",fldCount+1);
         if(whereFld=='')
         {
           break;
         }
         if(theForm.elements[whereFld][rowIndex])
         {
           whereFldValArr[fldCount++] = theForm.elements[whereFld][rowIndex].value;
         }
         else
         {
           whereFldValArr[fldCount++] = theForm.elements[whereFld].value;
         }
       }
    }
    else
    {
      if(theForm.elements[lovWhereFldsVal][rowIndex])
      {
        whereFldValArr[fldCount] = theForm.elements[lovWhereFldsVal][rowIndex].value;
      }
      else
      {
        whereFldValArr[fldCount] = theForm.elements[lovWhereFldsVal].value;
      }
    }
  }
  for(var i=0;i<tempCount;i++)
  {
    argumentsArray[i]=arguments[i];
  }
  width=500;
  height=500;
  windowObject.fieldnameArray = new Array();
  if (!windowObject.win || (windowObject.win && windowObject.win.closed))
  {
    for(var i=4;i<argumentsArray.length;i++)
    {
      windowObject.fieldnameArray[i] = argumentsArray[i];
    }
    windowObject.returnedValue = '';
    windowObject.width = width;
    windowObject.height = height;

    var index        = argumentsArray[4].indexOf(":");
    var fieldObjName = argumentsArray[4].substring(index+1,argumentsArray[4].length)
    var fieldValue   = theForm.elements[fieldObjName][rowIndex].value;
    if(fieldValue=='' || fieldValue==' ')
    {
      fieldValue="undefined";
    }

    windowObject.name = (new Date()).getSeconds().toString();

    windowObject.left = (screen.width - windowObject.width) / 2;
    windowObject.top = (screen.height - windowObject.height) / 2;

    var windowAttributes = 'left=' + windowObject.left + ',top=' + windowObject.top + ',resizable=no,width='+
                            windowObject.width +  ',height=' + windowObject.height;

    windowObject.url = '';
    windowObject.win=modalWin(windowObject.url,width,height);
    windowObject.win.focus();
    var tempHtml = "";
    tempHtml += "<html>";
    tempHtml += "<body>";
    tempHtml += "<form method=post action='/"+contextRoot+"/LovAction.do?method=lovFind'>";
    tempHtml += "<input type=hidden name='stLOVName' value='" + lovName + "' >";
    tempHtml += "<input type=hidden name='stLOVType' value='" + lovType + "' >";
    tempHtml += "<input type=hidden name='stFieldVal0' value='" + fieldValue + "' >";
    if( lovWhereFldsVal != null)
    {
      for(j=0; j<whereFldValArr.length ; j++)
      {
        tempHtml += "<input type=hidden name='arStFieldVal[j]' value='" + whereFldValArr[j] + "' >";
      }
    }
    for(var i=0;i<(tempCount-4);i++)
    {
    	fieldName = argumentsArray[i+4]+"["+rowIndex+"]";
      tempHtml += "<input type=hidden name='stFieldName" +i+"' value='" + fieldName+ "' >";
    }
    for(var j=i; j<5-i; j++)
    {
      tempHtml += "<input type=hidden name='stFieldName" +j+"' value='' >";
    }
    tempHtml +="Please Wait, While application is getting the desired values...";
    tempHtml += "</form>";
    tempHtml +="</body>";
    tempHtml +="</html>";
    windowObject.win.document.write(tempHtml);
    windowObject.win.document.forms[0].submit();
    windowObject.win.focus();
  }
}

/* Function for creating Global Links Start here */
//JOADOC Function Name    : showDetails()
//JOADOC Description      : This function pops-up a window for
//JOADOC                  : About, SwitchPort and SwitchRole global links.
//JOADOC Input Parameters : 1) Action to be called
//JOADOC                  : 2) screeName
//JOADOC                  : 3) width of the pop-up
//JOADOC                  : 4) height of the pop-up 5) left margin 6) topmargin 7) name of the screen.

function showDetails(action,screenName,width,height,left,top,name,methodName)
{
    /*
      If the screen opened is switch port/role the if any child window is opened or not. If yes the give alert
    */
    if(screenName == "MNT0960S" || screenName == "MNT0950S" )
    {
      if(win && !win.closed)
      {
        alert("Child window is already open!");
        win.focus();
        hideBlink();
        return;
      }
    }
    /*
      Open a pop-up window
    */
    var moduleName      = action.substr(0,3).toLowerCase() ;
    windowObject.url    = '';
    windowObject.width  = width;
    windowObject.height = height;
    windowObject.left = (screen.width - windowObject.width) / 2;
    windowObject.top = (screen.height - windowObject.height) / 2;
    windowObject.name   = name;
    if(screenName == "About")
    {
      var windowAttributes = 'left=' + windowObject.left + ',top=' + windowObject.top + ',resizable=yes,width='+
                            windowObject.width +  ',height=' + windowObject.height + ',scrollbars=yes';
    }
    else
    {
      var windowAttributes = 'left=' + windowObject.left + ',top=' + windowObject.top + ',resizable=yes,width='+
                            windowObject.width +  ',height=' + windowObject.height;
    }
    windowObject.win=window.open(windowObject.url,windowObject.name, windowAttributes);
    windowObject.win.focus();
    // a dynamic html is made to submit the form and call the specied action for loading the jsp.
    var tempHtml = "";
    tempHtml += "<html>";
    tempHtml += "<body>";
    if(moduleName == "mnt")
    {
      tempHtml += "<form method=post action='/"+contextRoot+"/"+moduleName+"/"+action+".do?method="+methodName+"'>";
    }
    else
    {
      tempHtml += "<form method=post action='/"+contextRoot+"/"+action+".do?method="+methodName+"'>";
    }
    tempHtml += "<input type=hidden name='method' value='"+screenName+"' >";
    tempHtml +="Please Wait, While application is getting the desired values...";
    tempHtml += "</form>";
    tempHtml +="</body>";
    tempHtml +="</html>";
    windowObject.win.document.write(tempHtml);
    windowObject.win.document.forms[0].submit();
    windowObject.win.focus();
}

//JOADOC Function Name    : showHide()
//JOADOC Description      : This function is used for showing and hiding the
//JOADOC                    Global Link Menu. I.e used in utils etc
//JOADOC Input Parameters : 1) menuID that needs to be shown.

function showHide(menuID)
{
   divID       = "Link"+menuID;
   divObj      = document.getElementById(divID); // get the particular element which is selected.
   divObjHelp  = document.getElementById("Link0");
   divObjUtils = document.getElementById("Link1");

   // If clause to switch on the menu
   if(divObj.className=="LINKSOFF")
	 {
     divObj.className         = "LINKSON";
     if(divID=="Link0")
     {
       divObjUtils.className  = "LINKSOFF";
     }
    else
    {
      divObjHelp.className    = "LINKSOFF";
    }
  }
// to switch off the menu
  else
  {
    divObj.className         = "LINKSOFF";
    if(divID=="Link1")
    {
      divObjHelp.className   = "LINKSOFF";
    }
    else
    {
      divObjUtils.className  = "LINKSOFF";
    }
 }
}

//JOADOC  This method will create the Global Link for the Child Window Application
//JOADOC
function createGlobalLinksAppWin()
{

	GlobalTabString="";
  GlobalTabString=  " <table class='ContainerTable' border=0 cellPadding=0 cellSpacing=0 background='" + webPath + "images/bg_hdr.jpg'  style='background-repeat:repeat-y'>";
  GlobalTabString+= " <tr>";
  GlobalTabString+= " <td width='30%'><img src='"+webPath+"images/logo2.jpg'></td>";
  GlobalTabString+= " <td width='50%'>";
  GlobalTabString+= " <td width='20%' align='center' valign='top'>";
  GlobalTabString+= " <table border=0 cellPadding=0 cellSpacing=0>";
  GlobalTabString+= " <tr align='right'>";
  GlobalTabString+= " <td valign='top'> ";
  GlobalTabString+= " <table cellpadding='2' cellspacing='0' border='0'> ";
  GlobalTabString+= " <tr> ";
  GlobalTabString+= " <td><a href='javascript:printit()'><img alt='Print Screen' width='20' border='0' src='"+webPath+"images/icon_mini_print.gif' ></a></td> ";
  GlobalTabString+= " <td><span class='glinkssep'>&nbsp;</span></td>";
  GlobalTabString+= " <td><img border='0' src='"+webPath+"images/icon_mini_help.gif' ></td> ";
  GlobalTabString+= " <td  onclick='showHide(0)' class='globallinks'>help</td> ";
  GlobalTabString+= " <td><span class='glinkssep'>&nbsp;</span></td>";
  GlobalTabString+= " <td><img border='0' src='"+webPath+"images/icon_mini_login.gif'></td> ";
  GlobalTabString+= " <td><div class='globallinks' onClick='window.close();'>close</div></td> ";
  GlobalTabString+= " </tr> ";
  GlobalTabString+= " </table> ";
  GlobalTabString+= " </td> ";
  GlobalTabString+= " </tr> ";
  GlobalTabString+= " <tr height='5px'></tr>";
  GlobalTabString+= " </table>";
  GlobalTabString+= " </td>";
  GlobalTabString+= " </tr>";
  GlobalTabString+= " </table>";
  GlobalTabString+= "<table border='0' cellspacing='0' cellpadding='0' class='ContainerTable'>";
  GlobalTabString+= "<tbody>";
  GlobalTabString+= "<tr class='ContainerTable'>";
	GlobalTabString+= "<td width='3' height='34' style='background-repeat:no-repeat' background='"+webPath+"tabimages/tabbar_left.gif'></td>";
	GlobalTabString+= "<td height='34' background='"+webPath+"tabimages/tabbar_body_fat.gif'>";
	GlobalTabString+= "<table border='0' cellpadding='0' cellspacing='0'>";
  GlobalTabString+= "<tr>";
  GlobalTabString+= "<td>&nbsp;</td>";
  GlobalTabString+= "</tr>";
	GlobalTabString+= "</table>";
	GlobalTabString+= "</td>";
	GlobalTabString+= "<td width='28' height='34' style='background-repeat:no-repeat'  background='"+webPath+"tabimages/tabbar_midcurve.gif'></td>";
  GlobalTabString+= "<td height='34' width='45%'  background='"+webPath+"tabimages/tabbar_body_slim.gif' align='right' valign='bottom' nowrap ><span class='WelcomeOption'><script language='JavaScript1.2'>showWelcomeMsg();</script></span></td>";
	GlobalTabString+= "<td width='5' height='34' style='background-repeat:no-repeat' background='"+webPath+"tabimages/tabbar_right.gif'></td>";
  GlobalTabString+= "</tr>";
  GlobalTabString+= "</tbody>";
  GlobalTabString+= "</table>";
  document.write(GlobalTabString);
  createGlobalLkMenu();
}

//JOADOC Function Name    : createGlobalLinks()
//JOADOC Description      : This function is invoked to show the globallinks.
//JOADOC                  : It will be called from the function that is
//JOADOC                    called for showing the menu on screen.
//JOADOC Input Parameters : 1) menuID that needs to be shown.

function createGlobalLinks()
{

  GlobalTabString=  " <table  border='0' cellPadding=0 cellSpacing=0 background='" + webPath + "images/backgd.gif' style='background-repeat:repeat-y'>";
  GlobalTabString+= " <tr>";
  GlobalTabString+= " <td><img src='"+webPath+"images/mcabannerpart.gif' border='0'></td>";
  GlobalTabString+= " <td  height='80' align='right'>";
  GlobalTabString+= " <table width='100%' height='100%' border='0' cellPadding=0 cellSpacing=0  bgcolor='#f5f0f6'>";
  GlobalTabString+= " <tr>";
//  GlobalTabString+= " <td valign='top'> ";
//  GlobalTabString+= " <table cellpadding='2' cellspacing='0' border='0'> ";
//  GlobalTabString+= " <tr> ";
  GlobalTabString+= "<td width='100%' colspan='5' ><img src='"+webPath+"images/dca21part.gif' border='0'></td>";
  GlobalTabString+= "</tr>";
  GlobalTabString+= " <tr align='bottom' >";
  GlobalTabString+= " <td width='20%' onclick='' class='globallinks'>Home</td> ";
//  GlobalTabString+= " <td  onclick='showHide(0)' class='globallinks'>help</td> ";
//  GlobalTabString+= " <td><span class='glinkssep'>&nbsp;</span></td> "
  GlobalTabString+= "<td width='10%'><b>|</b>&nbsp</td>";
  GlobalTabString+= " <td width='30%' onclick='javascript:checkLogout()' class='globallinks'>Logout</td> "
  GlobalTabString+= "<td width='10%'><b>|</b>&nbsp</td>";
//  GlobalTabString+= " <td  onclick='showHide(1)' class='globallinks'>utils</td> "
//  GlobalTabString+= " <td><span class='glinkssep'>&nbsp;</span></td> ";
  GlobalTabString+= " <td width='20%'><div class='globallinks' onClick='javascript:showHide(0)'>Help</td> ";
//  GlobalTabString+= "<td width='10%'><b>&nbsp;</b>&nbsp</td>";
//  GlobalTabString+= " <td><div class='globallinks' onClick='javascript:checkLogout();'>logout</div></td> ";
  GlobalTabString+= " </tr> ";
  GlobalTabString+= " </table> ";
  GlobalTabString+= " </td>";
  GlobalTabString+= " </tr> ";
  GlobalTabString+= " </table> ";

  document.write(GlobalTabString);

}
//JOADOC Function Name    : createGlobalLkMenu()
//JOADOC Description      : This function makes the Menu for Global Links.
function createGlobalLkMenu()
{
  str  = "  <div id='Link0' class='LINKSOFF' style='position:absolute;z-index:1;left:870px;top:16px'> ";
  str += "    <table cellspacing='0' cellpadding='2' class='menuTable' >";
  str += "      <tbody>";
  str += "        <tr class = 'itemOut'>";
  str += "          <td class='menuTd' colspan='2' nowrap onclick='showHide(0)'>";
  str += "            <a class='menuTxt' href='javascript:showHelp();'>";
  str += "              Application Help";
  str += "            </a>";
  str += "            <br/>";
  str += "          </td>";
  str += "        </tr>";
  str += "        <tr class = 'itemOut'>";
  str += "          <td class='menuTd' colspan='2' nowrap onclick='showHide(0)'>";
  str += "            <a class='menuTxt' href='javascript:showHotKeys(\""+jsWebPathDetails+"common/HotKeysHelp.jsp\",320,280);' >";
  str += "              Hot Key Details";
  str += "            </a>";
  str += "            <br/>";
  str += "          </td>";
  str += "        </tr>";
  str += "        <tr class = 'itemOut'>";
  str += "          <td class='menuTd' colspan='2' nowrap onclick='showHide(0)'>";
  str += "            <a class='menuTxt' href='javascript:showDetails(\"About\",\"About\",450,240,690,150,\"About\",\"about\");' >";
  str += "              About Application";
  str += "            </a>";
  str += "            <br/>";
  str += "          </td>";
  str += "        </tr>";
  str += "       </tbody>";
  str += "     </table>";
  str += "   </div>";
  str += "   <div id='Link1' class='LINKSOFF' style='position:absolute;z-index:1;left:920px;top:16px'>";
  str += "    <table cellspacing='0' cellpadding='2' class='menuTable' >";
  str += "      <tbody>";
  str += "        <tr class = 'itemOut'>";
  str += "          <td class='menuTd' colspan='2' nowrap onclick='showHide(1)'>";
  str += "            <a class='menuTxt' href='javascript:showDetails(\"MNT0960S\",\"MNT0960S\",475,200,500,200,\"MNT0960S\",\"MNT0112F\");'>";
  str += "              Switch Port";
  str += "            </a>";
  str += "            <br/>";
  str += "          </td>";
  str += "        </tr>";
  str += "        <tr class = 'itemOut'>";
  str += "          <td class='menuTd' colspan='2' nowrap onclick='showHide(1)'>";
  str += "            <a class='menuTxt' href='javascript:showDetails(\"MNT0950S\",\"MNT0950S\",475,200,500,200,\"MNT0950S\",\"switchRole\");'>";
  str += "              Switch Role";
  str += "            </a>";
  str += "            <br/>";
  str += "          </td>";
  str += "        </tr>";
  str += "      </tbody>";
  str += "    </table>";
  str += "  </div>";
  document.write(str);
}

//JOADOC Function Name    : createLovGlobalLinks()
//JOADOC Description      : This function creates Global Links for the menu.
function createLovGlobalLinks()
{
  LovGlobalTabString=  " <table class='LovContainerTable' border=0 cellPadding=0 cellSpacing=0 style='background-repeat:repeat-y'>";
  LovGlobalTabString+= " <tr align='right'> ";
  LovGlobalTabString+= " <table cellpadding='2' cellspacing='0' border='0'> ";
  LovGlobalTabString+= " <tr align='right'> ";
  LovGlobalTabString+= " <td><img border='0' src='"+webPath+"images/icon_mini_help.gif' ></td> ";
  LovGlobalTabString+= " <td><A href='#' class='globallinks'>Help</A></td> ";
  LovGlobalTabString+= " </tr> ";
  LovGlobalTabString+= " </tr> ";
  LovGlobalTabString+= " </table> ";
  document.write(LovGlobalTabString);
}

/* Function for creating Global Links End here */

//JOADOC   Function Name:  findQuery()
//JOADOC   Description  :  This function store the query criteria in string
//                        :  separated by delimiter  "~"
//JOADOC   I/p Parameter:  It takes parameter,formObject.
//JOADOC   return       :  the function returns query String

function findQuery(formObj)
{
  var noOfEle = formObj.elements; // number of elements in a form.
  var htmlObj;
  var queryStr ="";

  for(var i=0;i<noOfEle.length;i++)
  {
    htmlObj = formObj.elements[i]; // get the current object element.
    if(htmlObj.getAttribute("type")!='hidden')
    {
      if(queryStr=="")
      {
       queryStr = getLabelValuePair(htmlObj); // get name value pair in a string
      }
      else
      {
			if (getLabelValuePair(htmlObj) != undefined) //This is to eliminate the radio buttons whose value is undefined
			{
               queryStr += "~" +getLabelValuePair(htmlObj);
			}
      }
    }
  }
  // create a dynamic input element for populating the query criteria
  var inputElement = document.createElement("INPUT");
  inputElement.setAttribute("type" , "hidden");
  inputElement.setAttribute("name" , "queryValues");
  inputElement.setAttribute("value" , queryStr);
  formObj.appendChild(inputElement);
  if(formObj.elements["queryValues"])
  formObj.elements["queryValues"].value = queryStr;


}



//JOADOC   Function Name:  getLabelValuePair()
//JOADOC   Description  :  This function stores the label and value
//                           of the query criteria in a string, separated
//                           by a ":"
//JOADOC   Parameter    :  It takes htmlObject.
//JOADOC   return       :  the function returns string of name and value pairs

 function getLabelValuePair(srcObj)
{
  var nameLabelstr;
  switch(srcObj.nodeName)
  {
    case 'INPUT'  :
      if(srcObj.getAttribute("type") == 'text')
      {
		var objId = srcObj.id;
		var len =  objId.length;
        var lastChar = objId.charAt(len-1); // check if the object is of list type if last character is a number
		var rowNum="";
		if(checkDataType(lastChar,"N"))
        {
          rowNum = objId.substring(len-1);
		  if(srcObj.value == "")
          {
			  break;
          }
		  nameLabelstr = getObjName(srcObj.id) ; // get label string
          rowNum++;
		  nameLabelstr += "   [" + rowNum + "]|"; // apend row number
        }
		else
		{
          nameLabelstr = getObjName(srcObj.id) ; // get label and separate by "|"
          nameLabelstr +=  "|";
		}

       /* nameLabelstr  = getObjName(srcObj.id)+"|"; // get label of object*/
        nameLabelstr += srcObj.value;// get value of object
      }
      else if(srcObj.getAttribute("type")=='checkbox') // get labe and value for checkbox. If checked the value is "Y" else "N"
      {
        if(srcObj.checked)
        {
          if(srcObj.nextSibling.nodeName == '#text' && srcObj.nextSibling.data !=" ")
          {
              nameLabelstr  = getObjName(srcObj.id)+"-"+srcObj.nextSibling.data+"|";
              nameLabelstr+="Y";
          }
         else
          {
            nameLabelstr  = getObjName(srcObj.id)+"|";
            nameLabelstr+="Y";
          }
        }
        else
        {
          if(srcObj.nextSibling.nodeName== '#text' && srcObj.nextSibling.data !=" ")
          {
            nameLabelstr  = getObjName(srcObj.id)+"-"+srcObj.nextSibling.data+"|";
            nameLabelstr+="";
          }
         else
          {
            nameLabelstr  = getObjName(srcObj.id)+"|";
            nameLabelstr+="";
          }
        }
      }
      break;
    case 'SELECT' :
      selectobj = srcObj;
      if(srcObj.name=='sortBy') // if sorby field is present then get the label
      {
        nameLabelstr = "Sort Criteria|";
      }
      else
      {
		var objId = srcObj.id;
		var len =  objId.length;
        var lastChar = objId.charAt(len-1);
		var rowNum="";
		if(checkDataType(lastChar,"N"))
        {
          rowNum = objId.substring(len-1);
		  if(selectobj.selectedIndex!=-1)
          {
		    var temp = selectobj[selectobj.selectedIndex].text;
		    if(temp == "")
		    {
			  break;
		    }
          }
		  nameLabelstr = getObjName(srcObj.id) ;
          rowNum++;
		  nameLabelstr += "   [" + rowNum + "]|";
        }
		else
		{
          nameLabelstr = getObjName(srcObj.id) ;
          nameLabelstr +=  "|";
		}
	  }
      if(selectobj.selectedIndex!=-1)
      {
         nameLabelstr += selectobj[selectobj.selectedIndex].text;
      }
      break;
    default       :  break;
  }
  return nameLabelstr;
}


//JOADOC   Function Name:  showQueryCriteria()
//JOADOC   Description  :  This function is used to show the query criteria in
//                           pop-up window.

function showQueryCriteria(blockId)
{
  theForm = document.forms[0];
  var objSaveMode = eval("theForm.hidSaveMode_"+blockId);
  if((eval("DataRecord_"+blockId)==0 || objSaveMode.value == 'New') )
  {

    if( !(theForm.showQueryCriteria && theForm.showQueryCriteria.value=="true"))
    {
      alert("Query Criteria is not available !");
      hideBlink();
      return;
    }
  }
  var query = theForm.queryValues.value; // get queryString from jsp
  var labelValuePairs  = query.split('~'); // split it by delimeter '~'
  var val = new Array();
  for(var i=0;i<labelValuePairs.length;i++)
  {
    val[i]=getToken(labelValuePairs[i],"|",2);
    if(val[i] == "")
    {
      val.length=0;
    }
    else
    {
      break;
    }
  }
  if(val.length == 0)
  {
    alert("No Query Criteria is available");
  }
  else
  {
    var popwin = modalWin("",400,250);
    tempHtml = "";
    tempHtml +=
    tempHtml +="<html><head>";
	tempHtml +="<META http-equiv='Content-Type' content='text/html; charset=UTF-8'>";
    tempHtml +="<link href='" + jsWebPathDetails + "css/pofstylesheet.css' type='text/css' rel='stylesheet'>";
    tempHtml +="<script language='JavaScript' src='" + jsWebPathDetails + "js/Joa.js'></script>";
    tempHtml +="<title>Query Criteria</title>";
    tempHtml +="</head>";
    tempHtml +="<body onload='focusWindow()'>";
    tempHtml +="<table cellspacing='0' cellpadding='0' border='0' class='containertable'>";
    tempHtml +="<tr><td>";
    tempHtml +="<table cellspacing=0 cellpadding=1 border=0 class='cardoutline' width='300px'>";
    tempHtml +="<tr><td><table cellspacing=0 cellpadding=0 border=0 bgcolor='#aaaaaa' width='100%'>";
    tempHtml +="<tr><td><table cellspacing=1 cellpadding=0 border=0 width='100%'>";
    tempHtml +="<tr class='RowDataHdr'><td>Field</td>";
    tempHtml +="<td>Value&nbsp;</td></tr>";


    for(var i=0;i<labelValuePairs.length;i++)
    {
      if(i%2==0)
      {
        var classVar = "RowDataAlt";
      }
      else
      {
        classVar  = "RowData";
      }
	  var labelahead="";
	  if(i !=(labelValuePairs.length-1))
	  labelahead = getToken(labelValuePairs[i+1],"|",1);
	  tempHtml +="<tr class='"+classVar+"'>";
	  tempHtml +="<td>"+getToken(labelValuePairs[i],"|",1)+"</td>";
	  tempHtml +="<td>"+getToken(labelValuePairs[i],"|",2) ;
	  if(labelahead == getToken(labelValuePairs[i],"|",1))
		{
		  tempHtml += "&nbsp;&nbsp;"+getToken(labelValuePairs[i],"|",2);
		}
	  tempHtml +="</td></tr>";

	  } // end of for loop


    tempHtml +="</table></td></tr></table></td></tr><tr>";
    tempHtml +="<td align='right' bgcolor='#ffffff'>";
    tempHtml +="<table cellpadding='0' cellspacing='0' border='0' align='right'>";
    tempHtml +="<tr>";
    tempHtml +="<td align='right' bgcolor='#ffffff'>";
    tempHtml +="<table cellpadding='0' cellspacing='0' border='0'>";
    tempHtml +="<tr>";
    tempHtml +="<td><img alt='' src='"+ jsWebPathDetails +"images/bigbtn_left.gif'border='0'></td>";
    tempHtml +="<td nowrap='nowrap' background='"+ jsWebPathDetails +"images/bigbtn_body.gif' class='LargeBtnText'><a class='LargeBtnText' href='javascript:window.close();'>Close</a></td>";
    tempHtml +="<td><img alt='' src='"+ jsWebPathDetails +"images/bigbtn_right.gif'border='0'></td>";
    tempHtml +="</tr>";
    tempHtml +="</table>";
    tempHtml +="</td>";
    tempHtml +="</tr>";
    tempHtml +="</table>";
    tempHtml +="</td>";
    tempHtml +="</tr>";
    tempHtml +="</table>";
    tempHtml +="</td>";
    tempHtml +="</tr>";
    tempHtml +="</table>";
    tempHtml +="</body>";
    tempHtml +="</html>";
    popwin.document.close();
    popwin.document.open();
    popwin.document.writeln(tempHtml);
    popwin.focus();
    var bodyObj = popwin.document.getElementsByTagName('BODY');
    popwin.eval(bodyObj[0].getAttribute('onload')+";"); //Changed by MCACross
  }
  hideBlink();
}

// start added by preeti 
// For calling Page level help
function showBOHelp(helpDynPath)
{
	if(helpDynPath == undefined || helpDynPath == null || helpDynPath == "")
		helpDynPath="#About_MCA/About_MCA.htm";
	var helpUrl = "/"+contextRoot+"/help/MCA_Help.htm"+helpDynPath;
	window.open(helpUrl,"_blank","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes");
}
// end added by Preeti


//JOADOC   Function Name:  showHelp()
//JOADOC   Description  :  This function is used to show help window to the user
//                           For the particular screen.
//JOADOC   logic        :  The action name that we get is in form /Joa/action.do
//                           therefore to get only the action name I have separated it
//                           using lastIndexOf "/" and "." and then taking the
//                           substing in between.
//                           The first thre characters of the action give module
//                           name and the full name of the action gives the html
//                           name that will be invoked as help file.

function showHelp()
{
  var screenName  = document.title; // screen name
  var index       = screenName.indexOf(":",0);
  var screenId    = screenName.substring(0,index);
  var screenTitle = screenName.substring(index+1);
  str ="<html>";
  str+="  <head>";
  str+="  <META http-equiv='Content-Type' content='text/html; charset=UTF-8'>";
  str+="    <title>Help Screen</title>";
  str+="  </head>";
  str+="  <body bgcolor='rgb(206,231,255)'>";
  str+="    <table align='center'>";
  str+="      <tr width='100%'>";
  str+="        <table  width='100%'>";
  str+="         <tr>";
  str+="           <td valign='top'><img src='"+jsWebPath+"images/logo2.jpg' border='0'></td>";
  str+="         </tr>";
  str+="        </table>";
  str+="      </tr>";
  str+="      <tr>";
  str+="        <td>";
  str+="          <h3 align='center'> Help is not available for \""+screenTitle+"\" screen !</h3> ";
  str+="        </td>";
  str+="      </tr>";
  str+="      <tr>";
  str+="       <td colspan='2'>";
  str+="         <img src='"+jsWebPath+"images/topcat.gif'>";
  str+="       <td>";
  str+="      </tr>";
  str+="      <tr>";
  str+="        <td> ";
  str+="        </td>";
  str+="      </tr>";
  str+="    </table>";
  str+="  </body>";
  str+="</html>";
  showModalWin("",600,200,"no","no","no",str);
  hideBlink();
}
//JOADOC   Function Name:  detectKeyup()
//JOADOC   Description  :  This function is used to trap key pressed for
//                           following events - "close", "save", "cancel","prev",
//                           "next" and then call the respective event handler.
function detectKeyup(event)
{
	
	if(window.event)
	{
		event=window.event;
	}
  var code = event.keyCode;
  if (event.altKey && code == 80 ) //ALT+P Previous
  {
     pageLevelSubmit(this, "pagePrevious","false");
     return;
  }
  else if(!event.ctrlKey && event.altKey && code == 34)
  {
     callJoaMethod("Next","next","list1");
     return;
  }
  else if(!event.ctrlKey && event.altKey && code == 33)
  {
     callJoaMethod("Previous","previous","list1");
     return;
  }
  else if(event.ctrlKey && event.altKey && code == 34)
  {
     callJoaMethod("NextAll","nextAll","list1");
     return;
  }
  else if(event.ctrlKey && event.altKey && code == 33)
  {
     callJoaMethod("PreviousAll","previousAll","list1");
     return;
  }
  else if (event.altKey && code == 78 )  //ALT+N - Next
  {
    pageLevelSubmit(this, "pageNext","false");
    return;
  }

  switch(code)
  {
    case 13  : // Enter
      var sourceElement =window.event.srcElement;
	  //added by MCACross
	  if(event.originalTarget)
	  {
			 sourceElement =event.originalTarget;
	  }
      if(sourceElement.nodeName=='A' || sourceElement.nodeName=='IMG' ||
         sourceElement.nodeName=='TEXTAREA'|| sourceElement.nodeName=='SELECT')
      {
        hideBlink();
        return;
      }
      var aObj =  document.getElementById("Default");
      if(aObj!=null)
      {
        aObj.click();
        break;
      }
      var attribDefault ='false';
      var aObj =  document.getElementById("ancSave");
      if(aObj!=null)
      {
        attribDefault =  aObj.getAttribute("default");
        if(attribDefault=='true')
        {
          aObj.click();
          break;
        }
      }
      var aObj =  document.getElementById("cancel");
      if(aObj!=null)
      {
        attribDefault =  aObj.getAttribute("default");
        if(attribDefault=='true')
        {
          aObj.click();
          break;
        }
      }
      alert("No default button defined for screen");
      break;
   case 120  : // F6
      var aObj =  document.getElementById("Default");
      if(aObj!=null)
      {
        aObj.click();
      }
      break;

   case 27  : // ESC
      var screenId = document.title;
      var index = screenId.lastIndexOf(":");
      var screenTitle = screenId.substring(index+1);
      if(screenTitle == 'Switch Port' || screenTitle =='Switch Role')
      {
        pageLevelSubmit(this,'MNT9999S','true');
      }
      else if(screenTitle =='Information/Errors/Warning window')
      {
        break;
      }
      else
      {
        pageLevelSubmit(this,'cancel','false');
      }
      break;
    case 123 : //123 is the ascii code for F12
      sourceElement = window.event.srcElement;
      if(sourceElement.nodeName!='INPUT' || sourceElement.type =='checkbox'
          || sourceElement.type =='radio')
      {
        return;
      }
      remSrcElement = sourceElement;
      var nxtSibling = sourceElement.nextSibling;
      while(nxtSibling)
      {
        if(nxtSibling.nodeName=='A')
        {
          nxtSibling.click();
          return;
        }
        nxtSibling = nxtSibling.nextSibling;
      }
      break
    case 113 : // F2 - save
      var aObj =  document.getElementById("ancSave");
      if(aObj!=null)
      {
        aObj.click();
      }
      else
      {
        alert(COM00111);
      }
      break;
    case 118 :	// F7 - close
      window.close();
      break;
    case 119 :	// F8 - Details Window
      showDetailsWindow();
      break;
  }
}


//JOADOC   Function Name:  checkLogout()
//JOADOC   Description  :  This function promts the user for confirmation before
//                           logout. If user clicks ok then it allows logout else
//                           it does nothing.

function checkLogout()
{
  var message = "Are you sure you want to logout ?";
  var response = confirm(message);
  if(response)
  {
    logoutCall="Y";
    document.writeln("<HTML>");
    document.writeln("  <form action='/"+contextRoot+"/Login.do?method=logout' method='post'>");
    document.writeln("  <script>");
    document.writeln("    document.forms[0].submit();");
    document.writeln("  </script>");
    document.writeln("  </form>");
    document.writeln("</HTML>");
  }
  else
  {
    return;
  }
}
function sessionLogout()
{
document.forms[0].target = '_top';
document.forms[0].action = '/'+contextRoot+'/Login.do?method=sessionLogout';
document.forms[0].submit();
}
function addTaskId(taskID)
{
document.forms[0].taskID.value = taskID;
}

function processTableLink(method,taskID,row)
{
addTaskId(taskID);
method(row);
}

function checkSession()
{
checkForceLogout();
document.forms[0].action = '/'+contextRoot+'/Login.do?method=invalidateSession';
document.forms[0].submit();
}

//JOADOC   Function Name:  checkForceLogout()
//JOADOC   Description  :  This function logout the user from the application forcefully

function checkForceLogout()
{
var win = parent.window;
var w ;
var count=0;
if(win.opener)
{
do
  {
  if ((!win.opener) || win.name=="top")
  {
  count = count+1;
  }
  w = win.opener;
  win.close();  
  win = w ;
  }while(count < 1)
  document.forms[0].target = 'top';
 } 
else
 { 
 document.forms[0].target = '_top';
 }
 
}

//JOADOC   Function Name:  launchAppl()
//JOADOC   Description  :  This function launches the Joa Application without
//                           browser toolbar.
function launchAppl(browserType)
{
  // get user specified parameters
  var password  = document.forms[0].stPassword.value;
  var userid    = document.forms[0].stUserId.value;
  var macaddr   = document.forms[0].stMacAddress.value;
  var ipAddress = document.forms[0].ipAddress.value;
  // open pop-up
  windowObject.win = window.open("","JoaApp","top=0,left=0,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=1,Width="+screen.width+",Height="+screen.height*0.90);
  windowObject.win.focus();
  //build dynamic html
  windowObject.win.document.writeln("<HTML>");
  windowObject.win.document.writeln("  <form action='/"+contextRoot+"/mnt/Login.do?method=login' method='post'>");
  windowObject.win.document.writeln("  <input type='hidden' name='stPassword' value='"+password+"' />");
  windowObject.win.document.writeln("  <input type='hidden' name='stUserId' value='"+userid+"' />");
  windowObject.win.document.writeln("  <input type='hidden' name='stMacAddress' value='"+macaddr+"' />");
  windowObject.win.document.writeln("  <input type='hidden' name='ipAddress' value='"+ipAddress+"' />");
  windowObject.win.document.writeln("  <input type='hidden' name='browserType' value='"+browserType+"' />");
  if(browserType=='handheld')
  {
    windowObject.win.document.writeln("  <input type='hidden' name='menuform' value='true' />");
  }
  windowObject.win.document.writeln("   Loading Please Wait...");
  windowObject.win.document.writeln("  <script>");
  windowObject.win.document.writeln("    document.forms[0].submit();");
  windowObject.win.document.writeln("  </script>");
  windowObject.win.document.writeln("  </form>");
  windowObject.win.document.writeln("</HTML>");
}

//JOADOC   Function Name:  isDirty()
//JOADOC   Description  :  This function will mark a scalar block as Dirty
//JOADOC                   if there is change in any element of the Form
//JOADOC                   It takes on parameter, tableObj
//JOADOC                   tableObj: table containing DataBlock
//JOADOC   This function returns true if block is dirty else it returns false.

function isDirty(tableObj)
{
  var htmlObj, opt, hasDefault, i = 0, j;
  var inputElements  = tableObj.getElementsByTagName("INPUT");
  for(counterInput = 0; counterInput < inputElements.length; counterInput++)
  {
    htmlObj = inputElements[counterInput];
    switch (htmlObj.type)
    {
      case 'text' :
      case 'password' :
      case 'hidden' :
        if ( htmlObj.value != htmlObj.defaultValue)
        {
          return true;
        }
        break;
      case 'checkbox' :
      case 'radio' :
        if (htmlObj.checked != htmlObj.defaultChecked)
        {
          return true;
        }
        break;
    }
  }
  var selectElements = tableObj.getElementsByTagName("SELECT");
  for(counterSelect = 0; counterSelect < selectElements.length; counterSelect++)
  {
    htmlObj = selectElements[counterSelect];
    switch (htmlObj.type)
    {
      case 'select-one' :
      case 'select-multiple' :
      j = 0,
      hasDefault = false;
      while (opt = htmlObj.options[j++])
      {
        if (opt.defaultSelected)
        {
          hasDefault = true;
        }
      }
      j = hasDefault ? 0 : 1;
      while (opt = htmlObj.options[j++])
      {
         if (opt.selected != opt.defaultSelected)
         {
           return true;
         }
      }
      break;
    }
  }
  var arTextArea = tableObj.getElementsByTagName('TextArea');
  for(i = 0 ; i < arTextArea.length ; i++)
  {
    var htmlObj = arTextArea[i];
    if ( htmlObj.value != htmlObj.defaultValue)
    {
      return true;
    }
  }
  if ( inputElements.length == 0 && selectElements.length == 0 && arTextArea.length == 0 )
  {
    return true;
  }
  return false;
}

//JOADOC   Function Name:  showHotKeys()
//JOADOC   Description  :  This function will show the hotKeys used in the application
//JOADOC                   It takes on parameter,url with height ot show the screen in a
//JOADOC                :  pop-up.

function showHotKeys(url,width,height)
{
  if (!windowObject.win || (windowObject.win && windowObject.win.closed))
  {
    windowObject.width = width;
    windowObject.height = height;
    windowObject.name = (new Date()).getSeconds().toString();
    windowObject.left = (screen.width - windowObject.width) / 2;
    windowObject.top = (screen.height - windowObject.height) / 2;
    var windowAttributes = 'left=' + windowObject.left + ',top=' + windowObject.top + ',resizable=no,width='+
                            windowObject.width +  ',height=' + windowObject.height;
    windowObject.url = url;
    windowObject.win=window.open(windowObject.url, windowObject.name, windowAttributes);
  }
}

//JOADOC function name     : getListDesc()
//JOADOC Input parameters  : 1.function name depending upont the LOV type
//JOADOC Input parameters  : 2.Lov field object
//JOADOC Input parameters  : 3.description field object list
//JOADOC function usage    : this function is used to get the description of the LOV field
//JOADOC                   : From the database.
//JOADOC return type       : none
function getListDesc()
{
  if(flagVar=='false')
  {
    disableWindow();
    var argList   = getListDesc.arguments; // number of arguments specified
    var totalArgs = argList.length;
    var stRowIndex= argList[0];
    thisForm = document.forms[0];
    var val       = trim(eval("thisForm."+argList[2]+"["+stRowIndex+"]").value);
    var stLovObjName = eval("thisForm."+argList[2]+"["+stRowIndex+"]").id;
    if(val == undefined)
    {
      eval("thisForm."+argList[2]+"["+stRowIndex+"]").value = "";
    }
    else
    {
      eval("thisForm."+argList[2]+"["+stRowIndex+"]").value = val;
    }
    //if value is % or not specified then return and blank description fields
    var index = argList[3].indexOf("_hid");
    if(val == undefined || val=='%' || val == '')
    {
      var count  = (totalArgs-3);
      for(var i=0;i<count;i++)
      {
      	//EMPTY value specifies that user is trying to skip one column of LOV to populate the value
        if ( argList[i+3] != "EMPTY")
        {
          if(index!=-1 && i+3==3)
          {
            eval("thisForm."+argList[i+3]).value = "";
          }
          else
          {
            eval("thisForm."+argList[i+3]+"["+stRowIndex+"]").value = "";
          }
        }
      }
      enableWindow();
      return ;
    }
    theForm   = window.frames[0];

    //  Name of the first description field to be populated is sent
    //  in the hidden form field stFieldName1 to FetchLovDesc jsp
    //  If in description field EMPTY is specified then that column value of the lov
    //  corresponding to that position will be skipped.
    var tempHtml = "";
    tempHtml += "<html>";
    tempHtml += "<body>";
    tempHtml += "<form name='FetchLovDescForm' method='post' action='/"+contextRoot+"/LovDesc.do?method=getLovDesc'>";
    tempHtml += "<input type=hidden name='stLovName'    value='" + argList[1] + "' >";
    tempHtml += "<input type=hidden name='stLovObjName' value='" + stLovObjName + "' >";
    tempHtml += "<input type=hidden name='stFieldVal'   value='" + val + "' >";
    if(index!=-1)
    {
      tempHtml += "<input type=hidden name='stFieldName1' value='" + eval("thisForm."+argList[3]).name + "' >";
      tempHtml += "<input type=hidden name='stRowIndex' value='' >";
    }
    else
    {
      if (argList[3] == "EMPTY" )
      {
        tempHtml += "<input type=hidden name='stFieldName1' value='EMPTY' >";
      }
      else
      {
        tempHtml += "<input type=hidden name='stFieldName1' value='" + eval("thisForm."+argList[3]+"["+stRowIndex+"]").name + "' >";
      }
      tempHtml += "<input type=hidden name='stRowIndex' value='" + stRowIndex + "' >";
    }

    //  Names of the susequent description fields to be populated are sent
    // in the hidden form field stFieldName[index] to FetchLovDesc jsp
    for(index = 4;index<totalArgs;index++)
    {
      if ( argList[index] == "EMPTY" )
      {
        tempHtml += "<input type=hidden name='stFieldName"+ (index-2) + "' value='EMPTY' >";
      }
      else
      {
        tempHtml += "<input type=hidden name='stFieldName"+ (index-2) + "' value='" + eval("thisForm."+argList[index]+"["+stRowIndex+"]").name + "' >";
      }
    }
    tempHtml += "</form>";
    tempHtml +="</body>";
    tempHtml +="</html>";
    theForm.document.writeln(tempHtml);
    theForm.document.forms[0].submit();
  }
}


//JOADOC   Function Name:  auditInfo()
//JOADOC   Description  :  This function display the audit fields description
function auditInfo(button, value, blockid, functionid)
{
  stripMethod();
  if(blockid.indexOf("list")!= -1)
  {
    theForm = document.forms[0];
    var objSaveMode = eval("theForm.hidSaveMode_"+blockid);
    if(eval("DataRecord_"+blockid)==0 ||  objSaveMode.value=='New')
    {
      alert("Audit information  is not available !");
      hideBlink();
      return;
    }
    var value=new Array();
    value = isRowSelected(blockid);
    len = value.length;
    if (value.length <= 0 )
    {
      alert(COM00112);
      hideBlink();
      return;
    }
    if(value.length>1)
    {
      alert("Select only one record.");
      hideBlink();
      return;
    }
    selectedIndex = value[0];
  }
  else
  {
    selectedIndex = -1;
  }
  var formObj = document.getElementsByTagName("FORM");
  formName    = formObj[0].name;
  var windowObject   = new Object();
  windowObject.width = 300;
  windowObject.height = 200;
  windowObject.name = (new Date()).getSeconds().toString();
  windowObject.left = (screen.width - windowObject.width) / 2;
  windowObject.top = (screen.height - windowObject.height) / 2;
  var windowAttributes = 'left=' + windowObject.left + ',top=' + windowObject.top + ',resizable=no,width='+
                            windowObject.width +  ',height=' + windowObject.height;

  windowObject.url = '';
  windowObject.win=window.open(windowObject.url, windowObject.name, windowAttributes);
  windowObject.win.focus();

  var tempHtml = "";
  tempHtml += "<html>";
  tempHtml += "<body>";
  tempHtml += "<form method=post action='/"+contextRoot+"/AuditAction.do?method=auditInfo'>";
  tempHtml += "<input type=hidden name='blockId' value='" + blockid + "' >";
  tempHtml += "<input type=hidden name='formName' value='" + formName + "' >";
  tempHtml += "<input type=hidden name='selectedIndex' value='" + selectedIndex + "' >";
  tempHtml +="Please Wait, While application is getting the desired values...";
  tempHtml += "</form>";
  tempHtml +="</body>";
  tempHtml +="</html>";
  windowObject.win.document.write(tempHtml);
  windowObject.win.document.forms[0].submit();
  windowObject.win.focus();
  hideBlink();
}

//JOADOC   Function Name:changePassword()
//JOADOC   Description  :This function is used to launch the
//JOADOC                :change password screen.

function changePassword()
{
  var childWindow = parent.frames["left"];
  var stUser      = parent.frames["right"].document.forms[0].stUserId.value;
  var oldPassd    = parent.frames["right"].document.forms[0].stPassword.value;
  childWindow.document.writeln("<html>");
  childWindow.document.writeln("  <head>");
  childWindow.document.writeln("  <META http-equiv='Content-Type' content='text/html; charset=UTF-8'>");
  childWindow.document.writeln("    <title></title>");
  childWindow.document.writeln("  </head>");
  childWindow.document.writeln("  <body>");
  childWindow.document.writeln("    <form action='/"+contextRoot+"/mnt/MNT0490S.do?method=getScreen' method='post'>");
  childWindow.document.writeln("   Loading Please Wait...");
  childWindow.document.writeln("  <input type='hidden' name='stUserId' value='"+stUser+"' />");
  childWindow.document.writeln("  <input type='hidden' name='oldPassword' value='"+oldPassd+"' />");
  childWindow.document.writeln("    </form>");
  childWindow.document.writeln("  <script>");
  childWindow.document.writeln("    document.forms[0].submit(); ");
  childWindow.document.writeln("  </script>");
  childWindow.document.writeln("  </body>");
  childWindow.document.writeln("</html>");

}

//JOADOC   Function Name:ok()
//JOADOC   Description  :This function will be called on click of Ok button
//JOADOC                :on Remarks/Details popup window

function ok()
{
  var srcElement = window.opener.document.getElementById(document.forms[0].hidSrcId.value)
  var theForm      = document.forms[0];
  var objMaxLength = theForm.hidMaxLen.value;
  var objValue     = theForm.remTxtArea.value;
  if(objValue.length > objMaxLength)
  {
    alert("The entered data is larger than the allowable limit. It is being truncated");
    srcElement.value = objValue.substring(0, convertStringToNumber(objMaxLength));
  }
  else
  {
    srcElement.value = document.forms[0].remTxtArea.value;
  }
  window.close();
}

//JOADOC   Function Name:showDetailsWindow()
//JOADOC   Description  :This function will be called on double click on any input
//JOADOC                :element. It will either open remarks window or will inoke LOV,
//JOADOC                : calendar depending upon the type of input type.
function showDetailsWindow()
{
  if(windowObject.win && !windowObject.win.closed)
  {
    windowObject.win.close();
  }

  sourceElement = window.event.srcElement;
  var sourceElementId = sourceElement.id;
  var labelDesc = getObjName(sourceElementId);

  if(sourceElement.nodeName!='INPUT' || sourceElement.type =='checkbox'
          || sourceElement.type =='radio')
  {
    return;
  }
  remSrcElement = sourceElement;
//  var nxtSibling = sourceElement.nextSibling;
//  while(nxtSibling)
//  {
//    if(nxtSibling.nodeName=='A')
//    {
//      nxtSibling.click();
//      return;
//    }
//    nxtSibling = nxtSibling.nextSibling;
//  }
  var stReadOnly="";
  if(sourceElement.getAttribute('readOnly') || sourceElement.getAttribute('disabled'))
  {
    stReadOnly="readOnly";
  }

  win = modalWin("",400,200);
  var tempHtml = "";
  tempHtml += "<html>";
  tempHtml += "<head>";
  tempHtml += "<META http-equiv='Content-Type' content='text/html; charset=UTF-8'>";
  tempHtml += "<title>"+labelDesc+"</title>";
  tempHtml += "<link href='"+jsWebPathDetails+"css/pofstylesheet.css' type='text/css' rel='stylesheet'>";
  tempHtml += "<script  language='Javascript' src='"+jsWebPathDetails+"js/Joa.js'><\/script>";
  tempHtml += "<script language='JavaScript1.2' src='"+jsWebPathDetails+"js/validate.js'></script>";
  tempHtml += "<script language='JavaScript1.2' src='"+jsWebPathDetails+"js/ErrorMsgs.js'></script>";
  tempHtml += "</head>";
  tempHtml += "<body class='BodyClass' onload='focusWindow();'><br>";
  tempHtml += "<div class='scrContainer'>";
  tempHtml += "<form name='DetailsForm'>";
  tempHtml += "<input type='hidden' name='hidSrcName' value='"+sourceElement.name+"'>";
  tempHtml += "<input type='hidden' name='hidSrcId' value='"+sourceElement.id+"'>";
  tempHtml += "<input type='hidden' name='hidMaxLen' value='"+sourceElement.getAttribute("maxlength")+"'>";
  tempHtml += "<font face=arial size=2><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+labelDesc+"</b></font>";
  tempHtml += "<table cellspacing=1 cellpadding=0 border=0 width='100%'>";
  tempHtml += "<tr height='10'> </tr><tr><td width=30>&nbsp;</td><td>";
  tempHtml += "<textarea name='remTxtArea'rows='5' cols='40' "+stReadOnly+" >"+sourceElement.value+"</textarea>";
  tempHtml += "</td></tr></table>";
  tempHtml += "<table cellpadding='0' cellspacing='0' border='0' align='right'>";
  tempHtml += "<tr>";
  if(stReadOnly=="readOnly")
  {
    tempHtml += "<td><img alt='' src='"+jsWebPathDetails+"images/bigbtn_left.gif' border='0'></td>";
    tempHtml += "<td nowrap='nowrap' background='"+jsWebPathDetails+"images/bigbtn_body.gif' class='LargeBtnTextActive'><a class='LargeBtnTextActive' href='javascript:window.close();'>Close</a></td>";
    tempHtml += "<td><img alt='' src='"+jsWebPathDetails+"images/bigbtn_right.gif' border='0'></td>";
  }
  else
  {
    tempHtml += "<td><img alt='' src='"+jsWebPathDetails+"images/bigbtn_left.gif' border='0'></td>";
    tempHtml += "<td nowrap='nowrap' background='"+jsWebPathDetails+"images/bigbtn_body.gif' class='LargeBtnTextActive'><a class='LargeBtnTextActive' href='javascript:window.close();'>Cancel</a></td>";
    tempHtml += "<td><img alt='' src='"+jsWebPathDetails+"images/bigbtn_right.gif' border='0'></td>";
    tempHtml += "<td class='PageBtnSpacing'></td>";
    tempHtml += "<td><img alt='' src='"+jsWebPathDetails+"images/bigbtn_left.gif' border='0'></td>";
    tempHtml += "<td nowrap='nowrap' background='"+jsWebPathDetails+"images/bigbtn_body.gif' class='LargeBtnText'><a class='LargeBtnText' href='javascript:ok()'>OK</a></td>";
    tempHtml += "<td><img alt='' src='"+jsWebPathDetails+"images/bigbtn_right.gif' border='0'></td>";
  }
  tempHtml +="</tr></table></td></tr></table></td></tr></table></form>";
  tempHtml +="</div></body><blink class='processing'></blink></html>";
  win.document.write(tempHtml);
  var bodyObj = win.document.getElementsByTagName('BODY');
  //Changed by MCACross
	if(navigator.appName!="Microsoft Internet Explorer")
	{
	win.eval(bodyObj[0].getAttribute('onload')+";");
	}
	else
	{
	win.eval(bodyObj[0].getAttribute('onload')+";"+"anonymous();");
	}
}

//JOADOC   Function Name:isTableDirty()
//JOADOC   Description  :This will tell whether the Updateable list is dirty or not.
//JOADOC                :This function returns true if table is dirty(i.e some changes has been made)
//JOADOC                : else false.
function isTableDirty(tableObj, tableId)
{
  var retValue = false;
  rows = tableObj.getElementsByTagName('tr');
  var i=0;
  var rowModified = eval("document.forms[0].rowModified_"+tableId)
  if(!rowModified)
  {
    return retValue;
  }
  for(i = 1; i < rows.length ; i++ )
  {
    rowModifiedObj = rowModified[i-1];
    if(rowModifiedObj)
  	{
	    if(rowModifiedObj.value!='')
	    {
	            retValue = true;
	    }
  	}
  }
  return retValue;
}

//JOADOC   Function Name:setRowStatus
//JOADOC   Description  :This function will set rowModified Field of each row
//JOADOC                :as 'New', 'Updated' or 'Deleted'
//JOADOC                : else false.
function setRowStatus(tableObj, tableId)
{


  var objSaveMode = eval("document.forms[0].hidSaveMode_"+tableId);
   var objtemp="document.forms[0].hidSaveMode_"+tableId;
   
    if(eval(objtemp).value!=null)
	{
	eval(objtemp).value='';
	}
  if(objSaveMode.value == '' || objSaveMode.value == 'Delete')
  {
    compareValue(tableObj,tableId)
  }
  else if(objSaveMode.value == 'New')
  {
    markRows(tableId);
  }
  return true;
}


//JOADOC   Function Name:showSerErrors()
//JOADOC   Description  :This function to show server side errors

function showSerErrors()
{
  var fatalLen  = fatal_arr.length;
  var errorLen  = serverErr_arr.length;
  var warnLen   = warn_arr.length;
  var infoLen   = info_arr.length;
  var count = 0;
  str = "<html>"
      + "  <head>"
	  + "  <META http-equiv='Content-Type' content='text/html; charset=UTF-8'>"
      + "    <link href='" + jsWebPathDetails + "css/pofstylesheet.css' type='text/css' rel='stylesheet'>"
      + "    <script language='JavaScript' src='" + jsWebPathDetails + "js/Joa.js'></script>"
      + "    <title>"
      + "      Information/Errors/Warning window"
      + "    </title>"
      + " </head>"
      + "<body onload='javascript:focusWindow()'>"
      + "  <form name='dummy' action='dummyAction'>"
      + "    <table class='Messages' align=center cellspacing=1 cellpadding=0 border='0'>";
      // show fatal errors
  if ( fatalLen != 0 )
  {
    var lastEle = (fatalLen);
    count       =  fatalLen + errorLen + warnLen + infoLen ;
  str += ""
	  + "  <tr  class='RowDataHdr2'>"
      + "    <td  class='RowDataHdr2' colspan='4'>"
      + "      <table class='RowDataHdrFatal' border='0'>"
      + "        <tr width='100%'>"
/*      + "          <td><img width='30' src='" + jsWebPathDetails + "images/erroricon_pagetitle.gif'></td>"*/
      + "          <td>Transaction Error</td>"
      + "        </tr>"
      + "      </table>"
      + "    </td>"
      + " </tr>"
      + "  <tr class='RowDataFatal'>"
      + "    <td width='80%' colspan='3'>"
      + fatal_arr[0]
      + "    </td>"
 /*     + "    <td width='20%' align='center'>"
      + "      <a href='#' onclick='javascript:showErrorDiv("+count+",\"errorRow\");'>";
      // if fatal error length is 1 then hide more button gif
    if(fatalLen == 1)
    {
      str+= "      <img style='display:none' id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0'></a>";
    }
    else
    {
      str+= "<div id='fatalMore' class='LINKSON' style='position:relative'>"
      + "  <img id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0' onclick='changeImg(\"fatalMore\",\"fatalLess\");'>"
      + "</div>"
      + "<div id='fatalLess' class='LINKSOFF' style='position:relative'>"
      + "  <img id='img' alt='' src='" + jsWebPathDetails + "images/less.gif' border='0' onclick='changeImg(\"fatalLess\",\"fatalMore\");'>"
      +    "</a>"
      + "</div>";
    }

      str+= "    </td>" */
      + "  </tr>";
    for(var i = 1; i < lastEle ; i++)
    {
      str+="  <tr class='RowData' style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width='10%' align='center'><img  width='15' src='" + jsWebPathDetails + "images/erroricon_pagetitle.gif'</td> "
      +"    <td width='80%' colspan='3'>"
      +"    <textarea rows='5' cols='68'  class='DataFont'>"
      +      fatal_arr[i]
      +"    </textarea>"
      +"    </td>"
      +"  </tr>";
    }
    for(var i = 0; i < errorLen ; i++)
    {
      str+="  <tr class='RowDataError' style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width=10% align='center' class='RowData'><img width='15' src='" + jsWebPathDetails + "images/erroricon_pagetitle.gif'</td>"
      +"    <td width='20%'>"
      //+serverErrCtx_arr[i] show context sensitive information
      +"    </td>"
      +"    <td width='70%' colspan='2' class='fieldwrap'>"
      +       serverErr_arr[i]
      +"    </td>"
      +"  </tr>";
    }
    for(var i = 0; i < warnLen ; i++)
    {
      str+=" <tr class='RowDataWar'  style='display:none' id='errorRow"+(--count)+"'>"
      +"   <td width=10% align='center' class='RowData'><img width='15' src='" + jsWebPathDetails + "images/warningicon_pagetitle.gif'</td>"
      +"   <td width='20%'>"
      //+warnCtx_arr[i]
      +"   </td>"
      +"   <td width='70%' colspan='2' class='fieldwrap'>"
      +     warn_arr[i]
      +"   </td>"
      +" </tr>";
    }
    for(var i = 0; i < infoLen ; i++)
    {
      str+="  <tr class='RowDataInfo'  style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width=10% align='center' class='RowData'><img width='15' src='" + jsWebPathDetails + "images/infoicon_pagetitle.gif'</td>"
      +"    <td width='20%' >"
      //+infoCtx_arr[i]
      +"    </td>"
      +"    <td width='70%' colspan='2' class='fieldwrap'>"
      +info_arr[i]
      +"    </td>"
      +"  </tr>";
    }
  }
  else if(errorLen != 0)
  {
    var lastEle = (errorLen);
    count       =  errorLen + warnLen + infoLen ;
    str+="  <tr  class='RowDataHdr2'>"
    +"    <td  class='RowDataHdr2' colspan='4'>"
    +"      <table class='RowDataHdr2'>"
    +"        <tr>"
    +"          <td width=10%><img width='30' src='" + jsWebPathDetails + "images/erroricon_pagetitle.gif'</td>"
    +"          <td>Errors</td>"
    +"        </tr>"
    +"      </table>"
    +"    </td>"
    +"  </tr>"
    +"  <tr class='RowDataError'>"
    +"    <td width='80%' colspan='3' class='fieldwrap'>"
    +serverErr_arr[0]
    +"    </td>"
    +"    <td width='20%' align='center'>"
    +"      <a href='#' onclick='javascript:showErrorDiv("+count+",\"errorRow\");'>";
    if(errorLen == 1)
    {
// Commented by Jatin as per the requirement of the STQC Observations that image ">>" should not be displayed when 
// there is a single error to be thrown.
		if(warnLen==0&&infoLen==0){
//      str+="      <img style='dispaly:none' id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0'></a>";
		}
		else{
			str+="      <img style='dispaly:none' id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0'></a>";
		}
// STQC Change Ends
    }
    else
    {
      str+="<div id='errorMore' class='LINKSON' style='position:relative'>"
      +" <img id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0' onclick='changeImg(\"errorMore\",\"errorLess\");'>"
      +"</div>"
      +"<div id='errorLess' class='LINKSOFF' style='position:relative'>"
      +" <img id='img' alt='' src='" + jsWebPathDetails + "images/less.gif' border='0' onclick='changeImg(\"errorLess\",\"errorMore\");'>"
      +"</a>"
      +"</div>";
    }
    str+="    </td>"
     +"  </tr>";
    for(var i = 1; i < lastEle ; i++)
    {
      str+="  <tr class='RowDataError' style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width=10% align='center' class='RowData'><img  width='15' src='" + jsWebPathDetails + "images/erroricon_pagetitle.gif'</td>"
      +"    <td width='20%'>"
      //+serverErrCtx_arr[i]
      +"    </td>"
      +"    <td width='70%' colspan='2' class='fieldwrap'>"
      +serverErr_arr[i]
      +"    </td>"
      +"  </tr>";
    }
    for(var i = 0; i < warnLen ; i++)
    {
      str+="  <tr class='RowDataWar'  style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width='10%'align='center' class='RowData'><img width='15' src='" + jsWebPathDetails + "images/warningicon_pagetitle.gif'</td>"
      +"    <td width='20%'>"
      //+warnCtx_arr[i]
      +"    </td>"
      +"    <td width='70%' colspan='2' class='fieldwrap'>"
      +warn_arr[i]
      +"    </td>"
      +"  </tr>";
    }
    for(var i = 0; i < infoLen ; i++)
    {
      str+="  <tr class='RowDataInfo'  style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width=10% align='center' class='RowData'><img width='15' src='" + jsWebPathDetails + "images/infoicon_pagetitle.gif'</td>"
      +"    <td width='20%' >"
      //+infoCtx_arr[i]
      +"    </td>"
      +"    <td width='70%' colspan='2' class='fieldwrap'>"
      +info_arr[i]
      +"    </td>"
      +"  </tr>";
    }
  }
  else if(warnLen != 0)
  {
    var lastEle = (warnLen);
    count       = warnLen + infoLen ;
    str+="  <tr class='RowDataHdr2'>"
    +"    <td class='RowDataHdr2' colspan='4'>"
    +"      <table class='RowDataHdr2'>"
    +"        <tr >"
    +"          <td width=10%><img width='30' src='" + jsWebPathDetails + "images/warningicon_pagetitle.gif'</td>"
    +"          <td >Warnings</td>"
    +"        </tr>"
    +"      </table>"
    +"    </td>"
    +"  </tr>"
    +"  <tr class='RowDataWar'>"
    +"    <td width='80%' colspan='3' class='fieldwrap'>"
    +warn_arr[0]
    +"    </td>"
    +"    <td width='20%' align='center'>"
    +"      <a href='#' onclick='javascript:showErrorDiv("+count+",\"errorRow\");'>";
    if(warnLen == 1)
    {
// Commented by Jatin as per the requirement of the STQC Observations that image ">>" should not be displayed when 
// there is a single error to be thrown.
		if(errorLen==0&&infoLen==0){
//      str+="      <img style='display:none' id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0'></a>";
		}
		else{
			str+="      <img style='display:none' id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0'></a>";
		}
// STQC Change Ends
    }
    else
    {
      str+="<div id='warnMore' class='LINKSON' style='position:relative'>"
      +"  <img id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0' onclick='changeImg(\"warnMore\",\"warnLess\");'>"
      +"</div>"
      +"<div id='warnLess' class='LINKSOFF' style='position:relative'>"
      +"  <img id='img' alt='' src='" + jsWebPathDetails + "images/less.gif' border='0' onclick='changeImg(\"warnLess\",\"warnMore\");'>"
      +"</a>"
      +"</div>";
    }
    str+="    </td>"
    +"  </tr>";
    for(var i = 1; i < lastEle ; i++)
    {
      str+="  <tr class='RowDataWar'  style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width=10% class='RowData' align='center'><img width='15' src='" + jsWebPathDetails + "images/warningicon_pagetitle.gif'</td>"
      +"    <td width='20%'>"
      //+warnCtx_arr[i]
      +"    </td>"
      +"    <td width='70%' colspan='2' class='fieldwrap'>"
      +warn_arr[i]
      +"    </td>"
      +"  </tr>";
    }
    for(var i = 0; i < infoLen ; i++)
    {
      str+="  <tr class='RowDataInfo'  style='display:none' id='errorRow"+(--count)+"'>"
      +"  <td width=10% class='RowData' align='center' ><img width='15' src='" + jsWebPathDetails + "images/infoicon_pagetitle.gif'</td>"
      +"  <td width='20%' >"
      //+infoCtx_arr[i]
      +"  </td>"
      +"  <td width='70%' colspan='2' class='fieldwrap'>"
      +info_arr[i]
      +"    </td>"
      +"  </tr>";
    }
  }
  else
  {
    var lastEle = (infoLen);
    count       = infoLen ;
    str+="  <tr class='RowDataHdr2'>"
    +"    <td class='RowDataHdr2' colspan='4'>"
    +"      <table class='RowDataHdr2' "
    +"        <tr >"
    +"          <td width=10% ><img width='30' src='" + jsWebPathDetails + "images/infoicon_pagetitle.gif'</td>"
    +"          <td>Information</td>"
    +"        </tr>"
    +"      </table>"
    +"    </td>"
    +"  </tr>"
    +"  <tr class='RowDataInfo'>"
    +"    <td width='80%' colspan='3' class='fieldwrap'>"
    +info_arr[0]
    +"    </td>"
    +"    <td width='20%' align='center'>"
    +"      <a href='#' onclick='javascript:showErrorDiv("+count+",\"errorRow\");'>";
    if(infoLen == 1)
    {
// Commented by Jatin as per the requirement of the STQC Observations that image ">>" should not be displayed when 
// there is a single error to be thrown.
    	if(errorLen==0&&warnLen==0){
//      str+="      <img style='display:none' id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0'></a>";
		}
		else{
			str+="      <img style='display:none' id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0'></a>";
		}
// STQC Change Ends
    }
    else
    {
      str+="<div id='infoMore' class='LINKSON' style='position:relative'>"
      +"      <img id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0' onclick='changeImg(\"infoMore\",\"infoLess\");'>"
      +"</div>"
      +"<div id='infoLess' class='LINKSOFF' style='position:relative'>"
      +"      <img id='img' alt='' src='" + jsWebPathDetails + "images/less.gif' border='0' onclick='changeImg(\"infoLess\",\"infoMore\");'>"
      +"</a>"
      +"</div>";
    }

    str+="    </td>"
    +"  </tr>";
    for(var i = 1; i < lastEle ; i++)
    {
      str+="  <tr class='RowDataInfo'  style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width=10% class='RowData' align='center'><img width='15' src='" + jsWebPathDetails + "images/infoicon_pagetitle.gif'</td>"
      +"    <td width='20%'>"
      //+infoCtx_arr[i]
      +"    </td>"
      +"    <td width='70%' colspan='2' class='fieldwrap'>"
      +info_arr[i]
      +"    </td>"
      +"  </tr>";
    }
  }
  str+="</table>"
  +"<table cellpadding='0' cellspacing='0' border='0' align='right'>"
  +"  <tr><td class='PageButtonsBefore'></td></tr>"
  +"  <tr> ";
  if ( fatalLen != 0 || errorLen != 0 )
  {
    str+="    <td class='PageBtnSpacing'></td>"
    +"    <td><img alt='' src='" + jsWebPathDetails + "images/bigbtn_left.gif' border='0'></td>"
    +"    <td nowrap='nowrap' background='" + jsWebPathDetails + "images/bigbtn_body.gif' class='LargeBtnText'>"
    +"      <a id='Default' class='LargeBtnText' href='#' onclick='javascript:pageLevelSubmit(this, \"cancelError\", \"false\")'>"
    +"        Close"
    +"      </a>"
    +"    </td>"
    +"    <td nowrap='nowrap'><img alt='' src='" + jsWebPathDetails + "images/bigbtn_right.gif' border='0'></td>";
  }
  else if ( warnLen != 0 )
  {
    str+="    <td class='PageBtnSpacing'></td>"
    +"    <td><img alt='' src='" + jsWebPathDetails + "images/bigbtn_left.gif' border='0'></td>"
    +"    <td nowrap='nowrap' background='" + jsWebPathDetails + "images/bigbtn_body.gif' class='LargeBtnText'>"
    +"      <a class='LargeBtnText' href='#' onclick='javascript:pageLevelSubmit(this, \"continueError\", \"false\")'>"
    +"        Continue"
    +"      </a>"
    +"    </td>"
    +"    <td nowrap='nowrap'><img alt='' src='" + jsWebPathDetails + "images/bigbtn_right.gif' border='0'></td>"
    +"    <td class='PageBtnSpacing'></td>"
    +"    <td><img alt='' src='" + jsWebPathDetails + "images/bigbtn_left.gif' border='0'></td>"
    +"    <td nowrap='nowrap' background='" + jsWebPathDetails + "images/bigbtn_body.gif' class='LargeBtnText'>"
    +"      <a id='Default' class='LargeBtnText' href='#' onclick='javascript:pageLevelSubmit(this, \"cancelError\", \"false\")'>"
    +"        Close"
    +"      </a>"
    +"    </td>"
    +"    <td nowrap='nowrap'><img alt='' src='" + jsWebPathDetails + "images/bigbtn_right.gif' border='0'></td>";
  }
  else if ( infoLen != 0 )
  {
    str+="    <td class='PageBtnSpacing'></td>"
    +"    <td><img alt='' src='" + jsWebPathDetails + "images/bigbtn_left.gif' border='0'></td>"
    +"    <td nowrap='nowrap' background='" + jsWebPathDetails + "images/bigbtn_body.gif' class='LargeBtnText'>"
    +"      <a id='Default' class='LargeBtnText' href='#' onclick='javascript:pageLevelSubmit(this, \"cancelError\", \"false\")'>"
    +"        Close"
    +"      </a>"
    +"    </td>"
    +"    <td nowrap='nowrap'><img alt='' src='" + jsWebPathDetails + "images/bigbtn_right.gif' border='0'></td>";
  }
  str+="  </tr>"
  +"</table>"
  +"</form>"
  +"</body>"
  +"</html>";
  hideBlink();
  flagVar='false';
  showModalWin("",475,200,"yes","yes","no",str); // call show modal dialog for modal window
  focusOnFirstElement(); // after closing the pop-up }
}
// function for showing and hiding error stack on click of
// more button

function showErrorDiv(count,menuID)
{
  for(var i=1; i<count;i++)
  {
    divId       = menuID+i;
    divObj      = document.getElementById(divId); // get the particular element which is selected.

     // If clause to switch on the menu
     if(divObj.style.display == "none")
  	 {
    	divObj.style.display = '';
     }
     else
     {
       divObj.style.display = 'none';
     }
  }
   //return;
}

function changeImg(divId1,divId2)
{
    var divObj1 = document.getElementById(divId1);
    var divObj2 = document.getElementById(divId2);
    divObj1.className="LINKSOFF";
    divObj2.className="LINKSON";
}

//JOADOC function name     : getDesc()
//JOADOC Input parameters  : 1.function name depending upont the LOV type
//JOADOC Input parameters  : 2.Lov field object
//JOADOC Input parameters  : 3.description field object list
//JOADOC function usage    : this function is used to get the description of the LOV
//JOADOC                   : From the database.
//JOADOC return type       : none

function getDesc(lovName,lovField,lovWhereFldsVal)
{
  if(flagVar=='false')
  {
    disableWindow();
    var argList   = getDesc.arguments;
    var totalArgs = argList.length;
    //get user defined where clause from the string provoded by the user
    if(lovWhereFldsVal != null)
    {
      var whereFldIndex   = lovWhereFldsVal.indexOf(":");
      var startIndex      = 0          ;
      var whereFld                     ;
      var whereFldValArr  = new Array();
      var fldCount        = 0          ;
      while(whereFldIndex != -1)
      {
        whereFld = lovWhereFldsVal.substring(startIndex,whereFldIndex);
        whereFldValArr[fldCount] = document.forms[0].elements[whereFld].value;
        fldCount++;
        lovWhereFldsVal = lovWhereFldsVal.substring(whereFldIndex+1);
        whereFldIndex   = lovWhereFldsVal.indexOf(":");
        whereFld        = lovWhereFldsVal.substring(startIndex,whereFldIndex);
      }
      whereFldValArr[fldCount] = document.forms[0].elements[lovWhereFldsVal].value;
    }
    var val          = trim(argList[1].value);
    if(val == undefined)//if value is not specified then return and blank the value of LOV
    {
      argList[1].value = "";
    }
    else
    {
      argList[1].value = val;
    }
    if(val == undefined || val=='%' || val=="") //if value is % or not specified then return and blank description fields
    {
      var count  = (totalArgs-3);
      for(var i=0;i<count;i++)
      {
        if ( argList[i+3] != "EMPTY" ) //EMPTY value specifies that user is trying to skip one column of LOV to populate the value
        argList[i+3].value ='';
      }
      enableWindow();
      return ;
    }
    theForm   = window.frames[0];
    /*
       make temp html to submit to FetchLovDescForm
    */
    var tempHtml = "";
    tempHtml += "<html>";
    tempHtml += "<body>";
    tempHtml += "<form name='FetchLovDescForm' method='post' action='/"+contextRoot+"/LovDesc.do?method=getLovDesc'>";
    tempHtml += "<input type=hidden name='stLovName'    value='" + argList[0] + "' >"; // LOV Name
    tempHtml += "<input type=hidden name='stLovObjName' value='" + argList[1].name + "' >"; // Lov fiels Object name
    tempHtml += "<input type=hidden name='stFieldVal'   value='" + val + "' >"; // Lov field value
    /*
      Name of the first description field to be populated is sent
      in the hidden form field stFieldName1 to FetchLovDesc jsp
    */


    /*
       if in description field EMPTY is specified then that column value of the lov
       corresponding to that position will be skipped.
    */
   if ( argList[3] == "EMPTY" )
    tempHtml += "<input type=hidden name='stFieldName1' value='EMPTY' >";
   else
    tempHtml += "<input type=hidden name='stFieldName1' value='" + argList[3].name + "' >";

    var index =0;
    /*
      Names of the susequent description fields to be populated are sent
      in the hidden form field stFieldName[index] to FetchLovDesc jsp
    */
    for(index = 4;index<totalArgs;index++)
    {
      if ( argList[3] == "EMPTY" )
      tempHtml += "<input type=hidden name='stFieldName"+(index-2) + "' value='EMPTY' >";
      else
      tempHtml += "<input type=hidden name='stFieldName"+(index-2) + "' value='" + argList[index].name + "' >";
    }
    /*
      User defined where clause is populated into a hidden field and an array of such fields is submitted.
    */
    if( lovWhereFldsVal != null)
    {
      for(j=0; j<whereFldValArr.length ; j++)
      {
        tempHtml += "<input type=hidden name='arStFieldVal' value='" + whereFldValArr[j] + "' >";
      }
    }
    tempHtml += "</form>";
    tempHtml +="</body>";
    tempHtml +="</html>";
    theForm.document.writeln(tempHtml);
    theForm.document.forms[0].submit();
  }
}

//JOADOC function name     : doBlink()
//JOADOC                   : shows a blinking message when a jsp page is loading
var intervalVar = null;
function doBlink()
{
  var blink = document.getElementsByTagName('BLINK');
  //alert(blink);
  //blink[0].style.visibility = blink[0].style.visibility == "" ? "hidden" :"";
}
function hideBlink()
{
  var blink = document.getElementsByTagName('BLINK');
  clearInterval(intervalVar);
//  blink[0].style.visibility = "hidden";
	if (blink[0]!=undefined)
  {
	  blink[0].style.visibility = "hidden";
  }
}

function startBlink()
{
   if(document.createElement)
  {
    intervalVar = setInterval("doBlink()",500)
  }
}

//JOADOC  : disableLinks()
//JOADOC  : Disables the hrefs in a page when request is  submitted

function disableLinks(theForm)
{
      var hrefObjects = theForm.getElementsByTagName('a');
      for(var hrefCount = 0 ; hrefCount< hrefObjects.length ; hrefCount++)
      {
      	
		//hrefObjects[hrefCount].disabled=true;
		hrefObjects[hrefCount].style.visibility='hidden';
      }

}

//JOADOC  : checkBrowser()
//JOADOC  : gives alert message to user if the browser is not Internet Explorer
//JOADOC  : or Netscape and the version is below 6.0
function checkBrowser()
{
  version = navigator.appVersion;
  if(navigator.appName!="Microsoft Internet Explorer")
  {
     alert("This apllication is not supported in " + navigator.appName);
  }
  else if(navigator.appVersion.indexOf("MSIE")!=-1)
  {
    temp=navigator.appVersion.split("MSIE");
    version =parseFloat(temp[1]);
    if( !(version >= 6.0))
    {
       alert("This apllication is not supported in " + navigator.appName + " "  + version);
    }
  }
  else if((navigator.appName == "Netscape"))
  {
    temp=navigator.userAgent.split("Netscape6/");
    version =parseFloat(temp[1]);
    if( !(version >= 6.0))
    {
       alert("This apllication is not supported in " + navigator.appName + " "  + version);
    }
  }
}
//JOADOC function name     : disableAllFields
//JOADOC function usage    : This function will disable all the fields of the Form
//JOADOC function usage    : if the screen is being opened in View Mode
//JOADOC return type       : none
function disableAllFields()
{
  theForm = document.forms[0];
  if(theForm.screenMode.value=='View')
  {
    elements  = theForm.elements;
    elemCount =elements.length;
    for(i=0;i<elemCount;i++)
    {
      elements[i].disabled = true;
    }
  }
}
//JOADOC function name     : disableFields
//JOADOC function usage    : This function will disable all the fields whose name
//JOADOC function usage    : are passed to it as arguments if the screen is being opened
//JOADOC function usage    : in MaintainMode Mode
//JOADOC return type       : none
function disableFields()
{
  var htmlObj;
  var argList = disableFields.arguments;
  var objSaveMode = eval("document.forms[0].hidSaveMode_"+argList[0]);
  if(objSaveMode.value =='New')
  {
    return;
  }
  for(i=1;i < argList.length;i++)
  {
    var fieldName = argList[i];
    htmlObj = document.forms[0].elements[fieldName];
    var htmlObjCount = htmlObj.length;
    for(j=0;j< htmlObjCount;j++)
    {
      htmlObj[j].disabled=true;
    }
  }
}


// JOADOC function name        : printit()
// JOADOC function description : fires browser print command

function printit()
{
  // Use Browser Print feature
  Window.print() ;
}

// JOADOC function name        : before_submit()
function before_submit()
{
}

//JOADOC function name     : isRowAvailable
//JOADOC function usage    : This function checks whether the row under processing can
//JOADOC function usage    : be clone with selected row or not
//JOADOC return type       : true - if it can be cloned, false otherwise.
function isRowAvailable(rowObj)
{
  var objInputArray = rowObj.getElementsByTagName('INPUT');
  var inputObj;
  var available = true;
  var i = 0;
  for(i = 0 ; i < objInputArray.length ; i++)
  {
    inputObj = objInputArray[i];
    objType  = inputObj.type;
    if(objType=='text' && inputObj.value!='')
    {
      available = false;
      break;
    }
    else if(objType=='checkbox' && inputObj.checked)
    {
      available = false;
      break;
    }
  }
  if(!available)
  {
    return available;
  }
  objSelectArray = rowObj.getElementsByTagName('Select');
  for(i = 0 ; i < objSelectArray.length ; i++)
  {
    if(objSelectArray[i].selectedIndex != -1 && objSelectArray[i].selectedIndex != 0 )
    {
      available = false;
      break;
    }
  }
  return available;
}

//JOADOC function name     : cloneRow
//JOADOC function usage    : This function will copy data from rowObj1 to rowObj2
//JOADOC return type       : none
function cloneRow(rowObj1, rowObj2)
{
  var objInputArray1 = rowObj1.getElementsByTagName('INPUT');
  var objInputArray2 = rowObj2.getElementsByTagName('INPUT');
  var inputObj1;
  var inputObj2;
  var i =0;
  for(i = 0 ; i < objInputArray1.length ; i++)
  {
    inputObj1 = objInputArray1[i];
    inputObj2 = objInputArray2[i];
    objType  = inputObj1.type;
    if(objType=='text')
    {
      inputObj2.value = inputObj1.value;
    }
    else if(objType=='checkbox' && inputObj1.checked)
    {
      inputObj2.checked = true;
    }
  }
  var objSelectArray1 = rowObj1.getElementsByTagName('Select');
  var objSelectArray2 = rowObj2.getElementsByTagName('Select');
  var i = 0;
  for(i = 0 ; i < objSelectArray1.length ; i++)
  {
    objSelectArray2[i].selectedIndex = objSelectArray1[i].selectedIndex;
  }
}

//to set focus on the opener window
function focusWindow()
{
 if (opener)
 {
  opener.setFocus();
 }
}

// set focus on child window
function setFocus()
{
 window.onfocus = checkModal;
}

// make child window modal
function checkModal()
{
 setTimeout("finishChecking()", 0);
 return true;
}

// if child window is opened the keep focus on it
function finishChecking()
{
 if (windowObject.win && !windowObject.win.closed)
 {
  windowObject.win.focus();
 }
}


//JOADOC             : This function will be used to open popup window
//JOADOC             : and will transfer the control of response to that
//JOADOC             : popup window.
function openPopup(width, Height)
{
  theForm = document.forms[0];
  var win =  modalWin("",width, Height);
  theForm.target = win.name;
  isPopup = true;
}

//JOADOC             : This function will enable all deleted rows
//JOADOC             : before submitting the form.
function enableDeletedRows(tableId)
{
  var tableObj = document.getElementById(tableId);
  var rows = tableObj.getElementsByTagName("TR");
  var i=0;
  var j=0;
  var ind1;
  for(i = 1 ; i < rows.length ;  i++ )
  {
    ind1=0;
    cols = rows[i].getElementsByTagName("TD");
    hiddenElement = cols[0].childNodes[1];
    // To enable all the Fields of Deleted Row for  submission of those
    // elements of the Row in the request
    if(hiddenElement.value =='Deleted')
    {
      inputElements  = rows[i].getElementsByTagName("INPUT");
      for(counterInput = 0; counterInput < inputElements.length; counterInput++)
      {
        var inputObj = inputElements[counterInput];
        inputObj.disabled= false;
      }
      selectElements = rows[i].getElementsByTagName("SELECT");
      for(counterSelect = 0; counterSelect < selectElements.length; counterSelect++)
      {
        selectElements[counterSelect].disabled = false;
      }
    }
  }
}

//JOADOC  : This function will open the remarks window.
//JOADOC    It is MANDATORY  to enter the Remarks.
//JOADOC    Else an Alert will be displayed that remarks is Mandatory.
//JOADOC    The remarks window will remain open till remarks are entered.

function openRemarksWindow(methodName, maxLen)
{
  hideBlink();
  win = modalWin("",400,200);
  var tempHtml = "";
  tempHtml +="<html>";
  tempHtml +="<head>";
  tempHtml +="<META http-equiv='Content-Type' content='text/html; charset=UTF-8'>";
  tempHtml +="<title>Remarks</title>";
  tempHtml +="<link href='"+jsWebPathDetails+"css/pofstylesheet.css' type='text/css' rel='stylesheet'>";
  tempHtml +="<script  language='Javascript' src='"+jsWebPathDetails+"js/Joa.js'><\/script>";
  tempHtml +="<script  language='Javascript' src='"+jsWebPathDetails+"js/ErrorMsgs.js'><\/script>";
  tempHtml +="</head>";
  tempHtml +="<body class='BodyClass' onload='focusWindow();focusOnFirstElement();'><br>";
  tempHtml +="<div class='scrContainer'>";
  tempHtml +="<form name='DetailsForm'>";
  tempHtml +="<table cellpadding='0' cellspacing='0' border='0' class='ContainerTable'>";
  tempHtml +="<tr>";
  tempHtml +="<td align='center' width='100%'>";
  tempHtml +="<table cellspacing='0' cellpadding='0' border='0' width='100%'>";
  tempHtml +="<tr>";
  tempHtml +="<td>";
  tempHtml +="<table cellspacing='0' cellpadding='0' border='0' width='100%'>";
  tempHtml +="<tr>";
  tempHtml +="<td></td>";
  tempHtml +="<td><font face=arial size=2><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Remarks</b></font></td>";
  tempHtml +="<td width='70%'></td>";
  tempHtml +="</tr>";
  tempHtml +="</table>";
  tempHtml +="</td>";
  tempHtml +="</tr>";
  tempHtml +="<tr>";
  tempHtml +="<td>";
  tempHtml +="<table width='100%' cellpadding='0' cellspacing='0' border='0' class='cardoutline'>";
  tempHtml +="<tr>";
  tempHtml +="<td>";
  tempHtml +="<table cellspacing='0' cellpadding='0' border='0' width='100%'>";
  tempHtml +="<tr>";
  tempHtml +="<td>";
  tempHtml +="<table cellspacing='0' cellpadding='0' border='0'  width='100%'>";
  tempHtml +="<tr><td width='100%'>&nbsp;</td></tr></table></td>";
  tempHtml +="</tr></table></td></tr><tr><td>";
  tempHtml +="<table cellspacing=0 cellpadding=1 border='0' id='DataBlock1' frame='box' class='cardoutline' width='100%'>";
  tempHtml +="<tr><td><table cellspacing=0 cellpadding=0 border=0 class='inputpanel' width='100%'>";
  tempHtml +="<tr><td align='center'><table cellspacing=1 cellpadding=0 border=0 width='100%'>";
  tempHtml +="<tr height='10'> </tr><tr><td width=30>&nbsp;</td><td>";
  tempHtml +="<textarea name='remTxtArea'rows='5' cols='40'></textarea>";
  tempHtml +="</td></tr></table></td></tr></table></td></tr></table>";
  tempHtml +="</td></tr></table></td></tr></table>";
  tempHtml +="<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
  tempHtml +="<tr><td class='PageButtonsBefore'></td></tr>";
  tempHtml +="<tr>";
  tempHtml +="<td align='left' class='Field'>";
  tempHtml +="</td>";
  tempHtml +="<td align='right'>";
  tempHtml +="<table cellpadding='0' cellspacing='0' border='0'>";
  tempHtml +="<tr>";
  tempHtml +="<td><img alt='' src='"+jsWebPathDetails+"images/bigbtn_left.gif'border='0'></td>";
  tempHtml +="<td nowrap='nowrap' background='"+jsWebPathDetails+"images/bigbtn_body.gif' class='LargeBtnTextActive'>";
  tempHtml +="<a class='LargeBtnTextActive' href='javascript:window.close();'>Close</a></td>";
  tempHtml +="<td><img alt='' src='"+jsWebPathDetails+"images/bigbtn_right.gif'border='0'></td>";
  tempHtml +="<td class='PageBtnSpacing'></td>";
  tempHtml +="<td><img alt='' src='"+jsWebPathDetails+"images/bigbtn_left.gif'border='0'></td>";
  tempHtml +="<td nowrap='nowrap' background='"+jsWebPathDetails+"images/bigbtn_body.gif' class='LargeBtnText'>";
  tempHtml +="<a class='LargeBtnText' href='javascript:populateValue(\""+methodName+"\","+maxLen+");'>Save</a></td>";
  tempHtml +="<td><img alt='' src='"+jsWebPathDetails+"images/bigbtn_right.gif'border='0' ></td>";
  tempHtml +="</tr></table></td></tr></table></td></tr></table></form>";
  tempHtml +="</div></body><blink class='processing'></blink></html>";
  win.document.write(tempHtml);
  var bodyObj = win.document.getElementsByTagName('BODY');
 //Changed by MCACross
	if(navigator.appName!="Microsoft Internet Explorer")
	{
	 win.eval(bodyObj[0].getAttribute('onload')+";");
	}
	else
	{
	 win.eval(bodyObj[0].getAttribute('onload')+";"+"anonymous();");
	}
}

//JOADOC             : This window will close the remarks window
//JOADOC             : will  populate the value in field "stRemarks"
//JOADOC             : and then it will submit the form
function populateValue(methodName, maxLen)
{
  var parentWin  = window.opener;
  var parentForm = window.opener.document.forms[0];
  var objValue   = document.forms[0].remTxtArea.value;
  if(objValue.length > maxLen)
  {
    alert("Remarks"+ COM00052 + maxLen + " characters");
    parentForm.stRemarks.value = objValue.substring(0, convertStringToNumber(maxLen));
    return;
  }
  else
  {
    parentForm.stRemarks.value = document.forms[0].remTxtArea.value;
  }


  if(objValue.length == 0 || trim(objValue) == "")
  {
  var str = 'Remarks '+ COM00004 ;
  alert(str);
  return ;
  }
  parentWin.startBlink();
  parentForm.action +="?method="+methodName;
  parentForm.target = parentWin.name;
  parentForm.submit();
  window.close();
}


//JOADOC             : This function will check atleast one record is entered
//JOADOC             : in the Updateable Table
function isAnyChildEntered(tableId)
{
  var table=document.getElementById(tableId);
  var rows = table.getElementsByTagName('tr');
  var valueEntered = false;
  var cols;
  var ind;
  var htmlObj;
  var fieldVal;
  for(i = 1; i < rows.length ; i++ )
  {
    cols= rows[i].getElementsByTagName('td');
    for(ind = 0; ind < cols.length ; ind++ )
    {
      col = cols[ind];
      if(col.childNodes[0])
       {
        htmlObj = col.childNodes[0];
        switch(htmlObj.nodeName)
        {
          case 'INPUT'  :
            if(htmlObj.type == 'text')
            {
              fieldVal = htmlObj.value;
              fieldVal = trim(fieldVal);
              if(fieldVal!=undefined && fieldVal!='')
              {
                 valueEntered = true;
              }
            }
            else if(htmlObj.type== 'checkbox')
            {
              if(htmlObj.checked)
              {
                valueEntered = true;
              }
            }
            break;
           case 'SELECT' :
            selectobj = htmlObj;
            if(selectobj.selectedIndex>0)
            {
              valueEntered = true;
            }
            break;
          default       :
            break;
        }
        if(valueEntered)
        {
          return true;
        }
      }
    }
  }
  if(!valueEntered)
  {
    setError(" Please enter values in the List Block also");
    showErrors();
    return false;
  }

} // end of check for mandatory check in List

//JOADOC function name     : getListDescDep()
//JOADOC Input parameters  : 1.function name depending upont the LOV type
//JOADOC Input parameters  : 2.Lov field object
//JOADOC Input parameters  : 3.description field object list
//JOADOC function usage    : this function is used to get the description of the LOV
//JOADOC                   : From the database.
//JOADOC return type       : none
function getListDescDep()
{
  if(flagVar=='false')
  {
    var argList   = getListDescDep.arguments;
    var totalArgs = argList.length;
    var stRowIndex= argList[0];
    var lovWhereFldsVal = argList[2];
    var theForm =document.forms[0];
    if( lovWhereFldsVal != null)
    {
      var fldCount       = 0;
      var whereFldValArr = new Array();
      var whereFld;
      if(lovWhereFldsVal.indexOf(":")!=-1)
      {
         while(true)
         {
           whereFld = getToken(lovWhereFldsVal,":",fldCount+1);
           if(whereFld=='')
           {
             break;
           }
           if(theForm.elements[whereFld].length)
           {
             whereFldValArr[fldCount++] = theForm.elements[whereFld][stRowIndex].value;
           }
           else
           {
             whereFldValArr[fldCount++] = theForm.elements[whereFld].value;
           }
         }
      }
      else
      {
        if(theForm.elements[lovWhereFldsVal].length)
        {
          whereFldValArr[fldCount] = theForm.elements[lovWhereFldsVal][stRowIndex].value;
        }
        else
        {
          whereFldValArr[fldCount] = theForm.elements[lovWhereFldsVal].value;
        }
      }
    }
    var thisForm = document.forms[0];
    var val       = trim(eval("thisForm."+argList[3]+"["+stRowIndex+"]").value);
    var stLovObjName = eval("thisForm."+argList[3]+"["+stRowIndex+"]").id;
    if(val == undefined)
    {
      eval("thisForm."+argList[3]+"["+stRowIndex+"]").value = "";
    }
    else
    {
      eval("thisForm."+argList[3]+"["+stRowIndex+"]").value = val;
    }

    if(val == undefined || val=='%' || val == '')
    {
      var count  = (totalArgs-4);
      for(var i=0;i<count;i++)
      {
        //argList[i+4].value ='';
       	if(argList[i+4]!="EMPTY")
      	{
      	  if(eval("thisForm."+argList[i+4]).length)
      	  {
            eval("thisForm."+argList[i+4]+"["+stRowIndex+"]").value = "";
          }
          else
          {
            eval("thisForm."+argList[i+4]).value = "";
          }
	}
      }
      return ;
    }
    theForm   = window.frames[0];
    var tempHtml = "";
    tempHtml += "<html>";
    tempHtml += "<body>";
    tempHtml += "<form name='FetchLovDescForm' method='post' action='/"+contextRoot+"/LovDesc.do?method=getLovDesc'>";
    tempHtml += "<input type=hidden name='stLovName'    value='" + argList[1] + "' >";
    tempHtml += "<input type=hidden name='stLovObjName' value='" + stLovObjName + "' >";
    tempHtml += "<input type=hidden name='stFieldVal'   value='" + val + "' >";
    var index = argList[4].indexOf("_hid");
    if(index!=-1)
    {
      tempHtml += "<input type=hidden name='stFieldName1' value='" + eval("thisForm."+argList[4]).name + "' >";
      tempHtml += "<input type=hidden name='stRowIndex' value='' >";
    }
    else
    {
      tempHtml += "<input type=hidden name='stFieldName1' value='" + eval("thisForm."+argList[4]+"["+stRowIndex+"]").name + "' >";
      tempHtml += "<input type=hidden name='stRowIndex' value='" + stRowIndex + "' >";
    }
    for(index = 5;index < totalArgs;index++)
    {
      if(argList[index] == 'EMPTY')
      {
        tempHtml += "<input type=hidden name='stFieldName"+ (index-3) + "' value='EMPTY' >";
      }
      else
      {
        tempHtml += "<input type=hidden name='stFieldName"+ (index-3) + "' value='" + eval("thisForm."+argList[index]+"["+stRowIndex+"]").name + "' >";
      }
    }
    if( lovWhereFldsVal != null)
    {
      for(j=0; j<whereFldValArr.length ; j++)
      {
        tempHtml += "<input type=hidden name='arStFieldVal' value='" + whereFldValArr[j] + "' >";
      }
    }
    tempHtml += "</form>";
    tempHtml +="</body>";
    tempHtml +="</html>";
    theForm.document.writeln(tempHtml);
    theForm.document.forms[0].submit();
  }
}

function ignoreEvents(e)
{
  return false;
}
//JOADOC    : This function will enable the screen to capture events like
//JOADOC    : click, focus, and mosuedown after a request is submitted
function disableWindow()
{
//  document.onclick=ignoreEvents;
//  document.onfocus=ignoreEvents;
//  document.onmousedown=ignoreEvents;
}
//JOADOC    : This function will enable the screen to release events like
//JOADOC    : click, focus, and mosuedown after a request is stopped after some error
//JOADOC    : has occured.
function enableWindow()
{
//  document.onclick="";
//  document.onfocus="";
//  document.onmousedown="";
}

//JOADOC    : This function is used to validate and submit screen data
//JOADOC    : present on the screen.
function saveScreen(method)
{
  theForm = document.forms[0];
  var tableId;
  var isSaveAllowed  = false;
  for(tableCounter=1;;tableCounter++)
  {
    tableId  = "list"+tableCounter;
    tableObj = document.getElementById(tableId);
    if(tableObj!=null)
    {
	  var count = 0;
	  rows = tableObj.getElementsByTagName("TR");
      for(i = 1 ; i < rows.length ;  i++ )
  	  {
  	  
  	   var cols = rows[i].getElementsByTagName("TD");
  	   var col = cols[0];
  	   if(col)
  	   {
   		if(col.childNodes[0])
      	{
	      	var htmlObj     = col.childNodes[0];
	      	var htmlObjType = htmlObj.type;
	      	if(htmlObjType=='checkbox' &&
                       htmlObj.name.indexOf("chkSelect")!=-1)
            {
             	if (! (htmlObj.checked) )
             	{
             		count++;
             	}
            }
  	  	}
  	   }
  	  }
  	  if (count == rows.length-1)
  	  {
  	  		alert("No records selected");
  	  		return;
  	  }
      setRowStatus(tableObj, tableId);
      if(isTableDirty(tableObj, tableId))
      {
        isSaveAllowed = true;
      }
    }
    else
    {
      break;
    }
  }
  for(blockCounter=1;;blockCounter++)
  {
    tableId  = "DataBlock"+blockCounter;
    tableObj = document.getElementById(tableId);
    if(tableObj!=null)
    {
      if(isDirty(tableObj))
      {
        var inputElement = document.createElement("INPUT");
        inputElement.setAttribute("type" , "hidden");
        inputElement.setAttribute("name" , "blockModified");
        inputElement.setAttribute("value" , "Yes");
        theForm.appendChild(inputElement);
        isSaveAllowed =  true;
      }
    }
    else
    {
      break;
    }
  }
  if(!isSaveAllowed)
  {
    alert(COM00104);
    hideBlink();
    return;
  }
  info_arr.length=0;
  error_arr.length=0;
  infoCtx_arr.length=0;
  warnCtx_arr.length=0;
  fatal_arr.length=0;
  serverErr_arr.length=0;
  serverErrCtx_arr.length=0;
  warn_arr.length=0;
  validateflag=false;
  if(showErrorOnSubmit(theForm))
  {
    stripMethod();
    before_submit();
    for(tableCounter=1;;tableCounter++)
    {
      tableId  = "list"+tableCounter;
      tableObj = document.getElementById(tableId);
      if(tableObj!=null)
      {
        enableDeletedRows(tableId);
      }
      else
      {
        break;
      }
    }
	theForm.method.value=method;
//    theForm.action = theForm.action +"?method="+method;
      if(!isMultiSubAllowed)
      {
        disableLinks(theForm);
      }
    
    theForm.submit();
  }
  else
  {
    hideBlink();
    return ;
  }
}

//JOADOC    : This function will retain values on the load of window if the
//JOADOC    : tableId is not in sequence like list1, lis2
function buildListArr(tableId)
{
  var tableObj = document.getElementById(tableId);
  var varId = "Data_"+tableId;
  buildArray(tableObj, varId);
}

//JOADOC    : This function will submit a particular list block whose tableId is given
//JOADOC    : to as parameter to the function
function saveListBlock(tableId, method)
{
  var theForm  = document.forms[0];
  var tableObj = document.getElementById(tableId);
  setRowStatus(tableObj, tableId);
  var isSaveAllowed =false;
  if(isTableDirty(tableObj, tableId))
  {
    isSaveAllowed = true;
  }
  if(!isSaveAllowed)
  {
    alert(COM00104);
    hideBlink();
    return;
  }
  if(showErrListSubmit(theForm, tableId))
  {
    stripMethod();
    before_submit();
    enableDeletedRows(tableId);
	theForm.method.value=method;
//    theForm.action = theForm.action +"?method="+method;
      if(!isMultiSubAllowed)
      {
        disableLinks(theForm);
      }
    
    theForm.submit();
  }
  else
  {
    hideBlink();
    return ;
  }
}

//JOADOC    : This function will validate the screen for a patrticular list
//JOADOC    : block and will show errors.
function showErrListSubmit(formObj, tableId)
{
  flagVar='true';
  var tableObj;
  error_arr    = new Array();
  var tableObj = document.getElementById(tableId);
  listMandatoryFieldCheck(tableId, tableObj);
  var theForm = document.forms[0];
  var rows = tableObj.getElementsByTagName('tr');
  var rowModifiedObj;
  for(i = 1; i < rows.length ; i++ )
  {
    rowModifiedObj = eval("theForm.rowModified_"+tableId)[i-1];
    if(!rowModifiedObj || rowModifiedObj.value=='')
    {
      continue;
    }
    inputElements  = rows[i].getElementsByTagName("INPUT");
    for(var j=0;j<inputElements.length;j++)
    {
      if(inputElements[j].getAttribute('onblur'))
      {
        eval(inputElements[j].getAttribute('onblur')+";");//Changed by MCACross
      }
    }
    if(error_arr.length!=0)
    {
      showErrors();
      flagVar='false'; //reset to initial value
      return false;
    }
    else
    {
     return true;
    }
  }
}

//JOADOC    : This function will be called while switching tab to make all rows
//JOADOC    : readonly so that gifs are not visible in between tabs.
function makeRowReadonly(rows)
{
  for ( i = 0 ; i < rows.length ; i++ )
  {
    if ( rows[i].className == 'RowDataS' )
    {
      if ( ( i% 2) == 0)
      {
        changeClass(rows[i], 'RowDataAlt');
        assignColClass1(rows[i], 1);
      }
      else
      {
        changeClass(rows[i], 'RowData');
        assignColClass1(rows[i], 0);
      }
      break;
    }
  }
}
//JOADOC    : This function is called onLoad of body from  changeTables function
//JOADOC    : to mark the deleted record as disabled in case error occured while
//JOADOC    : deleting a record.
function deleteRow(rowObject, tableId)
{
  var inputElements  = rowObject.getElementsByTagName("INPUT");
  rowObject.className="RowDel";
  var noOfInpEle = inputElements.length;
  var counterInput;
  for(counterInput = 0; counterInput < noOfInpEle; counterInput++)
  {
    var inputObj = inputElements[counterInput];
    if((inputObj.name == ('chkSelect_'+tableId) ||
          inputObj.name == ('radSelect_'+tableId)))
    {
      inputObj.checked=false;
    }
    if(inputObj.className.indexOf('Num')!=-1)
    {
      inputObj.className ='tblNumDel';
    }
    else if(inputObj.className.indexOf('Text')!=-1)
    {
      inputObj.className ='tblTextDel';
    }
    inputObj.disabled= true;
  }
  selectElements = rowObject.getElementsByTagName("SELECT");
  noOfSelEle = selectElements.length;
  for(counterSelect = 0; counterSelect < noOfSelEle; counterSelect++)
  {
    if(selectElements[counterSelect].className.indexOf('Num')!=-1)
    {
      selectElements[counterSelect].className ='tblNumDel';
    }
    else
    {
      selectElements[counterSelect].className ='tblTextDel';
    }
    selectElements[counterSelect].disabled = true;
  }
}

function CINLookup(objproperty,objstlyeid,textproperty,textstyleid)
{
	window.open("/DCAPortalWeb/dca/displayCIN.do?method=getCIN&property="+objproperty+"&styleId="+objstlyeid+"&textproperty="+textproperty+"&textstyleId="+textstyleid,"load","toolbar=no,resize=no,scrollbar=no,width="+550+",height="+450+",top="+170+",left="+180);
}

//JOADOC   Function Name:showSerErrors()
//JOADOC   Description  :This function to show server side errors with an option to print the errors
//JOADOC   Changed 5-10-2005

function showSerErrorsWithPrint()
{
  var fatalLen  = fatal_arr.length;
  var errorLen  = serverErr_arr.length;
  var warnLen   = warn_arr.length;
  var infoLen   = info_arr.length;
  var count = 0;
  str = "<html>"
      + "  <head>"
	  + "  <META http-equiv='Content-Type' content='text/html; charset=UTF-8'>"
      + "    <link href='" + jsWebPathDetails + "css/pofstylesheet.css' type='text/css' rel='stylesheet'>"
      + "    <script language='JavaScript' src='" + jsWebPathDetails + "js/Joa.js'></script>"
      + "    <title>"
      + "      Information/Errors/Warning window"
      + "    </title>"
      + " </head>"
      + "<body onload='javascript:focusWindow()'>"
      + "  <form name='dummy' action='dummyAction'>"
      + "    <table class='Messages' align=center cellspacing=1 cellpadding=0 border='0'>";
      // show fatal errors
  if ( fatalLen != 0 )
  {
    var lastEle = (fatalLen);
    count       =  fatalLen + errorLen + warnLen + infoLen ;
  str += ""
	  + "  <tr  class='RowDataHdr2'>"
      + "    <td  class='RowDataHdr2' colspan='4'>"
      + "      <table class='RowDataHdrFatal' border='0'>"
      + "        <tr width='100%'>"
/*      + "          <td><img width='30' src='" + jsWebPathDetails + "images/erroricon_pagetitle.gif'></td>"*/
      + "          <td>Transaction Error</td>"
      + "        </tr>"
      + "      </table>"
      + "    </td>"
      + " </tr>"
      + "  <tr class='RowDataFatal'>"
      + "    <td width='80%' colspan='3'>"
      + fatal_arr[0]
      + "    </td>"
 /*     + "    <td width='20%' align='center'>"
      + "      <a href='#' onclick='javascript:showErrorDiv("+count+",\"errorRow\");'>";
      // if fatal error length is 1 then hide more button gif
    if(fatalLen == 1)
    {
      str+= "      <img style='display:none' id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0'></a>";
    }
    else
    {
      str+= "<div id='fatalMore' class='LINKSON' style='position:relative'>"
      + "  <img id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0' onclick='changeImg(\"fatalMore\",\"fatalLess\");'>"
      + "</div>"
      + "<div id='fatalLess' class='LINKSOFF' style='position:relative'>"
      + "  <img id='img' alt='' src='" + jsWebPathDetails + "images/less.gif' border='0' onclick='changeImg(\"fatalLess\",\"fatalMore\");'>"
      +    "</a>"
      + "</div>";
    }

      str+= "    </td>" */
      + "  </tr>";

    for(var i = 1; i < lastEle ; i++)
    {
      str+="  <tr class='RowData' style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width='10%' align='center'><img  width='15' src='" + jsWebPathDetails + "images/erroricon_pagetitle.gif'</td> "
      +"    <td width='80%' colspan='3'>"
      +"    <textarea rows='5' cols='68'  class='DataFont'>"
      +      fatal_arr[i]
      +"    </textarea>"
      +"    </td>"
      +"  </tr>";
    }
    for(var i = 0; i < errorLen ; i++)
    {
      str+="  <tr class='RowDataError' style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width=10% align='center' class='RowData'><img width='15' src='" + jsWebPathDetails + "images/erroricon_pagetitle.gif'</td>"
      +"    <td width='20%'>"
      //+serverErrCtx_arr[i] show context sensitive information
      +"    </td>"
      +"    <td width='70%' colspan='2'>"
      +       serverErr_arr[i]
      +"    </td>"
      +"  </tr>";
    }
    for(var i = 0; i < warnLen ; i++)
    {
      str+=" <tr class='RowDataWar'  style='display:none' id='errorRow"+(--count)+"'>"
      +"   <td width=10% align='center' class='RowData'><img width='15' src='" + jsWebPathDetails + "images/warningicon_pagetitle.gif'</td>"
      +"   <td width='20%'>"
      //+warnCtx_arr[i]
      +"   </td>"
      +"   <td width='70%' colspan='2'>"
      +     warn_arr[i]
      +"   </td>"
      +" </tr>";
    }
    for(var i = 0; i < infoLen ; i++)
    {
      str+="  <tr class='RowDataInfo'  style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width=10% align='center' class='RowData'><img width='15' src='" + jsWebPathDetails + "images/infoicon_pagetitle.gif'</td>"
      +"    <td width='20%' >"
      //+infoCtx_arr[i]
      +"    </td>"
      +"    <td width='70%' colspan='2'>"
      +info_arr[i]
      +"    </td>"
      +"  </tr>";
    }
  }
  else if(errorLen != 0)
  {
    var lastEle = (errorLen);
    count       =  errorLen + warnLen + infoLen ;
    str+="  <tr  class='RowDataHdr2'>"
    +"    <td  class='RowDataHdr2' colspan='4'>"
    +"      <table class='RowDataHdr2'>"
    +"        <tr>"
    +"          <td width=10%><img width='30' src='" + jsWebPathDetails + "images/erroricon_pagetitle.gif'</td>"
    +"          <td>Errors</td>"
    +"        </tr>"
    +"      </table>"
    +"    </td>"
    +"  </tr>"
    +"  <tr class='RowDataError'>"
    +"    <td width='80%' colspan='3'>"
    +serverErr_arr[0]
    +"    </td>"
    +"    <td width='20%' align='center'>"
    +"      <a href='#' onclick='javascript:showErrorDiv("+count+",\"errorRow\");'>";
    if(errorLen == 1)
    {
      str+="      <img style='dispaly:none' id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0'></a>";
    }
    else
    {
      str+="<div id='errorMore' class='LINKSON' style='position:relative'>"
      +" <img id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0' onclick='changeImg(\"errorMore\",\"errorLess\");'>"
      +"</div>"
      +"<div id='errorLess' class='LINKSOFF' style='position:relative'>"
      +" <img id='img' alt='' src='" + jsWebPathDetails + "images/less.gif' border='0' onclick='changeImg(\"errorLess\",\"errorMore\");'>"
      +"</a>"
      +"</div>";
    }
    str+="    </td>"
     +"  </tr>";
    for(var i = 1; i < lastEle ; i++)
    {
      str+="  <tr class='RowDataError' style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width=10% align='center' class='RowData'><img  width='15' src='" + jsWebPathDetails + "images/erroricon_pagetitle.gif'</td>"
      +"    <td width='20%'>"
      //+serverErrCtx_arr[i]
      +"    </td>"
      +"    <td width='70%' colspan='2'>"
      +serverErr_arr[i]
      +"    </td>"
      +"  </tr>";
    }
    for(var i = 0; i < warnLen ; i++)
    {
      str+="  <tr class='RowDataWar'  style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width='10%'align='center' class='RowData'><img width='15' src='" + jsWebPathDetails + "images/warningicon_pagetitle.gif'</td>"
      +"    <td width='20%'>"
      //+warnCtx_arr[i]
      +"    </td>"
      +"    <td width='70%' colspan='2'>"
      +warn_arr[i]
      +"    </td>"
      +"  </tr>";
    }
    for(var i = 0; i < infoLen ; i++)
    {
      str+="  <tr class='RowDataInfo'  style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width=10% align='center' class='RowData'><img width='15' src='" + jsWebPathDetails + "images/infoicon_pagetitle.gif'</td>"
      +"    <td width='20%' >"
      //+infoCtx_arr[i]
      +"    </td>"
      +"    <td width='70%' colspan='2'>"
      +info_arr[i]
      +"    </td>"
      +"  </tr>";
    }
  }
  else if(warnLen != 0)
  {
    var lastEle = (warnLen);
    count       = warnLen + infoLen ;
    str+="  <tr class='RowDataHdr2'>"
    +"    <td class='RowDataHdr2' colspan='4'>"
    +"      <table class='RowDataHdr2'>"
    +"        <tr >"
    +"          <td width=10%><img width='30' src='" + jsWebPathDetails + "images/warningicon_pagetitle.gif'</td>"
    +"          <td >Warnings</td>"
    +"        </tr>"
    +"      </table>"
    +"    </td>"
    +"  </tr>"
    +"  <tr class='RowDataWar'>"
    +"    <td width='80%' colspan='3'>"
    +warn_arr[0]
    +"    </td>"
    +"    <td width='20%' align='center'>"
    +"      <a href='#' onclick='javascript:showErrorDiv("+count+",\"errorRow\");'>";
    if(warnLen == 1)
    {
      str+="      <img style='display:none' id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0'></a>";
    }
    else
    {
      str+="<div id='warnMore' class='LINKSON' style='position:relative'>"
      +"  <img id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0' onclick='changeImg(\"warnMore\",\"warnLess\");'>"
      +"</div>"
      +"<div id='warnLess' class='LINKSOFF' style='position:relative'>"
      +"  <img id='img' alt='' src='" + jsWebPathDetails + "images/less.gif' border='0' onclick='changeImg(\"warnLess\",\"warnMore\");'>"
      +"</a>"
      +"</div>";
    }
    str+="    </td>"
    +"  </tr>";
    for(var i = 1; i < lastEle ; i++)
    {
      str+="  <tr class='RowDataWar'  style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width=10% class='RowData' align='center'><img width='15' src='" + jsWebPathDetails + "images/warningicon_pagetitle.gif'</td>"
      +"    <td width='20%'>"
      //+warnCtx_arr[i]
      +"    </td>"
      +"    <td width='70%' colspan='2'>"
      +warn_arr[i]
      +"    </td>"
      +"  </tr>";
    }
    for(var i = 0; i < infoLen ; i++)
    {
      str+="  <tr class='RowDataInfo'  style='display:none' id='errorRow"+(--count)+"'>"
      +"  <td width=10% class='RowData' align='center' ><img width='15' src='" + jsWebPathDetails + "images/infoicon_pagetitle.gif'</td>"
      +"  <td width='20%' >"
      //+infoCtx_arr[i]
      +"  </td>"
      +"  <td width='70%' colspan='2'>"
      +info_arr[i]
      +"    </td>"
      +"  </tr>";
    }
  }
  else
  {
    var lastEle = (infoLen);
    count       = infoLen ;
    str+="  <tr class='RowDataHdr2'>"
    +"    <td class='RowDataHdr2' colspan='4'>"
    +"      <table class='RowDataHdr2' "
    +"        <tr >"
    +"          <td width=10% ><img width='30' src='" + jsWebPathDetails + "images/infoicon_pagetitle.gif'</td>"
    +"          <td>Information</td>"
    +"        </tr>"
    +"      </table>"
    +"    </td>"
    +"  </tr>"
    +"  <tr class='RowDataInfo'>"
    +"    <td width='80%' colspan='3'>"
    +info_arr[0]
    +"    </td>"
    +"    <td width='20%' align='center'>"
    +"      <a href='#' onclick='javascript:showErrorDiv("+count+",\"errorRow\");'>";
    if(infoLen == 1)
    {
      str+="      <img style='display:none' id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0'></a>";
    }
    else
    {
      str+="<div id='infoMore' class='LINKSON' style='position:relative'>"
      +"      <img id='img' alt='' src='" + jsWebPathDetails + "images/more.gif' border='0' onclick='changeImg(\"infoMore\",\"infoLess\");'>"
      +"</div>"
      +"<div id='infoLess' class='LINKSOFF' style='position:relative'>"
      +"      <img id='img' alt='' src='" + jsWebPathDetails + "images/less.gif' border='0' onclick='changeImg(\"infoLess\",\"infoMore\");'>"
      +"</a>"
      +"</div>";
    }

    str+="    </td>"
    +"  </tr>";
    for(var i = 1; i < lastEle ; i++)
    {
      str+="  <tr class='RowDataInfo'  style='display:none' id='errorRow"+(--count)+"'>"
      +"    <td width=10% class='RowData' align='center'><img width='15' src='" + jsWebPathDetails + "images/infoicon_pagetitle.gif'</td>"
      +"    <td width='20%'>"
      //+infoCtx_arr[i]
      +"    </td>"
      +"    <td width='70%' colspan='2'>"
      +info_arr[i]
      +"    </td>"
      +"  </tr>";
    }
  }
  str+="</table>"
  +"<table cellpadding='0' cellspacing='0' border='0' align='right'>"
  +"  <tr><td class='PageButtonsBefore'></td></tr>"
  +"  <tr> ";
  if ( fatalLen != 0 || errorLen != 0 )
  {
    str+="    <td class='PageBtnSpacing'></td>"
    +"    <td><img alt='' src='" + jsWebPathDetails + "images/bigbtn_left.gif' border='0'></td>"
    +"    <td nowrap='nowrap' background='" + jsWebPathDetails + "images/bigbtn_body.gif' class='LargeBtnText'>"
    +"      <a id='Default' class='LargeBtnText' href='#' onclick='javascript:window.print()'>"
    +"        Print"
    +"      </a>"
    +"    </td>"
    +"    <td nowrap='nowrap'><img alt='' src='" + jsWebPathDetails + "images/bigbtn_right.gif' border='0'></td>"
    +"    <td>&nbsp;</td>"
    +"    <td><img alt='' src='" + jsWebPathDetails + "images/bigbtn_left.gif' border='0'></td>"
    +"    <td nowrap='nowrap' background='" + jsWebPathDetails + "images/bigbtn_body.gif' class='LargeBtnText'>"
    +"      <a id='Default' class='LargeBtnText' href='#' onclick='javascript:pageLevelSubmit(this, \"cancelError\", \"false\")'>"
    +"        Close"
    +"      </a>"
    +"    </td>"
    +"    <td nowrap='nowrap'><img alt='' src='" + jsWebPathDetails + "images/bigbtn_right.gif' border='0'></td>";
  }
  else if ( warnLen != 0 )
  {
    str+="    <td class='PageBtnSpacing'></td>"
    +"    <td><img alt='' src='" + jsWebPathDetails + "images/bigbtn_left.gif' border='0'></td>"
    +"    <td nowrap='nowrap' background='" + jsWebPathDetails + "images/bigbtn_body.gif' class='LargeBtnText'>"
    +"      <a id='Default' class='LargeBtnText' href='#' onclick='javascript:window.print()'>"
    +"        Print"
    +"      </a>"
    +"    </td>"
    +"    <td nowrap='nowrap'><img alt='' src='" + jsWebPathDetails + "images/bigbtn_right.gif' border='0'></td>"
    +"    <td>&nbsp;</td>"
    +"    <td><img alt='' src='" + jsWebPathDetails + "images/bigbtn_left.gif' border='0'></td>"
    +"    <td nowrap='nowrap' background='" + jsWebPathDetails + "images/bigbtn_body.gif' class='LargeBtnText'>"
    +"      <a class='LargeBtnText' href='#' onclick='javascript:pageLevelSubmit(this, \"continueError\", \"false\")'>"
    +"        Continue"
    +"      </a>"
    +"    </td>"
    +"    <td nowrap='nowrap'><img alt='' src='" + jsWebPathDetails + "images/bigbtn_right.gif' border='0'></td>"
    +"    <td class='PageBtnSpacing'></td>"
    +"    <td><img alt='' src='" + jsWebPathDetails + "images/bigbtn_left.gif' border='0'></td>"
    +"    <td nowrap='nowrap' background='" + jsWebPathDetails + "images/bigbtn_body.gif' class='LargeBtnText'>"
    +"      <a id='Default' class='LargeBtnText' href='#' onclick='javascript:pageLevelSubmit(this, \"cancelError\", \"false\")'>"
    +"        Close"
    +"      </a>"
    +"    </td>"
    +"    <td nowrap='nowrap'><img alt='' src='" + jsWebPathDetails + "images/bigbtn_right.gif' border='0'></td>";
  }
  else if ( infoLen != 0 )
  {
    str+="    <td class='PageBtnSpacing'></td>"
    +"    <td><img alt='' src='" + jsWebPathDetails + "images/bigbtn_left.gif' border='0'></td>"
    +"    <td nowrap='nowrap' background='" + jsWebPathDetails + "images/bigbtn_body.gif' class='LargeBtnText'>"
    +"      <a id='Default' class='LargeBtnText' href='#' onclick='javascript:window.print()'>"
    +"        Print"
    +"      </a>"
    +"    </td>"
    +"    <td nowrap='nowrap'><img alt='' src='" + jsWebPathDetails + "images/bigbtn_right.gif' border='0'></td>"
    +"    <td>&nbsp;</td>"
    +"    <td><img alt='' src='" + jsWebPathDetails + "images/bigbtn_left.gif' border='0'></td>"
    +"    <td nowrap='nowrap' background='" + jsWebPathDetails + "images/bigbtn_body.gif' class='LargeBtnText'>"
    +"      <a id='Default' class='LargeBtnText' href='#' onclick='javascript:pageLevelSubmit(this, \"cancelError\", \"false\")'>"
    +"        Close"
    +"      </a>"
    +"    </td>"
    +"    <td nowrap='nowrap'><img alt='' src='" + jsWebPathDetails + "images/bigbtn_right.gif' border='0'></td>";
  }
  str+="  </tr>"
  +"</table>"
  +"</form>"
  +"</body>"
  +"</html>";
  hideBlink();
  flagVar='false';
  showModalWin("",475,200,"yes","yes","no",str); // call show modal dialog for modal window
  focusOnFirstElement(); // after closing the pop-up }
}

//these functions are used to open a modal window - using window.open instead of showModalDialog
//should be used in case of large number of error messages 
var modalWindow;

function openModalWindow(url, width, height,resizable,scroll,status,arguments)
{
 //var param = "dialogHeight:"+height+"px;dialogWidth:"+width+"px;center:yes;resizable:"+resizable+";status:"+status+";scroll:"+scroll;
  var param = "height="+height+"px,width="+width+"px,resizable="+resizable+",status="+status+",scrollbars="+scroll+",menubar=no,directories=no";
  modalWindow = window.open("/"+contextRoot+"/joa/html/dummy.htm","dummy",param);
  modalWindow.document.write(arguments);
  modalWindow.document.close();
  window.onclick=ignoreFocus;
  window.onfocus=ignoreFocus ;
  window.onmousedown=ignoreFocus ;
  window.onmouseup=ignoreFocus ;
  window.ondblclick =ignoreFocus ;
  window.onfocusin =ignoreFocus ;
  window.onresize =ignoreFocus ;
  window.onresizestart  =ignoreFocus ;
  window.onresizeend =ignoreFocus ;
  window.onkeydown =ignoreFocus ;
  window.onkeypress  =ignoreFocus ;
  window.onkeyup  =ignoreFocus ;
  window.onselect  =ignoreFocus ;
  window.onmousewheel  =ignoreFocus ;
  modalWindow.onfocusout = modalWindow.focus();
  after_close();
}

function ignoreFocus()
{
	//alert('Inside ignore focus');
  if (modalWindow)
  {
    if (!modalWindow.closed)
    {
      modalWindow.focus();
    }
}
  return false
}

//end

//Addded by arun 26 july 

function enableLinks(theForm)
{
var hrefObjects = theForm.getElementsByTagName('a');
for(var hrefCount = 0 ; hrefCount< hrefObjects.length ; hrefCount++)
{
hrefObjects[hrefCount].style.visibility='visible';
}
}

 
        var markerHTML = "|";
        var minWidth = 150;
        var dragingColumn = null;
        var startingX = 0;
        var currentX = 0;

        function getNewWidth ()
         {
            var newWidth = minWidth;
            if (dragingColumn != null)
             {           
                newWidth = parseInt (dragingColumn.parentNode.style.width);
                if (isNaN (newWidth)) 
                {
                    newWidth = 0;
                }
                newWidth += currentX - startingX;
                if (newWidth < minWidth) 
                {
                    newWidth = minWidth;
                }
            }
            return newWidth;
        }

        function columnMouseDown (event) {
            if (!event) 
            {
                event = window.event;
            }
            if (dragingColumn != null)
            {
                ColumnGrabberMouseUp ();
            }
            startingX = event.clientX;
            currentX = startingX;
            dragingColumn = this;
            return true;
        }

        function columnMouseUp () {
            if (dragingColumn != null) 
            {
                dragingColumn.parentNode.style.width = getNewWidth ();
                dragingColumn = null;
            }
			return true;
        }

        function columnMouseMove (event) 
        {
            if (!event)
            {
                event = window.event;
            }
            if (dragingColumn != null) 
            {
			    currentX = event.clientX;
                dragingColumn.parentNode.style.width = getNewWidth ();
                startingX = event.clientX;
                currentX = startingX;
			}
			return true;
        }

        function installTable (tableId) 
        {
            var table = document.getElementById (tableId);
            // Test if there is such element in the document
            if (table != null)
             {
                // Test is this element a table
               
                if (table.nodeName.toUpperCase () == "TABLE") 
                {
                    document.body.onmouseup = columnMouseUp;
                    document.body.onmousemove = columnMouseMove;
                    for (i = 0; i < table.childNodes.length; i++) 
                    {
                        var tableHead = table.childNodes[i];
                      
                        // Look for the header
                        // Tables without header will not be handled.
                        if (tableHead.nodeName.toUpperCase () == "TBODY") 
                        {
                        	
                            // Go through THEAD nodes and set resize markers
                            // IE in THEAD contains TR element which contains TH elements
                            // Mozilla in THEAD contains TH elements
                            for (j = 0; j < tableHead.childNodes.length; j++) 
                            {
                        
                                var tableHeadNode = tableHead.childNodes[j];
                                  
                                // Handles IE style THEAD with TR
                                if (tableHeadNode.nodeName.toUpperCase () == "TR") 
                                {
                              
                                 if(tableHeadNode.id.toUpperCase()== "ROWHEAD")
                                 {
	                                    for (k = 0; k < tableHeadNode.childNodes.length; k++) 
	                                    {
	                                    	
	                                        var column = tableHeadNode.childNodes[k];
	                                        var marker = document.createElement ("span");
	                                        marker.innerHTML = markerHTML;
	                                        marker.style.cursor = "move";
	                                        marker.onmousedown = columnMouseDown;
	                                        column.appendChild (marker);
	                                        if (column.offsetWidth < minWidth) 
	                                        {
	                                            column.style.width = minWidth;
	                                        }
	                                        else
	                                         {
	                                            column.style.width = column.offsetWidth;
	                                        }
	                                    }
                                   }
                                }
                                // Handles Mozilla style THEAD
                                else if (tableHeadNode.nodeName.toUpperCase () == "TH") 
                                {
                             
                                    var column = tableHeadNode;
                                    var marker = document.createElement ("span");
                                    marker.innerHTML = markerHTML;
                                    marker.style.cursor = "move";
                                    marker.onmousedown = columnMouseDown;
                                    column.appendChild (marker);
                                    if (column.offsetWidth < minWidth) {
                                        column.style.width = minWidth;
                                    }
                                    else {
                                        column.style.width = column.offsetWidth;
                                    }
                                }
                            }
                            table.style.tableLayout = "fixed";
                            // Once we have found THEAD element and updated it
                            // there is no need to go through rest of the table
                            i = table.childNodes.length;
                        }
                    }
                }
            }
        }
    
	function anonymous(){
	//dont del this
	}
    
    
    
/**
*
*  Scrollable HTML table
*  http://www.webtoolkit.info/
*
**/
    
  function ScrollableTable (tableEl, tableHeight, tableWidth) {
 
	this.initIEengine = function () {
 
		this.containerEl.style.overflowY = 'auto';
		if (this.tableEl.parentElement.clientHeight - this.tableEl.offsetHeight < 0) {
			this.tableEl.style.width = this.newWidth - this.scrollWidth +'px';
		} else {
			this.containerEl.style.overflowY = 'hidden';
			this.tableEl.style.width = this.newWidth +'px';
		}
 
		if (this.thead) {
			var trs = this.thead.getElementsByTagName('tr');
			for (x=0; x<trs.length; x++) {
				trs[x].style.position ='relative';
				trs[x].style.setExpression("top",  "this.parentElement.parentElement.parentElement.scrollTop + 'px'");
			}
		}
 
		if (this.tfoot) {
			var trs = this.tfoot.getElementsByTagName('tr');
			for (x=0; x<trs.length; x++) {
				trs[x].style.position ='relative';
				trs[x].style.setExpression("bottom",  "(this.parentElement.parentElement.offsetHeight - this.parentElement.parentElement.parentElement.clientHeight - this.parentElement.parentElement.parentElement.scrollTop) + 'px'");
			}
		}
 
		eval("window.attachEvent('onresize', function () { document.getElementById('" + this.tableEl.id + "').style.visibility = 'hidden'; document.getElementById('" + this.tableEl.id + "').style.visibility = 'visible'; } )");
	};
 
 
	this.initFFengine = function () {
		this.containerEl.style.overflow = 'hidden';
		this.tableEl.style.width = this.newWidth + 'px';
 
		var headHeight = (this.thead) ? this.thead.clientHeight : 0;
		var footHeight = (this.tfoot) ? this.tfoot.clientHeight : 0;
		var bodyHeight = this.tbody.clientHeight;
		var trs = this.tbody.getElementsByTagName('tr');
		if (bodyHeight >= (this.newHeight - (headHeight + footHeight))) {
			this.tbody.style.overflow = '-moz-scrollbars-vertical';
			for (x=0; x<trs.length; x++) {
				var tds = trs[x].getElementsByTagName('td');
				tds[tds.length-1].style.paddingRight += this.scrollWidth + 'px';
			}
		} else {
			this.tbody.style.overflow = '-moz-scrollbars-none';
		}
 
		var cellSpacing = (this.tableEl.offsetHeight - (this.tbody.clientHeight + headHeight + footHeight)) / 4;
		this.tbody.style.height = (this.newHeight - (headHeight + cellSpacing * 2) - (footHeight + cellSpacing * 2)) + 'px';
 
	};
 
	this.tableEl = tableEl;
	this.scrollWidth = 16;
 
	this.originalHeight = this.tableEl.clientHeight;
	this.originalWidth = this.tableEl.clientWidth;
 
	this.newHeight = parseInt(tableHeight);
	this.newWidth = tableWidth ? parseInt(tableWidth) : this.originalWidth;
 
	this.tableEl.style.height = 'auto';
	this.tableEl.removeAttribute('height');
 
	this.containerEl = this.tableEl.parentNode.insertBefore(document.createElement('div'), this.tableEl);
	this.containerEl.appendChild(this.tableEl);
	this.containerEl.style.height = this.newHeight + 'px';
	this.containerEl.style.width = this.newWidth + 'px';
 
 
	var thead = this.tableEl.getElementsByTagName('thead');
	this.thead = (thead[0]) ? thead[0] : null;
 
	var tfoot = this.tableEl.getElementsByTagName('tfoot');
	this.tfoot = (tfoot[0]) ? tfoot[0] : null;
 
	var tbody = this.tableEl.getElementsByTagName('tbody');
	this.tbody = (tbody[0]) ? tbody[0] : null;
 
	if (!this.tbody) return;
 
	if (document.all && document.getElementById && !window.opera) this.initIEengine();
	if (!document.all && document.getElementById && !window.opera) this.initFFengine();
 
 
}
    
