// #region CLMS Javascript Utilities
function classCLMS_Utilities(){
	//Properties
	this["nLatestFlashVersion"] = 10;
	this["nLatestAcrobatVersion"] = 9;
	this["sUserAgent"] = navigator.userAgent.toLowerCase();
	this["nScreenWidth"] = window.screen.width;
	this["nScreenHeight"] = window.screen.height;
	this["sLibraryPath"] = 'Scripts/glibrary.html';
	this["sLibraryPathCTR"] = 'Scripts/gctrlogging.html';
	
	//Assign methods
	this.addEventHandlerOnload = addEventHandlerOnload;
	this.addEventHandlerOnresize = addEventHandlerOnresize;
	this.addEventHandlerOnscroll = addEventHandlerOnscroll;
	this.addEventHandlerOnunload = addEventHandlerOnunload;
	this.addEventHandlerOnbeforeunload = addEventHandlerOnbeforeunload;
	this.getAcrobatVersion = getAcrobatVersion;
	this.getBrowser = getBrowser;
	this.getBrowserVersion = getBrowserVersion;
	this.getOperatingSystem = getOperatingSystem;
	this.getFlashVersion = getFlashVersion;
	this.getInnerWidth = getInnerWidth;
	this.getInnerHeight = getInnerHeight;
	this.getPageHeight = getPageHeight;
	this.getMediaPlayerVersion = getMediaPlayerVersion;
	this.getScreenWidth = getScreenWidth;
	this.getScreenHeight = getScreenHeight;
	this.getScrollTop = getScrollTop;
	this.setInnerHTMLext = setInnerHTMLext;
	this.setBasePath = setBasePath;
	this.showPopupWindow = showPopupWindow;
		
	//Add onload event handler for specified function
	function addEventHandlerOnload(oCall){
		//Placeholder for inpage function
		var tempFunction;

		//Define onload log event flow, makes sure added function executes the last
		if (typeof window.onload == 'function'){
			tempFunction = window.onload;
			window.onload = function(){
				tempFunction();
				eval(oCall);
			}
		}
		else{
			window.onload = function(){
				eval(oCall);
			}
		}
	}
	
	//Add onresize event handler for specified function
	function addEventHandlerOnresize(oCall){
		//Placeholder for inpage function
		var tempFunction;

		//Define onload log event flow, makes sure added function executes the last
		if (typeof window.onresize == 'function'){
			tempFunction = window.onresize;
			window.onresize = function(){
				tempFunction();
				eval(oCall);
			}
		}
		else{
			window.onresize = function(){
				eval(oCall);
			}
		}
	}
	
	//Add onresize event handler for specified function
	function addEventHandlerOnscroll(oCall){
		//Placeholder for inpage function
		var tempFunction;

		//Define onload log event flow, makes sure added function executes the last
		if (typeof window.onscroll == 'function'){
			tempFunction = window.onscroll;
			window.onscroll = function(){
				tempFunction();
				eval(oCall);
			}
		}
		else{
			window.onscroll = function(){
				eval(oCall);
			}
		}
	}
	
	function addEventHandlerOnunload(oCall){
		//Placeholder for inpage function
		var tempFunction;

		//Define onload log event flow, makes sure added function executes the last
		if (typeof window.onunload == 'function'){
			tempFunction = window.onunload;
			window.onunload = function(){
				tempFunction();
				eval(oCall);
			}
		}
		else{
			window.onunload = function(){
				eval(oCall);
			}
		}
	}
	
	function addEventHandlerOnbeforeunload(oCall){
		//Placeholder for inpage function
		var tempFunction;

		//Define onload log event flow, makes sure added function executes the last
		if (typeof window.onbeforeunload == 'function'){
			tempFunction = window.onbeforeunload ;
			window.onbeforeunload  = function(){
				tempFunction();
				eval(oCall);
			}
		}
		else{
			window.onbeforeunload  = function(){
				eval(oCall);
			}
		}
	}
	
	

	
	//Adobe Acrobat Detection
	function getAcrobatVersion() {
		var nActobatVersion = 0;
		
		//NS3+, Opera3+, IE5+ Mac, Safari (support plugin array):  check for Acrobat plugin in plugin array
		if (navigator.plugins != null && navigator.plugins.length > 0) {
			for (i=0; i < navigator.plugins.length; i++ ) {
				var plugin = navigator.plugins[i];
				if (plugin.name.indexOf("Adobe Acrobat") > -1) {
					nActobatVersion = parseFloat(plugin.description.substring(30));
					break;
				}
			}
		}
		//IE4+ Win32:  attempt to create an ActiveX object
		else if (window.ActiveXObject){
			for (x=2; x <= this.nLatestAcrobatVersion; x++){
				try	{
					obAcro=eval("new ActiveXObject('PDF.PdfCtrl."+x+"');");
					if (obAcro){ nActobatVersion=x; }
				}
				catch(e) {}
			}			
			try	{
				obAcro4=new ActiveXObject('PDF.PdfCtrl.1');
				if (obAcro4){nActobatVersion='4'; }
			}
			catch(e) {}
		}
		//Can't detect in all other cases
		else {
			nActobatVersion = -1;
		}
		//Not installed
		if (nActobatVersion == 0) {nActobatVersion=-1}
		
		return nActobatVersion;
	}
	
	//Determine the browser details based on the user agent string
	function getBrowser()
	{
		var sBrowser = '';
		
		if (this.sUserAgent.indexOf('konqueror') + 1) sBrowser = 'konqueror';
		else if (this.sUserAgent.indexOf('safari') + 1) sBrowser = 'safari';
		else if (this.sUserAgent.indexOf('firefox') + 1) sBrowser = 'firefox'
		else if (this.sUserAgent.indexOf('omniweb') + 1) sBrowser = 'omniweb';
		else if (this.sUserAgent.indexOf('opera') + 1) sBrowser = 'opera';
		else if (this.sUserAgent.indexOf('webtv') + 1) sBrowser = 'webtv';
		else if (this.sUserAgent.indexOf('icab') + 1) sBrowser = 'icab';
		else if (this.sUserAgent.indexOf('msie') + 1) sBrowser = 'msie';
		else if (!this.sUserAgent.indexOf('compatible') + 1) sBrowser = 'netscape';
		else sBrowser = 'unknown';
		
		return sBrowser;
	}
	
	function getBrowserVersion(){
		var sBrowser = this.getBrowser();
		var sBrowserVersion = '';
		var nIndex = 0;
		var nLenght = 0;
		
		if (sBrowser != 'netscape'){
			nIndex = this.sUserAgent.indexOf(sBrowser) + 1;
			nLenght = sBrowser.length;
			sBrowserVersion = this.sUserAgent.substring(nIndex + nLenght, nIndex + nLenght + 3);
		}
		else{
			sBrowserVersion = this.sUserAgent.charAt(8);
		}
		
		return sBrowserVersion;
	}
	
	function getOperatingSystem(){
		var sBrowser = this.getBrowser();
		var sOS = '';
		if (this.sBrowser != 'konqueror'){
			if (this.sUserAgent.indexOf('linux') + 1) sOS = "linux";
			else if (this.sUserAgent.indexOf('x11') + 1) sOS = "unix";
			else if (this.sUserAgent.indexOf('mac') + 1) sOS = "mac";
			else if (this.sUserAgent.indexOf('win') + 1) sOS = "windows";
			else sOS = "Unknown";
		}
		else{
			sOS = "linux";
		}
		return sOS;
	}
						
	//Check if a string exists in the agent string and set the searched value
	function checkIt(string)
	{
		place = c_oCLAgent.indexOf(string) + 1;
		sCLCheckstring = string;
		return place;
	}

	//Flash Version Detection
	function getFlashVersion() {
		var nFlashVersion = 0;
		
		// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
		if (navigator.plugins != null && navigator.plugins.length > 0) {
			var flashPlugin = navigator.plugins['Shockwave Flash'];
			if (typeof flashPlugin == 'object') { 
				for (var i = this.nLatestFlashVersion; i >= 3; i--) {
					if (flashPlugin.description.indexOf(i + '.') != -1) {
						nFlashVersion = i;
						break;
					}
				}
			}
		}
		//IE4+ Win32:  attempt to create an ActiveX object
		else if (window.ActiveXObject) {
			for (x = 2; x <= this.nLatestFlashVersion; x++) {
				try {
					obFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + x + "');");
					if(obFlash) {nFlashVersion = x;}
				}
				catch(e) {}
			}
		}
		//Can't detect in all other cases
		else {
			nFlashVersion = -1;
		}
		//Not installed
		if (nFlashVersion == 0) {nFlashVersion = -1}
			
		return nFlashVersion;
	}
	
	//Get width of the window
	function getInnerWidth() {
		var nWidth = 0;
		
		if (window.innerWidth) {
			nWidth = window.innerWidth;
		}
		else if (window.document.documentElement) {
			if (window.document.documentElement.clientWidth){
				nWidth = window.document.documentElement.clientWidth;
			}
			else if(window.document.documentElement.offsetWidth){
				nWidth = window.document.documentElement.offsetWidth;
			}
		}
		else if (document.body) {
			nWidth = window.document.body.clientWidth;
		}
		return nWidth;
	}
								
	//Get height of the window
	function getInnerHeight() {
		var nHeight = 0;
		
		if (window.innerHeight) {
			nHeight = window.innerHeight;
		}
		else if (window.document.documentElement) {
			if (window.document.documentElement.clientHeight){
				nHeight = window.document.documentElement.clientHeight;
			}
			else if(window.document.documentElement.offsetHeight){
				nHeight = window.document.documentElement.offsetHeight;
			}
		}
		else if (window.document.body) {
			nHeight = window.document.body.clientHeight;
		}
		return nHeight;
	}
	
	function getPageHeight(){
		var y;
		var test1;
		var test2;
		
		/* Test for content height */	
		test1 = document.body.scrollHeight;
		test2 = document.body.offsetHeight;
		if (test1 > test2) // all but Explorer Mac
		{
			y = document.body.scrollHeight;
		}
		else // Explorer Mac;
		     //would also work in Explorer 6 Strict, Mozilla and Safari
		{
			y = document.body.offsetHeight;
		}
		/* Test for inner height */
		test1 = y;
		test2 = this.getInnerHeight();
		if (test1 < test2) // all but Explorer Mac
		{
			y = test2
		}
		return y;
	}
	
	//Windows Media Player Detection
	function getMediaPlayerVersion(){
		sMediaplayerVersion = 0;
		
		if (window.ActiveXObject){
			try{
				obWMP=new ActiveXObject('WMPlayer.OCX.7');
				if (obWMP){			
					sMediaplayerVersion=parseFloat(obWMP.versionInfo);
				}
			}
			catch(e) {}
			if (sMediaplayerVersion == 0){
				sMediaplayerVersion = -1;
			}
		}
		else if (navigator.plugins != null && navigator.plugins.length > 0) {
			if (navigator.mimeTypes["video/x-ms-wm"] &&  navigator.mimeTypes["video/x-ms-wm"].enabledPlugin && 	navigator.mimeTypes["video/x-ms-wmv"] && navigator.mimeTypes["video/x-ms-wmv"].enabledPlugin) {
				sMediaplayerVersion = '6.4';
			}
			else if (navigator.mimeTypes && navigator.mimeTypes["application/x-mplayer2"] &&  navigator.mimeTypes["application/x-mplayer2"].enabledPlugin){
				sMediaplayerVersion = '5.2';
			}
		}
		//Can't detect in all other cases
		else{
			sMediaplayerVersion = -1;
		}
		//Not installed
		if (sMediaplayerVersion == 0){sMediaplayerVersion = -1}
		
		return sMediaplayerVersion;
	}
	
	//Get screen width
	function getScreenWidth(){
		return this.nScreenWidth;
	}
	
	//Get screen height
	function getScreenHeight(){
		return this.nScreenHeight;
	}
	
	//Determin scroll distance
	function getScrollTop() {
		var scrollTop = 0;
		if( typeof( window.pageYOffset ) == 'number' ) {
			//Netscape compliant
			scrollTop = window.pageYOffset;
		} 
		else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
			//DOM compliant
			scrollTop = document.body.scrollTop;
		} 
		else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
			//IE6 standards compliant mode
			scrollTop = document.documentElement.scrollTop;
		}
		return scrollTop;
	}

	//Write innerHTML from external script (workaround for IE object functionality)
	function setInnerHTMLext(element,html) {
		element.innerHTML = html;
	}
	
	//Set basepath for logging script
	function setBasePath(sPath){
		this.sLibraryPath = sPath + "glibrary.asp"
		this.sLibraryPathCTR = sPath + "gctrlogging.asp"
	}
	
	//Show popup window with specified url relative to screen width and height
	function showPopupWindow(sUrl){
		var oWindow;
		oWindow = window.open(sUrl,'popupWindow','scrollbars=yes,status=no,toolbar=no,width=' + (this.getScreenWidth() - 200) + ',height=' + (this.getScreenHeight() - 200) + ',top=80,left=100');
		oWindow.focus();
		return false;
	}

}// #endregion

// #region CLMS Logging object
function classCLMS_Logging(){
	//Properties
	this["bCalculateSpeed"] = true;
	this["bResizeWait"] = false;
	this["nFileSize"] = 20876;
	this["nStartTime"] = 0;
	this["nResizeIntervalId"] = 0;
	this["nWindowHeight"] = 0;
	this["nWindowResizeHeight"] = 0;
	this["nWindowResizeWidth"] = 0;
	this["nWindowWidth"] = 0;
	this["oConnectionImg"] = null;
	this["nLogModeManual"] = 1;
	this["nLogModeAutomatic"] = 2;
	
	//Initialise utilities
	this["oUtilities"] = classCLMS_Utilities; 			
	this.oUtilities();
	
	//Initialise variables
	this.nWindowHeight = this.getInnerHeight();
	this.nWindowWidth = this.getInnerWidth();
	this.nWindowResizeHeight = this.getInnerHeight();
	this.nWindowResizeWidth = this.getInnerWidth();
		
	//Assign methods
	this.logClient = logClient;
	this.logClientResize = logClientResize;
	this.logClientSpeed = logClientSpeed;
	this.logMultimedia = logMultimedia;
	this.logPageview = logPageview;
	this.logEvent = logEvent;
	this.onResizeHandler = onResizeHandler;
		
	//Log client values
	function logClient(){	
		var sSrc = this.sLibraryPath + '?L=2&';
			sSrc += 'sw=' + this.getScreenWidth() + '&';
			sSrc += 'sh=' + this.getScreenHeight() + '&';
			sSrc += 'ww=' + this.getInnerWidth() + '&';
			sSrc += 'wh=' + this.getInnerHeight() + '&';
			sSrc += 'os=' + this.getOperatingSystem() + '&'; 
			sSrc += 'bn=' + this.getBrowser() + '&';
			sSrc += 'bv=' + this.getBrowserVersion() + '&';
			sSrc += 'fl=' + this.getFlashVersion() + '&';
			sSrc += 'ar=' + this.getAcrobatVersion() + '&';
			sSrc += 'mp=' + this.getMediaPlayerVersion() + '&';
			sSrc += 'nc=' + (new Date()).getTime();
		
			var oImg = new Image();
			oImg.src = sSrc;
			//alert(sSrc);
			
			//Show message on screen (element with id "status" nessecary)		
			//document.getElementById('status').innerHTML = document.getElementById('status').innerHTML + Date() + '&nbsp;&nbsp;&nbsp;' + src + "</br>";
	}
	
	//Log window values after resize
	function logClientResize(){
		this.nWindowWidth = this.getInnerWidth();
		this.nWindowHeight = this.getInnerHeight();
		
		// If stopped resizing then
		if (this.nWindowWidth == this.nResizeWindowWidth && this.nWindowHeight == this.nResizeWindowHeight){
			//Clear interval
			clearInterval(this.nResizeIntervalId);
			
			//Build image source and log
			var sSrc = this.sLibraryPath + '?L=3&';
			sSrc += 'ww=' + this.nWindowWidth + '&';
			sSrc += 'wh=' + this.nWindowHeight + '&';
			sSrc += 'nc=' + (new Date()).getTime();
				
			var oImg = new Image();
			oImg.src = sSrc;
			//alert(sSrc);
			
			//Show message on screen (element with id "status" nessecary)
			//document.getElementById('status').innerHTML = document.getElementById('status').innerHTML + Date() + '&nbsp;&nbsp;&nbsp;' + src + "<br />";
			
			this.bResizeWait = false;
		}
	}
	
	//Log connectionspeed          
	function logClientSpeed(sLogging){
		if (this.bCalculateSpeed == true) {
			//Set speedlogging to false
			this.bCalculateSpeed = false;
			
			//Declare image for connectionspeed;
			oConnectionImg = new Image()
			oConnectionImg.onload = function(){eval(sLogging + '.logClientSpeed()')};
			
			//Start speedTime
			this.nStartTime = (new Date()).getTime();
			oConnectionImg.src = this.sLibraryPath + "?L=4&nc=" + (new Date()).getTime();
		}
		else{
			//Calculate speedTime and when pingTime larger then speedTime, pingTime = 0
			var nSpeedTime = ((new Date()).getTime() - this.nStartTime);
			
			//Log client speed
			var sSrc = this.sLibraryPath + '?L=5&';
			sSrc += 'br=' + parseInt((((this.nFileSize * 8) / (nSpeedTime / 1000)) / 1024)) + '&';
			
			sSrc += 'nc=' + (new Date()).getTime();
		
			var img = new Image();
			img.src = sSrc;
			//alert(sSrc);
			
	//		Show message on screen (element with id "status" nessecary)		
	//		document.getElementById('status').innerHTML = document.getElementById('status').innerHTML + Date() + '&nbsp;&nbsp;&nbsp;' + src + "</br>";
		}
	}
	
	//Log pageview when a multimediaitem is viewed/selected
	function logMultimedia(nId, nType, nMode){
		var logmm;
		logmm = new Image();
		logmm.src = this.sLibraryPath +'?L=1&Id=' + nId + '&T=' + nType + '&M=' + nMode + '&Nc=' + (new Date()).getTime();
		//document.location.href = logmm.src;
		
		if(window["_ctr"]){
			var logmmctr;
			logmmctr = new Image();
			logmmctr.src = this.sLibraryPathCTR +'?L=3&Id=' + nId + '&T=' + nType + '&M=' + nMode + '&Nc=' + (new Date()).getTime();
			//document.location.href = logmmctr.src;
		}
	}
	
	//Log pageview
	function logPageview(nType){
		var logpv;
		logpv = new Image();
		logpv.src = this.sLibraryPath +'?L=6&T=' + nType + '&Nc=' + (new Date()).getTime();
	}
	
	//Log event
	function logEvent(nType, nSource){
		var logpv;
		logpv = new Image();
		logpv.src = this.sLibraryPath +'?L=7&T=' + nType + '&S=' + nSource + '&Nc=' + (new Date()).getTime();
	}
	
	//Handle resize in window for logging resize when window is enlarged
	function onResizeHandler(sLogging){
		if ((this.nResizeWindowWidth != this.getInnerWidth()) || (this.nResizeWindowHeight != this.getInnerHeight())){
			this.nResizeWindowWidth = this.getInnerWidth();
			this.nResizeWindowHeight = this.getInnerHeight();	
			if (this.bResizeWait == false && ( (this.nResizeWindowWidth > this.nWindowWidth && this.nResizeWindowHeight >= this.nWindowHeight) || (this.nResizeWindowWidth >= this.nWindowWidth && this.nResizeWindowHeight > this.nWindowHeight) ) ){
				this.bResizeWait = true;
				this.nResizeIntervalId = setInterval("eval('" + sLogging + ".logClientResize()')", 500);
			}
		}
	}
}// #endregion

// #region CLMS Gallery object
function classCLMS_Gallery(){
	//Properties
	this["bEngineRunning"] = false;
	this["bThumbnailBorder"] = false;
	this["bThumbnailStyle"] = false;
	this["bThumbnailSynchronisePosition"] = false;
	this["bThumbnailSynchroniseStatus"] = false;
	this["bLinkList"] = false;
	this["bEngineRunning"] = false;
	this["colPictures"] = new Object();
	this["colMovies"] = new Object();
	this["eBigPicture"] = null;
	this["eBigPictureBox"] = null;
	this["eBigPictureCaption"] = null;
	this["eGalleryPlayPause"] = null;
	this["eMovie"] = null;
	this["ePicture"] = null;
	this["ePictureCaption"] = null;
	this["nEngineAction"] = 0;
	this["nMinFlashVersion"] = 0;
	this["nGalleryType"] = 0;
	this["nGalleryOpacity"] = 0;
	this["nIndexTotal"] = 0;
	this["nIndexCurrent"] = 0;
	this["nIntervalEngine"] = 0;
	this["nIntervalPause"] = 128;
	this["nIntervalPauseCounter"] = 128;
	this["sLinkListClassNormal"] = '';
	this["sLinkListClassActive"] = '';
	this["sMovieQuality"] = 'high';
	this["sThumbnailBorderStyleNormal"] = '';
	this["sThumbnailBorderStyleActive"] = '';
	this["sThumnnailBorderStyleSelected"] = '';
	this["sThumbnailClassNormal"] = '';
	this["sThumbnailClassActive"] = '';
	this["sThumnnailClassSelected"] = '';
	
	//Initialise logging
	this["oLogging"] = classCLMS_Logging; 			
	this.oLogging();
	
	//Assign methods
	this.addBigPicture = addBigPicture;
	this.addMovieLow = addMovieLow;
	this.addMovieHigh = addMovieHigh;
	this.addPicture = addPicture;
	this.addThumbnail = addThumbnail;
	this.getCollectionElement = getCollectionElement;
	this.getCollectionMovies = getCollectionMovies;
	this.getCollectionPictures = getCollectionPictures;
	this.getCurrentIndex = getCurrentIndex;
	this.hideBigPicture = hideBigPicture;
	this.movieExists = movieExists;
	this.pictureExists = pictureExists;
	this.setBigPictureBoxPosition = setBigPictureBoxPosition;
	this.setBigPictureBoxPositionParameters = setBigPictureBoxPositionParameters;
	this.setCurrentIndex = setCurrentIndex;
	this.setElementPicture = setElementPicture;
	this.setElementPictureCaption = setElementPictureCaption;
	this.setElementBigPicture = setElementBigPicture;
	this.setElementBigPictureBox = setElementBigPictureBox;
	this.setElementBigPictureCaption = setElementBigPictureCaption;
	this.setElementGalleryControl = setElementGalleryControl;
	this.setElementMovie = setElementMovie;
	this.setGalleryType = setGalleryType;
	this.setLinkListStatus = setLinkListStatus;
	this.setLinkListStyle = setLinkListStyle;
	this.setMinFlashVersion = setMinFlashVersion;
	this.setMovieQuality = setMovieQuality;
	this.setThumbnailBorderStyle = setThumbnailBorderStyle;
	this.setThumbnailStatus = setThumbnailStatus;
	this.setThumbnailStyle = setThumbnailStyle;
	this.setThumbnailSynchronisePosition = setThumbnailSynchronisePosition;
	this.setThumbnailSynchroniseStatus = setThumbnailSynchroniseStatus;
	this.showBigPicture = showBigPicture;
	this.showMovie = showMovie;
	this.showPicture = showPicture;
	this.showWallpaper = showWallpaper;
	this.swapThumbnail = swapThumbnail;
	
	//Slideshow funtions
	this.engineLoop = engineLoop;
	this.startEngine = startEngine;
	this.stopEngine = stopEngine;
	this.fadeIn = fadeIn;
	this.fadeOut = fadeOut;
	
	//Type definitions
	this.classCLMS_Picture = classCLMS_Picture;
	this.classCLMS_Thumbnail = classCLMS_Thumbnail;
	this.classCLMS_Movie = classCLMS_Movie;
	this.classCLMS_Clip = classCLMS_Clip;
	
	function engineLoop(){
		//Get opacity
		var eFade = this.eBigPicture; 
		var nOpacity;
		
		if (this.nGalleryOpacity == 1){
			if (eFade.style.filter != '') {
				nOpacity = parseInt(eFade.filters.alpha.opacity);
			}
			else {
				nOpacity = 100;
			}
		}
		if (this.nGalleryOpacity == 2){
			nOpacity = parseInt((eFade.style.opacity * 100));
		}
		
		//Action 1 = fade in
		if (this.nEngineAction == 1){
			if (nOpacity < 100) {
				this.fadeIn(eFade);
			}
			else{
				if(this.nGalleryOpacity == 1){
					this.eBigPicture.style.filter = '';
				}
				this.nEngineAction = this.nEngineAction + 1;
			}
		}
		
		//Action 2 = set pause time
		if (this.nEngineAction == 2){
			this.nIntervalPauseCounter = this.nIntervalPause;
			this.nEngineAction = this.nEngineAction + 1;
		}
		
		//Action 3 = pause
		if (this.nEngineAction == 3){
			if (this.nIntervalPauseCounter > 0 ){
				this.nIntervalPauseCounter = this.nIntervalPauseCounter - 1;
			}
			else{
				if(this.nGalleryOpacity == 1){
					this.eBigPicture.style.filter = 'alpha(opacity=100)';
				}
				this.nEngineAction = this.nEngineAction + 1;
			}
		}
		
		//Action 4 = fade out
		if (this.nEngineAction == 4){
			if (nOpacity > 0) {
				this.fadeOut(eFade);
			}
			else{
				this.nEngineAction = this.nEngineAction + 1;
			}
		}
				
		//Action 5 = fade out
		if (this.nEngineAction == 5){
			this.showBigPicture(this.getCurrentIndex() + 1);
			this.nEngineAction = this.nEngineAction + 1;
		}
		
		//Action 6 = go to step one
		if (this.nEngineAction == 6){
			this.nEngineAction = 1;
		}
	}
	
	function startEngine(sGalleryName, bAutoRun){
		if (this.bEngineRunning != true){
			
			this.bEngineRunning = true;
			
			if (bAutoRun == true) {
				this.showBigPicture(1);
				
				if (this.nGalleryOpacity == 1){
					this.eBigPicture.style.filter = 'alpha(opacity=0)';
					this.eBigPicture.filters.alpha.opacity  = 0;
				}
				if (this.nGalleryOpacity == 2){
					this.eBigPicture.style.opacity = 0;
				}
				this.nEngineAction = 1;
			}
			else{
				if (this.nGalleryOpacity == 1){
					this.eBigPicture.style.filter = 'alpha(opacity=0)';
					this.eBigPicture.filters.alpha.opacity  = 100;
				}
				if (this.nGalleryOpacity == 2){
					this.eBigPicture.style.opacity = 1;
				}
				this.nEngineAction = 4;
			}
			
			this.eGalleryPlayPause.src = this.eGalleryPlayPause.srcOff;
			this.eGalleryPlayPause.alt = this.eGalleryPlayPause.altOff;
			
			this.nIntervalEngine = window.setInterval(sGalleryName + '.engineLoop()', 1000/62)
		}
		else{
			this.stopEngine();
		}
		
		return false;
	}
	
	function stopEngine(){
		window.clearInterval(this.nIntervalEngine);
		
		if (this.nGalleryOpacity == 1){
			this.eBigPicture.style.filter = '';
			//this.eBigPicture.filters.alpha.opacity  = 100;
		}
		if (this.nGalleryOpacity == 2){
			this.eBigPicture.style.opacity = 1;
		}
		
		this.eGalleryPlayPause.src = this.eGalleryPlayPause.srcOn;
		this.eGalleryPlayPause.alt = this.eGalleryPlayPause.altOn;
		
		this.bEngineRunning = false;
		
		return false;
	}
	
	function fadeIn(eFade){	
		if (this.nGalleryOpacity == 1){
			eFade.filters.alpha.opacity  = eFade.filters.alpha.opacity + 5;
		}
		if (this.nGalleryOpacity == 2){
			eFade.style.opacity = ((eFade.style.opacity * 100) + 5)/100;
		}
	}
	
	function fadeOut(eFade){
		if (this.nGalleryOpacity == 1){
			eFade.filters.alpha.opacity  = eFade.filters.alpha.opacity - 5;
		}
		if (this.nGalleryOpacity == 2){
			eFade.style.opacity = ((eFade.style.opacity * 100) - 5)/100;
		}
	}
	
	//Define methods
	function addBigPicture(sIndex, sUrl, sAlt, nWidth, nHeight){
		this.pictureExists(sIndex);
		this.colPictures[sIndex].oLarge.src = sUrl;
		this.colPictures[sIndex].oLarge.alt = sAlt;
		this.colPictures[sIndex].oLarge.width = nWidth;
		this.colPictures[sIndex].oLarge.height = nHeight;
	}
			
	function addMovieLow(sIndex, sUrl, nWidth, nHeight){
		this.movieExists(sIndex);
		this.colMovies[sIndex].oLow.src = sUrl;
		this.colMovies[sIndex].oLow.width = nWidth;
		this.colMovies[sIndex].oLow.height = nHeight;
	}
	
	function addMovieHigh(sIndex, sUrl, nWidth, nHeight){
		this.movieExists(sIndex);
		this.colMovies[sIndex].oHigh.src = sUrl;
		this.colMovies[sIndex].oHigh.width = nWidth;
		this.colMovies[sIndex].oHigh.height = nHeight;
	}
	
	function addPicture(sIndex, sUrl, sAlt, nWidth, nHeight){
		this.pictureExists(sIndex);
		if (sUrl.substring(sUrl.indexOf("."), sUrl.length) != '.swf'){
			this.colPictures[sIndex].oNormal.src = sUrl;
			this.colPictures[sIndex].oNormal.alt = sAlt;
			this.colPictures[sIndex].oNormal.width = nWidth;
			this.colPictures[sIndex].oNormal.height = nHeight;
		}
		else{
			this.colPictures[sIndex].oNormal = new Object();
			this.colPictures[sIndex].oNormal.src = sUrl;
			this.colPictures[sIndex].oNormal.alt = sAlt;
			this.colPictures[sIndex].oNormal.width = nWidth;
			this.colPictures[sIndex].oNormal.height = nHeight;
		}
	}
	
	function addThumbnail(sIndex, sUrlNormal, sUrlActive, sAlt, nWidth, nHeight){
		this.pictureExists(sIndex);
		this.colPictures[sIndex].oThumbnail.src = sUrlActive;
		this.colPictures[sIndex].oThumbnail.srcActive = sUrlActive;
		this.colPictures[sIndex].oThumbnail.src = sUrlNormal;
		this.colPictures[sIndex].oThumbnail.srcNormal = sUrlNormal;
		this.colPictures[sIndex].oThumbnail.alt = sAlt;
		this.colPictures[sIndex].oThumbnail.width = nWidth;
		this.colPictures[sIndex].oThumbnail.height = nHeight;
	}
	
	function getCollectionElement(colElements, nIndex){
		var oElement;
		
		if (nIndex > this.nIndexTotal){
			nIndex = 1;
		}
		if (nIndex < 1){
			nIndex = this.nIndexTotal;
		}
		
		for (var oTempElement in colElements){
			oElement = colElements[oTempElement];
			if (oElement.nIndex == nIndex){
				return oElement;
			}
		}
	}
	
	function getCollectionMovies(){
		return this.colMovies;
	}
	
	function getCollectionPictures(){
		return this.colPictures;
	}
	
	function getCurrentIndex(){
		return this.nIndexCurrent;
	}
	
	function hideBigPicture() {
		this.eBigPictureBox.style.display = 'none'; 
		this.eBigPicture.src = this.eBigPicture.sOriginalSrc;
		
		//Fire close event
		if (this.eBigPictureBox.sEventClose != ''){
			eval(this.eBigPictureBox.sEventClose);
		}
	}
	
	function movieExists(sIndex){
		if (this.colMovies[sIndex] == undefined){
			this.nIndexTotal += 1;
			this.colMovies[sIndex] = new classCLMS_Movie(this.nIndexTotal, sIndex);
		}
	}
	
	function pictureExists(sIndex){
		if (this.colPictures[sIndex] == undefined){
			this.nIndexTotal += 1;
			this.colPictures[sIndex] = new classCLMS_Picture(this.nIndexTotal, sIndex);
		}
	}
	
	function setBigPictureBoxPosition(){
		//Get scroll distance
		var nScroll = this.getScrollTop();
		
		//Position box
		if (nScroll > this.eBigPictureBox.nMinScroll) {
			this.eBigPictureBox.style.top = (nScroll + this.eBigPictureBox.nTopScroll) + 'px';
		}
		else {
			this.eBigPictureBox.style.top = this.eBigPictureBox.nTopNormal + 'px';
		}
	}
	
	function setBigPictureBoxPositionParameters(nTopNormal, nTopScroll, nMinScroll, sEventOpen, sEventClose, sEventReposition){
		this.eBigPictureBox.nTopNormal = nTopNormal;
		this.eBigPictureBox.nTopScroll = nTopScroll;
		this.eBigPictureBox.nMinScroll = nMinScroll;
		this.eBigPictureBox.sEventOpen = sEventOpen;
		this.eBigPictureBox.sEventClose = sEventClose;
		if (sEventReposition.length > 0){
			this.addEventHandlerOnresize(sEventReposition);
			this.addEventHandlerOnscroll(sEventReposition);
		}
	}
	
	function setCurrentIndex(nIndex){
		if(typeof(nIndex) == 'number'){
			this.nIndexCurrent = nIndex;
		}
	}

	function setElementBigPicture(sId){
		this.eBigPicture = document.getElementById(sId);
		this.eBigPicture["sOriginalSrc"] = '';
		if (this.eBigPicture.filters != undefined){
			this.nGalleryOpacity = 1 //alert('filters');
		}
		if (this.eBigPicture.style.opacity != undefined){
			this.nGalleryOpacity = 2 //alert('opacity');
		}
		
		if (this.nGalleryOpacity == 1){
			this.eBigPicture.style.filter = '';
		}
		if (this.nGalleryOpacity == 2){
			this.eBigPicture.style.opacity = 1;
		}
	}
	
	function setElementBigPictureBox (sId){
		this.eBigPictureBox = document.getElementById(sId);
		this.eBigPictureBox["nTopNormal"] = 0;
		this.eBigPictureBox["nTopScroll"] = 0;
		this.eBigPictureBox["nMinNormal"] = 0;
		this.eBigPictureBox["sEventOpen"] = '';
		this.eBigPictureBox["sEventClose"] = '';
	}
	
	function setElementBigPictureCaption(sId){
		this.eBigPictureCaption = document.getElementById(sId);
	}
	
	function setElementMovie(sId){
		this.eMovie = document.getElementById(sId);
	}
	
	function setElementGalleryControl(sIdPlayPause, sSrcOn, sAltOn, sSrcOff, sAltOff){
		this.eGalleryPlayPause = document.getElementById(sIdPlayPause);
		this.eGalleryPlayPause.srcOn = sSrcOn;
		this.eGalleryPlayPause.altOn = sAltOn;
		this.eGalleryPlayPause.srcOff = sSrcOff;
		this.eGalleryPlayPause.altOff = sAltOff;
	}
	
	function setElementPicture(sId){
		this.ePicture = document.getElementById(sId);
	}
	
	function setElementPictureCaption(sId){
		this.ePictureCaption = document.getElementById(sId);
	}
	
	function setGalleryType(nType){
		this.nGalleryType = nType;
	}
	
	function setLinkListStyle(sClassNormal, sClassActive){
		this.bLinkList = true;
		this.sLinkListClassNormal = sClassNormal;
		this.sLinkListClassActive = sClassActive;
	}
	
	function setMinFlashVersion(nMinVersion){
		this.nMinFlashVersion = nMinVersion;
	}
	
	function setLinkListStatus(colElements){
		var oElement;
		var aLinkList;
		var eLink;

		for (var oTempElement in colElements){
			oElement = colElements[oTempElement];
			aLinkList = document.getElementsByName(oTempElement);
			if(aLinkList.length > 0){
				if (oElement.nIndex == this.nIndexCurrent){
					for (var i=0; i<aLinkList.length; i++){
						if (aLinkList[i].name == oTempElement) aLinkList[i].className = this.sLinkListClassActive;
					}
				}
				else{
					for (var i=0; i<aLinkList.length; i++){
						if (aLinkList[i].name == oTempElement) aLinkList[i].className = this.sLinkListClassNormal;
					}
				}
			}
			else{
				eLink = document.getElementById(oTempElement);
				if (oElement.nIndex == this.nIndexCurrent){
					eLink.className = this.sLinkListClassActive;
				}
				else{
					eLink.className = this.sLinkListClassNormal;
				}
			}
		}
	}
	
	function setMovieQuality(sQuality){
		var bReload = false;
		if(sQuality.toLowerCase() != this.sMovieQuality.toLowerCase() && this.nIndexCurrent > 0){
			bReload = true;
		}
		
		switch(sQuality.toLowerCase())
		{
			case 'high':
				this.sMovieQuality = 'High';
				break;
			case 'low':
				this.sMovieQuality = 'Low';
				break;
			default:
				this.sMovieQuality = 'High';
		}
		
		if(bReload == true){
			//reset current index and load with new quality
			var nIndexTemp = this.nIndexCurrent;
			this.nIndexCurrent = 0;
			this.showMovie(nIndexTemp);
		}
	}
	
	function setThumbnailBorderStyle(sStyleNormal, sStyleActive, sStyleSelected){
		this.bThumbnailBorder = true;
		this.sThumbnailBorderStyleNormal = sStyleNormal;
		this.sThumbnailBorderStyleActive = sStyleActive;
		this.sThumnnailBorderStyleSelected = sStyleSelected;
	}
	
	function setThumbnailStatus(nIndex){
		var oPicture;
		var oPictureThumbnail;
		
		for (var oTempPicture in this.colPictures){
			oPicture = this.colPictures[oTempPicture];
			oPictureThumbnail = oPicture.oThumbnail;
			
			if (oPicture.nIndex == this.nIndexCurrent){
				oPictureThumbnail.active = false;
				this.swapThumbnail(document.getElementById(oTempPicture));
			}
			else{
				if(oPictureThumbnail.active == true){
					this.swapThumbnail(document.getElementById(oTempPicture));
				}
			}
		}
	}
	
	function setThumbnailStyle(sClassNormal, sClassActive, sClassSelected){
		this.bThumbnailStyle = true;
		this.sThumbnailClassNormal = sClassNormal;
		this.sThumbnailClassActive = sClassActive;
		this.sThumbnailClassSelected = sClassSelected;
	}
	
	function setThumbnailSynchronisePosition(bSynchronisePosition){
		this.bThumbnailSynchronisePosition = bSynchronisePosition;
	}
	
	function setThumbnailSynchroniseStatus(bSynchroniseStatus){
		this.bThumbnailSynchroniseStatus = bSynchroniseStatus
	}
	
	function showBigPicture(vIndex) {
		var oPicture;
		var oPictureLarge;
		var nScroll = this.getScrollTop();
		
		if (this.eBigPicture != undefined && this.eBigPictureBox != undefined){
			//Get picture and assign large picture
			switch(typeof(vIndex))
			{
				case 'string':
					oPicture = this.colPictures[vIndex];
					break;
				case 'number':
					oPicture = this.getCollectionElement(this.colPictures, vIndex);
					break;
			}
			oPictureLarge = oPicture.oLarge;
			
			//Set index to current
			if (this.nIndexCurrent != oPicture.nIndex){
				this.nIndexCurrent = oPicture.nIndex;
			}
			
			//Process large picture
			if (oPictureLarge.src.length > 0){				
				//Assign picture
				this.eBigPicture.alt = oPictureLarge.alt;
				this.eBigPicture.width = oPictureLarge.width;
				this.eBigPicture.height = oPictureLarge.height;
				this.eBigPicture.src = oPictureLarge.src;
				this.nCurrentIndex = oPicture.nIndex;
				
				//Log pageview multimedia
				if (this.bEngineRunning){
					this.logMultimedia(oPicture.sId, this.nGalleryType, this.nLogModeAutomatic);
				}
				else{
					this.logMultimedia(oPicture.sId, this.nGalleryType, this.nLogModeManual);
				}

				//Optionally show caption
				if(this.eBigPictureCaption != undefined){
					this.eBigPictureCaption.innerHTML = oPictureLarge.alt;
				}

				 //Position box
   				this.setBigPictureBoxPosition();
    
    			//Optionally fire open event
				if (this.eBigPictureBox.sEventOpen != '' && this.eBigPictureBox.style.display != 'block' ){
					eval(this.eBigPictureBox.sEventOpen);
				}
				
				//Show box
				if (this.eBigPictureBox.style.display != 'block'){
					this.eBigPictureBox.style.display = 'block';
				}
				
				//Optionally synchronise thumbnail status
				if (this.bThumbnailSynchroniseStatus == true){
					this.setThumbnailStatus();
				}
				
				//Optionally set linklist status
				if (this.bLinkList == true){
					this.setLinkListStatus(this.colPictures);
				}
			}
		}
		return false;
	}
	
	function showMovie(vIndex){
		var oMovie;
		var oClip;
	
		if (this.eMovie != undefined){
			//Get movie and assign clip
			switch(typeof(vIndex))
			{
				case 'string':
					oMovie = this.colMovies[vIndex];
					break;
				case 'number':
					oMovie = this.getCollectionElement(this.colMovies, vIndex);
					break;
			}
			oClip = oMovie['o' + this.sMovieQuality];

			//Only when not current
			if(this.nIndexCurrent != oMovie.nIndex){	
				//Process oMovie
				if (oClip.src.length > 0){
					var sMovie='';
					sMovie += '<object ID="DSHOW" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="' + oClip.width + '" height="' + oClip.height + '">';
					sMovie += '<param NAME="URL" VALUE="' + oClip.src + '">';
					sMovie += '<param NAME="autoStart" VALUE="-1">';
					//sMovie += '<param NAME="autoStart" VALUE="0">';
					sMovie += '<param NAME="currentMarker" VALUE="0">';
					sMovie += '<param NAME="DefaultFrame" VALUE="Content">';
					sMovie += '<param NAME="fullscreen" VALUE="0">';
					sMovie += '<param NAME="rate" VALUE="1">';
					sMovie += '<param NAME="balance" VALUE="0">';
					sMovie += '<param NAME="currentPosition" VALUE="0">';
					sMovie += '<param NAME="playCount" VALUE="1">';
					sMovie += '<param NAME="invokeURLs" VALUE="-1">';
					sMovie += '<param NAME="volume" VALUE="80">';
					sMovie += '<param NAME="mute" VALUE="0">';
					sMovie += '<param NAME="uiMode" VALUE="full">';
					sMovie += '<param NAME="stretchToFit" VALUE="0">';
					sMovie += '<param NAME="windowlessVideo" VALUE="0">';
					sMovie += '<param NAME="enableContextMenu" VALUE="-1">';
					sMovie += '<EMBED TYPE="application/x-mplayer2" NAME="MediaPlayer" width="' + oClip.width + '" HEIGHT="' + oClip.height + '" src="' + oClip.src + '">';
					sMovie += '</object>';
					this.setInnerHTMLext(this.eMovie,sMovie);
					
					//Set index to current
					this.nIndexCurrent = oMovie.nIndex;
					
					//Log pageview multimedia
					this.logMultimedia(oMovie.sId, this.nGalleryType, this.nLogModeManual);
					
					//Optionally set linklist status
					if (this.bLinkList == true){
						this.setLinkListStatus(this.colMovies);
					}
				}
			}
		}
		return false;
	}
	
	function showPicture(vIndex){
		var oPicture;
		var oPictureNormal;
		
		if (this.ePicture != undefined){
			//Get picture and assign normal picture
			switch(typeof(vIndex))
			{
				case 'string':
					oPicture = this.colPictures[vIndex];
					break;
				case 'number':
					oPicture = this.getCollectionElement(this.colPictures, vIndex);
					break;
			}
			
			oPictureNormal = oPicture.oNormal;
			
			//Only when not current
			if(this.nIndexCurrent != oPicture.nIndex){
				//Process normal picture
				if (oPictureNormal.src.length > 0){
					if (oPictureNormal.src.substring(oPictureNormal.src.indexOf("."), oPictureNormal.src.length) != '.swf'){
						this.ePicture.src = oPictureNormal.src;
						this.ePicture.alt = oPictureNormal.alt;
						this.ePicture.width = oPictureNormal.width;
						this.ePicture.height = oPictureNormal.height;
					}
					else{
						if (this.getFlashVersion() >= this.nMinFlashVersion){
							var sMovie = '';
							sMovie += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + oPictureNormal.width + '" height="' + oPictureNormal.height + '" id="swfmovie" align="middle">';
							sMovie += '<param name="allowScriptAccess" value="sameDomain" />';
							sMovie += '<param name="wmode" value="transparent" />';
							sMovie += '<param name="movie" value="' + oPictureNormal.src + '" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />';
							sMovie += '<embed src="' + oPictureNormal.src + '" wmode="transparent" quality="high" bgcolor="#ffffff" width="' + oPictureNormal.width + '" height="' + oPictureNormal.height + '" name="swfmovie" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
							sMovie += '</object>';
							this.setInnerHTMLext(this.ePicture, sMovie)
						}
					}
		
					//Optionally show caption
					if(this.ePictureCaption != undefined){
						this.ePictureCaption.innerHTML = oPictureNormal.alt;
					}
					//Set index to current
					this.nIndexCurrent = oPicture.nIndex;
					
					//Log pageview multimedia
					this.logMultimedia(oPicture.sId, this.nGalleryType, this.nLogModeManual);
					
					//Optionally synchronise thumbnail status
					if (this.bThumbnailSynchroniseStatus == true){
						this.setThumbnailStatus();
					}
					
					//Optionally set linklist status
					if (this.bLinkList == true){
						this.setLinkListStatus(this.colPictures);
					}
				}
			}
		}
		return false;
	}
	
	function showWallpaper(sUrl, nId){
		this.showPopupWindow(sUrl);
		this.logMultimedia(nId, this.nGalleryType, this.nLogModeManual);
	}
	
	function swapThumbnail (eThumb){
		var oPicture;
		var oPictureThumbnail;
		var nIndex, nTotal;
		
		oPicture = this.colPictures[eThumb.id];
		oPictureThumbnail = oPicture.oThumbnail;
		
		if (oPictureThumbnail.active == false){
			if (this.bThumbnailBorder == true){
				if(oPicture.nIndex == this.nIndexCurrent && this.bThumbnailSynchroniseStatus == true){
					eThumb.style.zIndex = 2;
					eThumb.style.border = this.sThumnnailBorderStyleSelected;
				}
				else{
					eThumb.style.zIndex = 3;
					eThumb.style.border = this.sThumbnailBorderStyleActive;
				}
				eThumb.style.marginLeft = '-1px';
			}
			
			if (this.bThumbnailStyle == true){
				if(oPicture.nIndex == this.nIndexCurrent && this.bThumbnailSynchroniseStatus == true){
					eThumb.className = this.sThumbnailClassSelected;
				}
				else{
					eThumb.className = this.sThumbnailClassActive;
				}
			}
			
			if (this.bThumbnailSynchronisePosition == true){
				if(oPicture.nIndex == this.nIndexCurrent && this.bThumbnailSynchroniseStatus == true){
					var nNext = ((Math.ceil(Math.ceil((eThumb.parentNode.parentNode.clientHeight / eThumb.clientHeight))/2) + 1) * eThumb.clientHeight) - eThumb.clientHeight;
					var nPrevious = ((Math.ceil(Math.ceil((eThumb.parentNode.parentNode.clientHeight / eThumb.clientHeight))/2) - 1) * eThumb.clientHeight) - eThumb.clientHeight;
					var nRemaining = ((Math.ceil(eThumb.parentNode.parentNode.clientHeight / eThumb.clientHeight)) - (Math.ceil(Math.ceil((eThumb.parentNode.parentNode.clientHeight / eThumb.clientHeight))/2) + 1)) * eThumb.clientHeight;
										
					if ((eThumb.offsetTop + parseInt(eThumb.parentNode.style.top)) <= nPrevious ) {
						if (parseInt(eThumb.parentNode.style.top) < 0){
							nIndex=0
							if ((eThumb.offsetTop + parseInt(eThumb.parentNode.style.top)) < 0){
								nTotal =  Math.ceil(Math.abs(eThumb.offsetTop + parseInt(eThumb.parentNode.style.top))/eThumb.clientHeight)
							}
							else {
								nTotal = 1
							}
							for (nIndex=0; nIndex < nTotal; nIndex++){
								eThumb.parentNode.style.top = (parseInt(eThumb.parentNode.style.top) + eThumb.clientHeight) + 'px';
							}
						}
					}
					
					if ((eThumb.offsetTop + parseInt(eThumb.parentNode.style.top)) >= nNext ) {
						if (((eThumb.parentNode.clientHeight - eThumb.parentNode.parentNode.clientHeight) + parseInt(eThumb.parentNode.style.top))  > eThumb.clientHeight){
							if (eThumb.parentNode.parentNode.clientHeight - ((eThumb.offsetTop + parseInt(eThumb.parentNode.style.top))) < 0) {
								nTotal = Math.ceil(Math.abs(eThumb.parentNode.parentNode.clientHeight - (eThumb.offsetTop + parseInt(eThumb.parentNode.style.top)))/eThumb.clientHeight);
							}
							else{
								nTotal = 1
							}
						}
						for (nIndex=0; nIndex < nTotal; nIndex++){
							eThumb.parentNode.style.top = (parseInt(eThumb.parentNode.style.top) - eThumb.clientHeight) + 'px';
						}
					}
				}
			}
			
			eThumb.src = oPictureThumbnail.srcActive;
			eThumb.alt = oPictureThumbnail.alt;
			oPictureThumbnail.active = true;
		}
		else
		{
			if(oPicture.nIndex != this.nIndexCurrent || this.bThumbnailSynchroniseStatus == false){
				//if (this.bThumbnailBorder == true){
				//	eThumb.style.zIndex = 1;
				//	eThumb.style.border = this.sThumbnailBorderStyleNormal;
				//	eThumb.style.marginLeft = '';
				//}
				
				if (this.bThumbnailStyle == true){
					eThumb.className = this.sThumbnailClassNormal;
				}
				
				eThumb.src = oPictureThumbnail.srcNormal;
				eThumb.alt = oPictureThumbnail.alt;
				oPictureThumbnail.active = false;
			}
		}
	}

// Internal class defines		
	function classCLMS_Picture(nIndex, sIndex, nType){
		this["oThumbnail"] = new classCLMS_Thumbnail();
		this["oNormal"] = new Image();
		this["oLarge"] = new Image();
		this["nIndex"] = nIndex;
		this["sId"] = sIndex;
		this["nType"] = nType;
	}
	
	function classCLMS_Thumbnail(){
		this.prototype = new Image();
		this["srcNormal"] = new String('');
		this["srcActive"] = new String('');
		this["active"] = false;
	}
	
	function classCLMS_Movie(nIndex, sIndex, nType){
		this["oLow"] = new classCLMS_Clip();
		this["oHigh"] = new classCLMS_Clip();
		this["nIndex"] = nIndex;
		this["sId"] = sIndex;
		this["nType"] = nType;
	}
	
	function classCLMS_Clip(){
		this["width"] = 0;
		this["height"] = 0;
		this["src"] = '';
	}
}// #endregion
