﻿var CMessageBox = Class.create(
{
	ShowLarge:function(box, options)
	{
		light = $(box)
		fader = light.next();
		light.style.display='block';
		fader.style.display='block';

		if(typeof(options) == 'undefined')
			options = {};

		var img = light.down(7);
		var heightOffSet = 29

		if(Prototype.Browser.IE)
		{
			heightOffset = 100
			img = light.down(9)
		}

		var style = {top:0, left:0};
		var height = img.getHeight()
		var width = img.getWidth()


		style.top      = (((10 + (document.documentElement.scrollTop || document.body.scrollTop))) ) + 'px';
		style.left      = ((pageWidth() - width ) / 2) + 'px';

		if(options.overflow == 'hidden')
		{
			style.overflow = 'hidden';
			width+= 15;
		}
			style.height = (height + heightOffSet) + 'px'
		if(Prototype.Browser.IE7)
			style.width = (width) + 'px'

		try
		{
			light.setStyle(style)
		}
		catch(ex){}

		try
		{
			var docheight = getDocHeight();
			fader.setStyle({height: docheight[0] + 'px'});
		}
		catch(ex){}

		if(options.closeVisible == 'false')
		{
			light.down('.CloseLarger').hide();
		}

	}
, 
	HideLarge:function()
	{
		light.style.display='none';
		fader.style.display='none';
	}
});
	MessageBox = new CMessageBox();






function pageWidth() {return window.innerWidth != null? window.innerWidth: document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth:null;}
function pageHeight() {return window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null? document.body.clientHeight:null;}
function getDocHeight() {
   
   	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	return arrayPageSizeWithScroll;

   
   }
   
   Prototype.Browser.IE7 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5)) == 7;