var isAnythingChanged = false;

function setEventHandlers() 
{

	var oControl;
	if (null == document.all( "hidNeed2Save"))
	{
		oControl = document.createElement("<INPUT id='hidNeed2Save' name='hidNeed2Save' type='hidden'>");
		document.forms[ 0].insertBefore( oControl);
	}
	for (i = 0; i < document.forms[ 0].elements.length ; i++) 
	{
		document.forms[ 0].elements[ i].attachEvent( 'onchange', onControlChange);
	}
}
function onControlChange() 
{
	isAnythingChanged = true;
}
function onMenuClick( sTargetPage)
{
	var s = new String( document.body.onload);
	
	oControl = document.createElement("<INPUT id='hidTargetPage' name='hidTargetPage' type='hidden'>");
	document.forms[ 0].insertBefore( oControl);
	document.forms[ 0].hidTargetPage.value = sTargetPage;
	if(isAnythingChanged && s.indexOf( "setEventHandlers()") != -1)
	{	
		if(window.confirm( 'Do you want to save the changes?')) 
		{ 
			document.forms[ 0].hidNeed2Save.value = true;
		}
	}
	document.forms[ 0].submit();
}