﻿// JScript File
var newWin = '';
function openWin(imageID,width,height) 
{
    window.name = "parent";
    if (!newWin.closed && newWin.location)
	{
		newWin.resizeTo( (width + 30 ),(height + 60)); //beats me why the width of this is diff to the width set below
		newWin.location.href  = "imageHolder.aspx?imageID=" + imageID;
		newWin.focus();
	}
	else
	{
		var myBars = 'directories=no,location=no,menubar=no,status=no,';
	    myBars += 'titlebar=no,toolbar=no';
	    var myOptions = 'scrollbars=no,width=' + (width +20 ) + ',height=' + (height + 20) + ',resizeable=no';
	    var myFeatures = myBars + ',' + myOptions;

	    newWin = open("imageHolder.aspx?imageID=" + imageID, 'child', myFeatures);
	    newWin.focus();

        //incase it already existed, so it wasnt created - we have to set the correct size.	    
  		newWin.resizeTo( (width + 30 ),(height + 60)); //beats me why the width of this is diff to the width set below
	}
}
function swapImage(container, imageUrl)
{
    container.src = imageUrl;
}

function getWindowHeight() 
{ 
	var windowHeight = 0; 
	if (typeof(window.innerHeight) == 'number') 
	{ 
		windowHeight = window.innerHeight; 
	} 
	else 
	{ 
		if (document.documentElement && document.documentElement.clientHeight) 
		{ 
			windowHeight = document.documentElement.clientHeight; 
		} 
		else 
		{ 
			if (document.body && document.body.clientHeight) 
			{ 
				windowHeight = document.body.clientHeight; 
			} 
		} 
	} 
	return windowHeight; 
} 
function setFooter() 
{
	if (document.getElementById) 
	{
		var windowHeight=getWindowHeight();
		if (windowHeight>0) 
		{
			var contentHeight=document.getElementById('masterDiv').offsetHeight;
			var footerElement=document.getElementById('footer');
			var footerHeight=footerElement.offsetHeight;
			if (windowHeight-(contentHeight+footerHeight)>=0) 
			{
				footerElement.style.position='absolute';
				footerElement.style.bottom='0px';
			}
			else 
			{
				footerElement.style.position='static';
			}
			
		}
		else 
		{
			footerElement.style.position='static';
		}
	}
}


