	function StageRect()
	{
						
		var viewportwidth;
		var viewportheight;
								
		if (typeof window.innerWidth != 'undefined')
		{
			 viewportwidth = window.innerWidth;
			 viewportheight = window.innerHeight;
		}
		else if (typeof document.documentElement != 'undefined'
			&& typeof document.documentElement.clientWidth !=
			'undefined' && document.documentElement.clientWidth != 0)
		{
			viewportwidth = document.documentElement.clientWidth;
			viewportheight = document.documentElement.clientHeight;
		}
		else
		{
			viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
			viewportheight = document.getElementsByTagName('body')[0].clientHeight;
		}
				
		this.x = 0;
		this.y = 0;
		this.width = viewportwidth;
		this.height = viewportheight;
		
	}
	
	function popUp(URL) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400,left = 660,top = 400');");
		}
	
	function getPopup(URLRequest, w, h)
	{
		
		var width = 600;
		var height = 380;
		
		var stage = new StageRect();
		var popup = document.createElement('div');
			popup.id = 'popup';
			popup.style.position = "absolute";
			popup.style.width = width+"px";
			popup.style.height = height+"px";
			popup.style.backgroundColor = '#FFF'; //'url(_CORE/img/trame.gif)';
			popup.style.textAlign = "right";
					
		var closeButton = document.createElement('div');
			closeButton.id = "close";
			closeButton.onclick = closePopup;
			closeButton.style.marginRight = 20+"px";
			closeButton.style.cursor = "pointer";
		
		var bitmap = new Image();
			bitmap.src = 'DATA/images/popup_closeBTN.gif';
			bitmap.style.width = 44 +"px";
			bitmap.style.height = 20 +"px";
		
		var iframe = document.createElement("IFRAME"); 
   			iframe.id = 'iframe';
			iframe.setAttribute("src", URLRequest); 
   			iframe.setAttribute('frameborder', '0');
			iframe.setAttribute('scrolling', 'hidden');
			iframe.style.width = Number(width-40)+"px"; 
   			iframe.style.height = Number(height-40)+"px";
			iframe.style.marginLeft = 20+"px";
			iframe.style.marginRight = 20+"px";
		
		closeButton.appendChild(bitmap);
		popup.appendChild(closeButton);
		popup.appendChild(iframe); 
		document.body.appendChild(popup);
		
		resizehandler();
		
	}
	
	function closePopup()
	{
		
		if(document.getElementById('popup') != null) document.body.removeChild(document.getElementById('popup'));
		
	}
	
	function resizehandler()
	{
		var stage = new StageRect();
		
		
		if(document.getElementById('container') != null)
		{
			document.getElementById('container').style.width = (stage.width < 960) ? 960+"px" : "100%";
			document.getElementById('container').style.height = (stage.height < 600) ? 600+"px" : "100%";
		}
		
		if(document.getElementById('popup') != null)
		{
			document.getElementById('popup').style.left = Number(stage.width/2 - 300) + "px";
			document.getElementById('popup').style.top = Number(stage.height/2 - 170) + "px";				
		}
				
	}
	
	function fbFan(type)
	{
		var stage = new StageRect();
		var fanBox = document.getElementById('fanbox');
		if(type == "up")
		{
			fanBox.style.bottom = "0px";
		}else{
			fanBox.style.bottom = "-560px";
		}
  	}
	
	
	
	/*
	var width = screen.availWidth;
	var height = screen.availHeight;
	window.screenX = 0;
	window.screenY = 0;	
	window.moveTo(0,0);
	window.resizeTo(width, height);
	*/
	window.onresize = resizehandler;
	
