/**************************************************************
	CLASS popWindow
	**************************************************************/
	
	popWindow = {
		
		_width:0,
		_height:0,
		_scrollx:0,
		_scrolly:0,
		_zindex:0,
		activePopWindow:null,
		activeParentWindow:null,
		resetInfo:function(e) {
		
			var IE 	= document.all ? true : false;
			_width 	= document.body.clientWidth;
			_height = document.body.clientHeight;
		
			_scrollx = document.body.scrollLeft;
			_scrolly = document.body.scrollTop;
		},
		
		show:function( id ){
			popWindow.resetInfo()
			popWindow.hide();
			//popWindow.activeParentWindow = document.getElementById(parentId);
			popWindow.activePopWindow = popWindow.create(document.getElementById(id));
			popWindow.activePopWindow.style.display = "block";
			popWindow.activePopWindow.style.zIndex = "1000";
			popWindow.activePopWindow.style.left = (_width/2) - (popWindow.activePopWindow.offsetWidth/2);
			popWindow.activePopWindow.style.top = (_height/2) - (popWindow.activePopWindow.offsetHeight/2);
			return false;
		},
		
		create:function(Obj){
			
			var tmp = document.createElement('DIV');
					tmp.setAttribute("id","backWindow");
					document.body.appendChild(tmp);
			
			/*var tmp = document.createElement('DIV');
					tmp.setAttribute("id","popWindow");
					tmp.innerHTML = Obj.innerHTML;
					popWindow.activeParentWindow.appendChild(tmp);
					return tmp;
			*/
			Obj.className += "popWindow";
			return Obj;
		},
		
		hide:function(){
			if(popWindow.activePopWindow){
				document.body.removeChild(document.getElementById('backWindow'));
				//popWindow.activePopWindow.parentNode.removeChild(popWindow.activePopWindow);
				popWindow.activePopWindow.style.display = "none";
				popWindow.activePopWindow.className = "";
			}
			popWindow.activePopWindow = null;
			return false;
		}
		
	}
	
	
	var bubbleStatus = {
	
		// STATUS
		loop:null,
		fade:0,
		permanent:false,
		elementId:"status",
		
		hide:function(){
			clearInterval( bubbleStatus.loop );
			
			bubbleStatus.fade = 9;
			bubbleStatus.loop = setInterval( bubbleStatus.fadeOut, 50 );
		},
		
		show:function( msg, correct, permanent ){
			
			clearInterval( bubbleStatus.loop );
			
			var Obj = document.getElementById(bubbleStatus.elementId);
			
			bubbleStatus.permanent = permanent;
			if( correct == true ){
				Obj.className = "ok";
			}else if( correct == false ){
				Obj.className = "error";	
			}else if( correct == null ){
				Obj.className = "info";
			}
			Obj.innerHTML = "<span><img src='../resources/images/spacer.gif' align='absmiddle'/> "+msg+"</span>";
			
			//bubbleStatus.fade = 0;
			bubbleStatus.loop = setInterval( bubbleStatus.fadeIn, 50 );
		},
		
		fadeOut:function(){
			var Obj = document.getElementById(bubbleStatus.elementId);
			
			if(bubbleStatus.fade > 0){
				Obj.style.filter = "alpha(opacity="+ (bubbleStatus.fade*10) +")";
				Obj.style.opacity = (bubbleStatus.fade/10);
				Obj.style.display = "block";
				bubbleStatus.fade --;
			}else{
				Obj.style.display = "none";
				bubbleStatus.fade = 0;
				clearInterval( bubbleStatus.loop );
			}
		},
		
		fadeIn:function(color, msg, permanent){
			var Obj = document.getElementById(bubbleStatus.elementId);
			
			if(bubbleStatus.fade < 10){
				Obj.style.filter = "alpha(opacity="+ (bubbleStatus.fade*10) +")";
				Obj.style.opacity = (bubbleStatus.fade/10);
				Obj.style.display = "block";
				bubbleStatus.fade ++;
			}else{
				bubbleStatus.fade = 9;
				clearInterval( bubbleStatus.loop );
				if( bubbleStatus.permanent == false ){
					setTimeout(bubbleStatus.hide, 3000);
				}
			}
		}
	
	};
