//==========================================================
// CenterTable												
//==========================================================
    function CenterTable(pTableID)
    {		
        // Find The Table Width                 
        var oDiv = document.getElementById(pTableID);
        var TableWidth = 0;
        if (oDiv != null)
        {
			if(oDiv.style.width.length == 4)
				TableWidth = oDiv.style.width.substr(0,2);
			if(oDiv.style.width.length == 5)
				TableWidth = oDiv.style.width.substr(0,3);
			if(oDiv.style.width.length == 6)
				TableWidth = oDiv.style.width.substr(0,4);
			// Fnd the Screen Width                 
			var screenwidth  = screen.availWidth;
			// Calculate the left Table position    
			var LeftPos = ((screenwidth - TableWidth) / 2) - 25;
			oDiv.style.left=LeftPos;
        }
        else
			alert ("Heading Object: " + pTableID + " Not Found");
    }

//==========================================================
// Postback
//==========================================================
//    function Postback()
//    {	
//        __doPostBack(btnName,''); 
//alert("Got To Postback");
//    }

// =================================================================
// Screen Load Message Clear										
//<body ms_positioning="GridLayout" onLoad="clearPreloadPage();">	
//		<!--#include file="../Builder Includes/LDS_PreLoad.htm" -->	
//==================================================================
	function clearPreloadPage() 
		{
			if (document.getElementById)
			{
				document.getElementById('prepage').style.visibility='hidden';
			}
			else
			{
				if (document.layers)
					{ 
						document.prepage.visibility = 'hidden';
					}
					else 
					{ 
						document.all.prepage.style.visibility = 'hidden';
					}
			}
		}

//==========================================================
// CLOSE All												
//==========================================================
  function CloseAll()
	{
		// Screen 2	
		try
		{
			if (Screen2 != null)
				Screen2.close();
		}
		catch (e){}		
		// Screen 3	
		try
		{
			if (Screen3 != null)
			{
				Screen3.close();
			}
		}
		catch (e){}	
		// Screen 4	
		try
		{
			if (Screen4 != null)
				Screen4.close();
		}
		catch (e){}	
		// Screen 5	
		try
		{
			if (Screen5 != null)
			{
				Screen5.close();
			}
		}
		catch (e){}
		// Screen 6	
		try
		{
			{
				if (Screen6 != null)
				{
					Screen6.close();
				}
			}
		}
		catch (e){}
		// Screen 7	
		try
		{
			if (Screen7 != null)
				Screen7.close();
		}
		catch (e){}
		// Screen 8	
		try
		{
			if (Screen8 != null)
			{
				Screen8.close();
			}
		}
		catch (e){}	
		// Screen 9	
		try
		{
			if (Screen9 != null)
				Screen9.close();
		}
		catch (e){}	
		// Screen 10	
		try
		{
			if (Screen10 != null)
				Screen10.close();
		}
		catch (e){}
		// Screen 11	
		try
		{
			{
				if (Screen11 != null)
					Screen11.close();
			}
		}
		catch (e){}
		// Screen 12	
		try
		{
			if (Screen12 != null)
				Screen12.close();
		}
		catch (e){}
		// Screen 13	
		try
		{
			if (Screen13 != null)
			{
				Screen13.close();
			}
		}
		catch (e){}	
		// Screen 14	
		try
		{
			if (Screen14 != null)
				Screen14.close();
		}
		catch (e){}	
		// Screen 15	
		try
		{
			if (Screen15 != null)
				Screen15.close();
		}
		catch (e){}
		// Screen 1	
		try
		{
			{
			if (Screen1 != null)
				Screen1.close();
			}
		}
		catch (e){}
	}

//==========================================================
// CLOSE WINDOW												
//==========================================================
  function CloseWin()
	{
	window.opener = self;
	window.close();
	}

//==========================================================
// BUTTON -- Color Mouse Out                                
//==========================================================
  function ColorMouseOut(id, cssName)
    {
        // document.getElementById(id).style.color='Blue';                  
        // document.getElementById(id).style.backgroundColor.color='Blue';  
        document.getElementById(id).className=cssName;
    }

//==========================================================
// BUTTON -- Color Mouse Over                               
//==========================================================
  function ColorMouseOver(id, cssName)
    {
        // document.getElementById(id).style.color='Red';                   
        // document.getElementById(id).style.backgroundColor.color='Red';   
        document.getElementById(id).className=cssName;
    }

//==========================================================
// GoBack													
//==========================================================
 function GoBack()
 	{
        window.history.go(-1);
	}

//==========================================================
// Hide Progress Bar										
//==========================================================
function HideProgressBar()	{
	var myDIV = document.all('DIVProgressBar');
	myDIV.style.visibility = 'hidden';
}

//==========================================================
// SET FOCUS												
//==========================================================
function init()
	{
	//	if (document.forms[0]["txt_UserID"] != null)
			document.forms[0][txt_UserID].focus();
	//		document.Form1..focus();			
	}
	
//==========================================================
// CLOSE WINDOW / GO TO LOGOFF SCREEN                       
//==========================================================
  function Logoff()
	{
	window.opener = self;
	window.close();
	ShowScreen("../CRM MyDocs/LDS_MyDocs.aspx");
	}

//==========================================================
// PUSHBUTTON - DELETE										
//==========================================================
function PB_Delete()
		{
		agree=confirm("THIS ACTION WILL DELETE THIS ITEM!")
		if (agree)
			window.location.href="Default.asp";
		}

//==========================================================
// POPUP -- Simple											
//==========================================================
// function PopUp0(pScreen)
//   	{
//      	Screen1 = window.open(pScreen,"aself",'toolbar=0,location=0,directories=0,status=0,menubar=0,top=150, left=120,scrollbars=yes,resizable=0,width=500,height=350');
//  	}

//==========================================================
// POPUP -- Simple											
//==========================================================
// function PopUp1(pScreen)
//   	{
//      	Screen1 = window.open(pScreen,"Message",'toolbar=0,location=0,directories=0,status=0,menubar=0,top=150, left=120,scrollbars=yes,resizable=0,width=500,height=350');
//  	}

//==========================================================
// PRINT THE SCREEN SCREEN									
//==========================================================
 function Print()
	{
		window.print();
	}
	
//==========================================================
// SHOW HELP IN NEW WINDOW									
//==========================================================
 function ShowHelp(pScreen)
	{
		window.clear
		window.open(pScreen,"","top=100, left=100, height=500, width=625, scrollbars=yes, toolbar=no, status=yes, resizable=yes");
	}

//==========================================================
// Show Progress Bar										
//==========================================================
function ShowProgressBar(posTop, posLeft)	
	{
		var myDIV = document.all('DIVProgressBar');
		myDIV.style.top = posTop;
		myDIV.style.left = posLeft;
		myDIV.style.visibility = 'visible';
	}

//==========================================================
// SHOW SCREEN IN NEW WINDOW								
//==========================================================
// function ShowScreen(pScreen)
//	{
//		//		screenwidth  = screen.availWidth
//		//		screenheight = screen.availHeight	
//		//		window.open(pScreen,"","top=0, left=0, height=screenheight, width=screenwidth, scrollbars=no, toolbar=no, status=yes, resizable=no");	
//		//		NewWindow.moveTo(0,0)
//		//     	NewWindow2 = window.open(pScreen,"pName",'toolbar=1,location=0,directories=0,status=1,menubar=0,top=0,left=0,scrollbars=yes,resizable=1,width=1012,height=635');
//		screenwidth  = screen.availWidth;
//		screenheight = screen.availHeight;	
//    	Screen1 = window.open(pScreen,"pName","toolbar=1,location=0,directories=0,status=1,menubar=0,top=0,left=0,scrollbars=yes,resizable=1");      	
//	}
//==========================================================
// SHOW SCREEN IN NEW WINDOW -- Centered					
//==========================================================
//function ShowScreenCentered(pScreen, pScreenID, pHeight, pWidth)
//		{
//			//
//			// CENTER THE WINDOW	
//			//
//			var screenwidth  = screen.availWidth; 
//			var screenheight = screen.availHeight; 
//			var leftVal = (screen.availWidth  - pWidth) / 2;
//			var topVal  = (screen.availHeight - pHeight) / 2;
//	    	pScreenID = window.open(pScreen,pScreenID,"toolbar=1,location=0,directories=0,status=1,menubar=0,top=" + topVal + ",left=" + leftVal + ",scrollbars=yes,resizable=1");      		    	
//		}
		
//==========================================================
// SHOW SCREEN IN NEW WINDOW -- Modal Centered				
//==========================================================
//function ShowScreenModalCentered(pScreen, pScreenID, pHeight, pWidth)
//		{
//		 // pScreenID = window.showModalDialog('../CW Administration/LDS_ChangePW.aspx', null,'status:no;dialogWidth:370px;dialogHeight:220px;dialogHide:true;help:no;scroll:no'); 
//		 //	pScreenID = window.showModalDialog(pScreen, null,'status:no;dialogWidth: 100px;dialogHeight:100px;dialogHide:true;help:no;scroll:no'); 			
//		 pScreenID = window.showModalDialog(pScreen, "Test Pams",'status:no; dialogWidth:' + pWidth + 'px;dialogHeight:' + pHeight + 'px;dialogHide:true;help:no;scroll:no'); 			
//		}

//==========================================================
// SHOW SCREEN IN NEW WINDOW -- Centered w/ Return Value	
//==========================================================
//function ShowScreenCenteredReturn(pScreen, pScreenID, pHeight, pWidth)
//		{
//			//
//			// CENTER THE WINDOW	
//			//
//			var screenwidth  = screen.availWidth; 
//			var screenheight = screen.availHeight; 
//			var leftVal = (screen.availWidth  - pWidth) / 2;
//			var topVal  = (screen.availHeight - pHeight) / 2;
//	    	pScreenID = window.open(pScreen,pScreenID,"toolbar=1,location=0,directories=0,status=1,menubar=0,top=" + topVal + ",left=" + leftVal + ",scrollbars=yes,resizable=1");      		    	
//		}		
		
//==================================================================
// **** SHOW SCREEN Modal -- No Parameters						****
//		1.	Absolute control	-- Just set all parms 				
//		2.	Centered			-- Just set the height and width	
//==================================================================
function ShowScreenModal(pScreen, pScreenID, pHeight, pWidth, pLeft, pTop)
		{
//pWidth	= 425;
//pHeight = 189;
//pLeft	= 0;
//pTop	= 0;		
			// Window Name		
			var	Window_Name		 =	pScreen ;			
			// Window Settings	
			var	Window_Settings  =	"";

			// ---- Height		
			if (pHeight == "0")
				Window_Settings	= Window_Settings +	"dialogHeight:" + screen.availHeight   + "px;";
			else
				Window_Settings	= Window_Settings +	"dialogHeight:" + pHeight + "px;";

			// ---- Left		
			if (pLeft != "0")
				Window_Settings	= Window_Settings +	"dialogLeft:" + pLeft + ";";
			// ---- Top			
			if (pTop != "0")
				Window_Settings	= Window_Settings +	"dialogTop:" + pTop + ";";

			// ---- Width		
			if (pWidth == "0")
				Window_Settings	= Window_Settings +	"dialogWidth:" + screen.availWidth + "px;";
			else
				Window_Settings	= Window_Settings +	"dialogWidth:" + pWidth + "px;";

			// This setting is in effect only if Left/Top are not set	
			Window_Settings	= Window_Settings +	"center:yes;"			;

			Window_Settings = Window_Settings +	"dialogHide:true;"		;
			Window_Settings = Window_Settings +	"help:no;"				;
			Window_Settings = Window_Settings +	"scroll:no;"			;
			Window_Settings	= Window_Settings +	"status:no;"			;		
			Window_Settings	= Window_Settings +	"unadorned:no;"			;		

			return pScreenID = window.showModalDialog(Window_Name, null, Window_Settings); 
		}
//==================================================================
// **** SHOW SCREEN Modal -- With Parameters					****
//		1.	Absolute control	-- Just set all parms 				
//		2.	Centered			-- Just set the height and width	
//==================================================================
function ShowScreenModalWithParameters( pScreen, pScreenID, pHeight, pWidth, pLeft, pTop, 
                                        pParm1, pParm2, pParm3, pParm4, pParm5, pParm6, pParm7)
		{
//pWidth	= 425;
//pHeight = 189;
//pLeft	= 0;
//pTop	= 0;		
			// Window Name		
            var Parms = "?Parm1=" + pParm1 + "&Parm2=" + pParm2 + "&Parm3=" + pParm3
                      + "&Parm4=" + pParm4 + "&Parm5=" + pParm5 + "&Parm6=" + pParm6+ "&Parm7=" + pParm7;
			var	Window_Name		 =	 pScreen + Parms ;			

			// Window Settings	
			var	Window_Settings  =	"";


			// ---- Height		
			if (pHeight == "0")
				Window_Settings	= Window_Settings +	"dialogHeight:" + screen.availHeight   + "px;";
			else
				Window_Settings	= Window_Settings +	"dialogHeight:" + pHeight + "px;";

			// ---- Left		
			if (pLeft != "0")
				Window_Settings	= Window_Settings +	"dialogLeft:" + pLeft + ";";
			// ---- Top			
			if (pTop != "0")
				Window_Settings	= Window_Settings +	"dialogTop:" + pTop + ";";

			// ---- Width		
			if (pWidth == "0")
				Window_Settings	= Window_Settings +	"dialogWidth:" + screen.availWidth + "px;";
			else
				Window_Settings	= Window_Settings +	"dialogWidth:" + pWidth + "px;";

			// This setting is in effect only if Left/Top are not set	
			Window_Settings	= Window_Settings +	"center:yes;"			;

			Window_Settings = Window_Settings +	"dialogHide:true;"		;
			Window_Settings = Window_Settings +	"help:no;"				;
			Window_Settings = Window_Settings +	"scroll:no;"			;
			Window_Settings	= Window_Settings +	"status:no;"			;		
			Window_Settings	= Window_Settings +	"unadorned:no;"			;		

			return pScreenID = window.showModalDialog(Window_Name, null, Window_Settings); 
		}

//==================================================================
// **** SHOW SCREEN MODLESS										****
//		1.	Absolute control	-- Just set all parms 				
//		2.	Centered			-- Just set the height and width	
//==================================================================
function ShowScreenModless(pScreen, pScreenID, pHeight, pWidth, pLeft, pTop)
		{
//pHeight	= 100;		
//pWidth	= 200;	
//pLeft	= 0;
//pTop	= 0;
			// Height				
			if (pHeight == "0")
				pHeight = screen.availHeight;
			if (pWidth	== "0")
				pWidth	= screen.availWidth; 
			// CENTER THE WINDOW?	
			if (pLeft	== "0")
				pLeft	= (screen.availWidth  - pWidth) / 2;
			if (pTop	==	"0")					
				pTop  = (screen.availHeight - pHeight) / 2;
    		pScreenID = window.open(pScreen,pScreenID,"toolbar=1,location=0,directories=0,status=1,menubar=0,top=" + pTop + ",left=" + pLeft + ",scrollbars=yes,resizable=1" + ", width=" + pWidth + ",height=" + pHeight);      		    	
		}

//==================================================================
// **** SHOW SCREEN MODLESS										****
//		1.	Absolute control	-- Just set all parms 				
//		2.	Centered			-- Just set the height and width	
//==================================================================
function ShowScreenModlessSame(pScreen, pScreenID, pHeight, pWidth, pLeft, pTop)
		{
//pHeight	= 100;		
//pWidth	= 200;	
//pLeft	= 0;
//pTop	= 0;
			// Height				
			if (pHeight == "0")
				pHeight = screen.availHeight;
			if (pWidth	== "0")
				pWidth	= screen.availWidth; 
			// CENTER THE WINDOW?	
			if (pLeft	== "0")
				pLeft	= (screen.availWidth  - pWidth) / 2;
			if (pTop	==	"0")					
				pTop  = (screen.availHeight - pHeight) / 2;
    		window.open(pScreen,pScreenID,"toolbar=1,location=0,directories=0,status=1,menubar=0,top=" + pTop + ",left=" + pLeft + ",scrollbars=yes,resizable=1" + ", width=" + pWidth + ",height=" + pHeight);      		    	
		}
		
//==========================================================
// SHOW SCREEN IN NEW WINDOW WITH SCREEN NAME				
//==========================================================
// function ShowScreenModless(pScreen, pScreenName)
//	{
//		//		screenwidth  = screen.availWidth
//		//		screenheight = screen.availHeight	
//		//		window.open(pScreen,"","top=0, left=0, height=screenheight, width=screenwidth, scrollbars=no, toolbar=no, status=yes, resizable=no");	
//		//		NewWindow.moveTo(0,0)
//		//     	NewWindow2 = window.open(pScreen,"pName",'toolbar=1,location=0,directories=0,status=1,menubar=0,top=0,left=0,scrollbars=yes,resizable=1,width=1012,height=635');
//		screenwidth  = screen.availWidth;
//		screenheight = screen.availHeight;	
//    	pScreenName = window.open(pScreen,pScreenName,"toolbar=1,location=0,directories=0,status=1,menubar=0,top=0,left=0,scrollbars=yes,resizable=1");      	
//	}

//==========================================================
// VALIDATOR -- Disable                                     
//==========================================================
  function Validator_Disable(pCTRL)
    {
     var myVal = document.getElementById(pCTRL);
        ValidatorEnable(myVal, false);  
    }

