﻿//---------------------------------------------------------------------------------
//  Description:    Javascript functions delaing with common display functionality    
//  Author:         Sam Mercer
//  Modified:       24/10/2006  Initial version
//  Modified:       19/04/2007  Changed object names
//---------------------------------------------------------------------------------
			
			function sizeFrame()
			{
			    var nHeight = 0, nIndex, eObj, eObjControl;
			    if (typeof(document.all.Report)=='object')
			        eObj = document.all.Report;
			    if (typeof(document.all.Heatmap)=='object')
			        eObj = document.all.Heatmap;
			    if (typeof(document.all.Results)=='object')
			        eObj = document.all.Results;
			        
			    if (typeof(document.all.ReportControl)=='object')
			        eObjControl = document.all.ReportControl;
			    if (typeof(document.all.ChartControl)=='object')
			        eObjControl = document.all.ChartControl;
			        			        
			    if (typeof(eObjControl)=='object')
			    {
			        nHeight = nHeight + eObjControl.offsetHeight;
			        nIndex = document.all.imgControl.src.indexOf('imgPlus');
			        if (nIndex < 0)
			            if (typeof(eObj)=='object')
			                nHeight = nHeight + eObj.offsetHeight;
			    }
			    else
			        if (typeof(eObj)=='object')
				        nHeight = nHeight + eObj.offsetHeight;

				if (typeof(eObj)=='object')
				    window.resizeTo(eObj.offsetWidth,nHeight);			    
			}
			
			function toggleDisplay()
			{
			    var nIndex;
				if (typeof(document.all.Report)=='object' || typeof(document.all.Heatmap)=='object' || typeof(document.all.Results)=='object')
				{
				    nIndex = document.all.imgControl.src.indexOf('imgPlus');
				    if (nIndex > 0)
				    {
				        document.all.imgControl.src = '/ReportGenerator/Common/images/imgMinus.gif';
				        document.all.imgControl.title = 'Collapse';
				    }
				    else
				    {
				        document.all.imgControl.src = '/ReportGenerator/Common/images/imgPlus.gif';
				        document.all.imgControl.title = 'Expand';
				    }
				    sizeFrame();
				}
			}



