

/*
addEvent(document, 'mouseover', function(evt) { getMouseXY(evt) } );

addEvent(document, 'click', function(evt) { getMouseXY(evt) } );

addEvent(document, 'mousemove', function(evt) { getMouseXY(evt) } );

addEvent(document, 'mouseout', function(evt) { getMouseXY(evt) } );	*/




var TimeoutExecutor = Class.create();
TimeoutExecutor.prototype = {
    initialize: function(callback, timeout) {
        this.callback = callback;
        this.timeout = timeout;
        this.currentlyExecuting = false;
        this.registerCallback();
    },
    registerCallback: function() {
        this.timeoutID = setTimeout(this.onTimerEvent.bind(this), this.timeout);
    },
    onTimerEvent: function() {
        try {
            this.currentlyExecuting = true;
            if (this.callback && this.callback instanceof Function) {
                this.callback();
            }
        }
        finally {
            this.currentlyExecuting = false;
            delete this.timeoutID;
        }
    },
    cancel: function() {
        if (!this.currentlyExecuting && this.timeoutID) {
            clearTimeout(this.timeoutID);
            delete this.timeoutID;
        }
    },
    reset: function() {
        if (!this.currentlyExecuting && this.timeoutID) {
            clearTimeout(this.timeoutID);
            delete this.timeoutID;
            this.registerCallback();
        }
    }
}

var QuickPopup = Class.create();
QuickPopup.prototype = {

/*
* Initialize the QuickUserProfile object.
*/
    initialize: function(frameURL, userTT, textTTLoading, textTTError, contextPath)
    {
        this.loadingContent = '<strong class="zeusportal-tooltip2-loading">' + textTTLoading + '</strong>';
        this.userTT = userTT;
        this.textErrorTT = textTTError;
		this.frameURL = frameURL;
		this.contextPath = contextPath;
		
		
	

    },


    openPopupLayer: function(url, width, height) {

	   
		keepOpenFlag = true;	
		
		
		if(width == 0 || width == null){
			width = 650;	
		}
		
		if(height == 0 || height == null){
			height = 400;	
		}

		
		
		this.userTTURL = url;
		
		/**
		
		var doc = document;
		   
		var xmlHttp = getTipHttp();
	
		xmlHttp.open("GET", url, true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
		xmlHttp.send(null);
		
		var docElement = this.userTT;
		
		var responseText;
	
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				
			 document.getElementById(docElement).innerHTML = this.loadingContent;

			 responseText = xmlHttp.responseText;
			 
			 document.getElementById(docElement).innerHTML = responseText;
			
				if ( FB.XFBML.Host.parseDomTree )
				  setTimeout( FB.XFBML.Host.parseDomTree, 0 );	
			}else{
			 doc.getElementById(docElement).innerHTML = "Error";
			}
       	}	
		
		$j("#"+this.userTT).dialog({ width: 600, height: 400, stack: true, zindex: 4555 });
		$j("#"+this.userTT).dialog('open');
		
		
		$j("#"+this.userTT).dialog({ width: 600, height: 400, stack: false, zindex: 4555 });
		$j("#"+this.userTT).dialog('open');
		

		
		document.getElementById(docElement).innerHTML = responseText;
		
		**/
		

		$j("#"+this.userTT).dialog( 'close' );
		$j("#"+this.userTT).dialog( 'destroy' );

		
		$j("#"+this.userTT).load(url).dialog({ width: width, height: height, stack: false, zindex: 4555, modal: true });
		$j("#"+this.userTT).dialog('open');
		
		eval($j("#"+this.userTT).html());


		
		
		/**
		$j("#"+this.userTT).load(url).dialog({ width: 600, height: 400, stack: false, zindex: 4555 });
		$j("#"+this.userTT).dialog('open'); **/

		

		/* Grab the Content From The URL */
	

    },

    getShareBox: function() {

		
		var instance = this;

	
		toggleProfileVisibility(this.userTT, this.userTTURL);



    },

    cancelPopup: function() {

			
			$j("#"+this.userTT).dialog( "close" );
			
	
		
    },
	
	openImagePopup: function(imageid, taggedid){
		
		if(taggedid == null){
			taggedid = 0;	
		}
		
		popuplayer.openPopupLayer(this.contextPath+"/jspincludes/viewimage.jsp?image_id="+imageid+"&t="+taggedid, 750, "auto");
		
	
	}
}

