var g_functions = {
	details_frame_id: 'det_frame',
	
	details_frame_dim: {width: 350, height: 420},
	
	place_centered: function(obj, base_size)
		{
		if (typeof obj == 'string') obj = document.getElementById(obj);
		DocBody = this.getBody();
		var top = (DocBody.height_bottom - DocBody.height_top) / 2 + DocBody.height_top - base_size.height / 2;
		if (top < 0) top = 0;
		var left = (DocBody.width_right - DocBody.width_left) / 2 + DocBody.width_left - base_size.width / 2;
		if (left < 0) left = 0;
		obj.style.top = top+'px';
		obj.style.left = left+'px';
		},
		
	getBody: function()
		{
		var DocBody = new Object();
		si = this.get_size();
		scr = this.get_scroll();
		DocBody.width_left = scr.l + 20;
		DocBody.width_right = scr.l + si.w - 20;
		DocBody.height_top = scr.t + 20;
		DocBody.height_bottom = scr.t + si.h - 20;
		return DocBody;
		},
		
	get_size: function()
		{
		var myWidth = 0, myHeight = 0;
		if( typeof( window.innerWidth ) == 'number' ) 
			{
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
		return {w: myWidth, h: myHeight}
		},
		
	get_scroll: function getScrollXY() 
		{
		var scrOfX = 0, scrOfY = 0;
		if( typeof( window.pageYOffset ) == 'number' ) {
			//Netscape compliant
			scrOfY = window.pageYOffset;
			scrOfX = window.pageXOffset;
		} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
			//DOM compliant
			scrOfY = document.body.scrollTop;
			scrOfX = document.body.scrollLeft;
		} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
			//IE6 standards compliant mode
			scrOfY = document.documentElement.scrollTop;
			scrOfX = document.documentElement.scrollLeft;
		}
		return {t: scrOfY, l: scrOfX}
		},
		
	open_details: function(id)
		{
		var obj = document.getElementById(this.details_frame_id);
		if (obj)
			{
			obj.src = 'show_movie_details.php?id='+id;
			} else {
			var tempIFrame = document.createElement('iframe');
			tempIFrame.setAttribute('id',this.details_frame_id);
			tempIFrame.style.border = '1px solid black';
			tempIFrame.style.width = this.details_frame_dim.width+'px';
			tempIFrame.style.height = this.details_frame_dim.height+'px';
			tempIFrame.style.position = 'absolute';
			tempIFrame.src = 'show_movie_details.php?id='+id;
			iframe = document.body.appendChild(tempIFrame);
			this.place_centered(this.details_frame_id, this.details_frame_dim);
			}
		},

	open_time: function(id, name)
		{
		var obj = document.getElementById(this.details_frame_id);
		if (obj)
			{
			obj.src = 'show_movie_time.php?id='+id+"&name="+name;
			} else {
			var tempIFrame = document.createElement('iframe');
			tempIFrame.setAttribute('id',this.details_frame_id);
			tempIFrame.style.border = '1px solid black';
			tempIFrame.style.width = this.details_frame_dim.width+'px';
			tempIFrame.style.height = this.details_frame_dim.height+'px';
			tempIFrame.style.position = 'absolute';
			tempIFrame.src = 'show_movie_time.php?id='+id+"&name="+name;
			iframe = document.body.appendChild(tempIFrame);
			this.place_centered(this.details_frame_id, this.details_frame_dim);
			}
		},

	close_details: function()
		{
		var obj = document.getElementById(this.details_frame_id);
		document.body.removeChild(obj);
		}
}
