var client = {

	getPage: function() { 
		
		// Default-Values for 1024x768
		var pageWidth = 720;
		var pageHeight = 576;
		
		var scrollArr = this.getScroll();
		var winArr = this.getWindow();
		pageWidth = winArr.width + scrollArr.left;
		pageHeight = winArr.height + scrollArr.top;
	
		return { scrollX: scrollArr.left, scrollY: scrollArr.top, winW: winArr.width, winH: winArr.height, pageW: pageWidth, pageY: pageHeight };
	}, 
	
	getScroll: function() { 
		return { left: this.scrollLeft(), top: this.scrollTop() };
	}, 
	
	getWindow: function() { 
		return { width: this.windowWidth(), height: this.windowHeight() };
	},
	
	scrollLeft: function() {
		var xScroll = 0;
		if (self.pageXOffset)
			xScroll = self.pageXOffset;
		else if (document.documentElement && document.documentElement.scrollLeft) 
			xScroll = document.documentElement.scrollLeft;
		else if (document.body)
			xScroll = document.body.scrollLeft;
			
		return xScroll;
	},
	
	scrollTop: function() {
		var yScroll = 0;
		if (self.pageYOffset)
			yScroll = self.pageYOffset;
		else if (document.documentElement && document.documentElement.scrollTop)
			yScroll = document.documentElement.scrollTop;
		else if (document.body)
			yScroll = document.body.scrollTop;
			
		return yScroll;
	},
	
	windowWidth: function() {
		var xWin = 720;
		if (self.innerHeight)
			xWin = self.innerWidth; 
		else if (document.documentElement && document.documentElement.clientWidth) 
			xWin = document.documentElement.clientWidth; 
		else if (document.body) 
			xWin = document.body.clientWidth;
			
		return xWin; 
	},
	
	windowHeight: function() { 
		var yWin = 576;
		if (self.innerHeight)
			yWin = self.innerHeight;
		else if (document.documentElement && document.documentElement.clientHeight)
			yWin = document.documentElement.clientHeight;
		else if (document.body)
			yWin = document.body.clientHeight;
			
		return yWin; 
	}
};

var updateShowBox;
var lastShowBox;
var yScroll;
var fade = false;
function showBox( id, type )
{
	if(fade == false)
	{
		var html = jQuery(id);
		
		//alert(html);
		
		//alert();
		
		html 	=	'<div id="'+html.attr('id')+'">'+html.html()+'/>';
		
		jQuery(id).remove();
		
		jQuery('body').append(html);
		
		
		fade = true;
		yScroll = client.scrollTop();
		jQuery(id).css('top', yScroll );
	
		if( type == 0 ) {
	
			lastShowBox = id;
		
			jQuery(id).fadeIn(1000, function(){ 
				jQuery(id+' .shadow_box_player').css('display', 'block');
				showBox(id, 2); 
			});
		}
		else if( type == 1 ) {
			lastShowBox = '';
			jQuery(id+' .shadow_box_player').css('display', 'none');
			jQuery(id).fadeOut(2000);
		}
		else if( lastShowBox == id ) {
			updateShowBox = setTimeout('showBox("' + id + '", 2)', 500);
		}
	fade = false;
	}
}

