function placeSort (colHead, colName, sortBy, tableNum, postFLAG) {
var colNameUp;
var arrowString = '';
var downArrow   = 'images/sort_down_off.gif';
var upArrow     = 'images/sort_up_off.gif';
forceFormPOST   = (postFLAG)? true : false;

   if (arguments.length == 2) {
      sortBy   = ''; tableNum = 1; forceFormPOST = false;
   } else if (2 > arguments.length || arguments.length > 5) return;
	
	
   if (String (sortBy) == String (colName) ||
      String (sortBy) == String ('!' + colName)) {
      if (sortBy.substring(0,1) != '!') upArrow = 'images/sort_up_on.gif';
      else downArrow = 'images/sort_down_on.gif';
   } // end if

   colNameUp = '!' + colName; 

   arrowString    += '<TABLE cellspacing="0" cellpadding="0" border="0">';
   arrowString    += '<TR class="columnHeadingBackground">';
   arrowString    += '<TD rowspan="2">';
   arrowString    += '<IMG src="images/spacer.gif" border="0" width="4" height="1"></TD>';
   arrowString    += '<Td class="columnHeadingText" rowspan="2" align="center" valign="middle">';
   arrowString    += colHead + '</Td>';
   arrowString    += '<TD rowspan="2">';
   arrowString    += '<IMG src="images/spacer.gif" border="0" width="4" height="1"></TD>';
   arrowString    += '<TD valign="bottom">';
   arrowString    += '<A href="javascript: void (0);" onclick=\'demoAlert(\"Sort by '+removeTag(colHead)+' in Ascending order.\"); return (false);\' onmouseover="stat (\'Click for Ascending Sort\'); return (true);" onmouseout="stat (); return (true);"><IMG src="' + upArrow + '" border="0" width="8" height="6"></A></TD>';
   arrowString    += '<TD rowspan="2">';
   arrowString    += '<IMG src="images/spacer.gif" border="0" width="4" height="1"></TD>';
   arrowString    += '</TR>';
   arrowString    += '<TR>';
   arrowString    += '<TD valign="top">';
   arrowString    += '<A href="javascript: void (0);" onclick=\'demoAlert(\"Sort by '+removeTag(colHead)+' in Descending order.\"); return (false);\' onmouseover="stat(\'Click for Descending Sort\'); return (true);" onmouseout="stat(); return (true);"><IMG src="' + downArrow   + '" border="0" width="8" height="6"></A></TD>';
   arrowString    += '</TR>';
   arrowString    += '</TABLE>';
	//alert(arrowString)
   document.write(arrowString);
   document.close();   
} // end fun placeSort
function removeTag(colHead){
	var position = colHead.indexOf("<BR>");
	if(position == -1){
		return colHead;
	}
	var tempString = colHead.substring(0,position)+" "+colHead.substring(position+4);
	return tempString;
}
function linkHist (accdesStr, accountIDStr, nhistFlag,surl) {
var accdesStr, accountIDStr, nhistFlag;
   if (nhistFlag != '')
      document.write (String (accdesStr)); // no hyperlink
   else 
      document.write ('<A class="plainText" href="'+surl+'" onmouseover="stat (\'Click to view the account history\'); return (true);" onmouseout="stat (); return (true);">' +
         String (accdesStr) + '</A>'); // hyperlinked
   document.close ();
} // end fun linkHist

function linkStmt (accountIDStr, stmtFlag,surl) {
var accountIDStr, stmtFlag;
   if (stmtFlag != '')
      document.write ('&nbsp;'); // no hyperlink
   else 
      document.write ('<A href="'+surl+'" onmouseover="stat (\'Click to view Account Statement\'); return (true);" ' +
         'onmouseout="stat (); return (true);"><IMG src="images/view_details.gif" ' +
         'width="20" height="18" border="0"></A>'); // hyperlinked
   document.close ();
} // end fun linkHist

function DFD (surl){
       PopWin = window.open(surl,'PopWin','dependent=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,screenX=80,screenY=40,Width=420,Height=320');
} // end fun DFD

function stripDollarSign(fld)
{                          
    
   var currFLD = String(fld);
   var dollar = currFLD.indexOf('$');
   
   if ( dollar >= 0 )
        currFLD = currFLD.substring(dollar+1,currFLD.length);  
        
   var dot = currFLD.indexOf('.');     
   
   if ( dot == 0 )
        currFLD = "0" + currFLD; 
   
  
   document.write(currFLD);
   document.close();

}
  
function SPD (theForm, ref,surl){
 PopWin = window.open(surl,'PopWin','dependent=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,screenX=80,screenY=40,Height=600,Width=635');
} // end fun SPD


function displayImage (chkNum, chkDate, chkAmt, chkLocat, MICR, acct)
{

	demoAlert("Display the check image.")
	return;
  var winH =  "620" ;
  var winW =  "540" ;

	theForm = document.forms[0];
	
	
	theForm.checknum.value = chkNum;
	theForm.checkdate.value = chkDate;
	theForm.checkamount.value = chkAmt;
	theForm.chkImageComp.value = 'HISTORY';
	theForm.checklocat.value = chkLocat;
	theForm.MICR.value = MICR;
    theForm.target = 'PopWin';

    if (IE)
    {
        var accountList = acct + ":1"  ;
        var surl = './CheckImage.cgi?checklocat=' + chkLocat + '&chkImageComp=HISTORY&accountList=' + accountList + '&checkamount=' + chkAmt + '&checknum=' + chkNum + '&checkdate=' +  chkDate ;
     	PopWin = window.open(surl,'PopWin','dependent=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,screenX=80,screenY=40,Width=' + winW + ',Height=' + winH  );
    }
    else
    {	
        	PopWin = window.open('','PopWin','dependent=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,screenX=80,screenY=40,Width=' + winW + ',Height=' + winH);
        	PopWin.document.write('<HTML><HEAD><TITLE>Cash Management System - '
        		+ ' Check Detail</TITLE></HEAD><BODY bgcolor="#ffffff" onload="window.opener.PopWin.focus();" onblur="window.opener.PopWin.focus();">'
        		+ '<DIV style="font-family: sans-serif; font-size: 24pt;" align="left"><BR><BR>'
        		+ '<BR><BR>Retrieving Check Image Data<BR><BR></BODY></HTML>');
        	theForm.action = "./CheckImage.cgi";
        	theForm.target = 'PopWin';
        	theForm.submit();
    }    

   return;
} 
