<!--
    // Function handleMultipleOnClick is used to capture multiple clicks on a button.
	// The first click is captured as a valid onClick event, subsequent clicks are disregarded
	// for the time period specified ('t'). After time 't' has elapsed the click counter is 
	// reset to 0 and the next subsequent click is handled as a valid onClick event and the process
	// is repeated. This function is used by transactional buttons where multiple processes will have
	// undesireable/ undeterminable effects.
	
	var clicked=null; //tracks double click 
	var btn_click_counter = 0;  // Counts the number of time an element has been clicked
	// 40000 milliseconds, 40 seconds. Delay time before the click counter is reset and 
	// the button is allowed to be clicked again (in case the first transaction was interuppted)
    
	function handleMultipleOnClick() {
		btn_click_counter++;
	  	if(btn_click_counter > 1) { 
	  	    alert('You have already clicked this button. It is not necessary to click again.');
		    setTimeout("btn_click_counter = 0; alert('timeout expired');" , 40000)
		    return false;   
		}
	
        // Check that the 'working' image is an element in the document object
        // Set the visibilty style to visible if it exists
		if (document.getElementById && document.getElementById("imgWaitAMoment") != null)
		    {
			node = document.getElementById("imgWaitAMoment").style.visibility='visible';
		    }
		else if (document.layers && document.layers["imgWaitAMoment"] != null)
		    {
			document.layers["imgWaitAMoment"].visibility = 'visible';
		    }
		else if (document.all)
		    {
   			document.all["imgWaitAMoment"].style.visibility = 'visible';
   		    }
        

		return true;
	}
	
	
	function ClickDone() {  clicked=null; } 

	function HandleDoubleClick() 
	{
		if(clicked==null) 
		{  
			clicked=setTimeout('ClickDone()',400);
			return true;
		}
		else 
		{  	 
			clearTimeout(clicked);  
			clicked=null;
			return false;
		}   
	}	
	
	var localclicktime = 0;
    function ResetClickTime()
    {
		localclicktime=0;
	}

    function ValidateDoubleClick()
    {
        var td = new Date();
        if ((td.getTime() - localclicktime)>60000) 
        {
			localclicktime=td.getTime(); 
			return true;
		} 
		else 
		{
			//alert('You already clicked button. Please be patient and wait for system to response.');
			return false;
		}
    }

//-->

