function sd()
{
	var df =  new getObj('chkDirty').obj;
	df.checked = true;
}
var handlerFlag_  = 0;
var IGNORE_DIRTY_ = 1;
var FORCE_CHECK_ = 2;
function navif()
{
	handlerFlag_ |= IGNORE_DIRTY_;
}
function navifv()
{
	handlerFlag_ |= IGNORE_DIRTY_;
	if (typeof(TurnOffValidation)=='function')
	{
		TurnOffValidation();
	}
}
function navff()
{
	handlerFlag_ |= FORCE_CHECK_;
}
function navffv()
{
	handlerFlag_ |= FORCE_CHECK_;
	if (typeof(TurnOffValidation)=='function')
	{
		TurnOffValidation();
	}
}
function handleNavError()
{
	return true;
}
function navoff(btn)
{
	if (typeof(DMI_ValidatePage)=="function")
	{
		if (DMI_ValidatePage(true, true) == false)
		{
			return;
		}
	}

	btn.disabled=true;
	var theform;
	var eventTarget = btn.name;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.Form1;
	}
	else {
		theform = document.forms["Form1"];
	}
	theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
	theform.__EVENTARGUMENT.value = '';
	try
	{
		theform.submit();
	}
	catch(e)
	{
		alert(e);
	}	
}

function confirmExit(e)
{
//@ added to create an event object to replace window.event since it is a windows only event
//@ JAP 4/5/2006

	var evnt;
	
	if ( window.event )
		evnt = window.event;
	else
		evnt = e;
	
	var returnMessage = false;
	var tar = "";
	if (document.Form1.__EVENTTARGET.value != null)
	{	// get the target of the postback
		tar = document.Form1.__EVENTTARGET.value;
	}
	// determine if any of the page controls are dirty
	var df =  new getObj('chkDirty').obj;

	if (df!=null && df.checked)
	{	// if there are one or more dirty controls, perform the checks to see if we
		// should give the continue/cancel message.
		
		if ((handlerFlag_ & IGNORE_DIRTY_) == 0)
		{	// if we are not to ignore the dirty flag, such as the case of a reset or save button press
		
			// determine the x-coordinate of the mouse
			var region = document.body.offsetWidth - evnt.clientX;

			// if the mouse x-coordinate is in the same vector as the close button 'x',
			// and the y-coordinate is negative (meaning the mouse is above the client
			// area), we consider that a browser-closing event.
			var xingOut =  (region > 0 && region < 25 && evnt.clientY < 0); 
					
			if (((handlerFlag_ & FORCE_CHECK_) > 0) || xingOut || evnt.altKey)
			{	// if we want to force the check, regardless of source,
				//	or there was a press of the close button, or an alt key
				returnMessage = true;
			}
			// otherwise, see if the navigation target is the inner toolbar
			else if (tar.indexOf (':_whToolbar') >= 0)
			{	// no message to give if it is "tab" navigation within a page
				;
			}
			
			// check if it is the outer, top level menu toolbar
			else if (tar.indexOf ('Menu1:') >= 0)
			{	// if the outer level menu was clicked we will offer the message.
				returnMessage = true;
			}			
		}
	}
	
	handlerFlag_ = 0;	// reset the handler flag for the next trip
	if (true == returnMessage)
	{
		if ( window.event )
			window.onerror = handleNavError;
			
		clearVeil();
		if ( window.event )
			event.returnValue="Your changes will be lost if they are not saved.";
		else
			return "Your changes will be lost if they are not saved.";
	}
}


