﻿// JScript File
        var allowedExit;
        
        //register the event
        if (window.captureEvents){
            //if firefox
            window.captureEvents(Event.CLICK);
            window.onclick=allowedExitEvent;
        }
        else 
            //if explorer
            document.onclick=allowedExitEvent;
        
        //set allow close window var to false
        window.onload = function(){allowedExit = false;}
        
        //
        window.onbeforeunload = function(e) {
		    if(!e) var e = window.event;
	        if(!allowedExit){ //if not allowed to quit without confirm
	          if(e.preventDefault) //if firefox
	            e.preventDefault();
	          else //if explorer
	             event.returnValue = " "; 
	       }
	    }
        function allowedExitEvent(e){
            if(!e) var e = window.event;
            var type;
            if(e.target) //check how send the click
                type = e.target.type;
            else
                type= e.srcElement.type;
            //if one of the image, button, link = ""
            if((type == "image") || (type == "button") || (type == ""))
                //set var to true
                allowedExit=true;
        }

