// JavaScript Document

var ZoomImage = {
	$				: function (strID) {return document.getElementById(strID); }
	,RootPath		: "/"
	,ImageRootPath	: ""
	,ResizeImage	: true
	,ResizeType		: 1
	,Resize			: {
		1 : {
			 Path			: "includes/getimage.aspx"
			,FileVar		: "file"
			,PathVar		: "path"
			,WidthVar		: "width"
			,Width			: 640
			,HeightVar		: "height"
			,Height			: 480
			,CropVar		: "crop"
			,Crop			: 1
			,CacheVar		: "cache"
			,Cache			: 1
			,TempVar		: "tempfolder"
			,Temp			: "_temp"
		}
	}
	,ImageList 		: new Array("")
	,intIndex		: -1
	,Folder			: ""
	,ResizeToImage	: true
	,CentreImage	: false
	,CentreVert		: false
	,blnZoomOpen	: false
	,intCurType		: false
	,OnScrollID		: -1
	,OnResizeID		: -1
	,ScrollPos		: {
		 Left			: 0
		,Top			: 0
	}
	,Current		: {
		 Index			: -1
		,File			: ""
		,Title			: ""
		,ID				: ""
	}
	,ZoomSize	: {Width : -1, Height : -1, MinWidth : 400, MinHeight : 150}
	,Window		: {Width : -1, Height : -1}
	,Images		: {
		Count		: -1
		,Length		: 0
		,Add			: function (strFileName,objVars) {
			if (strFileName != undefined && (strFileName != "")) {
				this.Count += 1;
				this.Length += 1;
				this[this.Count] = {
					 File		: strFileName
					,ID			: ""
					,Path		: ""
					,Title		: ""
					,Alt		: ""
					,Details	: ""
					,Type		: 1
					,Width		: ""
					,Height		: ""
				}
				if (objVars != undefined) {
					for (var objItem in objVars) {
						this[this.Count][objItem] = objVars[objItem];
					}
				}
				return this[this.Count]
			}
		}
		,FromArray	: function (arrImages) {
			for (var i=0;i<arrImages.length;i=i+3) {
				var strFullPath = arrImages[i];
				var strID		= (arrImages[i+1] == "") ? i : arrImages[i+1];
				var strTitle	= arrImages[i+2];
				var arrPath 	= strFullPath.split("/");
				
				var strFileName = arrPath[arrPath.length -1];
				var strPath		= strFullPath.replace(strFileName,"");
				
				this.Add(strFileName,{ID : strID, Path : strPath, Title : strTitle});
			}
		}
		,Search		: function (strSearch,strSearchType) {
			if (strSearchType == undefined || strSearchType == null || strSearchType == "") {
				strSearchType = "File";
			}
			for (var i=0;i<this.Length;i++) {
				if (this[i][strSearchType] == strSearch) {
					return i;
					break;
				}
			}
			return -1
		}
		
	}
	,onImageLoad	: null
	,GetResizePath	: function (strFileName,strFilePath) {
		this.GetWindowSize()
		var strPath 	= "";
		var objResize	= this.Resize[this.ResizeType];
		
		if (objResize) {
			strPath = this.RootPath + objResize.Path + "?" + objResize.FileVar + "=" + strFileName;
			
			if (strFilePath != undefined) {
				strPath += "&" + objResize.PathVar + "=" + "../" + strFilePath;
			}
			var intWinWidth = this.Window.Width - 100
			var intWinHeight = this.Window.Height - 100
			var intWidth = (intWinWidth < objResize.Width) ? intWinWidth  : objResize.Width
			var intHeight = (intWinHeight < objResize.Height) ? intWinHeight  : objResize.Height
			var intWinDiff = intWinHeight - intWinWidth
			
			if (this.Images[this.intIndex].Size) {
				var objImage = this.Images[this.intIndex];
				if (this.ResizeToImage) {
					var intWinRatio = intWinWidth/intWinHeight
					var intImageRatio = objImage.Size.Width/objImage.Size.Height
		
					if ((intWinWidth < objImage.Size.Width) || (intWinHeight < objImage.Size.Height)) {
						if (intWinWidth < objImage.Size.Width && (intWinHeight > objImage.Size.Height)) {
							intWidth = intWinWidth
							intHeight = (intWidth/objImage.Size.Width) * objImage.Size.Height
						}
						if (intWinWidth > objImage.Size.Width && (intWinHeight < objImage.Size.Height)) {
							intHeight = intWinHeight
							intWidth = (intHeight/objImage.Size.Height) * objImage.Size.Width
						}
						if (intWinWidth < objImage.Size.Width && (intWinHeight < objImage.Size.Height)) {
							
							if (objImage.Size.Width < (objImage.Size.Height-intWinDiff)) {
								intHeight = intWinHeight
								intWidth = (intHeight/objImage.Size.Height) * objImage.Size.Width
							}else{
								intWidth = intWinWidth
								intHeight = (intWidth/objImage.Size.Width) * objImage.Size.Height
								
							}
						}
					}else{
						intWidth = objImage.Size.Width
						intHeight = objImage.Size.Height
					}
					
					if ((this.Window.Width - 150 < objImage.Size.Width) || (this.Window.Height - 150 < objImage.Size.Height)) {
						
						
						/*if (objImage.Size.Width > objImage.Size.Height) {
							intWidth = this.Window.Width - 200
							intHeight = (intWidth/objImage.Size.Width) * objImage.Size.Height
						}else{
							intHeight = this.Window.Height - 200
							intWidth = (intHeight/objImage.Size.Height) * objImage.Size.Width
						}*/
						
						/*if ((this.Window.Width - 150 < objImage.Size.Width) && (this.Window.Height - 150 < objImage.Size.Height)) {
							if (objImage.Size.Width < objImage.Size.Height) {
								intWidth = this.Window.Width - 150
								intHeight = (intWidth/objImage.Size.Width) * objImage.Size.Height
							}else{
								intHeight = this.Window.Height - 150
								intWidth = (intHeight/objImage.Size.Height) * objImage.Size.Width
							}
						}else{
							if (this.Window.Width - 150 < objImage.Size.Width) {
								intWidth = this.Window.Width - 150
								intHeight = (intWidth/objImage.Size.Width) * objImage.Size.Height
							}else{
								
								intHeight = this.Window.Height - 150
								intWidth = (intHeight/objImage.Size.Height) * objImage.Size.Width
							}
						}*/
						
					}
					
					//intWidth = (this.Window.Width < objImage.Size.Width) ? this.Window.Width - 50 : objImage.Size.Width
					//intHeight = (this.Window.Height < objImage.Size.Height) ? this.Window.Height - 50 : objImage.Size.Height
				
				//	if (objImage.Size.Width < objResize.Width) intWidth = objImage.Size.Width
				//	if (objImage.Size.Height < objResize.Height) intHeight = objImage.Size.Height
				}
			}
			
			strPath += "&" + objResize.WidthVar 	+ "=" + intWidth;
			strPath += "&" + objResize.HeightVar 	+ "=" + intHeight;
			strPath += "&" + objResize.CropVar 		+ "=" + objResize.Crop;
			strPath += "&" + objResize.CacheVar 	+ "=" + objResize.Cache;
			strPath += "&" + objResize.TempVar 		+ "=" + objResize.Temp;
		}
		return strPath;
	}
	,Show			: function (strSearch,strSearchType) {
		this.Window = this.$("imagezoom")
		if (this.Images.Count == -1 && (this.ImageList.length > 0)) {
			this.Images.FromArray(this.ImageList);
		}
		
		if (this.Images.Length > 0) {
			
			this.$("imagezoomimage").src = ""
			this.$("imagezoomimage").style.display = "none"
			ZoomImage.$("imagezoom").style.width = 210 + "px";
			ZoomImage.$("imagezoom").style.height = 210 + "px";
			ZoomImage.$("imagezoomcontents").style.width = 200 + "px";
			ZoomImage.$("imagezoomcontents").style.height = 200 + "px";
			this.Centre();
			
			if (this.BlackOut.Show) {
				this.BlackOut.Show();
			}
			
			this.Window.style.display = "block";
			this.$("imagezoomloader").style.display = "block";
			this.blnZoomOpen = true;
			
			
			//this.Centre()
			//this.$("imagezoomimage").src = "includes/getimage.aspx?file=../media/" + this.Folder + "/zooms/" + strImage + "&width=640&height=480&nocrop=1"
			this.intIndex = this.Images.Search(strSearch,strSearchType);
			/*if (this.Images.Length > 1) {
				this.$("imagezoomcontrol_prev").style.display = (this.intIndex == 0) ?  "none" : "block"
				this.$("imagezoomcontrol_next").style.display = (this.intIndex == this.Images.Length) ?  "none" : "block"
			}else{
				this.$("imagezoomcontrol_prev").style.display = "none"
				this.$("imagezoomcontrol_next").style.display = "none"
			}*/
			
			this.Change(0);
			return false;
		}else{
			return true;
		}
	}
	,Close			: function () {
		this.$("imagezoom").style.display = "none";
		if (this.BlackOut.Hide) {
			this.BlackOut.Hide();
		}
		this.blnZoomOpen = false;
		return false;
	}
	,SetOnLoad		: function () {
		if (this.$("imagezoomimage").readyState) {
		this.$("imagezoomimage").onreadystatechange = function () {
			if (this.readyState.toString() == "loaded" || this.readyState.toString() == "complete") {
				ZoomImage.Loaded();
			}
		}
		if (this.$("imagezoomimage").readyState.toString() == "loaded" || this.$("imagezoomimage").readyState.toString() == "complete") {
			ZoomImage.Loaded();
		}
		}else{
			this.$("imagezoomimage").onload = function () {
				ZoomImage.Loaded();
			}
			if (this.$("imagezoomimage").complete) {
				ZoomImage.Loaded();
			}
		}
	}
	,Loaded			: function () {
		this.$("imagezoomloader").style.display = "none";
		this.$("imagezoomimage").style.display = "block"
		
		var objImageSize 	= ZoomImage.getElementSize(ZoomImage.$("imagezoomimage"))		
		this.ZoomSize.Width = objImageSize.x;
		this.ZoomSize.Height= objImageSize.y;
		this.Centre();
		if (this.onImageLoad) {
			this.onImageLoad();
		}
	}
	,GetWindowSize : function () {
		if (typeof window.innerWidth != 'undefined'){
      		this.Window.Width = window.innerWidth;
      		this.Window.Height = window.innerHeight;
		}else if(typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
			this.Window.Width = document.documentElement.clientWidth;
       		this.Window.Height = document.documentElement.clientHeight;
		}else {
			this.Window.Width = document.getElementsByTagName('body')[0].clientWidth;
       		this.Window.Height = document.getElementsByTagName('body')[0].clientHeight;

		}
	}
	,ImageSizeLoaded: function (objXml) {
		var objImage = this.Images[this.intIndex];
		if (objXml.responseText != "") {
			var arrSize = objXml.responseText.split(",")
			objImage.Size = {
				Width 	: arrSize[0]
				,Height : arrSize[1]
			}
		}
		//window.location = this.GetResizePath(objImage.File , this.Folder + objImage.Path );
		this.$("imagezoomimage").src = this.GetResizePath(objImage.File , this.Folder + objImage.Path );
	}
	,Change			: function (intDir) {
		this.GetWindowSize()

		if (intDir != 0) {
			this.intIndex += intDir;
		}
		var objImage = this.Images[this.intIndex];
		if (objImage.Type == 1) {
			
			this.$("imagezoomloader").style.display = "block";
			this.$("imagezoomimage").style.display = "block";
			this.$("imagezoommedia").style.display = "none";
			ZoomImage.$("imagezoomloader").style.width = ZoomImage.$("imagezoomcontents").style.width
			if (ZoomImage.$("imagezoom").style.height != "") {
				ZoomImage.$("imagezoomloader").style.height = ((parseInt(ZoomImage.$("imagezoomcontents").style.height,10)-50)/2) + "px"
				ZoomImage.$("imagezoomloader").style.paddingTop = ((parseInt(ZoomImage.$("imagezoomcontents").style.height,10)-60)/2) + "px"
			}
			
			if (this.ResizeImage) {
				if (objImage.Size) {
					this.$("imagezoomimage").src = this.GetResizePath(objImage.File , this.Folder + objImage.Path );
				}else{
					if (hex && (hex.Connect)) {
						hex.Connect.Get(this.RootPath + "library/imagezoom/getimagesize.asp?file="+objImage.File+"&path=../../"+this.Folder + objImage.Path,function(objXml){ZoomImage.ImageSizeLoaded(objXml)})
					}else{
						this.$("imagezoomimage").src = this.GetResizePath(objImage.File , this.Folder + objImage.Path );
					}
				}
				
			}else{
				this.$("imagezoomimage").src = this.RootPath + this.Folder + objImage.Path + objImage.File;
			}
			
			this.SetOnLoad();
			this.$("imagezoomcontrol_prev").style.display = (this.intIndex == 0) ?  "none" : "block";
			this.$("imagezoomcontrol_next").style.display = (this.intIndex == this.Images.Count) ?  "none" : "block";
		
		}else{
			this.$("imagezoomimage").style.display = "none";
			this.$("imagezoommedia").style.display = "block";
			this.$("imagezoomloader").style.display = "none";
			var strHtmlCode = '<object style="height: ' + objImage.Width+ 'px; width: ' + objImage.Height + 'px">'
			strHtmlCode += '<param name="movie" value="http://www.youtube.com/v/' + objImage.File  + '?version=3">'
			strHtmlCode += '<param name="allowFullScreen" value="true">'
			strHtmlCode += '<param name="allowScriptAccess" value="always">'
			strHtmlCode += '<embed src="http://www.youtube.com/v/' + objImage.File  + '?version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="' + objImage.Width + '" height="' + objImage.Height + '">'
			strHtmlCode += '</object>'
			
			this.ZoomSize.Width = objImage.Width
			this.ZoomSize.Height= objImage.Height
			this.$("imagezoommedia").innerHTML = strHtmlCode
			this.Centre();
			
		}
		if (objImage.Title != "") {
			this.$("imagezoomtitle").innerHTML = objImage.Title;
			this.$("imagezoomtitle").style.display = "block";
			this.$("imagezoomimage").alt = objImage.Alt;
		}else{
			this.$("imagezoomtitle").innerHTML = "";
			this.$("imagezoomtitle").style.display = "none";
			this.$("imagezoomimage").alt = "";
		}
		this.Current.Index = this.intIndex;
		this.Current.ID = objImage.ID;
		this.Current.Title = objImage.Title;
		this.Current.File = objImage.File;
		return false;
	}
	,Centre			: function () {
		ZoomImage.MoveToCentre()
		var objImageSize 	= ZoomImage.getElementSize(ZoomImage.$("imagezoomimage"))
		var objFrameSize	= ZoomImage.getElementSize(ZoomImage.$("imagezoomcontents"))
		
		var intImageWidth = ZoomImage.ZoomSize.Width;
		var intImageHeight = ZoomImage.ZoomSize.Height;

		if (intImageWidth < ZoomImage.ZoomSize.MinWidth) {
			ZoomImage.$("imagezoomimage").style.marginLeft = ((ZoomImage.ZoomSize.MinWidth-intImageWidth)/2) + "px"
			intImageWidth = ZoomImage.ZoomSize.MinWidth
		}else{
			ZoomImage.$("imagezoomimage").style.marginLeft = 0
		}
		if (intImageHeight < ZoomImage.ZoomSize.MinHeight) {
			ZoomImage.$("imagezoomimage").style.marginTop = ((ZoomImage.ZoomSize.MinHeight-intImageHeight)/2) + "px"
			intImageHeight = ZoomImage.ZoomSize.MinHeight
		}else{
			ZoomImage.$("imagezoomimage").style.marginTop = 0
		}
		
		
		var intFrameWidth	= (objFrameSize) ? objFrameSize.x 	: 640;
		var intFrameHeight	= (objFrameSize) ? objFrameSize.y	: 480;

		if (intImageWidth != 0) {
			ZoomImage.$("imagezoomcontrol").style.display = "block"
			if (intImageWidth != intFrameWidth || intImageHeight != intFrameHeight) {
				intFrameWidth = intImageWidth;
				intFrameHeight = intImageHeight;
				if (ZoomImage.ResizeToImage && (intImageWidth > 0)) {
					if (hex && (hex.FX)) {
						hex.FX.Resize.Start("imagezoom",{EndWidth: (intFrameWidth+20), EndHeight : (intFrameHeight+20), AnchorX : "centre", AnchorY : "top", Centre : false, PositionX : "centre", Border : {x : 2, y: 2}})
						hex.FX.Resize.Start("imagezoomcontents",{EndWidth: (intFrameWidth+10), EndHeight : (intFrameHeight+10), AnchorX : "centre", AnchorY : "centre", Border : {x : 10, y: 10}})
					}else{
						ZoomImage.$("imagezoom").style.width = intFrameWidth+20 + "px";
						ZoomImage.$("imagezoom").style.height = intFrameHeight+20 + "px";
						ZoomImage.$("imagezoomcontents").style.width = intFrameWidth+10 + "px";
						ZoomImage.$("imagezoomcontents").style.height = intFrameHeight+10 + "px";
					}
				}
				if (this.CentreImage) {
					var intImageLeft = ((intFrameWidth - 10) - intImageWidth) / 2;
					var intImageTop	= ((intFrameHeight - 10) - intImageHeight) / 2;
					ZoomImage.$("imagezoomimage").style.marginLeft = intImageLeft + "px";
					ZoomImage.$("imagezoomimage").style.marginTop = intImageTop + "px";
					
					ZoomImage.$("imagezoomloader").style.marginLeft = intImageLeft + "px";
					ZoomImage.$("imagezoomloader").style.marginTop = intImageTop + "px";
				}
			}else{
					
			}
			//ZoomImage.MoveToCentre()
		//hex.Effects.doResize($,startWidth,startHeight,endWidth,endHeight,steps,interval,blnCentre,onComplete,strAnchorX,strAnchorY,hideOnComplete)	
		}else{
			ZoomImage.MoveToCentre()
		}
		if (intFrameWidth > 0) {
			//ZoomImage.$("imagezoomloader").style.width = (intFrameWidth-50) + "px";
			//ZoomImage.$("imagezoomloader").style.height = ((intFrameHeight+20)/2) + "px"
			//ZoomImage.$("imagezoomloader").style.paddingTop = ((intFrameHeight+20)/2) + "px"
		}
		
	}
	,MoveToCentre	: function () {
		var blnIE = (window.innerHeight > 0) ? false : true;
		var intWinHeight = (blnIE) ? document.documentElement.clientHeight : window.innerHeight;
		var intWinWidth	= (blnIE) ? document.documentElement.clientWidth : window.innerWidth;
		var objFrameSize	= ZoomImage.getElementSize(ZoomImage.$("imagezoomcontents"))
		var intFrameWidth	= (objFrameSize) ? objFrameSize.x 	: 640;
		var intFrameHeight	= (objFrameSize) ? objFrameSize.y	: 480;
		var blnMove			= true
		
		if (intWinHeight == 0) intWinHeight = document.body.offsetHeight
		if (intWinWidth == 0) intWinWidth = document.body.offsetWidth
		//alert(document.body.offsetHeight)
		
		intFrameWidth = (intFrameWidth == 0) ? 		50 : intFrameWidth
		intFrameHeight = (intFrameHeight == 0) ? 	50 : intFrameHeight
	
		var intLeft = (intWinWidth/2) - (intFrameWidth/2);
		var intTop = (intWinHeight/2) - (intFrameHeight/2);
		
		if (intLeft < 0) intLeft = 0
		if (intTop < 0) {
			intTop = 20
			blnMove = false
		}
		var objSrollPos = ZoomImage.GetScrollPos();
		ZoomImage.$("imagezoom").style.marginLeft	= ((intLeft) + objSrollPos.Left) + "px";
		if (ZoomImage.CentreVert) {
			ZoomImage.$("imagezoom").style.top	= ((intTop) + objSrollPos.Top) + "px";
		}else{
			ZoomImage.$("imagezoom").style.top	= "18px";
		}
	}
	,OnScroll		: function () {
		if (ZoomImage.blnZoomOpen) {
			if (ZoomImage.OnScrollID != -1) {
				window.clearTimeout(ZoomImage.OnScrollID);
			}
			ZoomImage.OnScrollID = window.setTimeout(ZoomImage.Centre,500);
		}
	}

	,OnResize		: function () {
		if (ZoomImage.blnZoomOpen) {
			if (ZoomImage.OnResizeID != -1) {
				window.clearTimeout(ZoomImage.OnResizeID);
			}
			ZoomImage.OnResizeID = window.setTimeout(ZoomImage.DoResize,500);
		}
	}
	,DoResize			: function () {
		ZoomImage.Change(0)
		ZoomImage.BlackOut.Refresh()
	}
	,GetScrollPos	: function () {
		if (typeof window.pageYOffset != 'undefined') {
			this.ScrollPos = { Left : window.pageXOffset, Top : window.pageYOffset};
		}else if (typeof document.documentElement.scrollTop != 'undefined' && document.documentElement.scrollTop > 0) {
			this.ScrollPos = { Left : document.documentElement.scrollLeft, Top : document.documentElement.scrollTop};
		}else if (typeof document.body.scrollTop != 'undefined'){
			this.ScrollPos = { Left : document.body.scrollLeft, Top : document.body.scrollTop};
		}
		return this.ScrollPos;
	}
	,BlackOut : {
		 Version		: "1.2.0.2"
		,ID			: "blackout"
		,Depth		: 900
		,Colour		: "#000000"
		,Opacity	: 0.5
		,onClick	: null
		,Created	: false
		,Animate	: false
		,Width		: null
		,Height		: null
		,ActualWidth 	: null
		,ActualHeight 	: null
		,FullWidth		: null
		,FullHeight		: null
		,blnIE		: null
		,$			: function () {
			return	(this.Created) ? document.getElementById(this.ID) : null;
		}
		,Initialise	: function () {
		//hex.Log.Add("Blackout","Initialising: ID = '[$" + this.ID + "$]', Version: [$" + this.Version + "$]");
		//hex.Versions.Add(this.ID,this.Version)
		}
		,Fade		: {
			 StartOpacity 	: 0
			,Steps			: 20
			,Interval		: 25
		}
		,Show		: function () {
			ZoomImage.GetWindowSize()
			this.Create()
			this.$().style.display = "block";
		}
		,Hide		: function () {
			this.$().style.display = "none";
		}
		,GetWidth		: function (blnIngnoreContents) {
			this.blnIE = (window.innerWidth > 0) ? false : true
			if (blnIngnoreContents == null) {blnIngnoreContents = false}
			var intWinWidth = (this.blnIE) ? document.documentElement.clientWidth : window.innerWidth;
			var intBodyWidth = (this.blnIE) ? document.body.scrollWidth : document.body.scrollWidth;
			this.Width = (!blnIngnoreContents && (intBodyWidth > intWinWidth)) ? intBodyWidth : intWinWidth;
			this.ActualWidth = intWinWidth;
			this.FullWidth	 = intBodyWidth;
			//hex.Log.Add("Window","Getting Window Width: [$" + this.Width + "$]");
			return this.Width;
		}
		,GetHeight		: function (blnIngnoreContents) {
			this.blnIE = (window.innerWidth > 0) ? false : true
			if (blnIngnoreContents == null) {blnIngnoreContents = false}
			var intWinHeight = (this.blnIE) ? document.documentElement.clientHeight : window.innerHeight;
			var intBodyHeight = (this.blnIE) ? document.body.scrollHeight : document.body.scrollHeight;
			if (intWinHeight == 0) intWinHeight = document.body.offsetHeight
			this.Height = (!blnIngnoreContents && (intBodyHeight > intWinHeight)) ? intBodyHeight : intWinHeight;
			this.ActualHeight = intWinHeight;
			this.FullHeight	 = intBodyHeight;
			//hex.Log.Add("Window","Getting Window Height: [$" + this.Height + "$]");
			return this.Height;
		
		}
		,Create		: function () {
			if (!this.Created) {
				var objBlackout = document.createElement("div");
				var objIframe = document.createElement("iframe");
				objBlackout.id	= this.ID;
				objBlackout.style.backgroundColor = this.Colour;
				objBlackout.style.position = "absolute";
				objBlackout.style.zIndex = this.Depth;
				objBlackout.style.width = (((document.body.offsetWidth < this.GetWidth()) ? this.GetWidth()-21 : document.body.offsetWidth)) + "px";
				objBlackout.style.height = ((document.body.offsetHeight < this.GetHeight()) ? this.GetHeight() : document.body.offsetHeight) + "px";
				objBlackout.style.opacity = this.Opacity;
				objBlackout.style.filter = "Alpha(Opacity='" + (this.Opacity *100) + "')";
				objBlackout.style.display = "none";
				objBlackout.style.left = 0;
				objBlackout.style.top = 0;
				objBlackout.style.right = 0;
				objBlackout.style.bottom = 0;
				document.body.insertBefore(objBlackout,document.body.childNodes[0]);
				
				objIframe.style.width = "100%";
				objIframe.style.height = ((document.body.offsetHeight < this.GetHeight()) ? this.GetHeight() : document.body.offsetHeight) + "px";
				objBlackout.appendChild(objIframe)
				objBlackout.onclick = this.onClick;
			
				this.Created = true;
			}
		}
		,Refresh	: function () {
			if (this.Created) {
				this.$().style.backgroundColor = this.Colour;
				this.$().style.zIndex = this.Depth;
				this.$().style.width = "100%";
				this.$().style.height = ((document.body.offsetHeight < this.GetHeight()) ? this.GetHeight() : document.body.offsetHeight) + "px";
				this.$().style.opacity = this.Opacity;
				this.$().style.filter = "Alpha(Opacity='" + (this.Opacity *100) + "')";
			}
		}
	}
	,getElementWidth	: function (objElement) {
		var blnIE = (window.innerWidth > 0) ? false : true
		if (objElement == "window") {
			objElement = (blnIE) ? document.body : window
		}
		if (objElement != null) {
			return (blnIE) ? objElement.offsetWidth : objElement.clientWidth
		}else{
			return -1
		}
	}
	,getElementHeight	: function (objElement) {
		var intReturn = 0
		if (objElement != null) {
			var blnIE = (window.innerHeight > 0) ? false : true
			if (objElement == "window") {
				intReturn = (blnIE) ? document.body.offsetHeight : window.innerHeight
				intReturn = (blnIE) ? document.documentElement.clientHeight : window.innerHeight
				if (intReturn == 0) intReturn = document.body.offsetHeight
			}else{
				intReturn = (blnIE) ? objElement.offsetHeight : objElement.clientHeight
			}
			return intReturn
		}else{
			return -1
		}
	}
	,getElementSize : function (objElement) {
		var intWidth = this.getElementWidth(objElement)
		var intHeight =  this.getElementHeight(objElement)
		
		return {x:intWidth, y:intHeight};
	}
}

ZoomImage.RootPath = "/"
