/*var displayUnloadMessage = false;
var displayReportUnloadMessage = false;

var xmlhttp;
var contextPath;

window.onbeforeunload = function(){
	
	if((window.event.clientX<0) || (window.event.clientY<0))
	{
		onBeforeUnloadAction();
	}

}
window.attachEvent("onload",loadWindowHandler);
window.attachEvent("onunload",unloadWindowHandler);

function loadWindowHandler(){
	formSubmit();
	displayUnloadMessage = true;
	window.onbeforeunload = confirmExit;
}

function unloadWindowHandler(){
	
	window.detachEvent("onload",loadWindowHandler);
	window.detachEvent("onunload",unloadWindowHandler);
	
	if(window.displayUnloadMessage){
		killSession();
	}
}

function confirmExit(){
	//alert(window.displayUnloadMessage);
	onBeforeUnloadAction();
	
	if(!window.displayReportUnloadMessage && window.displayUnloadMessage){
		return "The survey session will be lost if you select back/close option from internet browser. Are you sure you want to exit the session?";
	}
}

function killSession(){
	//alert(displayUnloadMessage);
			//confirm( "The survey session will be lost if you select back / forward / close option from internet browser. Are you sure you want to exit the session?");
		
	
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); // For Old Microsoft Browsers
		} catch (e) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); // For Microsoft IE 6.0+
			} catch (e2) {
				xmlHttp = false; // No Browser accepts the XMLHTTP Object then false
			}
		}
		if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
			xmlHttp = new XMLHttpRequest(); //For Mozilla, Opera Browsers
		}
		
		if (xmlHttp != null ) { 

	          var url = contextPath + "/InvalidateSession" ; 
	          xmlHttp.open( "POST" , url, false ); 
	          try { 
	                xmlHttp.send(); 

	          } catch (e) {} ; 
	    } 
		window.open('','_parent',''); 
	    window.close();
	}
function onBeforeUnloadAction(){
		
		
		if(document.getElementById('contextPath')!= null){
		 contextPath = document.getElementById('contextPath').value;
		
		}
		else{
			contextPath = "/SurveyTool";
		}
		var flag = false;
		if((window.event.clientX<0) || (window.event.clientY<0))
		{
			displayUnloadMessage = true;
		 //flag=window.confirm("The survey session will be lost if you select back / forward / close option from internet browser. Are you sure you want to exit the session?");
		}
		if(flag){
			
			try {
				xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); // For Old Microsoft Browsers
			} catch (e) {
				try {
					xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); // For Microsoft IE 6.0+
				} catch (e2) {
					xmlHttp = false; // No Browser accepts the XMLHTTP Object then false
				}
			}
			if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
				xmlHttp = new XMLHttpRequest(); //For Mozilla, Opera Browsers
			}
			
			
		    if (xmlHttp != null ) { 

		    	

		          var url = contextPath + "/InvalidateSession" ; 

		         

		          xmlHttp.open( "POST" , url, false ); 

		          try { 

		                xmlHttp.send(); 

		          } catch (e) {} ; 

		    } 
		
		}else{
			
				return false;
		}
		
		   
	
	}

	function formSubmit(){

			var forms = document.getElementsByTagName("form");

			for(var i=0; i< forms.length;i++){
			forms[i]._submit = forms[i].submit;
			forms[i].submit = overrideSubmit;
			forms[i].attachEvent("onsubmit",onPageSubmit);
			}

			}

			overrideSubmit = function(){
			onPageSubmit();
			//this._submit();
			};

			onPageSubmit = function(){
	
			window.displayUnloadMessage = false;
			window.onbeforeunload = null;
			};

	








*/
