//*************************************************************
//***********************BACK and FORWARD**********************
//*************************************************************

// The function is invoked by the Back button in our navigation bar.
function go_back() 
{   
    history.back();
    //resetRow();   
}
// This function is invoked by the Forward button in the navigation bar.
// It works just like the one above.</I></TT>
function go_forward()
{
    history.forward();
}

//******************************************************		
//***********************ANIMATE BUTTON****************
//******************************************************
	var controlID;		
function animateme(test1)
	{
	controlID = test1;
	var orgwidth = document.getElementById(controlID).getAttribute("width");
	var orgheight = document.getElementById(controlID).getAttribute("height");
	var newwidth = orgwidth - 3;
	var newheight = orgheight - 2;
	
	//document.Form1.imgbtnForward.width=newwidth;
	document.getElementById(controlID).setAttribute("width",newwidth);
	document.getElementById(controlID).setAttribute("height",newheight);
	setTimeout("unanimateme(controlID);",200);
	}	
function unanimateme(controlID)
	{
	var orgwidth = document.getElementById(controlID).getAttribute("width");
	var orgheight = document.getElementById(controlID).getAttribute("height");
	var newwidth = (orgwidth + 3);
	var newheight = orgheight + 2;
	document.getElementById(controlID).setAttribute("width",newwidth);
	document.getElementById(controlID).setAttribute("height",newheight);
	//document.Form1.imgbtnForward.width=newwidth;
	}
	
	
	
//*********************************************************	
//*********************CLICK THE BUTTON********************
//---used in NewsSearch
function clickthebutton(btnID)
{
var theID = btnID;
document.getElementById(theID).click();
}

//*********************************************************	
//*********************KEYPRESS NEWS SEARCH click button***********
//---used in NewsSearch
function clickthebutton2(btnID)
{
	if (document.layers)
    document.captureEvents(Event.KEYPRESS);
    
  document.onkeypress = function (evt)
   {
    var key = 
      document.all ? event.keyCode :
      evt.which ? evt.which : evt.keyCode;
      
      //alert("The keypress was captured :" + key )
    if (key == 13)
    {
		//alert("The keypress was captured :" + key ); 
		//document.formName.submit();
		var theID = btnID;
		//alert("the var btnfocused contains: " + btnfocused + "  :  " + thefocused); //--for testing
		var theLiObj = document.getElementById(theID);
		
		theLiObj.click();
	}
         
  };

}
//*********************************************************
//*********************************************************
//*********************************************************	
//*********************CLICK THE BUTTON SEND VALUE*********
//---used in NewsSearch (on mousedown puts 'linkdata' into txtgetart)

var theValue;
var theTID;
function settxtvalue(txtID,txtValue)
{
//alert("The val of settextvalue arg is :" + txtValue); //for testing
theValue = txtValue;
theTID = txtID;
document.getElementById(theTID).value = theValue;
}

function sendvalwithclick(theBID)
{
document.getElementById(theBID).click();
}
//*********************************************************
//*********************************************************	

//***************************************************************
//*****************CHANGE LIST ITEMS ON MOUSEOVER FOR NewsSearch.ASPX****************
//***************************************************************
//----used in NewsSearch

function changeme(ListItemID,theNewClass)
{
var newClass = theNewClass;
var itemChanged = ListItemID;
document.getElementById(itemChanged).className =newClass;
}
//**********************CHANGES IT BACK AGAIN ON MOUSEOUT FOR NewsSearch.ASPX***************
//**********************************************************************
function changemeback(itemChangeback)
{
var itemtochangeback= itemChangeback;
document.getElementById(itemChangeback).className ="";
}



//*************************SET UP IMG BUTTONS FOR FOCUS*****************

function enableImgFocus()
{

			//var imgobj = document.imgbtnLoginScreen
			var icount = document.getElementsByTagName("IMG").length;
			
			if(icount > 0)
			{
			
				var imgItem = 0;
				for(imgItem=0; imgItem < icount; imgItem++)
				{
				//alert("imgItem is:  " + imgItem + "  and icount:  " + icount); //for testing
				var tmpobj = document.getElementsByTagName("IMG").item(imgItem);
				//document.getElementsByTagName("IMG").length;
				tmpobj.tabIndex=0;
				//imgobj.tabIndex=0;
				}
			}
			
			
			//var count = document.getElementsByTagName("IMG").length;
			//alert("Count is :" + count +"  end");
}	

function enableImgFocusLI()
{
		var lcount = document.getElementsByTagName("LI").length;
			
		if(lcount > 0)
		{
			
			var LiItem = 0;
			for(LiItem=0; LiItem < lcount; LiItem++)
			{
			//alert("LiItem is:  " + LiItem + "  and lcount:  " + lcount); //for testing
			var tmpobj = document.getElementsByTagName("LI").item(LiItem);
			tmpobj.tabIndex=(LiItem+1); //modified from just 0
			}
		}
			
			
}



	

/*   */






//==============new enable focus routine ======================================>
//===== NOT USED YET =====
function enableTagFocus(theTag)
{
		//var Tagcount = document.getElementsByTagName("LI").length;
		var Tagcount = document.getElementsByTagName(theTag).length;
			
		if(Tagcount > 0)
		{
			
			var TagItem = 0;
			for(TagItem=0; TagItem < Tagcount; TagItem++)
			{
			//alert("LiItem is:  " + LiItem + "  and lcount:  " + lcount); //for testing
			//var tmpobj = document.getElementsByTagName("LI").item(LiItem);
			var tmpobj = document.getElementsByTagName(theTag).item(TagItem);
			
			tmpobj.tabIndex=(TagItem+1); //modified from just 0
			}
		}
			
			
}			

/*   */


// ==================== NEW FOR TRACKING TABLE ==========================>
//===== USED ====
				function enableFocusTableRow(theTableID, OnFocusFunct)
				{
				if(document.getElementById(theTableID)== null)
					{
					//alert("NOT succesful");
					return;
					}
				var tblObj = document.getElementById(theTableID);
				var rowObjs = document.getElementById(theTableID).getElementsByTagName('TR');
				var olen = rowObjs.length;
				
				//var theFunction =function(){event.srcElement[OnFocusFunct]();}; //good working #1
				
				var i = 0;
				for(i=0; i<olen; i++)
					{
					rowObjs[i].tabIndex=0;
					if(OnFocusFunct != "")
						{
						
						// Take care of onfocus
						rowObjs[i].onfocus = rowObjs[i][OnFocusFunct];// also works #3
						// Take care of onblur
						rowObjs[i].onblur = rowObjs[i][OnFocusFunct];
						//----------------------------------
						//document.getElementById(rowlocation).style.cursor="hand";
						rowObjs[i].style.cursor="hand";
						
						//rowObjs[i].onfocus = rowObjs[i].onclick;// also works #2
						
						//rowObjs[i].onfocus = theFunction;  //good working #1 needs #1 above and pass 'click'
						
						//alert("onfocus funct added");
						}
					
					}
				
				}
				
				


			
//=============================================================================|







//************************SHOW BORDER ON FOCUS***************************
//************************HIDE BORDER ON BLUR***************************
function showborder(theImgControl)
{
var tmpFocus = theImgControl
document.getElementById(tmpFocus).border = 4;
}
function hideborder(theImgControl)
{
var tmpBlur = theImgControl
document.getElementById(tmpBlur).border = 0;
}

//************************CLICK FOCUSED ON KEYPRESS**(Enter)************
function clickFocused(btnfocused)
{
//need to check if it was 13 (Enter) pressed or not
//--------------
	if (document.layers)
    document.captureEvents(Event.KEYPRESS);
    
  document.onkeypress = function (evt)
   {
    var key = 
      document.all ? event.keyCode :
      evt.which ? evt.which : evt.keyCode;
      
      //alert("The keypress was captured :" + key )
    if (key == 13)
    {
		//alert("The keypress was captured :" + key ); 
		//document.formName.submit();
		var thefocused = btnfocused;
		//alert("the var btnfocused contains: " + btnfocused + "  :  " + thefocused); //--for testing
		var theImgObj = document.getElementById(thefocused);
		animateme(thefocused);
		theImgObj.click();
	}
         
  };
  }
  
//---------------------------------------------------------------------







//**********************CALL LOGOFF**on Browser close*************
//**********************************************************************
//----propose used by All.aspx pages -- enables user logoff when browser window closed by X button

function logOffOnX(logoffbtnID)
{
//alert("You are being logged off the CMTonline system");
alert("Logging off the CMTonline system");
 
var tmpWindow=window.open('Abandon.aspx','tmpWin','menubar=no scrollbars=no width=25 height=25 status=no resizable=no');
//tmpWindow.document.focus();

//BELOW NOT NEEDED ON LOGIN REQUEST PAGE
var btnObj = document.getElementById(logoffbtnID);
		btnObj.click();
		
//alert("You have been logged off the CMTonline system");
		
tmpWindow.close();		
}


		
//========================AUTO LOGOFF ON X CLOSE WINDOW======|
//===== VAR-ONXCLOSE()-ISBTN() work together ============|

		var btnClicked = false;
		
		//This is used in each BODY onunload event
		function onXclose()
		{
		if(!btnClicked)
			{
			//alert("Closing with X -- OR no button pushed");
			logOffOnX('btnLogoff2');
			}
		}
		
		
		//This is used in each button that is NOT going to Log off the SYStem
		// 
		function isBtn()
		{
		btnClicked = true;
		}
//============================================================|
	

//---------------------------------------------------------------------






//**********************CALL LOGINSCREEN**on initial request/login*************
//**********************************************************************
//----used by WELCOME.HTM -- calls Icontrol.aspx which calls login.html

//old LOGIN PAGE CALL
function loginscreen()
{
//location.replace("Login.html");
location.href="Icontrol.aspx"
}

//NEW LOGIN PAGE CALL
function LocHref(thepage)
{
//location.replace("Login.html");
//location.href="Icontrol.aspx"
location.href=""+thepage+"";
}		


//************************************************************************
//**************CALL LOGIN SCREEN from Bad Login Attempt******************
//----------used by NOTIFY.HTM-----------------------
function replacepage()
{		
location.replace("Login.html"); // is new for IFRAME --11:44 3/17/04		
//location.replace("");  // gives a FORBIDDEN error page
}
function replacepage2(thePage)
{		
location.replace(thePage); // is new for IFRAME --11:44 3/17/04		
//location.replace("");  // gives a FORBIDDEN error page
}

function replacepage3(thePage, theStyle)
{
var qryStr = "";
var hdnVal = "";
	if(theStyle != "")
	{
	hdnVal = document.getElementById(theStyle).value;
	
		if((hdnVal != "") && (hdnVal != null))
		{
		var end = hdnVal.lastIndexOf("."); //find end index
		hdnVal = hdnVal.substring(0,end); 
		qryStr = "?cssFile="+hdnVal;
		}
		
		if(hdnVal=="")
		{
		qryStr ="";
		}
	
	}		
location.replace(thePage+qryStr); // is new for IFRAME --11:44 3/17/04		
//location.replace("");  // gives a FORBIDDEN error page
//theColor = theVal.substring(8,theVal.length);
/*
var startHead = tmpHead.indexOf("<THEAD>");
		var endHead = tmpHead.lastIndexOf("</TABLE>");
		//alert("endHead " + endHead);
		//tmpHead = tmpHead.substring(0,endHead);
		tmpHead = tmpHead.substring(startHead,endHead);
		//alert("tmpHead " + tmpHead);
		if((theStyle != "") ||(theStyle==null) )
*/

}

//*********************FROM LOGIN.HTML***************************
/* Replaced below
function submittheform()
	{
		document.Form1.submit();	
	}
*/
function submittheform2(theForm)  //new form submit function
	{
	var tmpForm = theForm;
	document.getElementById(tmpForm).submit();	
	}
//-------------------------------
//---Specific to Login testing - will have to be removed in production

	/*
		function loaduser()
		{
		var passwords=new Array("","xxxa1","xxxb2","xxxcX","xxxdM","xxxxeX","xxxxgBAD");
		var sindex = 0;
		sindex = document.Form1.Suname.selectedIndex;		
		document.Form1.uName.value = document.Form1.Suname.options(sindex).text;		
		document.Form1.uPW.value = passwords[sindex];
		}
	*/
//------------------------------
//also used local animateme()
//-----------------------------

//=================================================================
//---------GRID CONTROL AND MYCONTROL3(3A).ASPX ----JS---START HERE
//--- ORIGINALLY FROM CMTwebDB3.js---------------------------------
//=================================================================

//++++++++++////////////////// MAIN GRID CODE BELOW /////////////////+++++++++++++++//
//************************GRID FUNCTIONS**********************************************
function sendmyid(locationID)
{

var tvalue = document.getElementById(locationID).getAttribute("value");

//alert("the location is: " + locationID + "  VALUE=:" + tvalue);
document.Form1.txtSelected.value =tvalue; //---------------special to the document
document.Form1.txtGrid.value =locationID; //---------------special to the document
//alert("the location is: " + locationID + "");
}

//---------------------------replaces function sendmyid(locationID)-------------
function g(locationID)
{

var tvalue = document.getElementById(locationID).getAttribute("value");

//alert("the location is: " + locationID + "  VALUE=:" + tvalue);
document.Form1.txtSelected.value =tvalue; //---------------special to the document
document.Form1.txtGrid.value =locationID; //---------------special to the document
//alert("the location is: " + locationID + "");
}
//------------------------------------------------------------------------------
//------------alternative to function g "IS d" ((MyControl3 only)) function g(locationID)--101404-----------
function d(locationID)
{

var tvalue = document.getElementById(locationID).getAttribute("value");
if (tvalue == null)
	{
	tvalue = document.getElementById(locationID).innerHTML;
	}
var strstart = locationID.indexOf("c") + 1;
//var strlen = locationID.length -(locationID.length - strstart + 1)
var strend = locationID.length;
var myparse = "x" + locationID.substring(strstart,strend);
var myparse2 = "t" + locationID.substring(strstart,strend);//--------added 101404

//alert("the myparse is: " + myparse + "");
//alert("the location is: " + locationID + "");

//alert("the location is: " + locationID + "  VALUE=:" + tvalue);
document.Form1.txtSelected.value =tvalue; //---------------special to the document
document.Form1.txtGrid.value =locationID; //---------------special to the document
//document.Form1.txtParsed.value = strend; //---------------special to the document

//NEED ON ERROR when there is no FilterTable on the page!!!!!!!!!

document.getElementById(myparse).setAttribute("value", tvalue);
document.getElementById(myparse2).scrollIntoView();//--------added 101404
tvalue = "";
//---------------later think about showdiv function here. Presently in 3.aspxtxtGridValue or txtSelected
//alert("the myparse is: " + myparse + "");
//alert("the location is: " + locationID + "");
}
//------------------------------------------------------------------------------
//------------alternative to function g "IS d" ((MyControl3 only)) function g(locationID)--101404-----------
function h(locationID)
{

//var tvalue = document.getElementById(locationID).getAttribute("value");
//if (tvalue == null)
//	{
//	tvalue = document.getElementById(locationID).innerHTML;
//	}

var strstart = locationID.indexOf("c") + 1;
//var strlen = locationID.length -(locationID.length - strstart + 1)
var strend = locationID.length;
//var myparse = "x" + locationID.substring(strstart,strend); // note that filter is T prefix for <a> tag name
var myparse = "t" + locationID.substring(strstart,strend); // note that filter is T prefix for <a> tag name

//alert("the Hmyparse is: " + myparse + "");


document.getElementById(myparse).scrollIntoView();
//document.getElementById(myparse).setAttribute("value", myparse);

//hideshowdiv('filterdiv');
showdiv('filterdiv');

//document.Form1.t1.focus();


}
//------------------------------------------------------------------------------

function sendrowidX(rowlocationID)
{
//var tvalue = document.getElementById(rowlocationID).style = 'bgcolor:red';
document.getElementById(rowlocationID).setAttribute("bgColor", "red");
//alert("the location is: " + rowlocationID + ""  );
}

//-------------------------replaces function sendrowidX(rowlocationID)------
//-----------??? Need to check if this is inside the tableMaker ??? -------- 
function rx(rowlocationID)
{
//var tvalue = document.getElementById(rowlocationID).style = 'bgcolor:red';
document.getElementById(rowlocationID).setAttribute("bgColor", "red");
//alert("the location is: " + rowlocationID + ""  );
}


//------------------------------------------------------------------------------
function sendrowid(rowlocationID)
{
var oldrow = document.Form1.Hidden1.value; //------The document must have this in it
//alert("Value of oldrow is : " + oldrow);
if(oldrow != "")
	{
	//alert("Should not reach here if oldrow : " + oldrow);
	document.getElementById(oldrow).removeAttribute("bgColor");
	}
document.getElementById(rowlocationID).setAttribute("bgColor", "DarkGray");
document.Form1.Hidden1.value =rowlocationID;

var newrow = document.Form1.Hidden1.value; //------The document must have this in it
//alert("Value of oldrow is : " + newrow);

}

//-----------------replaces - function sendrowid(rowlocationID)  ----------------
//############################################## DEV ########################################
function r_(rowlocationID)  // ###### NOT USED AT MOM
{
var oldrow = document.Form1.Hidden1.value; //------The document must have this in it
//alert("Value of oldrow is : " + oldrow);
if(oldrow != "")
	{
		
		alert("Should not reach here if oldrow : " + oldrow);
		document.getElementById(oldrow).removeAttribute("bgColor");
		
	
	}
document.getElementById(rowlocationID).setAttribute("bgColor", "DarkGray");
document.Form1.Hidden1.value =rowlocationID;

var newrow = document.Form1.Hidden1.value; //------The document must have this in it
//alert("Value of oldrow is : " + newrow);
document.Form1.PageRecSel.value = newrow;//------The document must have this in it -new 100804
//alert("Value of NEWrow/PageRecSel is : " + document.Form1.PageRecSel.value);
}
//############################################## DEV ########################################





//-----------------replaces - function sendrowid(rowlocationID)  ----------------
function r_seeDev(rowlocationID)
{
//alert("Before filling OldRow var");
var oldrow = document.Form1.Hidden1.value; //------The document must have this in it
//alert("Value of oldrow is : " + oldrow);
if(oldrow != "")
	{
	//alert("Should not reach here if oldrow : " + oldrow);
	document.getElementById(oldrow).removeAttribute("bgColor");
	}
document.getElementById(rowlocationID).setAttribute("bgColor", "DarkGray");
document.Form1.Hidden1.value =rowlocationID;

var newrow = document.Form1.Hidden1.value; //------The document must have this in it
//alert("Value of oldrow is : " + newrow);
document.Form1.PageRecSel.value = newrow;//------The document must have this in it -new 100804
//alert("Value of NEWrow/PageRecSel is : " + document.Form1.PageRecSel.value);
}


//-----------------DEV - function r(rowlocationID)  ---DEV----------
function r(rowlocationID)
{

//alert("Before filling OldRow var");
var oldrow = document.Form1.Hidden1.value; //------The document must have this in it

var testVal;
//testVal =document.getElementById(rowlocationID).style.getAttribute("background-color");
//testVal =document.getElementById(rowlocationID).style.getAttribute("bgColor");

//--------------- below works to recover css file name -----------------
//testVal =document.getElementsByTagName("LINK").item(1).getAttribute("href");
//alert("Value of testVal is : " + testVal);

if(oldrow != "")
	{
	
	//alert("Should not reach here if oldrow : " + oldrow);
	document.getElementById(oldrow).removeAttribute("bgColor");
	}
	
document.getElementById(rowlocationID).setAttribute("bgColor", "Blue");
document.Form1.Hidden1.value =rowlocationID;

//----returns a value but only after set by JS-----------------------
//testVal = document.getElementById(rowlocationID).getAttribute("bgColor");
//alert("Value of testVal is : " + testVal);

var newrow = document.Form1.Hidden1.value; //------The document must have this in it
//alert("Value of oldrow is : " + newrow);
document.Form1.PageRecSel.value = newrow;//------The document must have this in it -new 100804
//alert("Value of NEWrow/PageRecSel is : " + document.Form1.PageRecSel.value);
}

//===========================DEV OF R FUNCTION === END=================================



//***********************************************************************************************************

// *********************************************************************************************************
//-----------------adds to - function r(rowlocationID) above ----------------
//---   ******  --resets the highlight on row when page back or forward--------*****
// -- ******* -- it is called at bottom of HTML/aspx (body) by setTimeOut -- ******

function resetRow()
{
//alert("Value of oldrow is : " + oldrow);
//var oldrow = document.Form1.Hidden1.value; //------The document must have this in it
var oldrow = document.Form1.PageRecSel.value; //------The document must have this in it

//alert("Value of oldrow is : " + oldrow);
if(oldrow != "")
	{
	//alert("Should not reach here if oldrow : " + oldrow);
	//document.getElementById(oldrow).removeAttribute("bgColor");
	//document.getElementById(oldrow).setAttribute("bgColor", "DarkGray");
	document.getElementById(oldrow).setAttribute("bgColor", "Blue"); // matches with DEV above
	
	}
//document.getElementById(rowlocationID).setAttribute("bgColor", "DarkGray");
//document.Form1.Hidden1.value =rowlocationID;

//var newrow = document.Form1.Hidden1.value; //------The document must have this in it
//alert("Value of NEWrow is : " + newrow);
//PageRecSel
//document.Form1.PageRecSel.value = newrow;
document.Form1.Hidden1.value = oldrow;
}
//***********************************************************************************************************

//--------------------------------=========================-----------------------

//--------------------------MOVE SCOLL BARS WITH OTHER SCROLL BARS-----------------
		function follow_old()
		{
		//var a = document.Form1.Div2.applyElement(
		//document.Form1.Div1.scrollLeft=true;
		//document.getElementById('Div1').setAttribute("scrollLeft", 23);
		//document.Form1.Div1.replaceNode(document.Form1.Div2);
		//-----------------------
		var pos = document.getElementById('Div2').getAttribute("scrollLeft");
		document.getElementById('Div1').setAttribute("scrollLeft", pos);
		//document.getElementById('Span01').setAttribute("scrollLeft", pos);
		}
//----------------------------------------------------------------------
		function follow(leader, follower)
		{
		//-----------------------
		var pos = document.getElementById(leader).getAttribute("scrollLeft");
		document.getElementById(follower).setAttribute("scrollLeft", pos);
		//document.getElementById('Span01').setAttribute("scrollLeft", pos);
		}
			
//++++++++++++++++++++++++ END OF GRID FUNCTIONS ++++++++++++++++++++++

//***********************START GRID PAGE FUNCTIONS*********************
var intStatus;
function showlist(NameofList)
{
//intStatus = document.getElementById(NameofList).getAttribute("height");
//var intStatus = document.getElementById('lbxFieldsList').style.height;
var intStatus = document.getElementById(NameofList).style.height;
	
	if(parseInt(intStatus) >0)
	{
	document.getElementById(NameofList).style.height=0;
	}
	else
	{
	document.getElementById(NameofList).style.height=200;
	} 

//alert("My TEST MSG  " + intStatus);

}

//var intStatus;  //---needed?
function showFilter(NameofList)
{
//intStatus = document.getElementById(NameofList).getAttribute("height");
//var intStatus = document.getElementById('lbxFieldsList').style.height;
var intStatus = document.getElementById(NameofList).style.height;
	
	if(parseInt(intStatus) >0)
	{
	document.getElementById(NameofList).style.height=0;
	}
	else
	{
	document.getElementById(NameofList).style.height=200;
	} 

//alert("My TEST MSG  " + intStatus);

}


//---END--GRID CONTROL AND MYCONTROL3(3A).ASPX ----JS---END--------
//END-------END------END-------END-------END------END-------END----
//=================================================================	
	
	
	
//=============new stuff for---MYCONTROL3(3A).ASPX ==================
	
function maketable(theList, theDiv)     //working
{
//var myplate="";
var myplate = new String();
//style='table-layout:fixed; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid'
myplate += "<table border='1' class='txtbox' width='398' style='table-layout:fixed'>";
//myplate += "<table border='1' align='center' class='txtbox' style='table-layout:fixed' width='398'>";
//alert("Got Here");
var listcount = document.getElementById(theList).options.length;
var i = 0;
for(i = 0; i< listcount; i++)
{
myplate += "<tr>";
myplate += "<td width='30'>";
myplate += "" + i;
myplate += "</td>";
myplate += "<td width='218'>";
//var mytemptext = document.getElementById("Suname").options[i].text;
var mytemptext = document.getElementById(theList).options[i].text;

//myplate += "-- " + mytemptext;
myplate += mytemptext;
myplate += "</td>";
myplate += "<td width='150'>";
myplate += "<input type='text' id='param" + i + "'>";
myplate += "</td>";
myplate += "</tr>";
}
myplate +="</table>";
document.getElementById(theDiv).innerHTML = " " + myplate ;
}


//======================DIV HIDE SHOW========================
function hideshowdiv(theDivID)
{

var hstatus = document.getElementById(theDivID).style.height;
//alert("HSTATUS is:   " + hstatus);
if(parseInt(hstatus) > 1)
{
//document.getElementById(theDivID).style.width = 300; //---testing new vals - 101504
document.getElementById(theDivID).style.width = 570; //---orig- 101504
document.getElementById(theDivID).style.height = 1;
document.getElementById(theDivID).style.overflow = "hidden";
document.getElementById(theDivID).style.display = "none"
}
else
{
//document.getElementById(theDivID).style.width = 300; wrong
document.getElementById(theDivID).style.width = 570; 
//document.getElementById(theDivID).style.height = 100;//---testing new vals - 101504 --
document.getElementById(theDivID).style.height = 150;//---orig- 101504

document.getElementById(theDivID).style.overflow = "auto";
document.getElementById(theDivID).style.display = "inline"
//document.getElementById(theDivID).style.display = "inline"  //orig
//document.getElementById(theDivID).style.border = "black thin solid";
}
}
//====================================HIDE/SHOW DIV============================




//*******************************************************************************
//======================DIV HIDE SHOW OVERLOAD FOR HEIGHT========================
function hideshowdivHeight(theDivID,showHeight)
{
var hstatus = document.getElementById(theDivID).style.height;
//alert("HSTATUS is:   " + hstatus);
  if(parseInt(hstatus) > 1)
	{
	//document.getElementById(theDivID).style.width = 300; //---testing new vals - 101504
	document.getElementById(theDivID).style.width = 570; //---orig- 101504
	document.getElementById(theDivID).style.height = 1;
	document.getElementById(theDivID).style.overflow = "hidden";
	document.getElementById(theDivID).style.display = "none"
	}
  else
	{
	//document.getElementById(theDivID).style.width = 300; wrong
	document.getElementById(theDivID).style.width = 570; 
	document.getElementById(theDivID).style.height = showHeight;//---testing new vals - 101504 --
	//document.getElementById(theDivID).style.height = 150;//---orig- 101504

	document.getElementById(theDivID).style.overflow = "auto";
	document.getElementById(theDivID).style.display = "inline"
	//document.getElementById(theDivID).style.display = "inline"  //orig
	//document.getElementById(theDivID).style.border = "black thin solid";
	}
}
//====================================HIDE/SHOW DIV with HEIGHT===================







//============================NEW HIDE and NEW SHOW============================
//*****************************************************************************
//=============================HIDE DIV========================================
function hidediv(theDivID)
{

var hstatus = document.getElementById(theDivID).style.height;
//alert("HSTATUS is:   " + hstatus);
if(parseInt(hstatus) > 1)
{
//document.getElementById(theDivID).style.width = 300; //---testing new vals - 101504
document.getElementById(theDivID).style.width = 570; //---orig- 101504
document.getElementById(theDivID).style.height = 1;
document.getElementById(theDivID).style.overflow = "hidden";
document.getElementById(theDivID).style.display = "none"
}

}
//=============================================================================






//=============================SHOW DIV========================================
function showdiv(theDivID)
{

var hstatus = document.getElementById(theDivID).style.height;
//alert("HSTATUS is:   " + hstatus);
if(parseInt(hstatus) <= 1)
{
//document.getElementById(theDivID).style.width = 300; wrong
document.getElementById(theDivID).style.width = 570; 
//document.getElementById(theDivID).style.height = 100;//---testing new vals - 101504 --
document.getElementById(theDivID).style.height = 65;//---orig- 101504

document.getElementById(theDivID).style.overflow = "auto";
document.getElementById(theDivID).style.display = "inline"
//document.getElementById(theDivID).style.display = "inline"  //orig
//document.getElementById(theDivID).style.border = "black thin solid";
}
}
//=============================================================================

//================END=========NEW HIDE and NEW SHOW==========END===============



//=============================================================================
//=====================GET AND SET VALUES OF 'ORDERBY' CHECKBOXES==============
function doorder(theCheckbox,chbname)
{
var chbplate ="";

var chbinttest1 = 0;
var chbstrtest1 = "";
var chbinttest2 = 0;
var chbstrtest2 = "";

var chbintval = 0;
var chbvalue ="0"; //-----------------new mod from"" to "0"
chbvalue = document.getElementById(theCheckbox).value;
chbintval = parseInt(chbvalue);

var chbCount = 0;
chbCount = document.getElementsByName(chbname).length;

   if(document.getElementById(theCheckbox).checked)
	{
	//Give the value a number determined from the numbers already assigned
	var i = 0;
	for(i=0; i<chbCount; i++)
	{
		chbstrtest1 = document.getElementsByName(chbname).item(i).value;
		if(chbstrtest1 !="")
		//if(chbstrtest1 !="0")//------------------new mod
		
		{
		chbinttest1 = parseInt(chbstrtest1);
			if(chbinttest2<chbinttest1)
			{
			chbinttest2 = chbinttest1;
			}			
		}	
	}//--- end FOR
	document.getElementById(theCheckbox).value = "" + (chbinttest2 + 1);
	
	var divname1 = "d" + theCheckbox;//---new for dchb
	//document.getElementById(divname1).innerHTML = "" + (chbinttest2 + 1); //---new for dchb
	document.getElementById(divname1).innerText = "" + (chbinttest2 + 1); //---new for dchb
	
	//-//-----------for testing ---------------
	//chbvalue = document.getElementById(theCheckbox).value;
	//alert(" The new Value of the chbx is:   " + chbvalue);	
	}//---end IF

   else
	{//---start ELSE
	var divname1 = "d" + theCheckbox;
	//document.getElementById(divname1).innerHTML = "0"; //---new for dchb
	//document.getElementById(divname1).innerText = "0"; //---new for dchb
	document.getElementById(divname1).value = "0"; //---new for txtchb

	//document.getElementById(theCheckbox).value = "";
	document.getElementById(theCheckbox).value = "0"; //-------------------new mod from"" to "0"
	//++++++++++++++++++++++++
	var i = 0;
	for(i=0; i<chbCount; i++)
	{//---start FOR
		chbstrtest1 = document.getElementsByName(chbname).item(i).value;
		if(chbstrtest1 !="")
		{
		chbinttest1 = parseInt(chbstrtest1);
			if(chbinttest1>chbintval)
			{
			var newval = parseInt(document.getElementsByName(chbname).item(i).value) -1;
			document.getElementsByName(chbname).item(i).value = newval;
			
			var divname2 = "dchb" + i; //hard coded name!//---new for dchb
			//document.getElementById(divname2).innerHTML = newval;//---new for dchb
			//document.getElementById(divname2).innerText = newval;//---new for dchb
			document.getElementById(divname2).value = newval; //---new for txtchb
			}
		}	
	}//---end FOR
	}//---end ELSE

//--//--------TEST------------Prints out the results---------TEST------------
/*
	var i = 0;
	for(i=0; i<chbCount; i++)
	{
		chbplate += " chbx# " + i + " = "
		chbplate += document.getElementsByName(chbname).item(i).value;
		chbplate += " <br> "
	
	}
document.getElementById("divrowresult").innerHTML = " The Values of the chbx are: <br>  " + chbplate;
*/
//--//-------END TEST---------Print out results-------------END TEST---------

}  //------------------------------------end of FUNCTION
//========================================================================
//========================END======get-set orderby chbxs=========================







//======================START =========== GET SELECTED INDEX for HTML Select controls =============
//============================used by 3a===========================================================

		function findSelIndex(selListbox, selHiddenIndex)
		{
		//alert("Function called")
		//alert("the value of Hidden :" + document.getElementById(selHiddenIndex).value);
		
		var selected;
		//alert(selected);
		
		selected = document.getElementById(selListbox).selectedIndex;
		
		//selected = document.getElementById(selListbox).getAttribute(selectedIndex);
		//document.Form1.lbxSelDetail2.selectedIndex;
		
		//alert(selected);
		//document.getElementById(selHiddenIndex).getAttribute(value) = selected;
		document.getElementById(selHiddenIndex).value = selected;
		//document.Form1.hiddenIndex.value;
		//TESTING
		//alert("the value of Hidded :" + document.getElementById(selHiddenIndex).value);
		
		}
//======================END   =========== GET SELECTED INDEX for HTML Select controls =============
//============================used by 3a===========================================================







//======================START =========== SET SELECTED INDEX for HTML Select controls =============
//============================used by 3a===========================================================

		function SetSelIndex(selListboxSource, selListboxTarget)
		{
		//alert("the value of Hidded :" + document.getElementById(selHiddenIndex).value);
		
		var selected;
		//alert(selected);
		
		selected = document.getElementById(selListboxSource).selectedIndex;
		
		//selected = document.getElementById(selListbox).getAttribute(selectedIndex);
		//document.Form1.lbxSelDetail2.selectedIndex;
		
		//alert(selected);
		//document.getElementById(selHiddenIndex).getAttribute(value) = selected;
		document.getElementById(selListboxTarget).selectedIndex = selected;
		//document.Form1.hiddenIndex.value;
		//TESTING
		//alert("the value of Hidded :" + document.getElementById(selHiddenIndex).value);
		
		}
//======================END   =========== GET SELECTED INDEX for HTML Select controls =============
//============================used by 3a===========================================================
	
	
	
	
	
	
//=========================used by Order1.aspx==============================
function insertThisThere(sendCtrl,rcvCtrl)
{
var theVal = document.getElementById(sendCtrl).value;
document.getElementById(rcvCtrl).value = theVal;
}	
//=========================used by Order1.aspx==============================	
	
	
	
	
	
	
function CMTwindow(docURL)
{
//alert('the passed page URL is: ' + docURL);
//var newWindow1=window.open('" + nUrl + "','" + windowname + "');newWindow1.document.focus();"
var newWindow1=window.open(docURL,'CMTwindow','menubar=no scrollbars=yes width=660 height=600 status=yes');
newWindow1.document.focus();
}


function CMThelp(docURL)
{
window.name = 'cmtopener';
//alert('the passed page URL is: ' + docURL);
//var newWindow1=window.open('" + nUrl + "','" + windowname + "');newWindow1.document.focus();"
var newWindow2=window.open(docURL,'CMThelp','menubar=no scrollbars=yes width=550 height=500 status=yes resizable=yes');
newWindow2.document.focus();
}

function CMTimage(imageURL)
{
window.name = 'cmtopener';
//alert('the passed page URL is: ' + docURL);
//var newWindow1=window.open('" + nUrl + "','" + windowname + "');newWindow1.document.focus();"
//var newWindow3=window.open(docURL,'CMTimage','menubar=no scrollbars=yes width=550 height=500 status=yes resizable=yes');
var newWindow3=window.open('','CMTimage','menubar=no scrollbars=yes width=550 height=500 status=yes resizable=yes');
var imageScript = "";
var ijs = "";
imageScript = "<html><head></head><body><input type='hidden' id='hdnimg'><img id='cmtimg' src=''> </body></html>"
newWindow3.document.write(imageScript);
newWindow3.document.focus();
}

function CloseHelp_063005()
{
var newWindow2=window.open('','CMThelp','menubar=no scrollbars=no width=100 height=100 status=no resizable=no');
newWindow2.close();
}

function CloseHelp()
{
var newWindow2=window.open('','CMThelp','menubar=no scrollbars=no width=50 height=50 status=no resizable=no');
newWindow2.close();
var newWindow3=window.open('','CMTsmlPop','menubar=no scrollbars=no width=50 height=50 status=no resizable=no');
newWindow3.close();

}

function CloseHelp2()
{//------- called by the help page in a "setInterval( 'CloseHelpLocal()',2000);"
//var openName = window.opener.name;
//alert('Opener Name Is: ' + openName );
//var mytest = window.parent.open
//var mytest = window.opener.name
var mytest = window.opener.closed

//alert("ParentClosed "+ mytest);
//if(window.opener.name != "cmtopener")
if(window.opener.closed)
	{
	window.close();
	}
}


	
	
	
//PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
//================================================================================
//====================PRINT EASY V1===============================================
//================================================================================
	//------------test scripts-----
		function PrintEasyV3()
		{		
		var printPlate = "";
		alert("PrintPlate is : " + printPlate);
		////printPlate = document.Form1.Div2.innerHTML;
		//printPLate = document.getElementById("Div2").innerHTML;
		//printPLate = document.getElementById("Table1").innerHTML;
		//printPLate = document.getElementById("Div2").Text;
		//printPLate = document.getElementById("Div1").innerHTML;
		
		//printPlate = document.Form1.Div1.innerHTML;
		//printPlate = document.Form1.dataTable.innerHTML;
		
		//printPlate = document.getElementById("r0c0").innerHTML; //---works
		//printPlate = document.getElementById("Div1").innerHTML; //---works
		//printPlate = document.getElementById("Div2").innerHTML; //---works
		//printPlate = document.getElementById("Div3").innerHTML; //---works
		
		//---------------actual code required v1 -----------------------
		printPlate += document.getElementById("Div1").innerHTML; //---works
		printPlate += document.getElementById("Div2").innerHTML; //---works
		//printPlate += document.getElementById("Div3").innerHTML; //---works
		//-----------------------------------------------------------
		
		alert("PrintPlate after is : " + printPlate);
		
		//var pwindow = window.open("","PrintWindow");
		var pwindow = window.open("CMTPrint.html","PrintWindow");
		
		printPlate += " <input type='Button' value = 'Print' onclick='pagePrint();'>"
		
		pwindow.document.getElementById("divPrint").innerHTML = printPlate;
		
		//<input type='Button' value = 'Print' onclick='pagePrint();'>
		//CMTPrint.html
		
		//pwindow.document.write(printPlate);
		////pwindow.document.write("wheres my printPlate");
		pwindow.document.focus(); 
		
		/////REF:
		/////var newWindow1=window.open(docURL,'CMTwindow','menubar=no scrollbars=yes width=660 height=600 status=yes');
		/////newWindow1.document.focus();
		}		
		//-----------------------------	
		
		
		
		
		
		
		function WordPrint() //PrintEasyV1()$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$UNDER DEV	
		{
		//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$UNDER DEV		
		var printPlate = "";
		//alert("PrintPlate is : " + printPlate);
		////printPlate = document.Form1.Div2.innerHTML;
		//printPLate = document.getElementById("Div2").innerHTML;
		//printPLate = document.getElementById("Table1").innerHTML;
		//printPLate = document.getElementById("Div2").Text;
		//printPLate = document.getElementById("Div1").innerHTML;
		
		//printPlate = document.Form1.Div1.innerHTML;
		//printPlate = document.Form1.dataTable.innerHTML;
		
		//printPlate = document.getElementById("r0c0").innerHTML; //---works
		//printPlate = document.getElementById("Div1").innerHTML; //---works
		//printPlate = document.getElementById("Div2").innerHTML; //---works
		//printPlate = document.getElementById("Div3").innerHTML; //---works
		
		//---------------actual code required v1 -----------------------
		//--
		printPlate += "<div id=\"divInfo\" style=\"DISPLAY: inline; WIDTH: 0px; HEIGHT: 0px; BACKGROUND-COLOR: yellow\"></div>"
		//--
		
		printPlate += document.getElementById("Div1").innerHTML; //---works
		printPlate += document.getElementById("Div2").innerHTML; //---works
		
		
		//alert("PrintPlate after is : " + printPlate);
		
		var pwindow = window.open("","SaveWindow");
		
		//---------------------->
		//var saveCtrl ="";
		//saveCtrl += "<BUTTON onclick=\"document.execCommand('SaveAs', true, 'ExcelCopy');\" unselectable=\"on\">Click to Save</BUTTON>";
		
		//saveCtrl += "";
		
		//----------------------|
		//---------------------->
		/*
		var saveCtrl ="";
		saveCtrl += "<script>";
		
		saveCtrl += "document.execCommand('SaveAs', true, 'ExcelCopy');";
		saveCtrl += "</script>";
		saveCtrl += "";
		*/
		//----------------------|
		//---------------------->
		
		var saveCtrl ="";
		saveCtrl += "<script>";
		saveCtrl += "function autoSave(){";
		
		//saveCtrl += "var testUrl = document.referrer;";
		saveCtrl += "var testWindow = window.name;";

		//saveCtrl += "alert('var testWindow = : ' + testWindow);";
		
		saveCtrl += "var i = testWindow.indexOf('SaveWindow');";
		//saveCtrl += "alert('var i = : ' + i);";
		
		saveCtrl += "  if(i > -1){"
		saveCtrl += "  document.execCommand('SaveAs', true, 'ExcelCopy');";
		saveCtrl += "  window.close();";
		
		saveCtrl += "   }";
		//--------
		saveCtrl += "else{";
		saveCtrl += "var helpMsg = \"!! EXCEL EXPORT INSTRUCTIONS !!<br>\";";
		saveCtrl += "helpMsg += \"Right click mouse inside the main table and then select 'Export to Microsoft Excel' from the choices.\";";
		saveCtrl += "document.getElementById(\"divInfo\").innerHTML = helpMsg;";
		saveCtrl += "document.getElementById(\"divInfo\").style.width = 570;";
		saveCtrl += "document.getElementById(\"divInfo\").style.height = 65;";
		saveCtrl += "}";
		//----------------------------->
		/*
		 else
		{
		var helpMsg = "!! EXCEL EXPORT INSTRUCTIONS !!<br>";

		helpMsg += "Right click mouse inside the main table and then ";
		helpMsg += " select 'Export to Microsoft Excel' from the choices.";
		document.getElementById("divInfo").innerHTML = helpMsg;
		document.getElementById("divInfo").style.width = 570; 
		document.getElementById("divInfo").style.height = 65;
		}
		*/
		//-----------------------------|
		//--------
		saveCtrl += "}";
		saveCtrl += "window.setTimeout('autoSave()', 300);";
		
		saveCtrl += "</script>";
		saveCtrl += "";
		//var i = string.indexOf(text);
		//----------------------|
		
		//pwindow.document.write(printPlate);
		//pwindow.document.write(saveCtrl + printPlate);
		pwindow.document.write(printPlate+ saveCtrl);
		
		////pwindow.document.write("wheres my printPlate");
		
		
		pwindow.document.focus(); 
		
		/////REF:
		/////var newWindow1=window.open(docURL,'CMTwindow','menubar=no scrollbars=yes width=660 height=600 status=yes');
		/////newWindow1.document.focus();
		}		
		//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ UNDER DEV END $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$






	//------------test scripts-----
		function PrintEasy_V1() //PrintEasyV1()
		{		
		var printPlate = "";
		//alert("PrintPlate is : " + printPlate);
		////printPlate = document.Form1.Div2.innerHTML;
		//printPLate = document.getElementById("Div2").innerHTML;
		//printPLate = document.getElementById("Table1").innerHTML;
		//printPLate = document.getElementById("Div2").Text;
		//printPLate = document.getElementById("Div1").innerHTML;
		
		//printPlate = document.Form1.Div1.innerHTML;
		//printPlate = document.Form1.dataTable.innerHTML;
		
		//printPlate = document.getElementById("r0c0").innerHTML; //---works
		//printPlate = document.getElementById("Div1").innerHTML; //---works
		//printPlate = document.getElementById("Div2").innerHTML; //---works
		//printPlate = document.getElementById("Div3").innerHTML; //---works
		
		//---------------actual code required v1 -----------------------
		//--
		printPlate += "<div id=\"divInfo\" style=\"DISPLAY: inline; WIDTH: 0px; HEIGHT: 0px; BACKGROUND-COLOR: yellow\"></div>"
		//--
		
		printPlate += document.getElementById("Div1").innerHTML; //---works
		printPlate += document.getElementById("Div2").innerHTML; //---works
		//printPlate += document.getElementById("Div3").innerHTML; //---works
		//-----------------------------------------------------------
		
		//alert("PrintPlate after is : " + printPlate);
		
		var pwindow = window.open("","SaveWindow");
		
		//---------------------->
		//var saveCtrl ="";
		//saveCtrl += "<BUTTON onclick=\"document.execCommand('SaveAs', true, 'ExcelCopy');\" unselectable=\"on\">Click to Save</BUTTON>";
		
		//saveCtrl += "";
		
		//----------------------|
		//---------------------->
		/*
		var saveCtrl ="";
		saveCtrl += "<script>";
		
		saveCtrl += "document.execCommand('SaveAs', true, 'ExcelCopy');";
		saveCtrl += "</script>";
		saveCtrl += "";
		*/
		//----------------------|
		//---------------------->
		
		var saveCtrl ="";
		saveCtrl += "<script>";
		saveCtrl += "function autoSave(){";
		
		//saveCtrl += "var testUrl = document.referrer;";
		saveCtrl += "var testWindow = window.name;";

		//saveCtrl += "alert('var testWindow = : ' + testWindow);";
		
		saveCtrl += "var i = testWindow.indexOf('SaveWindow');";
		//saveCtrl += "alert('var i = : ' + i);";
		
		saveCtrl += "  if(i > -1){"
		saveCtrl += "  document.execCommand('SaveAs', true, 'ExcelCopy');";
		saveCtrl += "  window.close();";
		
		saveCtrl += "   }";
		//--------
		saveCtrl += "else{";
		saveCtrl += "var helpMsg = \"!! EXCEL EXPORT INSTRUCTIONS !!<br>\";";
		saveCtrl += "helpMsg += \"Right click mouse inside the main table and then select 'Export to Microsoft Excel' from the choices.\";";
		saveCtrl += "document.getElementById(\"divInfo\").innerHTML = helpMsg;";
		saveCtrl += "document.getElementById(\"divInfo\").style.width = 570;";
		saveCtrl += "document.getElementById(\"divInfo\").style.height = 65;";
		saveCtrl += "}";
		//----------------------------->
		/*
		 else
		{
		var helpMsg = "!! EXCEL EXPORT INSTRUCTIONS !!<br>";

		helpMsg += "Right click mouse inside the main table and then ";
		helpMsg += " select 'Export to Microsoft Excel' from the choices.";
		document.getElementById("divInfo").innerHTML = helpMsg;
		document.getElementById("divInfo").style.width = 570; 
		document.getElementById("divInfo").style.height = 65;
		}
		*/
		//-----------------------------|
		//--------
		saveCtrl += "}";
		saveCtrl += "window.setTimeout('autoSave()', 300);";
		
		saveCtrl += "</script>";
		saveCtrl += "";
		//var i = string.indexOf(text);
		//----------------------|
		
		//pwindow.document.write(printPlate);
		//pwindow.document.write(saveCtrl + printPlate);
		pwindow.document.write(printPlate+ saveCtrl);
		
		////pwindow.document.write("wheres my printPlate");
		
		
		pwindow.document.focus(); 
		
		/////REF:
		/////var newWindow1=window.open(docURL,'CMTwindow','menubar=no scrollbars=yes width=660 height=600 status=yes');
		/////newWindow1.document.focus();
		}		
		//-----------------------------
		
		
		
		
		//HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
		//HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
		//HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
		
		
		
		
		
		//================== PRINT EASY MODAL ===============================>
		
//-------------------MERGE HEADER AND BODY OF TABLE------------------------AUX TO BELOW------
//-------------------MERGE HEADER BODY END-----------------------------------------------------





//****************************************************************************************
//****************************************************************************************
// ---- Word/Excel Ver ---****************************************************************
		function PrintEasy_outfortest() //PrintEasyV1() ---- ---- Word/Excel Ver -- CURRENT IN USE
		{
		
		//#--
		var tmpHead = "";
		var tmpBody = "";		
		var printPlate = "";
		
		//var saveName = document.getElementById("lblPageHeader").innerHTML;
		//alert("FileName is: " + saveName);
		
		var d, s = "";
		d = new Date();
		s += (d.getMonth() + 1);
		s += "_";
		s += d.getDate();
		s += "_";
		
		var subyear = "";
		subyear = d.getYear(); 
		//s += subyear.substr(2);
		//subyear = subyear.substring(2,3);
		s += subyear;
		
		//s += d.getYear();
		s += d.getHours();
		s += d.getMinutes();
		s += "_";
		s += d.getSeconds();

		//alert(" Date is: " + s);
		//alert(" ParsedDate is: " + Date.parse(s));
		printPlate += "<title>cmt" + s + "</title>";
		
		
		printPlate += "<div id=\"divInfo\" style=\"DISPLAY: inline; WIDTH: 0px; HEIGHT: 0px; BACKGROUND-COLOR: yellow\"></div>"
		
		//#--
		//tmpHead = += document.getElementById("Div1").innerHTML;
		//tmpBody = += document.getElementById("Div2").innerHTML;
		
		//printPlate += document.getElementById("Div1").innerHTML; //---works
		//printPlate += document.getElementById("Div2").innerHTML; //---works
		//printPlate += document.getElementById("Div3").innerHTML; //---works
		
		//**************new PRRINT PLATE****************
		tmpHead = document.getElementById("Div1").innerHTML;
		var startHead = tmpHead.lastIndexOf("</TABLE>");
		//alert("startHead" + startHead);
		tmpHead = tmpHead.substring(0,startHead);
		//alert("tmpHead" + tmpHead);
		
		tmpBody = document.getElementById("Div2").innerHTML;
		var startBody = tmpBody.indexOf("<TBODY>");
		//alert("startBody" + startBody);
		tmpBody = tmpBody.substring(startBody,tmpBody.length);
		//alert("tmpBody" + tmpBody);
		
		printPlate += tmpHead + tmpBody;
		//**********************************************
		
		//-----------------------------------------------------------
		var pwindow = window.open("","SaveWindow");
		
		var saveCtrl = "";
		saveCtrl += "<script>";
		
		//-----------added --- to ovecome script error RowSelect------------------->
		saveCtrl += "function r(rowNo){";
		saveCtrl += "var tagcnt =document.getElementsByTagName(\"TR\").length;";
		saveCtrl += "if(tagcnt > 1)";
		saveCtrl += "{";//if tag count
		saveCtrl += "var trItem = 0;";
		saveCtrl += "for(trItem=1; trItem < tagcnt; trItem++)";
		saveCtrl += "{";//for loop
		saveCtrl += "var tmpobj = document.getElementsByTagName(\"TR\").item(trItem);";
		//saveCtrl += "tmpobj.tabIndex=(trItem+1);"; //enables focus
		saveCtrl += "tmpobj.removeAttribute(\"bgColor\");";//removes the high lite
		saveCtrl += "";
		saveCtrl += "}";//for loop
		saveCtrl += "}";//if tag count
		saveCtrl += "document.getElementById(rowNo).setAttribute(\"bgColor\", \"DarkGray\");";
		saveCtrl += "}";//end function
		//-----------added --- to ovecome script error RowSelect-------------------|
		
		//-----------added --- to ovecome script error GridSelect------------------->
		saveCtrl += "function g(coords){}"; // for g_funtioned cells -empty functions
		saveCtrl += "function d(coords){}"; // for d_funtioned cells		
		//-----------added --- to ovecome script error GridSelect-------------------|
		
		//saveCtrl += "var ans = \"nothing\";";
		
		
		//-------domodal------------
		saveCtrl += "function doDialog(themsg)";
		saveCtrl += "{";
		saveCtrl += "var x=showModalDialog('ExportDialog.htm',themsg,'status:no;resizable:yes; dialogWidth:500px; dialogHeight:300px; help:no');";
		saveCtrl += "return x;";
		saveCtrl += "}";
		//-------domodal------------
		
		
		//-------domodal message ---
		saveCtrl += "function domessage()";
		saveCtrl += "{";
		saveCtrl += "var msg = \"This document must be saved to your PC if you wish to export the information.\";";
		saveCtrl += "msg += \" Click one of the file type options to open the save dialog box.\";";
		saveCtrl += "msg += \"  Then Click 'Save' to export the document to your computer.<br><br>\";";
		
		saveCtrl += "msg += \" To only view this page click 'View'.<br><br>\";";
		saveCtrl += "msg += \" NOTE: Excel and Word Exporting is not always possible on pre XP systems.\";";
		saveCtrl += "return msg;";
		saveCtrl += "}";	
		//----------msg----->
		//----------------------------->
		//-------domodal message ---|
		
		saveCtrl += "function autoSave(){";
		//saveCtrl += "alert('reached autosave');";
		saveCtrl += "var saveName = document.getElementsByTagName(\"title\").item(0).innerHTML;";
		//saveCtrl += "alert('saveName ' + saveName);";
		saveCtrl += "var testWindow = window.name;";
		saveCtrl += "var i = testWindow.indexOf('SaveWindow');";
		
		saveCtrl += "  if(i > -1){";//------------SAVEWINDOW therefore live document
		//saveCtrl += "alert('i = ' + i);";
		//----------new decision structure --+code------------->
		saveCtrl += "var modmsg = domessage();";
		//----
		saveCtrl += "var ans;";
		saveCtrl += "ans=doDialog(modmsg);";
		//saveCtrl += "alert(\"ans = \" + ans);";
		//saveCtrl += "{";
		
		//saveCtrl += "if(ans==\"save\"){document.execCommand('SaveAs', true, 'ExcelCopy');window.close();}";
		
		
		//-----------WORD-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		//saveCtrl += "if(ans==\"saveW\"){document.execCommand('SaveAs', true, 'table.doc');";
		saveCtrl += "if(ans==\"saveW\"){document.execCommand('SaveAs', true, saveName + '.doc');";
		saveCtrl += "window.close();";
		saveCtrl += "}";
		//-----------WORD-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
		
		//-----------HTML-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		//saveCtrl += "if(ans==\"saveH\"){document.execCommand('SaveAs', true, 'table.htm');";
		saveCtrl += "if(ans==\"saveH\"){document.execCommand('SaveAs', true, saveName + '.htm');";
		saveCtrl += "window.close();";
		saveCtrl += "}";
		//-----------HTML-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
		
		//-----------XLS--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		//saveCtrl += "if(ans==\"saveX\"){document.execCommand('SaveAs', true, 'table.xls');";
		saveCtrl += "if(ans==\"saveX\"){document.execCommand('SaveAs', true, saveName + '.xls');";
		saveCtrl += "window.close();";
		saveCtrl += "}";
		//-----------XLS--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
		
		//-----------VIEW--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		saveCtrl += "if(ans==\"view\"){}";
		
		//-----------CNCL--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		saveCtrl += "if(ans==\"cancel\"){window.close();}";
		
		//-----------CLOSE-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		saveCtrl += "if(ans==null){window.close();}";
		
	
		saveCtrl += "";
		//----------new decision structure --+code---------------|
		//saveCtrl += "  document.execCommand('SaveAs', true, 'ExcelCopy');";
		//saveCtrl += "  window.close();";
		saveCtrl += "   }";//outer if
		
		//--------
		saveCtrl += "else{";	//-----------SAVEWINDOW not present therefore is a Saved Document
		saveCtrl += "var helpMsg = \"!! EXCEL EXPORT INSTRUCTIONS !!<br>\";";
		saveCtrl += "helpMsg += \"Right click mouse inside the main table and then select 'Export to Microsoft Excel' from the choices.\";";
		saveCtrl += "document.getElementById(\"divInfo\").innerHTML = helpMsg;";
		saveCtrl += "document.getElementById(\"divInfo\").style.width = 570;";
		saveCtrl += "document.getElementById(\"divInfo\").style.height = 65;";
		saveCtrl += "}";//else
		//----------------------------->
		
		
		saveCtrl += "}";
		saveCtrl += "window.setTimeout('autoSave()', 500);";
		
		saveCtrl += "</script>";
		saveCtrl += "";
		
		//++++++++++++++++++ writes all to export page +++++++++++++++++
		pwindow.document.write(printPlate+ saveCtrl);
		pwindow.document.focus(); 
		
		}			
//=============================== PRINT EASY MODAL =========================================|
		
//ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
//ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
//ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

//****************************************************************************************
//****************************************************************************************
// ---- Word/Excel Ver ---****************************************************************
		function PrintEasy_outfornewtest() //PrintEasyV1() ---- ---- Word/Excel Ver -- CURRENT TEST IN USE 042005
		{
		
		//#--
		var tmpHead = "";
		var tmpBody = "";
		//--------------
		var tmpFoot = ""; // ---------new
		var tmpCSS = ""
		var tmpInsert = "INSERTED INFO"
		tmpInsert = document.getElementById("divExport").innerHTML;
		//--------------		
		var printPlate = "";
		
		//var saveName = document.getElementById("lblPageHeader").innerHTML;
		//alert("FileName is: " + saveName);
		
		var d, s = "";
		d = new Date();
		s += (d.getMonth() + 1);
		s += "_";
		s += d.getDate();
		s += "_";
		
		var subyear = "";
		subyear = d.getYear(); 
		//s += subyear.substr(2);
		//subyear = subyear.substring(2,3);
		s += subyear;
		
		//s += d.getYear();
		s += d.getHours();
		s += d.getMinutes();
		s += "_";
		s += d.getSeconds();

		//alert(" Date is: " + s);
		//alert(" ParsedDate is: " + Date.parse(s));
		printPlate += "<title>cmt" + s + "</title>";
		
		
		printPlate += "<div id=\"divInfo\" style=\"DISPLAY: inline; WIDTH: 0px; HEIGHT: 0px; BACKGROUND-COLOR: yellow\"></div>"
		
		//#--
		//tmpHead = += document.getElementById("Div1").innerHTML;
		//tmpBody = += document.getElementById("Div2").innerHTML;
		
		//printPlate += document.getElementById("Div1").innerHTML; //---works
		//printPlate += document.getElementById("Div2").innerHTML; //---works
		//printPlate += document.getElementById("Div3").innerHTML; //---works
		
		//**************new PRRINT PLATE****************
		
		//tmpInsert = document.getElementById("DivExport").innerHTML;
		
		//---------
		tmpCSS = document.getElementById("Div1").innerHTML;
		var endCSS = tmpCSS.indexOf("<TABLE");
		tmpCSS = tmpCSS.substring(0,endCSS);
		alert("tmpCSS " + tmpCSS);
		//---------
		
		tmpHead = document.getElementById("Div1").innerHTML;
		
		
		var startHead = tmpHead.indexOf("<THEAD>");
		var endHead = tmpHead.lastIndexOf("</TABLE>");
		//alert("endHead " + endHead);
		//tmpHead = tmpHead.substring(0,endHead);
		tmpHead = tmpHead.substring(startHead,endHead);
		//alert("tmpHead " + tmpHead);
		
		tmpBody = document.getElementById("Div2").innerHTML;
		var startBody = tmpBody.indexOf("<TBODY>");
		//alert("startBody " + startBody);
		tmpBody = tmpBody.substring(startBody,tmpBody.length); //--orig
		//alert("tmpBody" + tmpBody);
		
		
		
		
		//---------------
		//var endBody = tmpBody.lastIndexOf("</TABLE>")
		//alert("endBody " + endBody);
		//tmpBody = tmpBody.substring(startBody,endBody); //--new
		//alert("tmpBody " + tmpBody);
		
		
		tmpFoot = document.getElementById("Div3").innerHTML;
		//alert("tmpFoot BEFORE " + tmpFoot);
		//var startFoot = tmpFoot.indexOf("<TFOOT>");
		var startFoot = 0;
		var endFoot =tmpFoot.indexOf("<TBODY>");
		//alert("startFoot and Endfoot " + startFoot + "  "+ endFoot);
		//tmpFoot = tmpFoot.substring(startFoot,tmpFoot.length);
		tmpFoot = tmpFoot.substring(startFoot,endFoot);

		//alert("tmpFoot AFTER" + tmpFoot);
		//function replace(string,text,by)
		tmpFoot=replace(tmpFoot,"<TFOOT>","<THEAD>")
		tmpFoot=replace(tmpFoot,"</TFOOT>","</THEAD>")
		//alert("tmpFoot AFTER replace" + tmpFoot);
		//var tmpInsert = "I inserted this"
		tmpFoot=replace(tmpFoot,">Rec","><H4>" + tmpInsert + "</H4> --- Rec")
		//alert("tmpFoot AFTER replace REC" + tmpFoot);
		//---------------
		
		
		
		
		
		//printPlate += tmpHead + tmpBody;
		printPlate += tmpCSS + tmpFoot + tmpHead + tmpBody;
		
		//**********************************************
		
		//-----------------------------------------------------------
		var pwindow = window.open("","SaveWindow");
		
		var saveCtrl = "";
		saveCtrl += "<script>";
		
		//-----------added --- to ovecome script error RowSelect------------------->
		saveCtrl += "function r(rowNo){";
		saveCtrl += "var tagcnt =document.getElementsByTagName(\"TR\").length;";
		saveCtrl += "if(tagcnt > 1)";
		saveCtrl += "{";//if tag count
		saveCtrl += "var trItem = 0;";
		saveCtrl += "for(trItem=1; trItem < tagcnt; trItem++)";
		saveCtrl += "{";//for loop
		saveCtrl += "var tmpobj = document.getElementsByTagName(\"TR\").item(trItem);";
		//saveCtrl += "tmpobj.tabIndex=(trItem+1);"; //enables focus
		saveCtrl += "tmpobj.removeAttribute(\"bgColor\");";//removes the high lite
		saveCtrl += "";
		saveCtrl += "}";//for loop
		saveCtrl += "}";//if tag count
		saveCtrl += "document.getElementById(rowNo).setAttribute(\"bgColor\", \"DarkGray\");";
		saveCtrl += "}";//end function
		//-----------added --- to ovecome script error RowSelect-------------------|
		
		//-----------added --- to ovecome script error GridSelect------------------->
		saveCtrl += "function g(coords){}"; // for g_funtioned cells -empty functions
		saveCtrl += "function d(coords){}"; // for d_funtioned cells		
		//-----------added --- to ovecome script error GridSelect-------------------|
		
		//saveCtrl += "var ans = \"nothing\";";
		
		
		//-------domodal------------
		saveCtrl += "function doDialog(themsg)";
		saveCtrl += "{";
		saveCtrl += "var x=showModalDialog('ExportDialog.htm',themsg,'status:no;resizable:yes; dialogWidth:500px; dialogHeight:300px; help:no');";
		saveCtrl += "return x;";
		saveCtrl += "}";
		//-------domodal------------
		
		
		//-------domodal message ---
		saveCtrl += "function domessage()";
		saveCtrl += "{";
		saveCtrl += "var msg = \"This document must be saved to your PC if you wish to export the information.\";";
		saveCtrl += "msg += \" Click one of the file type options to open the save dialog box.\";";
		saveCtrl += "msg += \"  Then Click 'Save' to export the document to your computer.<br><br>\";";
		
		saveCtrl += "msg += \" To only view this page click 'View'.<br><br>\";";
		saveCtrl += "msg += \" NOTE: Excel and Word Exporting is not always possible on pre XP systems.\";";
		saveCtrl += "return msg;";
		saveCtrl += "}";	
		//----------msg----->
		//----------------------------->
		//-------domodal message ---|
		
		saveCtrl += "function autoSave(){";
		//saveCtrl += "alert('reached autosave');";
		saveCtrl += "var saveName = document.getElementsByTagName(\"title\").item(0).innerHTML;";
		//saveCtrl += "alert('saveName ' + saveName);";
		saveCtrl += "var testWindow = window.name;";
		saveCtrl += "var i = testWindow.indexOf('SaveWindow');";
		
		saveCtrl += "  if(i > -1){";//------------SAVEWINDOW therefore live document
		//saveCtrl += "alert('i = ' + i);";
		//----------new decision structure --+code------------->
		saveCtrl += "var modmsg = domessage();";
		//----
		saveCtrl += "var ans;";
		saveCtrl += "ans=doDialog(modmsg);";
		//saveCtrl += "alert(\"ans = \" + ans);";
		//saveCtrl += "{";
		
		//saveCtrl += "if(ans==\"save\"){document.execCommand('SaveAs', true, 'ExcelCopy');window.close();}";
		
		
		//-----------WORD-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		//saveCtrl += "if(ans==\"saveW\"){document.execCommand('SaveAs', true, 'table.doc');";
		saveCtrl += "if(ans==\"saveW\"){document.execCommand('SaveAs', true, saveName + '.doc');";
		saveCtrl += "window.close();";
		saveCtrl += "}";
		//-----------WORD-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
		
		//-----------HTML-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		//saveCtrl += "if(ans==\"saveH\"){document.execCommand('SaveAs', true, 'table.htm');";
		saveCtrl += "if(ans==\"saveH\"){document.execCommand('SaveAs', true, saveName + '.htm');";
		saveCtrl += "window.close();";
		saveCtrl += "}";
		//-----------HTML-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
		
		//-----------XLS--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		//saveCtrl += "if(ans==\"saveX\"){document.execCommand('SaveAs', true, 'table.xls');";
		saveCtrl += "if(ans==\"saveX\"){document.execCommand('SaveAs', true, saveName + '.xls');";
		saveCtrl += "window.close();";
		saveCtrl += "}";
		//-----------XLS--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
		
		//-----------VIEW--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		saveCtrl += "if(ans==\"view\"){}";
		
		//-----------CNCL--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		saveCtrl += "if(ans==\"cancel\"){window.close();}";
		
		//-----------CLOSE-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		saveCtrl += "if(ans==null){window.close();}";
		
	
		saveCtrl += "";
		//----------new decision structure --+code---------------|
		//saveCtrl += "  document.execCommand('SaveAs', true, 'ExcelCopy');";
		//saveCtrl += "  window.close();";
		saveCtrl += "   }";//outer if
		
		//--------
		saveCtrl += "else{";	//-----------SAVEWINDOW not present therefore is a Saved Document
		saveCtrl += "var helpMsg = \"!! EXCEL EXPORT INSTRUCTIONS !!<br>\";";
		saveCtrl += "helpMsg += \"Right click mouse inside the main table and then select 'Export to Microsoft Excel' from the choices.\";";
		saveCtrl += "document.getElementById(\"divInfo\").innerHTML = helpMsg;";
		saveCtrl += "document.getElementById(\"divInfo\").style.width = 570;";
		saveCtrl += "document.getElementById(\"divInfo\").style.height = 65;";
		saveCtrl += "}";//else
		//----------------------------->
		
		
		saveCtrl += "}";
		saveCtrl += "window.setTimeout('autoSave()', 500);";
		
		saveCtrl += "</script>";
		saveCtrl += "";
		
		//++++++++++++++++++ writes all to export page +++++++++++++++++
		pwindow.document.write(printPlate+ saveCtrl);
		pwindow.document.focus(); 
		
		}			
//=============================== PRINT EASY MODAL =========================================|
//ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
//****************************************************************************************
//****************************************************************************************
// ---- Word/Excel Ver ---****************************************************************
		function PrintEasy() //PrintEasyV1() ---- ---- Word/Excel Ver -- CURRENT TEST2 IN USE 042005
		{
		
		//#--
		var tmpHead = "";
		var tmpBody = "";
		//--------------
		var tmpFoot = ""; // ---------new
		var tmpCSS = ""
		var tmpInsert = "INSERTED INFO"
		tmpInsert = document.getElementById("divExport").innerHTML;
		//--------------		
		var printPlate = "";
		
		//var saveName = document.getElementById("lblPageHeader").innerHTML;
		//alert("FileName is: " + saveName);
		
		var d, s = "";
		d = new Date();
		s += (d.getMonth() + 1);
		s += "_";
		s += d.getDate();
		s += "_";
		
		var subyear = "";
		subyear = d.getYear(); 
		//s += subyear.substr(2);
		//subyear = subyear.substring(2,3);
		s += subyear;
		
		//s += d.getYear();
		s += d.getHours();
		s += d.getMinutes();
		s += "_";
		s += d.getSeconds();

		//alert(" Date is: " + s);
		//alert(" ParsedDate is: " + Date.parse(s));
		printPlate += "<title>cmt" + s + "</title>";
		
		
		printPlate += "<div id=\"divInfo\" style=\"DISPLAY: inline; WIDTH: 0px; HEIGHT: 0px; BACKGROUND-COLOR: yellow\"></div>"
		
		//#--
		//tmpHead = += document.getElementById("Div1").innerHTML;
		//tmpBody = += document.getElementById("Div2").innerHTML;
		
		//printPlate += document.getElementById("Div1").innerHTML; //---works
		//printPlate += document.getElementById("Div2").innerHTML; //---works
		//printPlate += document.getElementById("Div3").innerHTML; //---works
		
		//**************new PRRINT PLATE****************
		
		//tmpInsert = document.getElementById("DivExport").innerHTML;
		
		//---------
		tmpCSS = document.getElementById("Div1").innerHTML;
		var endCSS = tmpCSS.indexOf("<TABLE");
		tmpCSS = tmpCSS.substring(0,endCSS);
		//alert("tmpCSS " + tmpCSS);
		//---------
		
		tmpHead = document.getElementById("Div1").innerHTML;
		
		
		var startHead = tmpHead.indexOf("<THEAD>");
		var endHead = tmpHead.lastIndexOf("</TABLE>");
		//alert("endHead " + endHead);
		//tmpHead = tmpHead.substring(0,endHead);
		tmpHead = tmpHead.substring(startHead,endHead);
		//alert("tmpHead " + tmpHead);
		
		tmpBody = document.getElementById("Div2").innerHTML;
		var startBody = tmpBody.indexOf("<TBODY>");
		//alert("startBody " + startBody);
		tmpBody = tmpBody.substring(startBody,tmpBody.length); //--orig
		//alert("tmpBody" + tmpBody);
		
		
		
		
		//---------------
		//var endBody = tmpBody.lastIndexOf("</TABLE>")
		//alert("endBody " + endBody);
		//tmpBody = tmpBody.substring(startBody,endBody); //--new
		//alert("tmpBody " + tmpBody);
		
		
		tmpFoot = document.getElementById("Div3").innerHTML;
		//alert("tmpFoot BEFORE " + tmpFoot);
		//var startFoot = tmpFoot.indexOf("<TFOOT>");
		var startFoot = 0;
		var endFoot =tmpFoot.indexOf("<TBODY>");
		//alert("startFoot and Endfoot " + startFoot + "  "+ endFoot);
		//tmpFoot = tmpFoot.substring(startFoot,tmpFoot.length);
		tmpFoot = tmpFoot.substring(startFoot,endFoot);

		//alert("tmpFoot AFTER" + tmpFoot);
		//function replace(string,text,by)
		tmpFoot=replace(tmpFoot,"<TFOOT>","<THEAD>")
		tmpFoot=replace(tmpFoot,"</TFOOT>","</THEAD>")
		//tmpFoot=replace(tmpFoot,"<TD","<TH")
		tmpFoot=replace(tmpFoot,"</TD>","</TH>")  //--working
		//<tr align="center"
		//tmpFoot=replace(tmpFoot,"<TR","<TR align='left'")
		tmpFoot=replace(tmpFoot,"<TD","<TH align='left'")
		
		//alert("tmpFoot AFTER replace" + tmpFoot);
		//var tmpInsert = "I inserted this"
		//tmpFoot=replace(tmpFoot,">Rec","><H4>" + tmpInsert + "</H4> --- Rec")
		tmpFoot=replace(tmpFoot,">Rec",">" + tmpInsert + " --- Rec")
		//alert("tmpFoot AFTER replace REC" + tmpFoot);
		//---------------
		
		
		
		
		
		//printPlate += tmpHead + tmpBody;
		printPlate += tmpCSS + tmpFoot + tmpHead + tmpBody;
		
		//**********************************************
		
		//-----------------------------------------------------------
		var pwindow = window.open("","SaveWindow");
		
		var saveCtrl = "";
		saveCtrl += "<script>";
		
		//-----------added --- to ovecome script error RowSelect------------------->
		saveCtrl += "function r(rowNo){";
		saveCtrl += "var tagcnt =document.getElementsByTagName(\"TR\").length;";
		saveCtrl += "if(tagcnt > 1)";
		saveCtrl += "{";//if tag count
		saveCtrl += "var trItem = 0;";
		saveCtrl += "for(trItem=1; trItem < tagcnt; trItem++)";
		saveCtrl += "{";//for loop
		saveCtrl += "var tmpobj = document.getElementsByTagName(\"TR\").item(trItem);";
		//saveCtrl += "tmpobj.tabIndex=(trItem+1);"; //enables focus
		saveCtrl += "tmpobj.removeAttribute(\"bgColor\");";//removes the high lite
		saveCtrl += "";
		saveCtrl += "}";//for loop
		saveCtrl += "}";//if tag count
		saveCtrl += "document.getElementById(rowNo).setAttribute(\"bgColor\", \"DarkGray\");";
		saveCtrl += "}";//end function
		//-----------added --- to ovecome script error RowSelect-------------------|
		
		//-----------added --- to ovecome script error GridSelect------------------->
		saveCtrl += "function g(coords){}"; // for g_funtioned cells -empty functions
		saveCtrl += "function d(coords){}"; // for d_funtioned cells		
		//-----------added --- to ovecome script error GridSelect-------------------|
		
		//saveCtrl += "var ans = \"nothing\";";
		
		
		//-------domodal------------
		saveCtrl += "function doDialog(themsg)";
		saveCtrl += "{";
		saveCtrl += "var x=showModalDialog('ExportDialog.htm',themsg,'status:no;resizable:yes; dialogWidth:500px; dialogHeight:300px; help:no');";
		saveCtrl += "return x;";
		saveCtrl += "}";
		//-------domodal------------
		
		
		//-------domodal message ---
		saveCtrl += "function domessage()";
		saveCtrl += "{";
		saveCtrl += "var msg = \"This document must be saved to your PC if you wish to export the information.\";";
		saveCtrl += "msg += \" Click one of the file type options to open the save dialog box.\";";
		saveCtrl += "msg += \"  Then Click 'Save' to export the document to your computer.<br><br>\";";
		
		saveCtrl += "msg += \" To only view this page click 'View'.<br><br>\";";
		saveCtrl += "msg += \" NOTE: Excel and Word Exporting is not always possible on pre XP systems.\";";
		saveCtrl += "return msg;";
		saveCtrl += "}";	
		//----------msg----->
		//----------------------------->
		//-------domodal message ---|
		
		saveCtrl += "function autoSave(){";
		//saveCtrl += "alert('reached autosave');";
		saveCtrl += "var saveName = document.getElementsByTagName(\"title\").item(0).innerHTML;";
		//saveCtrl += "alert('saveName ' + saveName);";
		saveCtrl += "var testWindow = window.name;";
		saveCtrl += "var i = testWindow.indexOf('SaveWindow');";
		
		saveCtrl += "  if(i > -1){";//------------SAVEWINDOW therefore live document
		//saveCtrl += "alert('i = ' + i);";
		//----------new decision structure --+code------------->
		saveCtrl += "var modmsg = domessage();";
		//----
		saveCtrl += "var ans;";
		saveCtrl += "ans=doDialog(modmsg);";
		//saveCtrl += "alert(\"ans = \" + ans);";
		//saveCtrl += "{";
		
		//saveCtrl += "if(ans==\"save\"){document.execCommand('SaveAs', true, 'ExcelCopy');window.close();}";
		
		
		//-----------WORD-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		//saveCtrl += "if(ans==\"saveW\"){document.execCommand('SaveAs', true, 'table.doc');";
		saveCtrl += "if(ans==\"saveW\"){document.execCommand('SaveAs', true, saveName + '.doc');";
		saveCtrl += "window.close();";
		saveCtrl += "}";
		//-----------WORD-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
		
		//-----------HTML-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		//saveCtrl += "if(ans==\"saveH\"){document.execCommand('SaveAs', true, 'table.htm');";
		saveCtrl += "if(ans==\"saveH\"){document.execCommand('SaveAs', true, saveName + '.htm');";
		saveCtrl += "window.close();";
		saveCtrl += "}";
		//-----------HTML-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
		
		//-----------XLS--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		//saveCtrl += "if(ans==\"saveX\"){document.execCommand('SaveAs', true, 'table.xls');";
		saveCtrl += "if(ans==\"saveX\"){document.execCommand('SaveAs', true, saveName + '.xls');";
		saveCtrl += "window.close();";
		saveCtrl += "}";
		//-----------XLS--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
		
		//-----------VIEW--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		saveCtrl += "if(ans==\"view\"){}";
		
		//-----------CNCL--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		saveCtrl += "if(ans==\"cancel\"){window.close();}";
		
		//-----------CLOSE-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@>
		saveCtrl += "if(ans==null){window.close();}";
		
	
		saveCtrl += "";
		//----------new decision structure --+code---------------|
		//saveCtrl += "  document.execCommand('SaveAs', true, 'ExcelCopy');";
		//saveCtrl += "  window.close();";
		saveCtrl += "   }";//outer if
		
		//--------
		saveCtrl += "else{";	//-----------SAVEWINDOW not present therefore is a Saved Document
		saveCtrl += "var helpMsg = \"!! EXCEL EXPORT INSTRUCTIONS !!<br>\";";
		saveCtrl += "helpMsg += \"Right click mouse inside the main table and then select 'Export to Microsoft Excel' from the choices.\";";
		saveCtrl += "document.getElementById(\"divInfo\").innerHTML = helpMsg;";
		saveCtrl += "document.getElementById(\"divInfo\").style.width = 570;";
		saveCtrl += "document.getElementById(\"divInfo\").style.height = 65;";
		saveCtrl += "}";//else
		//----------------------------->
		
		
		saveCtrl += "}";
		saveCtrl += "window.setTimeout('autoSave()', 500);";
		
		saveCtrl += "</script>";
		saveCtrl += "";
		
		//++++++++++++++++++ writes all to export page +++++++++++++++++
		pwindow.document.write(printPlate+ saveCtrl);
		pwindow.document.focus(); 
		
		}			
//=============================== PRINT EASY MODAL =========================================|
//ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ




//******************************************************************************************
		function PrintEasy_outButWorking() //PrintEasyV1() ---WORKING VER
		{		
		var printPlate = "";
		
		printPlate += "<div id=\"divInfo\" style=\"DISPLAY: inline; WIDTH: 0px; HEIGHT: 0px; BACKGROUND-COLOR: yellow\"></div>"
		
		printPlate += document.getElementById("Div1").innerHTML; //---works
		printPlate += document.getElementById("Div2").innerHTML; //---works
		//printPlate += document.getElementById("Div3").innerHTML; //---works
		//-----------------------------------------------------------
		
		var pwindow = window.open("","SaveWindow");
		var saveCtrl = "";
		saveCtrl += "<script>";
		//-----------added --- to ovecome script error RowSelect------------------->
		saveCtrl += "function r(rowNo){";
		saveCtrl += "var tagcnt =document.getElementsByTagName(\"TR\").length;";
		saveCtrl += "if(tagcnt > 1)";
		saveCtrl += "{";//if tag count
		saveCtrl += "var trItem = 0;";
		saveCtrl += "for(trItem=1; trItem < tagcnt; trItem++)";
		saveCtrl += "{";//for loop
		saveCtrl += "var tmpobj = document.getElementsByTagName(\"TR\").item(trItem);";
		//saveCtrl += "tmpobj.tabIndex=(trItem+1);"; //enables focus
		saveCtrl += "tmpobj.removeAttribute(\"bgColor\");";//removes the high lite
		saveCtrl += "";
		saveCtrl += "}";//for loop
		saveCtrl += "}";//if tag count
		saveCtrl += "document.getElementById(rowNo).setAttribute(\"bgColor\", \"DarkGray\");";
		saveCtrl += "}";//end function
		//-----------added --- to ovecome script error RowSelect-------------------|
		//-----------added --- to ovecome script error GridSelect------------------->
		saveCtrl += "function g(coords){}"; // for g_funtioned cells -empty functions
		saveCtrl += "function d(coords){}"; // for d_funtioned cells
		
		//-----------added --- to ovecome script error GridSelect-------------------|
		
		//saveCtrl += "var ans = \"nothing\";";
		//-------domodal------------
		saveCtrl += "function doDialog(themsg)";
		saveCtrl += "{";
		saveCtrl += "var x=showModalDialog('ExportDialog.htm',themsg,'status:no;resizable:yes; dialogWidth:500px; dialogHeight:300px; help:no');";
		saveCtrl += "return x;";
		saveCtrl += "}";
		//-------domodal------------
		
		//-------domodal message ---
		
		saveCtrl += "function domessage()";
		saveCtrl += "{";
		saveCtrl += "var msg = \"This page must be saved to your PC if you wish to export the information\";";
		saveCtrl += "msg += \" to Microsoft Excel. To complete the export to excel you must open the\";";
		saveCtrl += "msg += \" saved page/file locally by double clicking it and following the export\";";
		saveCtrl += "msg += \" instructions on the saved page.<br><br>\";";
		saveCtrl += "msg += \" To open the save dialog click 'Save'. To only view this page click 'View'.<br><br>\";";
		saveCtrl += "msg += \" NOTE: Excel Exporting is not always possible on pre XP systems.\";";
		saveCtrl += "return msg;";
		saveCtrl += "}";
			
	//----------msg----->
	//----------------------------->
		//-------domodal message ---|
		
		saveCtrl += "function autoSave(){";
		//saveCtrl += "alert('reached autosave');";
		
		saveCtrl += "var testWindow = window.name;";
		saveCtrl += "var i = testWindow.indexOf('SaveWindow');";
		
		saveCtrl += "  if(i > -1){";
		//saveCtrl += "alert('i = ' + i);";
		//----------new decision structure --+code------------->
		saveCtrl += "var modmsg = domessage();";
		//----
		saveCtrl += "var ans;";
		saveCtrl += "ans=doDialog(modmsg);";
		//saveCtrl += "alert(\"ans = \" + ans);";
		//saveCtrl += "{";
		saveCtrl += "if(ans==\"save\"){document.execCommand('SaveAs', true, 'ExcelCopy');window.close();}";
		//saveCtrl += "if(ans==\"save\"){document.execCommand('SaveAs', true, 'WordCopy.doc');window.close();}";

		saveCtrl += "if(ans==\"view\"){}";
		saveCtrl += "if(ans==\"cancel\"){window.close();}";
		saveCtrl += "if(ans==null){window.close();}";
	
		saveCtrl += "";
		//----------new decision structure --+code---------------|
		//saveCtrl += "  document.execCommand('SaveAs', true, 'ExcelCopy');";
		//saveCtrl += "  window.close();";
		saveCtrl += "   }";//outer if
		
		//--------
		saveCtrl += "else{";
		saveCtrl += "var helpMsg = \"!! EXCEL EXPORT INSTRUCTIONS !!<br>\";";
		saveCtrl += "helpMsg += \"Right click mouse inside the main table and then select 'Export to Microsoft Excel' from the choices.\";";
		saveCtrl += "document.getElementById(\"divInfo\").innerHTML = helpMsg;";
		saveCtrl += "document.getElementById(\"divInfo\").style.width = 570;";
		saveCtrl += "document.getElementById(\"divInfo\").style.height = 65;";
		saveCtrl += "}";//else
		//----------------------------->
		
		saveCtrl += "}";
		saveCtrl += "window.setTimeout('autoSave()', 500);";
		
		saveCtrl += "</script>";
		saveCtrl += "";
		
		//++++++++++++++++++ writes all to export page +++++++++++++++++
		pwindow.document.write(printPlate+ saveCtrl);
		pwindow.document.focus(); 
		
		}		
		//================== PRINT EASY MODAL ===============================|	
			
			
			
			
			
			
			
			
		//********************************************************************>
		//------------test scripts-----
		function PrintEasyV2()   //PrintEasyV2()
		{		
		var printPlate = "";
		alert("PrintPlate is : " + printPlate);
		////printPlate = document.Form1.Div2.innerHTML;
		//printPLate = document.getElementById("Div2").innerHTML;
		//printPLate = document.getElementById("Table1").innerHTML;
		//printPLate = document.getElementById("Div2").Text;
		//printPLate = document.getElementById("Div1").innerHTML;
		
		//printPlate = document.Form1.Div1.innerHTML;
		//printPlate = document.Form1.dataTable.innerHTML;
		
		//printPlate = document.getElementById("r0c0").innerHTML; //---works
		//printPlate = document.getElementById("Div1").innerHTML; //---works
		//printPlate = document.getElementById("Div2").innerHTML; //---works
		//printPlate = document.getElementById("Div3").innerHTML; //---works
		
		//---------------actual code required v1 -----------------------
		//printPlate += document.getElementById("Div1").innerHTML; //---works
		//printPlate += document.getElementById("Div2").innerHTML; //---works
		//--tmp out //printPlate += document.getElementById("Div3").innerHTML; //---works
		//-----------------------------------------------------------
		//---------------actual code required v2 -----------------------
		//printPlate += document.getElementById("Div1").innerText; //---works
		//printPlate += document.getElementById("Div2").innerText; //---works
		//printPlate += document.getElementById("Div3").innerText; //---works
		//-----------------------------------------------------------
		
		printPlate += document.getElementById("Div1").innerHTML; //---works
		printPlate += document.getElementById("Div2").innerHTML; //---works
		
		alert("PrintPlate after is : " + printPlate);
		
		//printPlate = replace("<TR></TR>", " && ", printPlate);
		
		var tmpString = "";
		 
		 //tmpString = replace(printPlate,'</TR>', ' ***</TR> ');
		//var mycrlf ="vbcrlf"
		//printPlate = replace(printPlate,"</TR>", " ***</TR> ");
		//printPlate = replace(printPlate,"</TR>", mycrlf);
		//printPlate = replace(printPlate,"</TR>", "\r/\n</TR>");
		printPlate = replace(printPlate,"</TR>", "||</TR>");
		
		alert("PrintPlate after 1 is : " + printPlate);
		
		printPlate = replace(printPlate,"</TH>", ",</TH>"); 
		alert("PrintPlate after 2 is : " + printPlate);
		
		printPlate = replace(printPlate,"</TD>", ",</TD>"); 
		alert("PrintPlate after 3 is : " + printPlate);
		
		
		//printPlate = replace(printPlate,"||</TR>", "</TR>\n");
		//alert("PrintPlate after 4 is : " + printPlate);
		
		
		var tmpHolder = "";
		tmpHolder = document.getElementById("Div2").innerHTML;
		document.getElementById("Div2").innerHTML = printPlate;
		printPlate = document.getElementById("Div2").innerText;
		
		//------------
		//printPlate = replace(printPlate,"||", "\n");
		printPlate = replace(printPlate,"||", "<br>");
		
		alert("PrintPlate after 4 is : " + printPlate);
		//------------
		
		document.getElementById("Div2").innerHTML = tmpHolder;
		//var myinput ="<input type='textarea' value='"+ printPlate + "'>"
		//<input type="text" style="FLOAT: left">
		//var myinput = "<input type='textarea' value='"+ printPlate + "' style='OVERFLOW: auto; WIDTH: 800px; HEIGHT: 400px' readonly>"
		var myinput = "<input type='text' value='"+ printPlate + "' style='WIDTH: 800px; FLOAT: left; HEIGHT: 400px' readonly>"

		var pwindow = window.open("","PrintWindow");
		pwindow.document.write(myinput);
		
		
		//pwindow.document.write(tmpString);
		//pwindow.document.write(printPlate);
		////pwindow.document.write("wheres my printPlate");
		
		
		pwindow.document.focus(); 
		
		/////REF:
		/////var newWindow1=window.open(docURL,'CMTwindow','menubar=no scrollbars=yes width=660 height=600 status=yes');
		/////newWindow1.document.focus();
		}		
		//-----------------------------PRINT EASY STUFF ---------------------	
//===========================================================================
//PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP		
		
		
		
		
		
		
		
//-----------------FIND REPLACE IMPORT FROM ELSEWHERE--(how long is a piece of string)------------------
function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}
//---------------------------FIND REPLACE IMPORT FROM ELSEWHERE--------------------------------------------
//===========================================================================





//=======================HIDE CONTROL========================================
function hideControl(theCtrlID)
{
//REF -<!--  style="VISIBILITY: hidden"  style="VISIBILITY: visible" -->
////document.getElementById('txtCust_No').style.visibility.blink				
//var hstatus = document.getElementById(theCtrlID).style.height;
//var hstatus = document.getElementById(theCtrlID).style.height;
//alert("HSTATUS is:   " + hstatus);
//if(parseInt(hstatus) > 1)
//{
//document.getElementById(theDivID).style.width = 300; //---testing new vals - 101504
//------------------------------------------------------>
document.getElementById(theCtrlID).style.width = '0px'; //---orig- 101504
document.getElementById(theCtrlID).style.height = '0px';
document.getElementById(theCtrlID).style.visibility = "hidden";
//document.getElementById(theCtrlID).style.overflow = "hidden";
//document.getElementById(theCtrlID).style.display = "none"
//}
}
//===========================================================================







//=============================SHOW CONTROL=================================
function showControl(theCtrlID)
{
//var hstatus = document.getElementById(theCtrlID).style.height;
//alert("HSTATUS is:   " + hstatus);
//if(parseInt(hstatus) <= 1)
//{
//document.getElementById(theDivID).style.width = 300; wrong
//document.getElementById(theCtrlID).style.width = 72;

//document.getElementById(theDivID).style.height = 100;//---testing new vals - 101504 --
//------------------------------------------------------>
var ctrlType = document.getElementById(theCtrlID).type;
//alert("the type is: " + ctrlType);
if(ctrlType == "text")
	{
	document.getElementById(theCtrlID).style.height = '15px';//---orig- 101504
	document.getElementById(theCtrlID).style.width = '72px';
	}
else
	{
	document.getElementById(theCtrlID).style.height = '15px';//---orig- 101504
	document.getElementById(theCtrlID).style.width = '180px';
	}
document.getElementById(theCtrlID).style.visibility = "visible";


//document.getElementById(theCtrlID).style.overflow = "auto";
//document.getElementById(theCtrlID).style.display = "inline"

//document.getElementById(theDivID).style.display = "inline"  //orig
//document.getElementById(theDivID).style.border = "black thin solid";
//}
}
//===========================================================================







//***********************************************************************
//*********************** NEW OVERLOAD FOR STYLE-CLR SEARCH PAGE*********
//***********************************************************************
function showControlWidth(theCtrlID, theWidth)
{
//------------------------------------------------------>
var ctrlType = document.getElementById(theCtrlID).type;
//alert("the type is: " + ctrlType);
if(ctrlType == "text")
	{
	document.getElementById(theCtrlID).style.height = '15px';//---orig- 101504
	document.getElementById(theCtrlID).style.width = theWidth;
	}
else
	{
	document.getElementById(theCtrlID).style.height = '15px';//---orig- 101504
	document.getElementById(theCtrlID).style.width = theWidth;
	}
document.getElementById(theCtrlID).style.visibility = "visible";
}
//================END=========NEW HIDE and NEW SHOW==========END===============







//*************************************************************************
//*********************** CLEAR FIELD OP FOR STYLE-CLR SEARCH PAGE*********
//*************************************************************************
function clearText(ctrlName)
{
document.getElementById(ctrlName).value="";
}//END==================CLEAR TEXT===========================================
//===========================================================================




//*****************************************************************************
//***********for adding from avails color selection************NEW*************
//################### CBO to CBO ########## SAME DOC ##################>
//*****************************************************************************
function saveToList_avail(selSource, selTarget)
{
//alert("Function Entered: ");
var sourceCnt = 0;
var sourceVal;

var hiddenName = "hdn" + selTarget; //---------new for hidden

sourceCnt = document.getElementById(selSource).length;
//alert("SourceCnt=: " + sourceCnt);
//var ctrlcount = document.getElementById('cboQtyFieldNames').length;

var i;
for(i=0; i<sourceCnt; i++)   //----new------
	{

    if(document.getElementById(selSource).children[i].selected)
		{
		//alert("Is selected - index source: " + i); 
		 
		sourceVal = document.getElementById(selSource).children[i].value;
		//alert("SourceVal=: " + sourceVal);
		
		//var destCnt = parent.document.getElementById(selTarget).length;
		var destCnt = document.getElementById(selTarget).length;
		//alert("Index destCnt: " + destCnt);
		
		/**/
		var myOption = new Option(sourceVal, sourceVal); 
		
		//parent.document.getElementById(selTarget).options[destCnt] = myOption;
		document.getElementById(selTarget).options[destCnt] = myOption;
		
		//-----------------------new for hidden
		//parent.document.getElementById(hiddenName).value += sourceVal +",";
		document.getElementById(hiddenName).value += sourceVal +",";
		
		//-----------------------
		//alert("Success to Here: ");			
		}
	}	
//parent.document
}//END function-----------------------------------
//################ CBO to CBO ####### SAME DOC ####################^^^
//===========================================================================













//*****************************************************************************
//*****************************************************************************
//################### CBO to CBO ########## CHILD to PARENT ##################>
//*****************************************************************************
function saveToList(selSource, selTarget)
{
//alert("Function Entered: ");
var sourceCnt = 0;
var sourceVal;

var hiddenName = "hdn" + selTarget; //---------new for hidden

sourceCnt = document.getElementById(selSource).length;
//alert("SourceCnt=: " + sourceCnt);
//var ctrlcount = document.getElementById('cboQtyFieldNames').length;

var i;
for(i=0; i<sourceCnt; i++)   //----new------
	{

    if(document.getElementById(selSource).children[i].selected)
		{
		//alert("Is selected - index source: " + i); 
		 
		sourceVal = document.getElementById(selSource).children[i].value;
		//alert("SourceVal=: " + sourceVal);
		
		var destCnt = parent.document.getElementById(selTarget).length;
		//alert("Index destCnt: " + destCnt);
		
		/**/
		var myOption = new Option(sourceVal, sourceVal); 
		//parent.document.getElementById(selTarget).children[destCnt] = myOption;
		parent.document.getElementById(selTarget).options[destCnt] = myOption;
		//parent.document.getElementById(selTarget).child[destCnt] = myOption;
		//-----------------------new for hidden
		parent.document.getElementById(hiddenName).value += sourceVal +",";
		//-----------------------
		//alert("Success to Here: ");			
		}
	}	
//parent.document
}//END function-----------------------------------
//################ CBO to CBO ####### CHILD TO PARENT ####################^^^
//===========================================================================








//*******************************************************************************
//*******************************************************************************
//################### SPECIAL ### CLEAR CBO LIST #### UPDATE HIDDEN ##########>>>
//*******************************************************************************
function clearlist(listID)
{
var listCnt;
listCnt = document.getElementById(listID).length;
var hiddenName = "hdn"+listID;
var deleteChk = 0;
var i;

var selIndex = document.getElementById(listID).selectedIndex;
//First - decide ALL or ONE and update the list box

  if(selIndex > 0)
  {
	//Then delete only that item	
	document.getElementById(listID).options[selIndex]=null;
	deleteChk = 1;	
  } 
  else
  {
	//Else delete all the list items except "Saved List" item 
	for(i=listCnt-1; i>0; i--)
		{	
		document.getElementById(listID).options[i]=null;
		deleteChk = 1;
		}
  }
  
  //Next------now maintain the hdncbo (the hidden control storing the list for server)-----
  var hiddenPlate = "";
  var itemValue;
  var listReCnt
  listReCnt = document.getElementById(listID).length; // refresh the list count as some are deleted
  //alert("ListReCnt:= " + listReCnt + "   Orig Cnt:= " + listCnt);
  if(deleteChk == 1)		//Then delete the hidden value(s) delimited list.
  {
	//alert("	deleteChk was passed = " + deleteChk);
	document.getElementById(hiddenName).value = ""; //clear it out
	
		for(i=0; i<listReCnt; i++)
		{	
			itemValue = document.getElementById(listID).children[i].value;
			//alert("Item Value1  = " + itemValue);
			if(itemValue == "")
			{
				itemValue = "Saved List"//Server will put the "" value in on postback  
			}
			//alert("Item Value2  = " + itemValue);
		    hiddenPlate+= itemValue +",";
		}
		document.getElementById(hiddenName).value = hiddenPlate;// re initialize the hidden
																//used by the server cbo sub	
   } 
}
//#### END ###### SPECIAL ### CLEAR CBO LIST #### UPDATE HIDDEN ##########^^^
//===========================================================================







//*******************************************************************************
//*******************************************************************************
//################### SPECIAL ###  UPDATE HIDDEN FOR #### CBO LIST ##########>>>
//*******************************************************************************
function updateCBOhidden(listID)
{
var hiddenName = "hdn"+listID;
var deleteChk = 1;
var i;
//Next------now maintain the hdncbo (the hidden control storing the list for server)-----
  var hiddenPlate = "";
  var itemValue;
  var listReCnt
  listReCnt = document.getElementById(listID).length; // refresh the list count as some are deleted
  //alert("ListReCnt:= " + listReCnt + "   Orig Cnt:= " + listCnt);
  if(deleteChk == 1)		//Then delete the hidden value(s) delimited list.
  {
	//alert("	deleteChk was passed = " + deleteChk);
	document.getElementById(hiddenName).value = ""; //clear it out
	
		for(i=0; i<listReCnt; i++)
		{	
			itemValue = document.getElementById(listID).children[i].value;
			//alert("Item Value1  = " + itemValue);
			if(itemValue == "")
			{
				itemValue = "Saved List"//Server will put the "" value in on postback  
			}
			//alert("Item Value2  = " + itemValue);
		    hiddenPlate+= itemValue +",";
		}
		document.getElementById(hiddenName).value = hiddenPlate;// re initialize the hidden
																//used by the server cbo sub	
   } 

}
//################### SPECIAL ###  UPDATE HIDDEN FOR #### CBO LIST ##########>>>
//===========================================================================







//*****************************************************************************
//*****************************************************************************
//================START ===========ON FOCUS GIVE FOCUS TO ===========110504====
function giveFocus(contolToGetFocus)
{
//alert("Control getting focused: " + contolToGetFocus);

document.getElementById(contolToGetFocus).focus();

//setTimeout("document.getElementById(contolToGetFocus).focus();",100);

//document.getElementById('txtCust_No').setAttribute('focus', true);
//document.Form1.txtCarr.focus = true;
//REFs: 
//setTimeout("unanimateme(controlID);",200);
}
//================ END  ===========ON FOCUS GIVE FOCUS TO =========110504====
//===========================================================================







//*****************************************************************************
//*****************************************************************************
//===================START FOOL VALIDATOR ==========For ORDERS1.aspx=only======
//*****************************************************************************
function foolValidator(theInput)
{
var cncl =document.getElementById('txtCncl_Date').value;
var ship =document.getElementById('txtShip_Date').value;
var buyer =document.getElementById('txtBuyer').value;
var PoNo =document.getElementById('txtPO_No').value;
var type =document.getElementById('txtType').value;

var ipVal =document.getElementById(theInput).value;

//alert("Control values are: ss " + ship + " cc " + cncl + " bb " + buyer + " pp " + PoNo + " IPval: " + ipVal);

if((ipVal.indexOf("ADD") > -1) || (ipVal.indexOf("EDIT") > -1))
//if(ipVal.indexOf("ADD") > -1) 

 {
  if(ship.length < 1)
	{
	document.getElementById('txtShip_Date').value = "$";
	}
  if(cncl.length < 1)
	{
	document.getElementById('txtCncl_Date').value = "$";
	}
  if(buyer.length < 1)
	{
	document.getElementById('txtBuyer').value = "$";
	}
  if(PoNo.length < 1)
	{
	document.getElementById('txtPO_No').value = "$";
	}
  if(type.length < 1)
	{
	document.getElementById('txtType').value = "$";
	}
 }
	
// var i = string.indexOf(text);
//document.getElementById(txtShip_Date).value = "$";
//document.getElementById(txtCncl_Date).value = "$";
}
//===================END = FOOL VALIDATOR ===================================
//===========================================================================







//***************************************************************************
//=============GET SELECTED INDEX and PUT IN TXTBOX==========================
//=====ALSO used by UserSearch to send selected user to UserAsso!!!!
function sendSelected(cboID, txtID)
{
var selItem;
var selIndex;
selIndex = document.getElementById(cboID).selectedIndex;
selItem = document.getElementById(cboID).options(selIndex).value;
//alert("Value of Sel is: " + selItem);
document.getElementById(txtID).value = selItem;
}
//===========================================================================







//???????????????????????????????????????????????????????????????????????????
//???????????????????????????????????????????????????????????????????????????
//=====NEW=====GET SELECTED INDEX and PUT IN TXTBOX==========================
function setPageNo_DEV(valueControl)
{
var thelen;
	if(document.getElementById(valueControl).value == "")
	{	
		thelen = parseInt(document.getElementById(valueControl).value);	
		document.getElementById(valueControl).value = thelen;	
	}
//	else
//	{
//	//thelen = parseInt(document.getElementById(valueControl).value)
//	document.getElementById(valueControl).value = PageNumber + 1;
//	}
//thelen = history.length;
//alert("Page No is: " + thelen);
//document.getElementById(valueControl).value = thelen;
}
//=============GET SELECTED INDEX and PUT IN TXTBOX==========================







//===========================================================================
function setPageNo(valueControl)
{
var thelen;
thelen = history.length;
//alert("Page No is: " + thelen);
document.getElementById(valueControl).value = thelen;
}
//===========================================================================






//===================MYCONTROL3 RETURN===NEW NEW=============================
function retMyControl3()//===================for use by mycontrol3a on table error
{  
var curHost2 = location.host; // ---tmp rem 112204_1242
history.go('http://' + curHost2 + '/CMTonline/MyControl3.aspx');
//history.go('http://www.' + curHost2 + '/CMTonline/Login01.aspx');
}
//===========================================================================





//===================OPTIONS RETURN===NEW NEW================================
function cmtOptPage2_outfordev()//===================for all other pages using a return to Options Button
{  //===================(has no argument as not needed in new ver below either)
var curHost2 = location.host; // ---tmp rem 112204_1242
history.go('http://' + curHost2 + '/CMTonline/Login01.aspx');
//history.go('http://www.' + curHost2 + '/CMTonline/Login01.aspx');
}
//===========================================================================






//===================OPTIONS RETURN===NEW NEW=========DEV======032805======?????
function cmtOptPage2()//===================for all other pages using a return to Options Button
{  //===================(has no argument as not needed in new ver below either)
var curHost2 = location.host; // ---tmp rem 112204_1242

//alert("Location value is: " + "http://" + curHost2 + "/CMTonline/Login01.aspx");
//window.location.assign('http://' + curHost2 + '/CMTonline/Login01.aspx');
//window.location.replace('http://' + curHost2 + '/CMTonline/Login01.aspx');


history.go('http://' + curHost2 + '/CMTonline/Login01.aspx'); //-----orig
//history.go('http://www.' + curHost2 + '/CMTonline/Login01.aspx');

/*
//--------------------------testing------------------->
alert('cur host is: ' + curHost2);
var assgStr ='http://' + curHost2 + '/CMTonline/Login01.aspx';
alert('cur assgStr is: ' + assgStr);
window.location.assign(assgStr);
//--------------------------testing-------------------|
*/

window.location.assign('http://' + curHost2 + '/CMTonline/Login01.aspx');

//window.location.assign('Login01.aspx');
//<PRE>if (location.replace == null)<BR>   location.replace = location.assign</PRE>
}
//===========================================================================






//===========================================================================
//===========================================================================
//==================FOR "MAKE-ORDER" works in conjunction with Code behind!!=
function cmtOptPage(valueControl)
{
//NOTE: the passed argument is not being used in this version!!!
var thelen;
thelen = history.length;

var theCur;

theCur = parseInt(document.getElementById('txtPageServed').value); //NB: hard coded!!!! for test


var rindex;


rindex = ((theCur + 1) * -1) ;


var curHost = location.host; // ---tmp rem 112204_1242


history.go('http://' + curHost + '/CMTonline/Login01.aspx');

//REFs:
//http://localhost/CMTonline/welcome.htm
//var myhist = window.history.go([pvargdistance]);
//window.location.assign(bstr);
}
//===================OPTIONS RETURN==========================================	
//===========================================================================







//===========================================================================
//===================OPTIONS RETURN==========================================
function cmtOptPage_ORIG(valueControl)
{
var thelen;
thelen = history.length;
//alert("Hist Len is: " + thelen);

var theCur;
//theCur = document.getElementById(valueControl).value;
theCur = parseInt(document.getElementById(valueControl).value);

//theCur = history.current.index;
//alert("Hist Cur is: " + theCur);

//var rindex =((thelen - 2) * -1);
var rindex;
//rindex = ((thelen - theCur) * -1)
//rindex = ((theCur-thelen))
rindex = ((thelen - (thelen - theCur)) * -1) + 3 
//rindex = ((thelen - (thelen + theCur)) ) + 2  


//alert("Hist Back is: " + rindex);

history.go(rindex);
//history.go('CMTonline/Login01.aspx');


//alert("Hist Back is: " + ((thelen - 2) * -1) );

  //history.back();
    //resetRow(); 
    
    //history.go(0);  
//history.back(5);
//history.go(-3);
//history.go(-9);

//<PRE>if (location.replace == null)<BR>   location.replace = location.assign</PRE>

//<PRE>1. history[<I>index</I>]<BR>2. history.length</PRE>

//<A name=61311>The following button navigates to the nearest history entry that 
//contains the string "home.netscape.com":
//onClick="history.go('home.netscape.com');

//history.go('Login01');
//history.go('localhost/CMTonline/Login01.aspx');

//Login01
//OR
//http://localhost/CMTonline/Login01.aspx

//cmtOptPage('txtPage')
}
//===================OPTIONS RETURN==========================================	
//===========================================================================








//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK

//===========================================================================
//=====================CALC LINE=============================================
function calcLine()					//-- USED BY ORDERS1.ASPX - obsolete!
{									//WORKING GOOD
//window.onerror = null;
var sumL;
sumL = 0;
var controlname;
var tmpstr;
//--------new---110804---->
if(isNaN(document.getElementById('txtQtyFieldCount').value))
{
document.getElementById('txtQtyFieldCount').value = 1;
}
//--------new----------
var ctrlcount = parseInt(document.getElementById('txtQtyFieldCount').value);
//alert("ALERT ctrl count:  =" + ctrlcount);
//-----^^^--new------

var i;
for(i=1; i<ctrlcount; i++)   //----new------
//for(i=0; i<ctrlcount; i++)   //----new------
//for(i=0; i<11; i++)
	{
		controlname = "QTY_ORDR_" + i;
		//alert("ALERT Name  =" + controlname);
		
		//-----new 110904-------------------->
		if(document.getElementById(controlname).value == "")
			{
			document.getElementById(controlname).value = 0;
			}
		//-----new 110904--------------------^
		
		//-----new 110804----->
		if(isNaN(document.getElementById(controlname).value))
			{
			document.getElementById(controlname).value = 0;
			}
		//-^---new 110804-----^
		tmpstr = document.getElementById(controlname).value;
		//document.getElementById(controlname).value =parseInt(tmpstr); // resets the number but not needed
														//plus control loses it focus highlight on tab
		
		//alert("ALERT value  =" + tmpstr);
		//var myEr = window.onerror;
		//alert("ALERT ERROR  =" + myEr);
		sumL += parseInt(tmpstr);
		//alert("ALERT TOT  =" + sumC);
	}
document.getElementById('txtSumL').value = sumL;
//-----call the calcTotalPrice routine here.
calcPrice()
}
//---------------------------------------
//====^^^==============CALC LINE=======================^^^===================
//===========================================================================






//===========================================================================
//=====================CALC LINE==========VER2=====================2222222222
function calcLine2()				//==== USED BY ORDERS2.ASPX =============
{									//WORKING GOOD ==========================
var sumL;
sumL = 0;
var controlname;
var tmpstr;

if(isNaN(document.getElementById('txtQtyFieldCount').value))
	{
	document.getElementById('txtQtyFieldCount').value = 1;
	}
var ipVal = document.getElementById('txtPageStatus').value;
	if(ipVal.indexOf("VIEW") > -1)
	{
	return;  //empty return to halt the function here
	}



var ctrlcount = document.getElementById('cboQtyFieldNames').length;
//alert("ALERT ctrlcount  =" + ctrlcount);
var i;
  for(i=0; i<ctrlcount; i++)   //----new------
		{
		controlname = document.getElementById('cboQtyFieldNames').children[i].value;
		if(!controlname)
		{
			return;
		}
		if(controlname == "")
		{
			return;
		}
		//controlname = "QTY_ORDR_" + i;  //--out - replaced by above
		//alert("ALERT Name  =" + controlname);
		//alert("controlName=  " + controlname);
		
		//alert("controlName=  " + controlname + "\n i= :" + i);
		
		if(!document.getElementById(controlname))
		{
			//alert("Is Null I think");
			return;
		}
		
		
		if(document.getElementById(controlname).value == "")
			{
			document.getElementById(controlname).value = 0;
			}
		if(isNaN(document.getElementById(controlname).value))
			{
			document.getElementById(controlname).value = 0;
			}
		tmpstr = document.getElementById(controlname).value;
		sumL += parseInt(tmpstr);
		//alert("ALERT TOT  =" + sumC);
		}
document.getElementById('txtSumL').value = sumL;
//-----call the calcTotalPrice routine here.
calcPrice()
}
//---------------------------------------
//====^^^==============CALC LINE======VER2============^^^==========2222222222
//===========================================================================






//===========================================================================
//============CALC PRICE=====USED BY CALCLINE()=CALCLINE2 above=============>
//===========================================================================
function calcPrice()
{
var lineTotal;
var unitPrice;
var itemQty = parseInt(document.getElementById('txtSumL').value); 

	if(document.getElementById('txtPrice').value == "")
			{
			document.getElementById('txtPrice').value = 0;
			}
			
	if(isNaN(document.getElementById('txtPrice').value) || document.getElementById('txtPrice').value == null)
			{
			document.getElementById('txtPrice').value = 0;
			}
//	if(document.getElementById('txtPrice').value == null)
//			{
//			document.getElementById('txtPrice').value = 0;
//			}
			
unitPrice = parseFloat(document.getElementById('txtPrice').value);	
	//lineTotal = itemQty * unitPrice;
	lineTotal= (Math.round((itemQty * unitPrice) * 100))/100;
			
//txtDtotal
document.getElementById('txtDtotal').value = lineTotal;
//REF:
//var tmpF= (Math.round(fvalue * 100))/100;
}
//=========^^^=========CALC PRICE=============^^^===========================^
//===========================================================================

//KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK







//IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
//===========================================================================
// =======================for new Iframe/form/ ==============================
//======================IFRAME TALKS TO PARENT===============================


//****************************************************************************
//****************************************************************************
//-------------------SENDS VAL FROM IFRAME TO PARENT-------------------------
function sendTheValueORIG(theControlID)
{
var theVal;
theVal = document.getElementById(theControlID).value;
//alert("the val is:   " + theVal);
//parent.document.frmReceive.myreceivetext.value = theVal;
parent.document.Form1.txtCust_No.value = theVal;
}
//===========================================================================






//****************************************************************************
//****************************************************************************
//---------NEW
function sendTheValue(theChildSender, theParentReceiver)
{
var theVal;
theVal = document.getElementById(theChildSender).value;
//alert("the val is:   " + theVal);
//parent.document.frmReceive.myreceivetext.value = theVal;
//parent.document.Form1.txtCust_No.value = theVal;
parent.document.getElementById(theParentReceiver).value = theVal;
}
//------------NEW for LIST BOX CONTROL IN IFRAME---------
function sendSelectedValue(theChildSender, theParentInput)
{
var selItem;
var selIndex;
selIndex = document.getElementById(theChildSender).selectedIndex;
selItem = document.getElementById(theChildSender).options(selIndex).value;

//alert("Value of Sel is: " + selItem);

parent.document.getElementById(theParentInput).value = selItem; 

}
//------^^^--------------SENDS VAL FROM IFRAME TO PARENT--------^^^---------|
//===========================================================================






//****************************************************************************
//****************************************************************************
//--------------- NEW SENDS A PARSED VAL -------------------------------------
//--------------- FROM SINGLE CHILD CTL TO TWO PARENT CTLS -------031405------>
//---------function sendTheValue(theChildSender, theParentReceiver)----------- 
//----------------------- based on this func ---------------------------------
function sendStyClrParsVal(theSender, ParentIP1, ParentIP2)
{
var theVal;
theVal = document.getElementById(theSender).value;
//alert("the val is:   " + theVal);
var theStyle;
theStyle = theVal.substring(0,8);
var theColor;
theColor = theVal.substring(8,theVal.length);

parent.document.getElementById(ParentIP1).value = theStyle;
parent.document.getElementById(ParentIP2).value = theColor;
}
//--------NEW SENDS PARSED VAL FROM one CHILD TO two PARENT------^^^^-------|
//===========================================================================







//****************************************************************************
//****************************************************************************
//---------------- NEW SENDS A PARSED VAL (same document)---------------------
//--------------- FROM SINGLE  CTL TO TWO  CTLS ------------------031405------>
//--------function sendTheValue(theChildSender, theParentReceiver) -----------
//------------ based on this func --------------------------------------------
function sendStyClrParsVal2(theSender, IP1, IP2)
{
var theVal;
theVal = document.getElementById(theSender).value;
//alert("the val is:   " + theVal);
var theStyle;
theStyle = theVal.substring(0,8);
var theColor;
theColor = theVal.substring(8,theVal.length);

document.getElementById(IP1).value = theStyle;
document.getElementById(IP2).value = theColor;
}
//-------NEW SENDS PARSED VAL FROM one CTRL TO two CTRLS -------^^^^--------|
//===========================================================================







//****************************************************************************
//****************************************************************************
//---------------FOR AFTER CHILD INFO TO PARENT THIS COLAPSES DIV (HOLDING IFRAME)------->
var intStatusP;  // --needed?
function showFrameP(NameofCtrl)
{
//intStatus = document.getElementById(NameofList).getAttribute("height");
//var intStatus = document.getElementById('lbxFieldsList').style.height;
var intStatusP = parent.document.getElementById(NameofCtrl).style.height;
	
	if(parseInt(intStatusP) >0)
	{
	parent.document.getElementById(NameofCtrl).style.height=0;
	if(parent && parent.window && parent.window.HideFullShade)
		parent.window.HideFullShade();
	
	}
	else
	{
	parent.document.getElementById(NameofCtrl).style.height=300;

	} 
//alert("My TEST MSG  " + intStatus);
}
//-------^^^---GETS INFO FROM PARENT AND COLAPSES DIV (HOLDING IFRAME)--^^^---|
//-----------------------
//****************************************************************************

//*********** DEV ********** DEV *********************************************
//---------------FOR AFTER CHILD INFO TO PARENT THIS COLAPSES DIV (HOLDING IFRAME)------->
//var intStatusP;  // --needed?
function showFrameP_DEV(NameofCtrl)
{
//intStatus = document.getElementById(NameofList).getAttribute("height");
//var intStatus = document.getElementById('lbxFieldsList').style.height;
var intStatusP = parent.document.getElementById(NameofCtrl).style.height;
	
	if(parseInt(intStatusP) >0)
	{
	parent.document.getElementById(NameofCtrl).style.height=0;
	
	///////document.getElementsByTagName(<input>).item[0].focus();
	
	//document.Form1.releaseCapture();
	//parent.document.Form1.setCapture();
	
	//parent.document.focus();
	//document.parentWindow.focus();
	
	
	//----try getelemnet by Tag <input> and send focus there
	
	//parent.document.Form1.tabIndex = 0;
	//parent.document.Form1.focus();
	alert(parent.document.getElementsByTagName("INPUT").item(3).name);
	parent.document.getElementsByTagName("INPUT").item(3).focus();
	
	}
	else
	{
	parent.document.getElementById(NameofCtrl).style.height=300;
	
	//parent.document.Form1.releaseCapture();
	//document.Form1.setCapture();
	//document.Form1.focus();
	//document.getElementsByTagName("INPUT").item(0).focus();
	//parent.document.Form1.blur();
	//parent.document.Form1.tabIndex = -1;
	
	
	} 
//alert("My TEST MSG  " + intStatus);
}


//==========^^==========IFRAME TALKS TO PARENT=======^^================|
//===========================================================================







//****************************************************************************
//****************************************************************************
//=======================PARENT CALLS IFRAME===========================>
//------PUT selected PAGE into IFRAME for Orders/custFind--------------------->
function getTheSendPage(htmlToGet,putInFrame)
{
//alert("The htmlToGet is:  " + htmlToGet);
//document.getElementById('receiveFrame').src= htmlToGet;

//document.getElementById(putInFrame).src= htmlToGet;

var srcTest;
srcTest = document.getElementById(putInFrame).src;
	if(srcTest == htmlToGet)
	{
	//document.getElementById(putInFrame).src= "";		
	}
	else
	{
	document.getElementById(putInFrame).src= htmlToGet;
	}
}
//-^^---PUT selected PAGE into IFRAME----------^^^--------|
//===========================================================================





//------EXPAND selected IFRAME for PAGE--------------------->
var intStatusC;		//--???? this var needed?
function showFrameC(NameofCtrl)
{
//intStatus = document.getElementById(NameofList).getAttribute("height");
//var intStatus = document.getElementById('lbxFieldsList').style.height;
var intStatusC = document.getElementById(NameofCtrl).style.height;
	
	if(parseInt(intStatusC) >0)
	{
	document.getElementById(NameofCtrl).style.height=0;
	
	}
	else
	{
	document.getElementById(NameofCtrl).style.height=300;
	
	} 
//alert("My TEST MSG  " + intStatus);
}
//--^^--EXPAND selected IFRAME for PAGE----------^^^--------|
//============^^^========PARENT CALLS IFRAME=============^^^===========|
//===========================================================================





//           DEV     8888     DEV -----COPY OF ORIG ABOVE
//****************************************************************************
//****************************************************************************
//------EXPAND selected IFRAME for PAGE-----------DEV  DEV----->
//var intStatusC;		//--???? this var needed?
function showFrameC_DEV061005(NameofCtrl)
{
//intStatus = document.getElementById(NameofList).getAttribute("height");
//var intStatus = document.getElementById('lbxFieldsList').style.height;
var intStatusC = document.getElementById(NameofCtrl).style.height;
	
	if(parseInt(intStatusC) >0)
	{
	//alert("Closing ");
	document.getElementById(NameofCtrl).style.height=0;
	//---------------060705
	
	//document.getElementsByTagName("INPUT").item(0).focus();
	//alert(document.getElementsByTagName("INPUT").item(3).name);
	//document.getElementsByTagName("INPUT").item(3).focus();
	
	//---------------060705
	}
	else
	{
	//alert("Opening ");
	document.getElementById(NameofCtrl).style.height=300;
	//---------------060705
	//alert("Opening " + NameofCtrl);
	//document.Form1.receiveFrame.document.forms("Form1").focus();
	
	//alert("vChild Stuff coming");
	
	//---------------060705
	} 
//alert("My TEST MSG  " + intStatus);
}
//--^^--EXPAND selected IFRAME for PAGE----------^^^--------|
//============^^^========PARENT CALLS IFRAME=============^^^===========|
//===========================================================================








//****************************************************************************
//****************************************************************************
//==================PUT PAGE NO (SERVERD) from CHILD to PARENT===============>
function passChildToParent(sendertext, receivertext)
{
var sent;
sent = document.getElementById(sendertext).value;

//alert("SENT VAL =:  " + sent);

if(isNaN(sent) || sent == null || sent=="")
	{
	// do nothing
	//alert("Nothing Passed");
	}
else
	{
	//alert("Value Passed " + sent);
	parent.document.getElementById(receivertext).value = sent;
	}
}
//===========================================================================







//****************************************************************************
//****************************************************************************
//========================for USER MAINT ======================================
//------PUT selected PAGE into IFRAME for Orders/custFind--------------------->
function getTheFramePage(htmlToGet,putInFrame)
{
//alert("The htmlToGet is:  " + htmlToGet);
//document.getElementById('receiveFrame').src= htmlToGet;

//document.getElementById(putInFrame).src= htmlToGet;
    //-----
var intStatusC = document.getElementById(putInFrame).style.height;
   //-----
var srcTest;
srcTest = document.getElementById(putInFrame).src;
	if(srcTest == htmlToGet)
	{
	//document.getElementById(putInFrame).src= "";
	//---
		if(parseInt(intStatusC) >0)
		{
		document.getElementById(putInFrame).style.height=0;
		}
		else
		{
		document.getElementById(putInFrame).style.height=380;
		} 
	//---	
	}
	else
	{
	document.getElementById(putInFrame).src= htmlToGet;
	//---
	document.getElementById(putInFrame).style.height=380; //--400 originally
	//---
	}
}
//-^^---PUT selected PAGE into IFRAME----------^^^--------|
//===========================================================================


//****************************************************************************
//****************************************************************************
//========================for APP MAINT ======================================
//------?PUT selected PAGE into IFRAME for Orders/custFind??----------------->
//---Takes Height and Width for finer adjustment----------------------------
function getTheFramePageWithSize(htmlToGet,putInFrame,Wd,Ht)
{
//alert("The htmlToGet is:  " + htmlToGet);
//document.getElementById('receiveFrame').src= htmlToGet;

//document.getElementById(putInFrame).src= htmlToGet;
    //-----
var intStatusC = document.getElementById(putInFrame).style.height;
   //-----
var srcTest;
srcTest = document.getElementById(putInFrame).src;
	if(srcTest == htmlToGet)
	{
	//document.getElementById(putInFrame).src= "";
	//---
		if(parseInt(intStatusC) >0)
		{
		document.getElementById(putInFrame).style.height=0;
		document.getElementById(putInFrame).style.width=0;
		}
		else
		{
		document.getElementById(putInFrame).style.height=Ht;
		document.getElementById(putInFrame).style.width=Wd;
		} 
	//---	
	}
	else
	{
	document.getElementById(putInFrame).src= htmlToGet;
	//---
	//document.getElementById(putInFrame).style.height=380; //--400 originally
	document.getElementById(putInFrame).style.height=Ht;
	document.getElementById(putInFrame).style.width=Wd;
	//---
	}
}
//-^^---PUT selected PAGE into IFRAME----------^^^--------|
//===========================================================================



//****************************************************************************
//****************************************************************************
//------EXPAND selected IFRAME for PAGE--------------------->
var intStatusC;
function showFrameU(NameofCtrl)
{
//intStatus = document.getElementById(NameofList).getAttribute("height");
//var intStatus = document.getElementById('lbxFieldsList').style.height;
var intStatusC = document.getElementById(NameofCtrl).style.height;
	
	if(parseInt(intStatusC) >0)
	{
	document.getElementById(NameofCtrl).style.height=0;
	}
	else
	{
	document.getElementById(NameofCtrl).style.height=300;
	} 
//alert("My TEST MSG  " + intStatus);
}
//--^^--EXPAND selected IFRAME for PAGE----------^^^--------|
//===========================================================================

//CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

function beforeCode()
{
var tmp=document.getElementById("ses").value;
//alert("ses Val: " + tmp);
var p=document.getElementById("uPW").value;
//alert("p Val: " + p);
var n=document.getElementById("uName").value;
//alert("n Val: " + n);
var m;
var s;

if(n=="")
	{
	n="non"
	}
if(p=="")
	{
	p="nop"
	}

var np = "";
np = n + p;

m = parseInt(tmp.substring(0,1));


if(m==0)
	{
	m = 1;
	}
	
m++;

//alert("M Val: " + m);
s = tmp.substring(2,tmp.length);

	while(((m * np.length)+2) > (s.length-1))
		{
		s = s + s;
		}

//s = s + s;
//alert("S Val: " + s);


var z = m;

//alert("** Z Val: " + z);
//alert("** NP Val: " + np);
var ss="";
var k=1;
var j=0;

for(j=0; j<s.length; j++)
	{
	//alert("enter Loop J: " + j + " Zval=: " + z);
	
		
	if(j==z)
		{
		ss += np.substring(k-1,k);
		k++;
		//if((z + m) <= s.length)
		//if((z + m) < s.length)
		if(k <= np.length)
			{
			//ss += np.substring(k-1,k);
			//k++;
			
			z += m;
			}
		
		//z += m;
		}
	else
		{
	
			if(j==(m-1)) 
			{
				//ss += np.substring(k-2,k-1);
				ss += n.length;
			}
			
			else if(j==(s.length-2))
			{
			//alert("S.Len - 2 = J at " + j);
			//alert("np.Len at J " + np.length);
				if(np.length < 10)
				{	
					ss += "0";
					ss += np.length;
					j = s.length;
				}
				else
				{
					ss += np.length;
					j = s.length;
				}
				break;				
			}
			
			else
			{
				ss += s.substring(j,j+1);
			}
		}
	//alert("sS Val: " + ss);
	}
	
	
	
	
	
//alert("sS Val END: " + ss);


var rs="";
var i=0;
//for(i=0; i<s.length; i++)
//alert("SS length= " + ss.length);
for(i=ss.length; i>0; i--)
	{
	rs += ss.substring(i-1,i);
	//alert("RS Val: " + rs);
	}


//alert("STOP!! RS Val end: " + rs);

document.getElementById("hdnData").value = rs;
document.getElementById("uPW").value = "";
document.getElementById("uName").value = "";
document.getElementById("ses").value = "";

}

//REF:
//tmpFoot = document.getElementById("Div3").innerHTML;
//var startHead = tmpHead.indexOf("<THEAD>");
		//var endHead = tmpHead.lastIndexOf("</TABLE>");
		// //alert("endHead " + endHead);
		// //tmpHead = tmpHead.substring(0,endHead);
		//tmpHead = tmpHead.substring(startHead,endHead);
		//alert("tmpHead " + tmpHead);


//----JOSH------
function charReplace(s,i,c)
{
 var z=s.substr(0,i);
 var y=s.substr(i+1);
 return z+c+y;
}



//CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-1
/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-2
/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-3
/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */
function deleteCookie(name, path, domain)
{
    if (getCookie(name))
    {
        document.cookie = name + "=" + 
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--END








//CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
//-------global var---     BEING USED

//--------------------
function confirmDel()
{

var ans = confirm("This will delete all items in this Order. \n\n\tCONTINUE?");

if(ans == true)
	{
	//alert("Is true");
	document.getElementById("btnCancel").click();
	//Form1.submit= true;
	}
else 
	{
	//-- do nothing
	//alert("Is false");
	}	
}
//cccccccccccccccccccccccccccccccccccccccccc end cccccccccccccccccccccccccccc


//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
function followVisability(visSource, visDest) //NOT USED!!!!
{
alert("Got to function");
alert(" the " + visSource + " visability is set to (" + document.getElementById(visSource).Style.getAttribute('visibility') + ") ");
if(document.getElementById(visSource).style.getAttribute('visibility') == 'hidden')
{
	document.getElementById(visDest).style.setAttribute('visibility', 'hidden');
}

/*
if(Form1.btnCancel.getAttribute(visable)= false)
{
	Form1.btnCancel2.setAttribute(visable, false);
}
*/
}
//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV END VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV

//************************DBL-CLICK SELECT ON KEYPRESS**(Enter)************
// will put this in onFocus event of select
function dblclickSelect(selectID)
{
//need to check if it was 13 (Enter) pressed or not
//--------------
	if (document.layers)
    document.captureEvents(Event.KEYPRESS);
    
  document.onkeypress = function (evt)
   {
    var key = 
      document.all ? event.keyCode :
      evt.which ? evt.which : evt.keyCode;
      
      //alert("The keypress was captured ascii char : " + key )
    if (key == 13)
    {
		//alert("The keypress was captured :" + key ); 
		//document.formName.submit();
		var theSelect = selectID;
		//alert("the var btnfocused contains: " + btnfocused + "  :  " + thefocused); //--for testing
		var theSelectObj = document.getElementById(theSelect);
		//alert("The keypress was captured : " + key + "\nThe ID : " + theSelect);
		
		//theSelectObj.dblClick();
		//theSelectObj.fireEvent('dblClick');
		theSelectObj.fireEvent('ondblclick');
		//document.Form1.cboCustList.fireEvent('dblClick');
	}
         
  };
  }
  
//---------------------------------------------------------------------










//TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
//TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
//TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTEST
//************************DEV to monitor OnFocus/Blur events between parent/child************
// will put this in onFocus event of select
function FocusOrNotTest_devWait(IFrameName)
{
//need to check if it was 13 (Enter) pressed or not
//--------------
	if (document.layers)
    document.captureEvents(Event.KEYPRESS);
    
  document.onkeypress = function (evt)
   {
    var key = 
      document.all ? event.keyCode :
      evt.which ? evt.which : evt.keyCode;
      
      //alert("The keypress was captured ascii char : " + key )
    if (key == 13)
    {
		//alert("The keypress was captured :" + key ); 
		//document.formName.submit();
		var theSelect = selectID;
		//alert("the var btnfocused contains: " + btnfocused + "  :  " + thefocused); //--for testing
		var theSelectObj = document.getElementById(theSelect);
		
		//theSelectObj.dblClick();
		//theSelectObj.fireEvent('dblClick');
		theSelectObj.fireEvent('ondblclick');
		//document.Form1.cboCustList.fireEvent('dblClick');
	}
         
  };
  }
  
//---------------------------------------------------------------------
//TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
//TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
//TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTEST




//----------------get selected value and put in hidden-------------->
//=====ALSO used by UserSearch to send selected user to UserAsso!!!!
/*OUT---------OUT-------OUT
		function SelValue2Hidden(selListbox, selHiddenIndex)
		{
		//alert("Function called")
		//alert("the value of Hidden :" + document.getElementById(selHiddenIndex).value);
		
		var selected;
		//alert(selected);
		
		var selectValue;
		//alert(selectValue);
		
		selected = document.getElementById(selListbox).selectedIndex;
		selectValue = document.getElementById(selListbox).selectedIndex;
		var selectValue;
		//alert(selectValue);
		
		//selected = document.getElementById(selListbox).getAttribute(selectedIndex);
		//document.Form1.lbxSelDetail2.selectedIndex;
		
		//alert(selected);
		//document.getElementById(selHiddenIndex).getAttribute(value) = selected;
		document.getElementById(selHiddenIndex).value = selected;
		//document.Form1.hiddenIndex.value;
		//TESTING
		//alert("the value of Hidded :" + document.getElementById(selHiddenIndex).value);
		
		}
*/
//========================for USER MAINT ==============================|
//===========================================================================
//===========================================================================
//IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII


function CMTLrgPop(docURL)
{
window.name = 'cmtopener';
//alert('the passed page URL is: ' + docURL);
//var newWindow1=window.open('" + nUrl + "','" + windowname + "');newWindow1.document.focus();"
var newWindow4=window.open(docURL,'CMTlrgPop','menubar=yes scrollbars=yes status=yes resizable=yes');
newWindow4.document.focus();
}


function CMTsmlPop(docURL)
{
window.name = 'cmtopener';
//alert('the passed page URL is: ' + docURL);
//var newWindow1=window.open('" + nUrl + "','" + windowname + "');newWindow1.document.focus();"
var newWindow3=window.open(docURL,'CMTsmlPop','menubar=no scrollbars=no width=460 height=350 status=yes resizable=no');
newWindow3.document.focus();
}

function CMTsmlPop_DEV(docURL)
{
window.name = 'cmtopener';
//alert('the passed page URL is: ' + docURL);
//var newWindow1=window.open('" + nUrl + "','" + windowname + "');newWindow1.document.focus();"
//var newWindow3=window.showModalDialog(docURL,'CMTsmlPop','menubar=no scrollbars=no width=460 height=350 status=yes resizable=no');
var newWindow3=window.showModelessDialog(docURL,'CMTsmlPop','menubar=no scrollbars=no width=460 height=350 status=yes resizable=no');

newWindow3.document.focus();
}




//===========================================================
//===========================================================
//=START===Make IP BOXES routines============================>
		//-----------------------------------------------
		//======NEW CHKBOX===============================
		
		function chkbx(theData)
		{
		//alert("Event happened: "+ theData);
		var editBox;
		var boxName = "ip"+theData;
		
		if(document.getElementById(boxName) != null)
			{
			//alert("is not null");
			//document.getElementById(boxName)
			//document.getElementById(boxName).children.remove;
			
			}
		
	    var divText =document.getElementById(theData).innerText;
	    
	    if(divText == "YES")
			{
			divText = "NO"
			}
		else
			{
			divText = "YES"
			}
		
		editBox = "<input type='text' value='" + divText + "";
		editBox +="' id='" + boxName + "' name='" + boxName + "";
		editBox +="'>";
		//editBox +="' onblur='restoreDiv(this.id);'>";
		
		document.getElementById(theData).innerHTML = editBox
		//document.getElementById(boxName).focus();
		document.getElementById(boxName).style.width=0;
		document.getElementById(boxName).style.height=0;
		document.getElementById(boxName).style.visibility = "hidden";
		
		document.getElementById(theData).innerHTML += divText
	
		}
		
		
		
		
		
		
		
		//============================================================
		//--------------chbox edits----------------------
		function chkbx_orig(theData)
		{
		//alert("Event happened: "+ theData);
		var chBox;
		var boxName = "ip"+theData;
		var cbstyle = "style='WIDTH: 24px; HEIGHT: 20px'";
		var cbval = " value='YES'";
		
		if(document.getElementById(boxName) != null)
			{
			//alert("is not null");
			}
		
	    var divText =document.getElementById(theData).innerText;
		//checked=true
		var chk = "";
		if(divText == "YES")
			{//chk = "checked='true'";
			chk = "checked";
			}
			else
			{//chk = "checked='false'";
			chk = "";
			}
		chBox = "<input type='checkbox'" + chk + "";
		chBox +=" id='" + boxName + "' name='" + boxName + "' ";
		chBox += cbstyle;
		chBox += cbval;
		chBox +=" onblur='redoChkDiv(this.id);'>";
		
		document.getElementById(theData).innerHTML = chBox;
		document.getElementById(boxName).focus();
		}
		
		
		function redoChkDiv(chkID)
		{
		
		var divName = chkID.substring(2,chkID.length);
		var theText =""
		if(document.getElementById(chkID).checked)
			{
			theText = "--YES--";
			}
			else
			{
			theText = "--no--";
			}
		
		document.getElementById(divName).innerHTML += theText; 
		document.getElementById(chkID).style.width=0;
		document.getElementById(chkID).style.height=0;
		document.getElementById(chkID).style.visibility = "hidden";
		}
		//============================================================
		
		
		
		
		//-----------------------------------------------
		//---Text Edits------------------
		
		function onEditF(theData)
		{
		//alert("Event happened: "+ theData);
		var editBox;
		var boxName = "ip"+theData;
		
		if(document.getElementById(boxName) != null)
			{
			//alert("is not null");
			//document.getElementById(boxName)
			//document.getElementById(boxName).children.remove;
			
			}
		
	    var divText =document.getElementById(theData).innerText;
		
		editBox = "<input type='text' value='" + divText + "";
		editBox +="' id='" + boxName + "' name='" + boxName + "";
		editBox +="' onblur='restoreDiv(this.id);'>";
		
		document.getElementById(theData).innerHTML = editBox
		document.getElementById(boxName).focus();
	
		}
		

		
		function restoreDiv(txtID)
		{
		//alert("the restore was called: " + txtID);
		var divName = txtID.substring(2,txtID.length);
		//alert("the divName is : " + divName);
		//alert("the txtID is : " + txtID);
		var theText =document.getElementById(txtID).value;
		document.getElementById(divName).innerHTML += theText; 
		//document.getElementById(txtID).style.visibility = "hidden"
		document.getElementById(txtID).style.width=0;
		document.getElementById(txtID).style.height=0;
		document.getElementById(txtID).style.visibility = "hidden";
		//substring(j,j+1)
		}
		
		
//------------------------------------
//--------------select edits---------------------------
function onEditSel(theData)
		{
		//alert("Event happened: "+ theData);
		//theData holds calling divtag's name/id
		var editBox;
		var boxName = "ip"+theData;
		
		var endSubStr = theData.lastIndexOf("_");
		var cboName = "cbo"+(theData.substring(0,endSubStr));
		//alert("cboName is: "+ cboName);
		
		if(document.getElementById(boxName) != null)
			{
			//alert("is not null");
			//document.getElementById(boxName)
			//document.getElementById(boxName).children.remove;
			
			}
		
	    //var divText =document.getElementById(theData).innerText;
	    
	    //selIndex = document.getElementById(cboID).selectedIndex;
		//selItem = document.getElementById(cboID).options(selIndex).value;
		var cboSelIndex =document.getElementById(cboName).selectedIndex;
	    var cboVal = document.getElementById(cboName).options(cboSelIndex).value;
		
		editBox = "<input type='text' readonly value='" + cboVal + "";
		editBox +="' id='" + boxName + "' name='" + boxName + "";
		editBox +="' onblur='restoreDiv(this.id);'>";
		
		document.getElementById(theData).innerHTML = editBox
		document.getElementById(boxName).focus();
	
		}
		
//-------------------------------------

//==END====Make IP BOXES routines============================|




//==================CLIENT CHECKS===========================>
function checkHandW()
		{
		
		var w = eval(document.body.clientWidth);
		var h = eval(document.body.clientHeight);
		alert("H = " + h + " and W = " + w);
		if(h<530 || w<551)
		{
		alert("H = " + h + " and W = " + w + "\nTHIS WINDOW NEEDS TO CLOSE");
		window.close();
		}
		}
		
		
function checkWin()
		{
		
		var winName = window.name
		//alert("WindowName is: " + winName);
		
		}
				
//===========================================================|



//================= NEW STUFF FOR AVAILSGRID3.aspx ====================>
function pleaseWait()
		{
		var waitMsg = "<b>Please Wait - your request is being processed !!</b>"
		document.getElementById('divClrSel').innerHTML = waitMsg;
		document.getElementById('divClrSel').style.color = "yellow";
		document.getElementById('divClrSel').style.backgroundColor = 'red';
		document.getElementById('btnRefrDisp').disabled = true;
		//---------------
		
		}



//================= NEW STUFF FOR ORDERS4.aspx ============>

var previousDescription="";
function pleaseWait2(ctrlWithInnerHtml)
		{
		var waitMsg = "<b>Please Wait - your request is being processed !!</b>"
		previousDescription=document.getElementById(ctrlWithInnerHtml).innerHTML;
		document.getElementById(ctrlWithInnerHtml).innerHTML = waitMsg;
		document.getElementById(ctrlWithInnerHtml).style.color = "yellow";
		document.getElementById(ctrlWithInnerHtml).style.backgroundColor = 'red';
		//document.getElementById(ctrlToDisable).disabled = true;
		//---------------
		var buttons=document.getElementsByTagName("input");
		var it=-1,cnt=buttons.length;
		while(++it<cnt)
			if(buttons[it].type=="button")
				buttons[it].disabled=true;
		
		}

		
		




//REFs:
//if(isNaN(document.getElementById('txtPrice').value) || document.getElementById('txtPrice').value == null)

//=================^^=====================^^================|
	
//<asp:textbox id="txtRecTcount" runat="server" Height="17px" Width="50px" CssClass="txtbox"></asp:textbox>	
	
	
//Protected WithEvents txtRecTcount As System.Web.UI.WebControls.TextBox	
	
//window.document.Form1.Div1.setCapture();	
	
	
	
