//JavaScript Document
//Kerberos Internet Services CC, Copyright 2005
//Image Studio V3.0
//http://www.kerberosdev.net


var IMAGESTUDIO_CONTAINER_PREFIX = "IMAGESTUDIO_CONTAINER";
var IMAGESTUDIO_CONTAINEROFFSET_PREFIX = "IMAGESTUDIO_CONTAINEROFFSET";
var IMAGESTUDIO_DISPLAY_PREFIX = "IMAGESTUDIO_DISPLAY";
var IMAGESTUDIO_DISPLAY_INFO_PREFIX = "IMAGESTUDIO_DISPLAY_INFO";
var IMAGESTUDIO_DISPLAY_IMAGE_PREFIX = "IMAGESTUDIO_DISPLAY_IMAGE";
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_FRAMECELL_PREFIX = "IMAGESTUDIO_FILMSTRIP_FRAMECELL";
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
isIE4 = document.all? true : false;
isIE6 = document.getElementById && document.all ? true : false;
isNS4 = document.layers? true : false;
isNS6 = document.getElementById && !document.all ? true : false;
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){ 
		if (!eval(frameID).document)return null;
		return eval(frameID).document.getElementById(documentID);
	}
}
//Image Studio
function ImageStudio(){
	this.idGenerator = IMAGESTUDIO_idGenerator;
	this.id = this.idGenerator.GenerateID();
	IMAGESTUDIOMap[this.id] = this;
	IMAGESTUDIOIDGenerator = this.idGenerator;
	this.instantiated = false;
//Public setup variables
	this.height = 400;
	this.width = 500;
	this.backgroundCSS_Thumbnails = 'background-color:#FAFAFF;';
	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_InfoBox = 'font:20px verdana; color:#666666';
	this.resourceURL = 'scripts/';
	this.baseURL_Thumbnails = '';
	this.baseURL_Images = '';
	this.scrollSafe = false;
	this.canPrint = true;
	this.showNextPreviousButtons = false;
	this.showSlideShowButton = false;
	this.NoRightClick = false;
	this.startupThumbMode = false;
	this.displayLayout = 1;
	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_Slide = 'ICO_Slide.gif';
	this.button_Slide_Rollover = 'ICO_Slide_R.gif';
	this.button_Slide_Down = 'ICO_Slide_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 = [];
	this.imagesArray = [];
	this.resourceArray = [];
	this.isFilmStripView = true;
	this.currentResource = 0;
//Slideshow Variables
	this.isSlideShow = false;
	this.slideShowDelay = 4000;
	this.slideShowIntervalID = "";
//Filmstrip Animation Variables
	this.animated = false;
	this.AnimSpeed = 50;
	this.intervalID = '';
	this.pos_Left = 0;
	this.pos_Top = 0;
//Loading Anim Variabes
	this.isLoading = false;
	this.isLoadingAnimSpeed = 100;
	this.isLoadingIntervalID = '';
	this.isLoadingDots = '';
//Thumb Loading Variables
	this.isLoading_CurrentThumb = 0;
	this.isLoading_ThumbsStarted = false;
	this.thumbnailViewHeight = 0;
	this.thumbnailViewWidth = 0;
//Document Variables
	this.Old_DocumentOnload_Function = window.onload;
	this.Old_DocumentUnload_Function = window.onunload;
//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.runSlideShow = ImageStudio_RunSlideShow;
	this.setLoadCode = ImageStudio_SetLoadCode;
	this.toggleMinMaxView = ImageStudio_ToggleMinMaxView;
	this.toggleInfoDisplay = ImageStudio_ToggleInfoDisplay;
	this.performInitialisationCheck = ImageStudio_performInitialisationCheck;
	this.performInitialisationCheck2 = ImageStudio_performInitialisationCheck2;
	this.printResource = ImageStudio_PrintResource;
	this.drawLayout_1 = ImageStudio_DrawLayout_1;
	this.drawLayout_2 = ImageStudio_DrawLayout_2;
	this.drawLayout_3 = ImageStudio_DrawLayout_3;
	this.drawLayout_4 = ImageStudio_DrawLayout_4;
	this.errorRecovery_DisplayFrame = ImageStudio_ErrorRecovery_DisplayFrame;
	this.errorRecovery_FilmstripFrame = ImageStudio_ErrorRecovery_FilmstripFrame;
	this.loadThumbnails = ImageStudio_LoadThumbnails;
}
function ImageStudio_DrawLayout_1(){
	return "<TD valign='top' id='" + IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id + "' name='" + IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id + "' height='100%' width='100%'><IFRAME NAME='" + IMAGESTUDIO_DISPLAY_PREFIX + this.id + "' ID='" + IMAGESTUDIO_DISPLAY_PREFIX + this.id + "'   frameborder=no scrolling=auto width='100%' height='100%' STYLE='width:100%; height:100%;  '></IFRAME></TD></TR><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:100px'><TABLE cellspacing=0 cellpadding=0 border=0 width='100%' height='100%' style='"+this.backgroundCSS_Thumbnails+"'><TR><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.resourceURL + this.button_SrollSafe + "' onmouseover='this.src=\"" + this.resourceURL + this.button_SrollSafe_Rollover + "\";' onmouseout='this.src=\"" + this.resourceURL + this.button_SrollSafe + "\";' onmouseup='this.src=\"" + this.resourceURL + this.button_SrollSafe_Rollover + "\";' onmousedown='this.src=\"" + this.resourceURL + this.button_SrollSafe_Down + "\";' border=0 title='Toggle ScrollSafe'></a></TD><TD id='" + IMAGESTUDIO_FILMSTRIP_FRAMECELL_PREFIX + this.id + "' name='" + IMAGESTUDIO_FILMSTRIP_FRAMECELL_PREFIX + this.id + "' rowspan='2' align='center' valign='middle' style='width:100%'><IFRAME name='" + IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id + "' id='" + IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id + "'  frameborder='0' scrolling='no' width='100%' height='100'  style='width:100%; height:100px;'></IFRAME></TD><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.resourceURL + this.button_Maximise + "' onmouseover='this.src=\"" + this.resourceURL + this.button_Maximise_Rollover + "\";' onmouseout='this.src=\"" + this.resourceURL + this.button_Maximise + "\";' onmouseup='this.src=\"" + this.resourceURL + this.button_Maximise_Rollover + "\";' onmousedown='this.src=\"" + this.resourceURL + this.button_Maximise_Down + "\";' border=0 title='Thumbnail Browser View'></a></TD></TR><TR><TD align='left' valign='middle'  style='width:20px;'><IMG title='Scroll Left' src='" + this.resourceURL + this.button_ScrollLeft + "' onmouseover='this.src=\"" + this.resourceURL + this.button_ScrollLeft_Rollover + "\"; IMAGESTUDIOMap[" + this.id + "].startScroll(1);' onmouseout='this.src=\"" + this.resourceURL + this.button_ScrollLeft + "\"; IMAGESTUDIOMap[" + this.id + "].stopScroll();'></TD><TD align='right' valign='middle' style='width:20px'><IMG title='Scroll Right' src='" + this.resourceURL + this.button_ScrollRight + "' onmouseover='this.src=\"" + this.resourceURL + this.button_ScrollRight_Rollover + "\"; IMAGESTUDIOMap[" + this.id + "].startScroll(2);' onmouseout='this.src=\"" + this.resourceURL + this.button_ScrollRight + "\"; IMAGESTUDIOMap[" + this.id + "].stopScroll();'></TD></TR></TABLE></TD>";
}
function ImageStudio_DrawLayout_2(){
	return "<TD id='" + IMAGESTUDIO_FILMSTRIP_CELL_PREFIX + this.id + "' name='" + IMAGESTUDIO_FILMSTRIP_CELL_PREFIX + this.id + "' valign=top align=center height='100' style='height:100px;"+this.borderCSS_Light+"'><TABLE cellspacing=0 cellpadding=0 border=0 width='100%' height='100%' style='"+this.backgroundCSS_Thumbnails+"'><TR><TD align='left' 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.resourceURL + this.button_SrollSafe + "' onmouseover='this.src=\"" + this.resourceURL + this.button_SrollSafe_Rollover + "\";' onmouseout='this.src=\"" + this.resourceURL + this.button_SrollSafe + "\";' onmouseup='this.src=\"" + this.resourceURL + this.button_SrollSafe_Rollover + "\";' onmousedown='this.src=\"" + this.resourceURL + this.button_SrollSafe_Down + "\";' border=0 title='Toggle ScrollSafe'></a></TD><TD id='" + IMAGESTUDIO_FILMSTRIP_FRAMECELL_PREFIX + this.id + "' name='" + IMAGESTUDIO_FILMSTRIP_FRAMECELL_PREFIX + this.id + "' rowspan='2' align='center' valign='middle' style='width:100%'><IFRAME name='" + IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id + "' id='" + IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id + "'  frameborder='0' scrolling='no' width='100%' height='100'  style='width:100%; height:100px;'></IFRAME></TD><TD align='right' 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.resourceURL + this.button_Maximise + "' onmouseover='this.src=\"" + this.resourceURL + this.button_Maximise_Rollover + "\";' onmouseout='this.src=\"" + this.resourceURL + this.button_Maximise + "\";' onmouseup='this.src=\"" + this.resourceURL + this.button_Maximise_Rollover + "\";' onmousedown='this.src=\"" + this.resourceURL + this.button_Maximise_Down + "\";' border=0 title='Thumbnail Browser View'></a></TD></TR><TR><TD align='left' valign='middle'  style='width:20px;'><IMG title='Scroll Left' src='" + this.resourceURL + this.button_ScrollLeft + "' onmouseover='this.src=\"" + this.resourceURL + this.button_ScrollLeft_Rollover + "\"; IMAGESTUDIOMap[" + this.id + "].startScroll(1);' onmouseout='this.src=\"" + this.resourceURL + this.button_ScrollLeft + "\"; IMAGESTUDIOMap[" + this.id + "].stopScroll();'></TD><TD align='right' valign='middle' style='width:20px'><IMG title='Scroll Right' src='" + this.resourceURL + this.button_ScrollRight + "' onmouseover='this.src=\"" + this.resourceURL + this.button_ScrollRight_Rollover + "\"; IMAGESTUDIOMap[" + this.id + "].startScroll(2);' onmouseout='this.src=\"" + this.resourceURL + this.button_ScrollRight + "\"; IMAGESTUDIOMap[" + this.id + "].stopScroll();'></TD></TR></TABLE></TD></TR><TR><TD valign='top' id='" + IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id + "' name='" + IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id + "' valign='top' height='100%' STYLE='height:100%'><IFRAME  id='" + IMAGESTUDIO_DISPLAY_PREFIX + this.id + "' name='" + IMAGESTUDIO_DISPLAY_PREFIX + this.id + "' scrolling='auto'  frameborder=no height='100%' width='100%'  STYLE='width:100%; height:100%;  '></IFRAME></TD>";
}
function ImageStudio_DrawLayout_3(){
	return "<TD id='" + IMAGESTUDIO_FILMSTRIP_CELL_PREFIX + this.id + "' name='" + IMAGESTUDIO_FILMSTRIP_CELL_PREFIX + this.id + "' valign=top align=center height='100%' width='100' style='"+this.borderCSS_Light+" width:100px; height:100%'><TABLE cellspacing=0 cellpadding=0 border=0 width='100%' height='100%' style='"+this.backgroundCSS_Thumbnails+"'><TR><TD><TABLE cellspacing=5 cellpadding=0 border=0 width='100%' height='100%'><TR><TD align='center' valign='top' height='20px' width='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.resourceURL + this.button_SrollSafe + "' onmouseover='this.src=\"" + this.resourceURL + this.button_SrollSafe_Rollover + "\";' onmouseout='this.src=\"" + this.resourceURL + this.button_SrollSafe + "\";' onmouseup='this.src=\"" + this.resourceURL + this.button_SrollSafe_Rollover + "\";' onmousedown='this.src=\"" + this.resourceURL + this.button_SrollSafe_Down + "\";' border=0 title='Toggle ScrollSafe'></a></TD><TD align='center' valign='top'  width='20px'><IMG title='Scroll Up' src='" + this.resourceURL + this.button_ScrollLeft + "' onmouseover='this.src=\"" + this.resourceURL + this.button_ScrollLeft_Rollover + "\"; IMAGESTUDIOMap[" + this.id + "].startScroll(1);' onmouseout='this.src=\"" + this.resourceURL + this.button_ScrollLeft + "\"; IMAGESTUDIOMap[" + this.id + "].stopScroll();'></TD><TD align='center' valign='top' width='20px'><IMG title='Scroll Down' src='" + this.resourceURL + this.button_ScrollRight + "' onmouseover='this.src=\"" + this.resourceURL + this.button_ScrollRight_Rollover + "\"; IMAGESTUDIOMap[" + this.id + "].startScroll(2);' onmouseout='this.src=\"" + this.resourceURL + this.button_ScrollRight + "\"; IMAGESTUDIOMap[" + this.id + "].stopScroll();'></TD><TD align='right' valign='top' width='100%'><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.resourceURL + this.button_Maximise + "' onmouseover='this.src=\"" + this.resourceURL + this.button_Maximise_Rollover + "\";' onmouseout='this.src=\"" + this.resourceURL + this.button_Maximise + "\";' onmouseup='this.src=\"" + this.resourceURL + this.button_Maximise_Rollover + "\";' onmousedown='this.src=\"" + this.resourceURL + this.button_Maximise_Down + "\";' border=0 title='Thumbnail Browser View'></a></TD></TR></TABLE></TD></TR><TR><TD  id='" + IMAGESTUDIO_FILMSTRIP_FRAMECELL_PREFIX + this.id + "' name='" + IMAGESTUDIO_FILMSTRIP_FRAMECELL_PREFIX + this.id + "' align='top' valign='middle' style='width:100; height:100%'><IFRAME name='" + IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id + "' id='" + IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id + "' scrolling='no' frameborder='0' width='100' height='100%' style='width:100px; height:100%;'></IFRAME></TD></TR></TABLE></TD><TD id='" + IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id + "' name='" + IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id + "' height='100%' width='100%' STYLE='height:100%; width:100%'><IFRAME  id='" + IMAGESTUDIO_DISPLAY_PREFIX + this.id + "' name='" + IMAGESTUDIO_DISPLAY_PREFIX + this.id + "' scrolling='auto' frameborder=0  STYLE='width:100%; height:100%;  '></IFRAME></TD>";
}
function ImageStudio_DrawLayout_4(){
	return "<TD id='" + IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id + "' name='" + IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id + "' height='100%' width='100%' STYLE='height:100%; width:100%'><IFRAME  id='" + IMAGESTUDIO_DISPLAY_PREFIX + this.id + "' name='" + IMAGESTUDIO_DISPLAY_PREFIX + this.id + "' scrolling='auto'  height='100%' width='100%' frameborder=0  STYLE='width:100%; height:100%;  '></IFRAME></TD><TD id='" + IMAGESTUDIO_FILMSTRIP_CELL_PREFIX + this.id + "' name='" + IMAGESTUDIO_FILMSTRIP_CELL_PREFIX + this.id + "' valign=top align=center height='100%' width='100' style='"+this.borderCSS_Light+" width:100px; height:100%'><TABLE cellspacing=0 cellpadding=0 border=0 width='100%' height='100%' style='"+this.backgroundCSS_Thumbnails+"'><TR><TD><TABLE cellspacing=5 cellpadding=0 border=0 width='100%' height='100%'><TR><TD align='center' valign='top' height='20px' width='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.resourceURL + this.button_SrollSafe + "' onmouseover='this.src=\"" + this.resourceURL + this.button_SrollSafe_Rollover + "\";' onmouseout='this.src=\"" + this.resourceURL + this.button_SrollSafe + "\";' onmouseup='this.src=\"" + this.resourceURL + this.button_SrollSafe_Rollover + "\";' onmousedown='this.src=\"" + this.resourceURL + this.button_SrollSafe_Down + "\";' border=0 title='Toggle ScrollSafe'></a></TD><TD align='center' valign='top'  width='20px'><IMG title='Scroll Up' src='" + this.resourceURL + this.button_ScrollLeft + "' onmouseover='this.src=\"" + this.resourceURL + this.button_ScrollLeft_Rollover + "\"; IMAGESTUDIOMap[" + this.id + "].startScroll(1);' onmouseout='this.src=\"" + this.resourceURL + this.button_ScrollLeft + "\"; IMAGESTUDIOMap[" + this.id + "].stopScroll();'></TD><TD align='center' valign='top' width='20px'><IMG title='Scroll Down' src='" + this.resourceURL + this.button_ScrollRight + "' onmouseover='this.src=\"" + this.resourceURL + this.button_ScrollRight_Rollover + "\"; IMAGESTUDIOMap[" + this.id + "].startScroll(2);' onmouseout='this.src=\"" + this.resourceURL + this.button_ScrollRight + "\"; IMAGESTUDIOMap[" + this.id + "].stopScroll();'></TD><TD align='right' valign='top' width='100%'><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.resourceURL + this.button_Maximise + "' onmouseover='this.src=\"" + this.resourceURL + this.button_Maximise_Rollover + "\";' onmouseout='this.src=\"" + this.resourceURL + this.button_Maximise + "\";' onmouseup='this.src=\"" + this.resourceURL + this.button_Maximise_Rollover + "\";' onmousedown='this.src=\"" + this.resourceURL + this.button_Maximise_Down + "\";' border=0 title='Thumbnail Browser View'></a></TD></TR></TABLE></TD></TR><TR><TD id='" + IMAGESTUDIO_FILMSTRIP_FRAMECELL_PREFIX + this.id + "' name='" + IMAGESTUDIO_FILMSTRIP_FRAMECELL_PREFIX + this.id + "' align='top' valign='middle' style='height:100%; width:100px'><IFRAME name='" + IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id + "' id='" + IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id + "'  frameborder='no' scrolling='no' width='100' height='100%' style='width:100px; height:100%;'></IFRAME></TD></TR></TABLE></TD>";
}
function ImageStudio_ErrorRecovery_DisplayFrame(){
	window.setTimeout("IMAGESTUDIOMap["+this.id+"].performInitialisationCheck();IMAGESTUDIOMap["+this.id+"].loadResource("+this.currentResource+");",5000);
}
function ImageStudio_ErrorRecovery_FilmstripFrame(){
	window.setTimeout("IMAGESTUDIOMap["+this.id+"].performInitialisationCheck2(); IMAGESTUDIOMap["+this.id+"].loadThumbnails(0);",2000);
}
function ImageStudio_Instantiate(){
	if (this.instantiated)return;
	var disphtml = "";
	disphtml += "<TABLE id='" + IMAGESTUDIO_CONTAINER_PREFIX + this.id + "' name='" + IMAGESTUDIO_CONTAINER_PREFIX + this.id + "' cellspacing=0 cellpadding=0 width='"+this.width+"'  height='"+this.height+"' style='"+this.borderCSS_Dark+"'>";
	disphtml += "<TR>";
	switch (this.displayLayout){
		case 1: disphtml += this.drawLayout_1(); break;
		case 2: disphtml += this.drawLayout_2(); break;
		case 3: disphtml += this.drawLayout_3(); break;
		case 4: disphtml += this.drawLayout_4(); break;
		default: disphtml += this.drawLayout_1(); break;
	}
	disphtml += "</TR>";
	disphtml += "<TR><TD colspan='2' 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><SPAN ID='" + IMAGESTUDIO_CONTAINEROFFSET_PREFIX + this.id + "' NAME='" + IMAGESTUDIO_CONTAINEROFFSET_PREFIX + this.id + "'></SPAN></TD></TR>";
	disphtml += "</TABLE>";
	document.write (disphtml);
	this.performInitialisationCheck2();
	this.performInitialisationCheck();
	var myID = this.id;
	var thumbMode = this.startupThumbMode;
	window.onload = function(){
			eval ("IMAGESTUDIOMap["+myID+"].loadResource(0);IMAGESTUDIOMap["+myID+"].loadThumbnails(0);" + (thumbMode ? "IMAGESTUDIOMap["+myID+"].toggleMinMaxView();":"IMAGESTUDIOMap["+myID+"].toggleMinMaxView();IMAGESTUDIOMap["+myID+"].toggleMinMaxView();"));
			return true;
	}
	window.onunload = function(){
		eval("window.clearInterval(IMAGESTUDIOMap["+myID+"].isLoadingIntervalID);void(0);"); 
		eval("window.onload = IMAGESTUDIOMap["+myID+"].Old_DocumentOnload_Function;void(0);"); 
		eval("window.onunload = IMAGESTUDIOMap["+myID+"].Old_DocumentUnload_Function;void(0);"); 
		eval ("IMAGESTUDIOMap = null;");
		return true;
	}  
	window.onerror = function(message, url, line){
		eval ("IMAGESTUDIOMap["+myID+"].performInitialisationCheck();");
		eval ("IMAGESTUDIOMap["+myID+"].performInitialisationCheck2();");
		eval ("IMAGESTUDIOMap["+myID+"].loadResource(0);IMAGESTUDIOMap["+myID+"].loadThumbnails(0);");
		return true;
	}
	//Set the correct height parameter
	this.thumbnailViewHeight = getDOMObject (IMAGESTUDIO_CONTAINER_PREFIX + this.id).offsetHeight;
	this.thumbnailViewWidth = getDOMObject (IMAGESTUDIO_CONTAINER_PREFIX + this.id).offsetWidth;
	if (!isIE6 || String(navigator.platform).toUpperCase() != "WIN32"){
	if (this.displayLayout == 3 || this.displayLayout == 4){
		getDOMObject (IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.height = this.thumbnailViewHeight - 40;
		getDOMObject (IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.width = 100;
		getDOMObject (IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.height = this.thumbnailViewHeight;
		getDOMObject (IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.width =  this.thumbnailViewWidth - 110;
	}else if (this.displayLayout == 1 || this.displayLayout == 2){
		getDOMObject (IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.height = 100;
		getDOMObject (IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.width = this.thumbnailViewWidth - 40;
		getDOMObject (IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.height = this.thumbnailViewHeight - 110;
		getDOMObject (IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.width =  this.thumbnailViewWidth ;
	}
	}
	this.instantiated = true;
}
function ImageStudio_LoadThumbnails(resourceID){
	if (this.resourceArray.length == 0)return;
	if (Number(resourceID) < this.resourceArray.length){
		this.thumbnailsArray[Number(resourceID)].src = this.resourceArray[Number(resourceID)][0];
	}
}
function ImageStudio_performInitialisationCheck(){
	var dhtml = "<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'><HTML><BODY scroll=auto leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' style='"+this.backgroundCSS_ImageView+"' " + (this.NoRightClick ? "oncontextmenu='return false;'" : "") + "><DIV id='" + IMAGESTUDIO_DISPLAY_IMAGE_PREFIX + this.id + "' name='" + IMAGESTUDIO_DISPLAY_IMAGE_PREFIX + this.id + "' style='height:100%; width:100%'></DIV></BODY></HTML>";
	try{
		this.container2 = getDOMObject(IMAGESTUDIO_DISPLAY_PREFIX + this.id);//Return Null Object -- NN Recovery
		eval(IMAGESTUDIO_DISPLAY_PREFIX + this.id).document.open();
		eval(IMAGESTUDIO_DISPLAY_PREFIX + this.id).document.write(dhtml);
		eval(IMAGESTUDIO_DISPLAY_PREFIX + this.id).document.close();
		this.container2 = getDOMObject(IMAGESTUDIO_DISPLAY_PREFIX + this.id);//Return full object - IE Recovery
	}catch (e){
		this.errorRecovery_DisplayFrame ();		
	}
}
function ImageStudio_performInitialisationCheck2(){
	var thtml = "<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'><HTML>";
	thtml += "<STYLE>#CSS_IS_Thumbnail{display:block; height:100%; width:100%;}</STYLE>";
	thtml += "<STYLE>#CSS_IS_Thumbnail:hover{border:1px solid #000000}</STYLE>";
	thtml += "<BODY scroll='no' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' style=' "+this.backgroundCSS_Thumbnails+"' " + (this.NoRightClick ? "oncontextmenu='return false;'" : "") + ">";
	thtml += "<DIV id='" + IMAGESTUDIO_FILMSTRIP_PREFIX + this.id + "' name='" + IMAGESTUDIO_FILMSTRIP_PREFIX + this.id + "' style='position:absolute; left:0px; top:0px; overflow:visible;'></DIV></BODY></HTML>";
	try{
		this.container1 = getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id);//Return Null Object -- NN Recovery
		eval(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).document.open();
		eval(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).document.write(thtml);
		eval(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).document.close();
		this.container1 = getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id);//Return full object - IE Recovery
	}catch (e){
		this.errorRecovery_FilmstripFrame ();		
	}
}
function ImageStudio_SetLoadCode(resourceID, type, code){
	this.resourceArray[resourceID][type] = code;
	if (type == 4 && this.instantiated){		
//Update thumbnail display
		if (code != 1){
			this.isLoading_CurrentThumb = this.isLoading_CurrentThumb + 1;
			window.setTimeout("IMAGESTUDIOMap[" + this.id + "].loadThumbnails("+this.isLoading_CurrentThumb+")",100);
		}
		try{
			getFrameDOMObject(IMAGESTUDIO_FILMSTRIP_PREFIX + this.id, IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).innerHTML = String(this.populateFilmStrip());
		}catch (e){
			this.errorRecovery_FilmstripFrame();
		}
		if ((this.displayLayout == 1 || this.displayLayout ==2) && this.isFilmStripView){
			getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.height = 100;
		}else if ((this.displayLayout == 3 || this.displayLayout ==4) && this.isFilmStripView){
			getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.width = 100;
		}
	}
}
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 myID = String (this.id);
	thisThumb.onload = function(){eval("IMAGESTUDIOMap[" + myID + "].setLoadCode(" + resourceID + ",4,2); void(0);");return true;}
	thisThumb.onerror = function(){eval("IMAGESTUDIOMap[" + myID + "].setLoadCode(" + resourceID + ",4,3);void(0);");return true;}
	thisImage.onload = function(){eval("IMAGESTUDIOMap[" + myID + "].setLoadCode(" + resourceID + ",3,2);void(0);");return true;}
	thisImage.onerror = function(){eval("IMAGESTUDIOMap[" + myID + "].setLoadCode(" + resourceID + ",3,3);void(0);");return true;}
}
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){
		if (this.displayLayout == 1 || this.displayLayout == 2){
			var myFrameHeight = (!isNaN(this.thumbnailViewHeight) && this.thumbnailViewHeight > 0 ? this.thumbnailViewHeight : ImageStudio_retrieveTotalOffsetTopNN (getDOMObject(IMAGESTUDIO_CONTAINEROFFSET_PREFIX + this.id)) - ImageStudio_retrieveTotalOffsetTopNN (getDOMObject(IMAGESTUDIO_CONTAINER_PREFIX + this.id)));
			num_Rows = parseInt(String (eval(myFrameHeight / 100)));
			num_Cols = parseInt(String(eval(this.resourceArray.length / num_Rows)));
			if (this.resourceArray.length % num_Rows != 0)num_Cols = num_Cols + 1;
		}else if (this.displayLayout == 3 || this.displayLayout == 4){
			var myFrameWidth = (!isNaN(this.thumbnailViewWidth) && this.thumbnailViewWidth > 0 ? this.thumbnailViewWidth : ImageStudio_retrieveTotalOffsetLeftNN (getDOMObject(IMAGESTUDIO_CONTAINEROFFSET_PREFIX + this.id)) - ImageStudio_retrieveTotalOffsetLeftNN (getDOMObject(IMAGESTUDIO_CONTAINER_PREFIX + this.id)));
			num_Cols = parseInt (String (eval(myFrameWidth / 100)));
			num_Rows = parseInt(String(eval(this.resourceArray.length / num_Cols)));
			if (this.resourceArray.length % num_Cols != 0)num_Rows = num_Rows + 1;
		}
	}else if ((this.displayLayout == 3 || this.displayLayout == 4) && this.isFilmStripView){
		num_Cols = 1;
		num_Rows = this.resourceArray.length;
	}
	
	fhtml += "<TABLE cellpadding=0 cellspacing=2 border=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>";
						html_thumbs += "<a id='CSS_IS_Thumbnail' 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 " + (this.displayLayout == 1 || this.displayLayout == 2 ? "height='64'" : "width='90'") + " onclick='window.parent.IMAGESTUDIOMap[" + this.id + "].loadResource(" + eval(num_Cols * rows + i) + ");'></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><TR>" + html_titles + "</TR>";
	}
	fhtml += "<TR>" + html_bottom_space + "</TR></TABLE>";
	return fhtml;
}
function ImageStudio_LoadResource(resourceID){
	if (!this.instantiated)return;
	if (resourceID < 0 || resourceID >= this.resourceArray.length)return;
	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;
		if (this.isSlideShow){
			window.clearTimeout (this.slideShowIntervalID);
			this.slideShowIntervalID = window.setTimeout("IMAGESTUDIOMap[" + this.id + "].loadResource(" + resourceID + ");", this.slideShowDelay);
		}
	}else{
		if (this.isSlideShow){
			var nextRes = resourceID + 1;
			if (nextRes >= this.resourceArray.length)nextRes = 0;
			window.clearTimeout (this.slideShowIntervalID);
			this.slideShowIntervalID = window.setTimeout("IMAGESTUDIOMap[" + this.id + "].loadResource(" + nextRes + ");", this.slideShowDelay);
		}
		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 = "<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=20 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.resourceURL + this.button_Info + "' border=0 onmouseover='this.src=\"" + this.resourceURL + this.button_Info_Rollover + "\";' onmouseout='this.src=\"" + this.resourceURL + this.button_Info + "\";' onmouseup='this.src=\"" + this.resourceURL + this.button_Info_Rollover + "\";' onmousedown='this.src=\"" + this.resourceURL + this.button_Info_Down + "\";' Title='View Price'></a></TD>";
		}
		if (this.showSlideShowButton)html += "<TD><a href='javascript:window.parent.IMAGESTUDIOMap["+this.id+"].runSlideShow();void(0);'><IMG src='" + this.resourceURL + this.button_Slide + "' border=0 onmouseover='this.src=\"" + this.resourceURL + this.button_Slide_Rollover + "\";' onmouseout='this.src=\"" + this.resourceURL + this.button_Slide + "\";' onmouseup='this.src=\"" + this.resourceURL + this.button_Slide_Rollover + "\";' onmousedown='this.src=\"" + this.resourceURL + this.button_Slide_Down + "\";' Title='" + (this.isSlideShow ? "Stop" : "Run") + " Slideshow'></a></TD>";
		if (this.canPrint)html += "<TD><a href='javascript:window.parent.IMAGESTUDIOMap["+this.id+"].printResource();void(0);'><IMG src='" + this.resourceURL + this.button_Print + "' border=0 onmouseover='this.src=\"" + this.resourceURL + this.button_Print_Rollover + "\";' onmouseout='this.src=\"" + this.resourceURL + this.button_Print + "\";' onmouseup='this.src=\"" + this.resourceURL + this.button_Print_Rollover + "\";' onmousedown='this.src=\"" + this.resourceURL + this.button_Print_Down + "\";' Title='Print Document'></a></TD>";
		if (this.showNextPreviousButtons)html += "<TD><a href='javascript:window.parent.IMAGESTUDIOMap["+this.id+"].loadResource("+eval(resourceID-1)+");void(0);'><IMG src='" + this.resourceURL + this.button_ScrollLeft + "' border=0 onmouseout='this.src=\"" + this.resourceURL + this.button_ScrollLeft + "\";' onmouseup='this.src=\"" + this.resourceURL + this.button_ScrollLeft + "\";' onmousedown='this.src=\"" + this.resourceURL + this.button_ScrollLeft_Rollover + "\";' Title='View Previous'></a></TD><TD><a href='javascript:window.parent.IMAGESTUDIOMap["+this.id+"].loadResource("+eval(resourceID+1)+");void(0);'><IMG src='" + this.resourceURL + this.button_ScrollRight + "' border=0 onmouseout='this.src=\"" + this.resourceURL + this.button_ScrollRight + "\";' onmouseup='this.src=\"" + this.resourceURL + this.button_ScrollRight + "\";' onmousedown='this.src=\"" + this.resourceURL + this.button_ScrollRight_Rollover + "\";' Title='View Next'></a></TD>";
		html += "</TR></TABLE>";
	html += "</TD></TR>";
	var scrollSafeString = "";
	var virtualViewPortWidth = 0;
	var virtualViewPortHeight = 0;
	var factor = 1;
	var imageAspectRatio = this.imagesArray[resourceID].height / this.imagesArray[resourceID].width;
	var viewPortAspectRatio = (getDOMObject (IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id).offsetHeight - 50) / (getDOMObject (IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id).offsetWidth -50);
	if (isNaN(imageAspectRatio) || imageAspectRatio == 0)imageAspectRatio = 1; // Default to sqaure
	if (imageAspectRatio > viewPortAspectRatio){// The image has a greater height ratio
		virtualViewPortHeight = getDOMObject (IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id).offsetHeight - 50;
		virtualViewPortWidth = virtualViewPortHeight / imageAspectRatio;
	}else if (imageAspectRatio < viewPortAspectRatio){//The image has a greater width ratio
		virtualViewPortWidth = getDOMObject (IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id).offsetWidth - 50;
		virtualViewPortHeight = virtualViewPortWidth * imageAspectRatio;
	}else if (imageAspectRatio == viewPortAspectRatio){//the ratios are equal
		virtualViewPortWidth = getDOMObject (IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id).offsetWidth - 50;
		virtualViewPortHeight = getDOMObject (IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id).offsetHeight - 50;
	}
	scrollSafeString += " height='" + parseInt(virtualViewPortHeight) + "'";
	scrollSafeString += " width='" + parseInt(virtualViewPortWidth) + "'";
	
	if (!this.scrollSafe)scrollSafeString="";
	switch (this.resourceArray[resourceID][3]){
		case 2:html += "<TR><TD align='center' valign='middle'>&nbsp;<IMG src='"+this.resourceArray[resourceID][1] +"' " + scrollSafeString + "></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;
		default:html += "<TR><TD align='center' valign='middle'>&nbsp;<IMG src='"+this.resourceArray[resourceID][1] +"' " + scrollSafeString + "></TD></TR>";	break;
	}
	html += "</TABLE>";
	var infoHeight = (getDOMObject (IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id).offsetHeight - 50)/100*90 + 20;
	html += "<DIV id='" + IMAGESTUDIO_DISPLAY_INFO_PREFIX + this.id + "' name='" + IMAGESTUDIO_DISPLAY_INFO_PREFIX + this.id + "' STYLE='position:absolute; left:50%; top:5%; height:20%; width:40%; visibility:hidden; 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.resourceURL + this.button_Close + "' border=0 onmouseover='this.src=\"" + this.resourceURL + this.button_Close_Rollover + "\";' onmouseout='this.src=\"" + this.resourceURL + this.button_Close + "\";' onmouseup='this.src=\"" + this.resourceURL + this.button_Close_Rollover + "\";' onmousedown='this.src=\"" + this.resourceURL + this.button_Close_Down + "\";' title='Close Information Box'></a></TD></TR>";
	html += "<TR><TD valign=top><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>";
	try{
		getFrameDOMObject(IMAGESTUDIO_DISPLAY_IMAGE_PREFIX + this.id,  IMAGESTUDIO_DISPLAY_PREFIX + this.id).innerHTML = String(html);
	}catch(e){
		//alert ("Image Studio encountered an error when accessing the main viewer. Attempting to recover.");
		this.errorRecovery_DisplayFrame();
	}
}
function ImageStudio_RunSlideShow(){
	this.isSlideShow = !this.isSlideShow;
	if (!this.isSlideShow && this.slideShowIntervalID != "") window.clearTimeout(this.slideShowIntervalID);
	this.loadResource(this.currentResource);
}
//Window Event Handlers and Methods
function ImageStudio_ToggleInfoDisplay(){
	var currentSetting = getFrameDOMObject(IMAGESTUDIO_DISPLAY_INFO_PREFIX + this.id, IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.visibility;
	getFrameDOMObject(IMAGESTUDIO_DISPLAY_INFO_PREFIX + this.id, IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.visibility = (currentSetting == 'visible' ? 'hidden' : 'visible');
	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_PREFIX + this.id).style.position='static';
		getDOMObject(IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.visibility='visible';
		if (this.displayLayout == 1 || this.displayLayout == 2){
			getDOMObject(IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id).style.height='100%';
			if (!isIE6 || String(navigator.platform).toUpperCase() != "WIN32"){
				getDOMObject(IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.height = this.thumbnailViewHeight - 110;
				getDOMObject(IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.width =  this.thumbnailViewWidth ;
			}
			getDOMObject(IMAGESTUDIO_FILMSTRIP_CELL_PREFIX + this.id).style.height=100;
			getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAMECELL_PREFIX + this.id).style.height=100;
			getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.height=100;
		}else if (this.displayLayout == 3 || this.displayLayout == 4){
			getDOMObject(IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id).style.width='100%';
			if (!isIE6 || String(navigator.platform).toUpperCase() != "WIN32"){
				getDOMObject(IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.height = this.thumbnailViewHeight;
				getDOMObject(IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.width =  this.thumbnailViewWidth - 110;
			}
			getDOMObject(IMAGESTUDIO_FILMSTRIP_CELL_PREFIX + this.id).style.width=100;
			getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAMECELL_PREFIX + this.id).style.width=100;
			getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.width=100;
		}
		var btnStd = this.resourceURL + this.button_Maximise;
		var btnRoll = this.resourceURL + this.button_Maximise_Rollover;
		var btnDown = this.resourceURL + 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;};	
		this.loadResource(this.currentResource);//Recovery for NN and Mozilla
	}else{//Thumbnail View
		getDOMObject(IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.position='absolute';
		getDOMObject(IMAGESTUDIO_DISPLAY_PREFIX + this.id).style.visibility='hidden';
		if (this.displayLayout == 1 || this.displayLayout == 2){
			getDOMObject(IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id).style.height='1px';
			getDOMObject(IMAGESTUDIO_FILMSTRIP_CELL_PREFIX + this.id).style.height='100%';
			getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAMECELL_PREFIX + this.id).style.height='100%';
			if (!isIE6 || String(navigator.platform).toUpperCase() != "WIN32"){
				getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.height=this.thumbnailViewHeight;
				getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.width = this.thumbnailViewWidth - 40;
			}else{
				getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.height='100%';
				getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.width ='100%'; 
			}
		}else if (this.displayLayout == 3 || this.displayLayout == 4){
			getDOMObject(IMAGESTUDIO_DISPLAY_CELL_PREFIX + this.id).style.width='1px';
			getDOMObject(IMAGESTUDIO_FILMSTRIP_CELL_PREFIX + this.id).style.width='100%';
			getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAMECELL_PREFIX + this.id).style.width='100%';
			if (!isIE6 || String(navigator.platform).toUpperCase() != "WIN32"){
				getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.width = this.thumbnailViewWidth;
				getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.height=this.thumbnailViewHeight - 40;
			}else{
				getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.height='100%';
				getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.width ='100%'; 
			}
		}
		var btnStd = this.resourceURL + this.button_Minimise;
		var btnRoll = this.resourceURL + this.button_Minimise_Rollover;
		var btnDown = this.resourceURL + 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).style.top = this.pos_Left + "px";
	}
	getFrameDOMObject(IMAGESTUDIO_FILMSTRIP_PREFIX + this.id, IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).innerHTML = String(this.populateFilmStrip());
	//Arbitrary dimension recovery - required in some odd browsers
	getDOMObject(IMAGESTUDIO_CONTAINER_PREFIX + this.id).style.height = this.height;
	getDOMObject(IMAGESTUDIO_CONTAINER_PREFIX + this.id).style.width = this.width;
}
//Animation Functions
function ImageStudio_ShowIsLoadingAnim(resourceID){
	if (!this.isLoading)return;
	if (this.resourceArray[resourceID][3] != 1){
		this.stopIsLoadingAnim();
		this.displayImage(resourceID);
		return;
	}
	var html = "<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>";
	this.isLoadingDots = this.isLoadingDots.length >= 20 ? "": this.isLoadingDots + "..";
	getFrameDOMObject(IMAGESTUDIO_DISPLAY_IMAGE_PREFIX + this.id,  IMAGESTUDIO_DISPLAY_PREFIX + this.id).innerHTML = String(html);
}
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 = 0;
	var myLayerWidth = 0;
	if (this.displayLayout == 1 || this.displayLayout == 2){
		myFrameWidth = getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).scrollWidth;
		myLayerWidth = ImageStudio_retrieveTotalOffsetLeftNN(getFrameDOMObject(IMAGESTUDIO_FILMSTRIP_STOP_R_PREFIX + this.id, IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id));
	}else if (this.displayLayout == 3 || this.displayLayout == 4){
		myFrameWidth = getDOMObject(IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).scrollHeight;
		myLayerWidth = ImageStudio_retrieveTotalOffsetTopNN(getFrameDOMObject(IMAGESTUDIO_FILMSTRIP_STOP_B_PREFIX + this.id, IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id));
	}
	switch (direction){
		case 1: //Scroll Left or Scroll Up
			if (this.pos_Left >= 0)return;
			this.pos_Left = this.pos_Left + 10;
			break;
		case 2: //Scroll Right or Scroll Down
			if (eval(myLayerWidth - myFrameWidth) <= 0)return;
			this.pos_Left = this.pos_Left - 10;
			break;
	}
	if (this.displayLayout == 1 || this.displayLayout == 2){
		getFrameDOMObject(IMAGESTUDIO_FILMSTRIP_PREFIX + this.id, IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.left = this.pos_Left + "px";
	}else if (this.displayLayout == 3 || this.displayLayout == 4){
		getFrameDOMObject(IMAGESTUDIO_FILMSTRIP_PREFIX + this.id, IMAGESTUDIO_FILMSTRIP_FRAME_PREFIX + this.id).style.top = 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);
}
