// JavaScript Document
//Kerberos Internet Services CC, Copyright 2004
//Image Studio V2
//http://www.kerberosdev.net
//http://www.kerberosb2b.com
/* ident @(#)ImageStudio.js	1.1 */

isIE4 = document.all? true : false;
isIE6 = document.getElementById && document.all ? true : false;
isNS4 = document.layers? true : false;
isNS6 = document.getElementById && !document.all ? true : false;

var IMAGESTUDIO_CONTAINER_PREFIX = "IMAGESTUDIO_CONTAINER";
var IMAGESTUDIO_DISPLAY_PREFIX = "IMAGESTUDIO_DISPLAY";
var IMAGESTUDIO_DISPLAY_IMAGE_PREFIX = "IMAGESTUDIO_DISPLAY_IMAGE";
var IMAGESTUDIO_DISPLAY_INFO_PREFIX = "IMAGESTUDIO_DISPLAY_INFO";
var IMAGESTUDIO_DISPLAY_CELL_PREFIX = "IMAGESTUDIO_DISPLAY_CELL";
var IMAGESTUDIO_FILMSTRIP_PREFIX = "IMAGESTUDIO_FILMSTRIP";
var IMAGESTUDIO_FILMSTRIP_MINMAX_PREFIX = "IMAGESTUDIO_FILMSTRIP_MINMAX";
var IMAGESTUDIO_FILMSTRIP_CELL_PREFIX = "IMAGESTUDIO_FILMSTRIP_CELL";
var IMAGESTUDIO_FILMSTRIP_STOP_R_PREFIX = "IMAGESTUDIO_FILMSTRIP_STOP_R";
var IMAGESTUDIO_FILMSTRIP_STOP_B_PREFIX = "IMAGESTUDIO_FILMSTRIP_STOP_B";
var IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX = "IMAGESTUDIO_FILMSTRIP_FRAME";
var IMAGESTUDIO_FILMSTRIP_SCROLLMINUS_PREFIX = "IMAGESTUDIO_FILMSTRIP_SCROLLMINUS";
var IMAGESTUDIO_FILMSTRIP_SCROLLPLUS_PREFIX = "IMAGESTUDIO_FILMSTRIP_SCROLLPLUS";
var IMAGESTUDIO_idGenerator = new IDGenerator(0);
var IMAGESTUDIOMap = new Object();
var IMAGESTUDIOIDGenerator = null;

//Utility Functions
function IDGenerator(nextID){
	this.nextID = nextID;
	this.GenerateID = IDGeneratorGenerateID;
}
function IDGeneratorGenerateID(){
	return this.nextID++;
}
function getDOMObject (documentID){
	if (isIE4){
		return document.all[documentID];
	}else if(isIE6){
		return document.getElementById(documentID);
	}else if (isNS4){
		return document.layers[documentID];
	}else if (isNS6) {
		return document.getElementById(documentID);
	}
}
function getFrameDOMObject (documentID, frameID){
	if (isIE4){
		return eval(frameID).document.all[documentID];
	}else if(isIE6){
		return eval(frameID).document.getElementById(documentID);
	}else if (isNS4){
		return eval(frameID).document.layers[documentID];
	}else if (isNS6) {
		return eval(frameID).document.getElementById(documentID);
	}
}
//************************************
//Image Studio Functions
//************************************
function ImageStudio(resouceURL) {
	this.idGenerator = IMAGESTUDIO_idGenerator;
	this.id = this.idGenerator.GenerateID();
	IMAGESTUDIOMap[this.id] = this;
	IMAGESTUDIOIDGenerator = this.idGenerator;
	this.instantiated = false;
//Public setup variables
	//this.height = height;
	//this.width = width;
	this.backgroundCSS_Thumbnails = 'background-color:#FAFAFF; top: 0; left: 0; margin: 0;';
	this.backgroundCSS_ImageView = 'background-color:#FDFEFF;';
	this.backgroundCSS_InfoBox = 'background-color:#FAFAFF;';
	this.borderCSS_Dark = 'border:1px solid #666666;';
	this.borderCSS_Light = 'border:1px solid #CCCCCC;';
	this.font_Thumbnails = 'font:10px verdana; color:#666666';
	this.font_Thumbnails_Status = 'font:8px verdana; color:#999999';
	//this.font_ImageView = 'font:bold 20px verdana; color:#0066CC';
	this.font_ImageView = 'COLOR: #59472d; FONT-FAMILY: Arial, Verdanda, sans-serif';
	this.font_InfoBox = 'font:10px verdana; color:#666666';
	//this.resouceURL = '/gifs/IS_Res_Blue/';
	this.resouceURL = resouceURL;
	this.baseURL_Thumbnails = '';
	this.baseURL_Images = '';
	this.scrollSafe = false;
	this.canPrint = true;
	this.button_Info = 'ICO_Help.gif';
	this.button_Info_Rollover = 'ICO_Help_R.gif';
	this.button_Info_Down = 'ICO_Help_D.gif';
	this.button_Print = 'ICO_Print.gif';
	this.button_Print_Rollover = 'ICO_Print_R.gif';
	this.button_Print_Down = 'ICO_Print_D.gif';
	this.button_Close = 'ICO_Close.gif';
	this.button_Close_Rollover = 'ICO_Close_R.gif';
	this.button_Close_Down = 'ICO_Close_D.gif';
	this.button_Minimise = 'ICO_minimize.gif';
	this.button_Minimise_Rollover = 'ICO_minimize_R.gif';
	this.button_Minimise_Down = 'ICO_minimize_D.gif';
	this.button_Maximise = 'ICO_maximise.gif';
	this.button_Maximise_Rollover = 'ICO_maximise_R.gif';
	this.button_Maximise_Down = 'ICO_maximise_D.gif';
	this.button_SrollSafe = 'ICO_SCROLL.gif';
	this.button_SrollSafe_Rollover = 'ICO_SCROLL_R.gif';
	this.button_SrollSafe_Down = 'ICO_SCROLL_D.gif';
	this.button_ScrollLeft = 'IMGS_DN.gif';
	this.button_ScrollLeft_Rollover = 'IMGS_DN_Active.gif';
	this.button_ScrollRight = 'IMGS_UP.gif';
	this.button_ScrollRight_Rollover = 'IMGS_UP_Active.gif';
//Runtime Variables
	this.thumbnailsArray = new Array();
	this.imagesArray = new Array();
	this.resourceArray = new Array();
	this.isFilmStripView = true;
	this.filmstripInnerHeight = 100;
	this.currentResource = 0;
//Filmstrip Scroll Animation Variables
	this.animated = false;
	this.AnimSpeed = 20;
	this.intervalID = '';
	this.pos_Left = 0;
	this.pos_Top = 0;
	
//Loading Image Anim Variabes
	this.isLoading = false;
	this.isLoadingAnimSpeed = 50;
	this.isLoadingIntervalID = '';
	this.isLoadingDots = '';
//Object Functions
	this.Instantiate = ImageStudio_Instantiate;
	this.addImage = ImageStudio_addResource;
	this.populateFilmStrip = ImageStudio_PopulateFilmStrip;
	this.startScroll = ImageStudio_FilmStrip_StartScroll;
	this.stopScroll = ImageStudio_FilmStrip_StopScroll;
	this.scrollStrip = ImageStudio_FilmStrip_Scroll;
	this.loadResource = ImageStudio_LoadResource;
	this.showIsLoadingAnim = ImageStudio_ShowIsLoadingAnim;
	this.stopIsLoadingAnim = ImageStudio_StopIsLoadingAnim;
	this.displayImage = ImageStudio_DisplayImage;
	this.setLoadCode = ImageStudio_SetLoadCode;
	this.toggleMinMaxView = ImageStudio_ToggleMinMaxView;
	this.toggleInfoDisplay = ImageStudio_ToggleInfoDisplay;
	this.performInitialisationCheck = ImageStudio_performInitialisationCheck;
	this.printResource = ImageStudio_PrintResource;
}

function ImageStudio_Instantiate(){
	if (this.instantiated) {
		return;
	}
	var html = "";
	html += "<TABLE cellspacing=0 cellpadding=0 style='width:"+this.width+"px; height:"+this.height+"px; "+this.borderCSS_Dark+"'>";
	html += "<TR>";
	html += "<TD id='" + IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id + "' name='" + IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id + "' STYLE='height:"+eval (this.height-100)+"px'><IFRAME  id='" + IMAGESTUDIO_DISPLAY_PREFIX + this.id + "' name='" + IMAGESTUDIO_DISPLAY_PREFIX + this.id + "' scrolling='auto' src='' frameborder=0 style='height:100%; width:100%;'></IFRAME></TD>";
	html += "</TR>";
	html += "<TR><TD id='" + IMAGESTUDIO_FILMSTRIP_CELL_PREFIX + this.id + "' name='" + IMAGESTUDIO_FILMSTRIP_CELL_PREFIX + this.id + "' valign=top align=center style='"+this.borderCSS_Light+" height:"+this.filmstripInnerHeight+"px'>";
		html += "<TABLE cellspacing=0 cellpadding=0 border=0 width='100%' height='100%' style='"+this.backgroundCSS_Thumbnails+"'><TR>";
		html += "<TD align='center' valign='top' height='20px'><A HREF='javascript:IMAGESTUDIOMap[" + this.id + "].scrollSafe = !IMAGESTUDIOMap[" + this.id + "].scrollSafe; IMAGESTUDIOMap[" + this.id + "].loadResource(IMAGESTUDIOMap[" + this.id + "].currentResource); void(0);'><IMG src='" + this.resouceURL + this.button_SrollSafe + "' onmouseover='this.src=\"" + this.resouceURL + this.button_SrollSafe_Rollover + "\";' onmouseout='this.src=\"" + this.resouceURL + this.button_SrollSafe + "\";' onmouseup='this.src=\"" + this.resouceURL + this.button_SrollSafe_Rollover + "\";' onmousedown='this.src=\"" + this.resouceURL + this.button_SrollSafe_Down + "\";' border=0 title='Toggle ScrollSafe'></a></TD>";
		html += "<TD rowspan='2' align='center' valign='middle' style='width:100%'>";
		html += "<IFRAME id='" + IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id + "' name='" + IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id + "' src='' frameborder=no scrolling=no width='100%' height='100%'></IFRAME>";
		html += "</TD>";
		html += "<TD align='center' valign='top' height='20px'><A HREF='javascript:IMAGESTUDIOMap[" + this.id + "].toggleMinMaxView();void(0);'><IMG id='" + IMAGESTUDIO_FILMSTRIP_MINMAX_PREFIX + this.id + "' name='" + IMAGESTUDIO_FILMSTRIP_MINMAX_PREFIX + this.id + "' src='" + this.resouceURL + this.button_Maximise + "' onmouseover='this.src=\"" + this.resouceURL + this.button_Maximise_Rollover + "\";' onmouseout='this.src=\"" + this.resouceURL + this.button_Maximise + "\";' onmouseup='this.src=\"" + this.resouceURL + this.button_Maximise_Rollover + "\";' onmousedown='this.src=\"" + this.resouceURL + this.button_Maximise_Down + "\";' border=0 title='Thumbnail Browser View'></a></TD>"
		html += "</TR><TR>";
		html += "<TD align='left' valign='middle'  style='width:20px;'><IMG title='Scroll Left' src='" + this.resouceURL + this.button_ScrollLeft + "' onmouseover='this.src=\"" + this.resouceURL + this.button_ScrollLeft_Rollover + "\"; IMAGESTUDIOMap[" + this.id + "].startScroll(1);' onmouseout='this.src=\"" + this.resouceURL + this.button_ScrollLeft + "\"; IMAGESTUDIOMap[" + this.id + "].stopScroll();'></TD>";
		html += "<TD align='right' valign='middle' style='width:20px'><IMG title='Scroll Right' src='" + this.resouceURL + this.button_ScrollRight + "' onmouseover='this.src=\"" + this.resouceURL + this.button_ScrollRight_Rollover + "\"; IMAGESTUDIOMap[" + this.id + "].startScroll(2);' onmouseout='this.src=\"" + this.resouceURL + this.button_ScrollRight + "\"; IMAGESTUDIOMap[" + this.id + "].stopScroll();'></TD>";
		html += "</TR></TABLE>";
	html += "</TD></TR>";
	html += "<TR><TD align=right height='10' STYLE=' "+this.backgroundCSS_Thumbnails+"'><a href='http://www.kerberosdev.net' target='_blank'  STYLE='font:8px Verdana; color: #FFFFFF;'>Powered By Kerberos</a></TD></TR>";
	html += "</TABLE>";
	document.write (html);
	window.setTimeout("IMAGESTUDIOMap[" + this.id + "].performInitialisationCheck();",1500);//IE Recovery
	this.performInitialisationCheck();
	this.instantiated = true;
}
function ImageStudio_performInitialisationCheck(){
	var html = "<BODY class='media' scroll=no style=' "+this.backgroundCSS_Thumbnails+"'><DIV id='" + IMAGESTUDIO_FILMSTRIP_PREFIX + this.id + "' name='" + IMAGESTUDIO_FILMSTRIP_PREFIX + this.id + "' style='position:absolute; left:-20px; top:0px; width:100%; height:100%;overflow:visible;'></DIV></BODY>";
	this.container = getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id);
	eval(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).document.open();
	eval(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).document.write(html);
	eval(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).document.close();
	this.container = getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id);
	getFrameDOMObject(IMAGESTUDIO_FILMSTRIP_PREFIX + this.id, IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).innerHTML = String(this.populateFilmStrip());	
	this.filmstripInnerHeight = ImageStudio_retrieveTotalOffsetTopNN(getFrameDOMObject(IMAGESTUDIO_FILMSTRIP_STOP_B_PREFIX + this.id, IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id));
	getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.height = this.filmstripInnerHeight + "px";
	if (this.resourceArray.length > 0)this.loadResource(0);
}
function ImageStudio_SetLoadCode(resourceID, type, code){
	this.resourceArray[resourceID][type] = code;
	if (type == 4 && this.instantiated){
//Update thumbnail display
		getFrameDOMObject(IMAGESTUDIO_FILMSTRIP_PREFIX + this.id, IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).innerHTML = String(this.populateFilmStrip());
		this.filmstripInnerHeight = ImageStudio_retrieveTotalOffsetTopNN(getFrameDOMObject(IMAGESTUDIO_FILMSTRIP_STOP_B_PREFIX + this.id, IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id));
		getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.height = this.filmstripInnerHeight + "px";
	}
}
function ImageStudio_addResource (thumbURL, imageURL, imageTitle, imageDesc){
	var thisThumb = new Image;
	var thisImage = new Image;
	this.thumbnailsArray[this.thumbnailsArray.length] =thisThumb;
	this.imagesArray[this.imagesArray.length]=thisImage;
	this.resourceArray[this.resourceArray.length]=[this.baseURL_Thumbnails + thumbURL, this.baseURL_Images + imageURL,imageDesc, 1, 1, imageTitle];
	var resourceID = this.resourceArray.length - 1;
	var thumbOnload =  "IMAGESTUDIOMap[" + this.id + "].setLoadCode(" + resourceID + ",4,2);";
	var thumbOnError = "IMAGESTUDIOMap[" + this.id + "].setLoadCode(" + resourceID + ",4,3);";
	var thumbOnAbort = "IMAGESTUDIOMap[" + this.id + "].setLoadCode(" + resourceID + ",4,4);";
	var imageOnload =  "IMAGESTUDIOMap[" + this.id + "].setLoadCode(" + resourceID + ",3,2);";
	var imageOnError = "IMAGESTUDIOMap[" + this.id + "].setLoadCode(" + resourceID + ",3,3);";
	var imageOnAbort = "IMAGESTUDIOMap[" + this.id + "].setLoadCode(" + resourceID + ",3,4);";
	thisThumb.onload = function(){eval(thumbOnload);return true;}
	thisThumb.onerror = function(){eval(thumbOnError);return true;}
	thisThumb.onabort = function(){eval(thumbOnAbort);return true;}
	thisImage.onload = function(){eval(imageOnload);return true;}
	thisImage.onerror = function(){eval(imageOnError);return true;}
	thisImage.onabort = function(){eval(imageOnAbort);return true;}	
	thisThumb.src = this.baseURL_Thumbnails + thumbURL;
}

function ImageStudio_PopulateFilmStrip(){
	var fhtml = "";
	var html_thumbs = "";
	var html_titles = "";
	var html_bottom_space = "";
	var num_Rows = 1;
	var num_Cols = this.resourceArray.length;
	if (this.resourceArray.length == 0)return;
	if (!this.isFilmStripView){
		num_Rows = parseInt (String(eval(this.height / this.filmstripInnerHeight)));
		if (this.height % this.filmstripInnerHeight != 0) num_Rows = num_Rows + 1;
		num_Cols = parseInt (String(eval(this.resourceArray.length / num_Rows)));
		if (this.resourceArray.length % num_Rows != 0)num_Cols = num_Cols + 1;
	}
	fhtml += "<TABLE cellpadding=0 cellspacing=5 border=0 style='margin-left: 0;'>";
	for (rows = 0; rows < num_Rows; rows++){
		html_thumbs = "";
		html_titles = "";
		html_bottom_space = "";
		for (var i = 0; i < num_Cols; i++){
			if (eval(num_Cols * rows + i) <  this.resourceArray.length){
				switch (this.resourceArray[num_Cols * rows + i][4]){
					case 1:
						html_thumbs += "<TD align=center valign=middle Style='"+this.font_Thumbnails_Status+"'>Loading...</TD>";
						break;
					case 2:
						//html_thumbs += "<TD align=center valign=middle onmouseout='this.style.border=\"none\"' onmouseover='this.style.border=\"1px solid #333333\"'>";
						html_thumbs += "<TD align=center valign=middle onmouseout='this.style.border=\"none\"'>"; 
						html_thumbs += "<a href='javascript:window.parent.IMAGESTUDIOMap[" + this.id + "].loadResource(" + eval(num_Cols * rows + i) + ");'>";
						html_thumbs += "<IMG src='" + this.resourceArray[num_Cols * rows + i][0] + "' border=0 height='64'></a></TD>";
						break;
					case 3:
						html_thumbs += "<TD align=center valign=middle Style='"+this.font_Thumbnails_Status+"'>Loading Error</TD>";
						break;
					case 4:
						html_thumbs += "<TD align=center valign=middle Style='"+this.font_Thumbnails_Status+"'>Loading Aborted</TD>";
						break;
				}
				html_titles += "<TD valign=top align=center valign=top style='"+this.font_Thumbnails+"'>" + this.resourceArray[num_Cols * rows + i][5] + "</TD>";
			}else{
				html_thumbs += "<TD></TD>";
				html_titles += "<TD></TD>";
			}
			html_bottom_space += "<TD></TD>";
		}
		if (rows + 1 >= num_Rows) {
			html_thumbs += "<TD id='" + IMAGESTUDIO_FILMSTRIP_STOP_R_PREFIX + this.id + "' name='" + IMAGESTUDIO_FILMSTRIP_STOP_R_PREFIX + this.id + "'></TD>";
			html_bottom_space += "<TD id='" + IMAGESTUDIO_FILMSTRIP_STOP_B_PREFIX + this.id + "' name='" + IMAGESTUDIO_FILMSTRIP_STOP_B_PREFIX + this.id + "' height=0></TD>";
		}else{
			html_thumbs += "<TD height=0></TD>";
			html_bottom_space += "<TD height=0></TD>";
		}
		html_titles += "<TD height=0></TD>";
		fhtml += "<TR>" + html_thumbs + "</TR>";
		fhtml += "<TR>" + html_titles + "</TR>";
	}
	fhtml += "<TR>" + html_bottom_space + "</TR>";
	fhtml += "</TABLE>";
	return fhtml;
}
function ImageStudio_LoadResource(resourceID){
	if (this.isLoading)this.stopIsLoadingAnim();
	if (!this.isFilmStripView)this.toggleMinMaxView();
	if (this.resourceArray[resourceID][3] == 1){
		this.imagesArray[resourceID].src =  this.resourceArray[resourceID][1]; //Start loading
		this.isLoadingIntervalID = window.setInterval("IMAGESTUDIOMap[" + this.id + "].showIsLoadingAnim(" + resourceID + ");", this.isLoadingAnimSpeed);
		this.isLoading = true;
	}else{
		this.displayImage(resourceID);
	}
	this.currentResource = resourceID;
}
function ImageStudio_StopIsLoadingAnim(){
	if (!this.isLoading)return;
	window.clearInterval(this.isLoadingIntervalID); 
	this.isLoading = false;
}
function ImageStudio_PrintResource(){
	try{
		eval (IMAGESTUDIO_DISPLAY_PREFIX + this.id).document.execCommand('print',false,null);
	}catch(p1){
		try{
			getDOMObject (IMAGESTUDIO_DISPLAY_PREFIX + this.id).document.execCommand('print',false,null);
		}catch(p2){
			try{
				eval (IMAGESTUDIO_DISPLAY_PREFIX + this.id).contentWindow.print();
			}catch(p3){
				try{
					getDOMObject (IMAGESTUDIO_DISPLAY_PREFIX + this.id).contentWindow.print();
				}catch(p4){
					alert ('Your browser is not capable of printing inline frames. Printing entire window');
					window.print();
				}
			}
		}
	}
}
function ImageStudio_DisplayImage(resourceID){
	var html = "<BODY class='media' scroll=" + (this.scrollSafe?"no":"auto") + " leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' style='"+this.backgroundCSS_ImageView+"'><TABLE width=100% height=100% cellspacing=0 cellpadding=0 border=0>";
	html += "<TR><TD height=20 style='"+this.borderCSS_Light+" border-left:none; border-right:none; border-top:none'>";
	html += "<TABLE width=100% height=100% cellspacing=5 cellpadding=0 border=0><TR><TD width='100%' style='"+this.font_ImageView+"'>" + this.resourceArray[resourceID][5] + "</TD>";
	if (this.resourceArray[resourceID][2] != "" && this.resourceArray[resourceID][2] != "undefined"){
		html += "<TD><a href='javascript:window.parent.IMAGESTUDIOMap["+this.id+"].toggleInfoDisplay();void(0);'><IMG src='" + this.resouceURL + this.button_Info + "' border=0 onmouseover='this.src=\"" + this.resouceURL + this.button_Info_Rollover + "\";' onmouseout='this.src=\"" + this.resouceURL + this.button_Info + "\";' onmouseup='this.src=\"" + this.resouceURL + this.button_Info_Rollover + "\";' onmousedown='this.src=\"" + this.resouceURL + this.button_Info_Down + "\";' Title='View Information'></a></TD>";
	}
	if (this.canPrint)html += "<TD><a href='javascript:window.parent.IMAGESTUDIOMap["+this.id+"].printResource();void(0);'><IMG src='" + this.resouceURL + this.button_Print + "' border=0 onmouseover='this.src=\"" + this.resouceURL + this.button_Print_Rollover + "\";' onmouseout='this.src=\"" + this.resouceURL + this.button_Print + "\";' onmouseup='this.src=\"" + this.resouceURL + this.button_Print_Rollover + "\";' onmousedown='this.src=\"" + this.resouceURL + this.button_Print_Down + "\";' Title='Print Document'></a></TD>";
	html += "</TR></TABLE>";
	html += "</TD></TR>";
	switch (this.resourceArray[resourceID][3]){
		case 2:
			var scrollSafeString = "";
			if (this.imagesArray[resourceID].height > this.imagesArray[resourceID].width && this.imagesArray[resourceID].height > (this.height-20-this.filmstripInnerHeight)){
				scrollSafeString += " HEIGHT='"+eval(this.height - 50 - this.filmstripInnerHeight)+"'";
			}else if ( this.imagesArray[resourceID].width > this.imagesArray[resourceID].height && this.imagesArray[resourceID].width > this.width){
				scrollSafeString += " WIDTH='"+eval(this.width-50)+"'";
			}
			if (!this.scrollSafe)scrollSafeString="";
			html += "<TR><TD align=center valign=middle><DIV ID='" + IMAGESTUDIO_DISPLAY_IMAGE_PREFIX + this.id + "' NAME='" + IMAGESTUDIO_DISPLAY_IMAGE_PREFIX + this.id + "' STYLE='position:relative;'><IMG SRC='"+this.resourceArray[resourceID][1] +"' " + scrollSafeString + "  ></DIV></TD></TR>";
			break;
		case 3:html += "<TR><TD align=center valign=middle Style='"+this.font_ImageView+"'>A Loading Error Has Occured</TD></TR>";break;
		case 4:html += "<TR><TD align=center valign=middle Style='"+this.font_ImageView+"'>Loading Has Been Aborted</TD></TR>";break;
	}
	html += "</TABLE>";
	var infoHeight = (this.height - this.filmstripInnerHeight - 20) - (this.height - this.filmstripInnerHeight - 20)/100*10;
	html += "<DIV id='" + IMAGESTUDIO_DISPLAY_INFO_PREFIX + this.id + "' name='" + IMAGESTUDIO_DISPLAY_INFO_PREFIX + this.id + "' STYLE='position:absolute; left:5%; top:5%; height:90%; width:90%; display:none; overflow:hidden; "+this.borderCSS_Dark + this.backgroundCSS_InfoBox+"'>";
	html += "<TABLE width='100%' height='100%' cellspacing=0 cellpadding=0 border=0>";
	html += "<TR><TD align=right valign=top height=20><a href='javascript:window.parent.IMAGESTUDIOMap["+this.id+"].toggleInfoDisplay();void(0);'><IMG src='" + this.resouceURL + this.button_Close + "' border=0 onmouseover='this.src=\"" + this.resouceURL + this.button_Close_Rollover + "\";' onmouseout='this.src=\"" + this.resouceURL + this.button_Close + "\";' onmouseup='this.src=\"" + this.resouceURL + this.button_Close_Rollover + "\";' onmousedown='this.src=\"" + this.resouceURL + this.button_Close_Down + "\";' title='Close Information Box'></a></TD></TR>";
	html += "<TR><TD><DIV STYLE='position:relative;left:0px; top:0px; height:" + infoHeight + "px; width:100%; overflow:auto ;"+this.font_InfoBox+"'>"+this.resourceArray[resourceID][2] +"</DIV></TD></TR></TABLE></DIV></BODY>";
	eval(IMAGESTUDIO_DISPLAY_PREFIX + this.id).document.open();
	eval(IMAGESTUDIO_DISPLAY_PREFIX + this.id).document.write(html);
	eval(IMAGESTUDIO_DISPLAY_PREFIX + this.id).document.close();
}

//Window Event Handlers and Window Methods
function ImageStudio_ToggleInfoDisplay(){
	var currentSetting = getFrameDOMObject(IMAGESTUDIO_DISPLAY_INFO_PREFIX + this.id, IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.display;
	getFrameDOMObject(IMAGESTUDIO_DISPLAY_INFO_PREFIX + this.id, IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.display = (currentSetting == 'inline' ? 'none' : 'inline');
	eval(IMAGESTUDIO_DISPLAY_PREFIX + this.id).focus();
}
function ImageStudio_ToggleMinMaxView(){
	this.isFilmStripView = !this.isFilmStripView;
	var imageIconStringRef = IMAGESTUDIO_FILMSTRIP_MINMAX_PREFIX + this.id;
	if (this.isFilmStripView){
		getDOMObject(IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id).style.height=this.height-100;
		getDOMObject(IMAGESTUDIO_FILMSTRIP_CELL_PREFIX + this.id).style.height=this.filmstripInnerHeight;
		getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.height=this.filmstripInnerHeight;
		getDOMObject(IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.display='inline';
		var btnStd = this.resouceURL + this.button_Maximise;
		var btnRoll = this.resouceURL + this.button_Maximise_Rollover;
		var btnDown = this.resouceURL + this.button_Maximise_Down;
		getDOMObject(imageIconStringRef).src= btnStd;
		getDOMObject(imageIconStringRef).title= 'Thumbnail Browser View';
		getDOMObject(imageIconStringRef).onmouseover = function () { getDOMObject(imageIconStringRef).src=btnRoll;}; 
		getDOMObject(imageIconStringRef).onmouseout = function () {  getDOMObject(imageIconStringRef).src=btnStd;}; 
		getDOMObject(imageIconStringRef).onmouseup = function () {  getDOMObject(imageIconStringRef).src=btnRoll;};
		getDOMObject(imageIconStringRef).onmousedown = function () {  getDOMObject(imageIconStringRef).src=btnDown;};	
	}else{//Thumbnail View
		getDOMObject(IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id).style.height=0;
		getDOMObject(IMAGESTUDIO_FILMSTRIP_CELL_PREFIX + this.id).style.height=this.height;
		getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.height=this.height;
		getDOMObject(IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.display='none';
		var btnStd = this.resouceURL + this.button_Minimise;
		var btnRoll = this.resouceURL + this.button_Minimise_Rollover;
		var btnDown = this.resouceURL + this.button_Minimise_Down;
		getDOMObject(imageIconStringRef).src= btnStd;
		getDOMObject(imageIconStringRef).title= 'Filmstrip View';
		getDOMObject(imageIconStringRef).onmouseover = function () { getDOMObject(imageIconStringRef).src=btnRoll;}; 
		getDOMObject(imageIconStringRef).onmouseout = function () {  getDOMObject(imageIconStringRef).src=btnStd;}; 
		getDOMObject(imageIconStringRef).onmouseup = function () {  getDOMObject(imageIconStringRef).src=btnRoll;};
		getDOMObject(imageIconStringRef).onmousedown = function () {  getDOMObject(imageIconStringRef).src=btnDown;};
		this.pos_Left = 0;
		getFrameDOMObject(IMAGESTUDIO_FILMSTRIP_PREFIX + this.id, IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.left = this.pos_Left + "px";
	}
	getFrameDOMObject(IMAGESTUDIO_FILMSTRIP_PREFIX + this.id, IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).innerHTML = String(this.populateFilmStrip());
}

//Animation Functions
function ImageStudio_ShowIsLoadingAnim(resourceID){
	if (!this.isLoading)return;
	if (this.resourceArray[resourceID][3] != 1){
		this.stopIsLoadingAnim();
		this.displayImage(resourceID);
		return;
	}
	var html = "<BODY class='media' scroll=" + (this.scrollSafe?"no":"auto") + " leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' style='"+this.backgroundCSS_ImageView+"'><TABLE width=100% cellspacing=0 cellpadding=0 border=0><TR><TD align=center valign=middle Style='"+this.font_ImageView+"'>Loading</TD></TR><TR><TD align=center valign=middle Style='"+this.font_ImageView+"'>"+this.isLoadingDots+"</TD></TR></TABLE></BODY>";
	if (this.isLoadingDots.length >= 20){
		this.isLoadingDots = '';
	}else{
		this.isLoadingDots += '..';
	}
	eval(IMAGESTUDIO_DISPLAY_PREFIX + this.id).document.open();
	eval(IMAGESTUDIO_DISPLAY_PREFIX + this.id).document.write(html);
	eval(IMAGESTUDIO_DISPLAY_PREFIX + this.id).document.close();
	eval(IMAGESTUDIO_DISPLAY_PREFIX + this.id).document.body.leftMargin=0;
	eval(IMAGESTUDIO_DISPLAY_PREFIX + this.id).document.body.topMargin=0;
}
function ImageStudio_FilmStrip_StartScroll(direction){
	if (this.animated)return;
	this.intervalID = window.setInterval("IMAGESTUDIOMap[" + this.id + "].scrollStrip( " + direction + ");", this.AnimSpeed);
	this.animated = true;
}
function ImageStudio_FilmStrip_StopScroll(){
	if (!this.animated)return;
	window.clearInterval(this.intervalID); 
	this.animated = false;
}
function ImageStudio_FilmStrip_Scroll(direction){
	var myFrameWidth = getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).scrollWidth;
	//Determine Filmstrip internal width
	var myLayerWidth = 0;
	myLayerWidth = ImageStudio_retrieveTotalOffsetLeftNN(getFrameDOMObject(IMAGESTUDIO_FILMSTRIP_STOP_R_PREFIX + this.id, IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id));
	switch (direction){
		case 1: //Scroll Left
			if (this.pos_Left >= 0)return;
			this.pos_Left = this.pos_Left + 5;
			break;
		case 2: //Scroll Right
			if (eval(myLayerWidth - myFrameWidth) <= 0)return;
			this.pos_Left = this.pos_Left - 5;
			break;
	}
	getFrameDOMObject(IMAGESTUDIO_FILMSTRIP_PREFIX + this.id, IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.left = this.pos_Left + "px";
}
//Window Element Utility Functions
function ImageStudio_retrieveTotalOffsetLeftNN(thisElement){
	if (isNS4) return thisElement.x;
	if (thisElement == null)return 0;
	return thisElement.offsetLeft + ImageStudio_retrieveTotalOffsetLeftNN(thisElement.offsetParent);
}
function ImageStudio_retrieveTotalOffsetTopNN(thisElement){
	if (isNS4) return thisElement.y;
	if (thisElement == null)return 0;
	return thisElement.offsetTop + ImageStudio_retrieveTotalOffsetTopNN(thisElement.offsetParent);
}
