
/**
 * 
 * @todo move to namespace
 * 
 */
function onArtistClicked(nickname) {
	th.flash.onArtistClicked(nickname);
}

/**
 * @project talenthouse
 * @package th.flash
 * @since 05.06.2009
 * 
 */
var FL_INIT = -1;
var FL_PRELOADING = 0;
var FL_NOTLOADED = 1;
var FL_LOADING = 2;
var FL_LOADED = 3;

th.flash = {

	stop : function() {
	},

	onArtistClicked : function(nickname) {
		// th.log('LOAD PLAYER FOR NICK: ' + nickname);
		th.flash.goToProject(nickname);
		th.flash.showUserpageButton();
	},

	onCreativeInviteClicked : function(id) {
		// th.log('LOAD CREATIVE INVITE ID #' + id);
		// th.ui.thickbox.show('', '/explore/creative/challenges/show/' + id +
		// '?width=700&height=500', '');
		th.ui.panels.load('/explore/creative/challenges/detail/' + id + '', '#pnl_Explore');
		th.ui.panels.markTabActive('#nav_top_artistinvites');
	},

	/*
	 * BASIC
	 */
	_getFlashEmbed : function() {
		if (typeof document.getElementById("flashContentTimeline") == 'undefined') {
			th.log("Could not get embedded Flash Content Object");
			return false;
		}

		return document.getElementById("flashContentTimeline");
	},

	/**
	 * @param Object
	 *            event
	 */
	handleWheel : function(event) {
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().handleWheel(event);
			}
		} catch (e) {
			th.log(e);
		}
	},

	showUserpageButton : function() {
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().showUserpageButton();
			}
		} catch (e) {
			th.log('ERROR: th.flash.showUserpageButton: ' + e);
		}
	},

	hideUserpageButton : function() {
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().hideUserpageButton();
			}
		} catch (e) {
			th.log('ERROR: th.flash.hideUserpageButton: ' + e);
		}
	},

	/**
	 * @param String
	 *            nickname
	 * @deprecated
	 */
	changePlayerArtistTo : function(nickname) {
	},

	/**
	 * String url
	 */
	changeBackgroundTo : function(url) {
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().changeBackgroundTo(url);
			}
		} catch (e) {
			th.log(e);
		}

	},

	/**
	 * String nickname String projectId
	 */
	goToProject : function(nickname, projectId) {
		try {
			th.flash.activeFlashId = th.flash.pnlIdTimeline;
			$('#flash').css('margin-left', '0px');
			$('#flash').css('min-height', '440px');

			th.log('th.flash.goToProject (nickname, projectId) [' + nickname
					+ '][' + projectId + ']');

			th.flash.load('timeline', nickname);

			if (th.flash.flStatusTimeline == FL_LOADED) {

				if (typeof projectId != 'undefined') {
					th.flash._getFlashEmbed().goToProject(nickname, projectId);
				} else {
					th.flash._getFlashEmbed().goToProject(nickname);

				}

			} else {
				if (th.flash.flStatusTimeline == FL_LOADING) {

					// if flash not loaded, push auth event into stack and wait
					// for load evnt:

					var bLoadExists = false;

					if (typeof projectId == 'undefined' || projectId == '') {
						// if project id undefined, check for existing project
						// load requests
						// for the same user:
						if (th.flash.loadUserProjectQueue.length > 0) {
							for ( var i = th.flash.loadUserProjectQueue.length; i > 0; i--) {
								// traverse backwards through list; break if
								// another user is found : we want to insert our
								// entry
								// or if we find our user (we don't add, because
								// with a valid project id
								// means we want them; without means we'd be
								// adding a duplicate)
								var aEvt = th.flash.loadUserProjectQueue[i - 1];
								if (aEvt['nickname'] != nickname) {
									break;
								}
								if (aEvt['nickname'] == nickname) {
									bLoadExists = true;
									break;
								}
							}
						}
					}

					if (bLoadExists === false) {
						th.flash.loadUserProjectQueue.push( {
							'exec' : function() {
								th.flash.goToProject(nickname, projectId);
							},
							'projectId' :projectId,
							'nickname' :nickname
						});
					}
				}
			}

		} catch (e) {
			th.log('ERROR: th.flash.goToProject: ' + e);
		}

	},

	/**
	 * String projectId String mediaId String mediaCategory
	 */
	showMedia : function(projectId, mediaId, mediaCategory) {
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().showMedia(projectId, mediaId,
						mediaCategory);
			}
		} catch (e) {
			th.log('ERROR: th.flash.showMedia: ' + e);
		}

	},

	/*
	 * LOGIN
	 */
	/**
	 * @param int
	 *            section
	 * 
	 * @todo: there are some display errors, when a messeage is shown, but this
	 *        has to be fixed by the author of the loginAction() in the
	 *        AuthController (Herbert Roth <herbert@kronomy.com>) messageString
	 *        has to be translated there too!
	 */
	showLoginBox : function(section) {
		try {
			loginMsg = "";
			var sectionMessages = {
				1 :"login_msg_support",
				2 :"login_msg_message",
				3 :"login_msg_comments",
				4 :"login_msg_vote",
				100 :"login_msg_default_message"
			}
			loginMsg = (sectionMessages[section] == undefined) ? sectionMessages[100]
					: sectionMessages[section];
			th.ui.thickbox.show("Login",
					'/user/login?width=320&height=220&msg=' + loginMsg, '');
		} catch (e) {
			th.log('ERROR: th.flash.showLoginBox: ' + e);
		}
	},

	/**
	 * @param String
	 *            nickname
	 * @param String
	 *            session
	 */
	authenticate : function(nickname, session) {
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().authenticate(nickname, session);
			} else {
				// if flash not loaded, push auth event into stack and wait for
				// load evnt:
				th.flash.authQueue.push( function() {
					th.flash._getFlashEmbed().authenticate(nickname, session);
				});
			}
		} catch (e) {
			th.log('ERROR: th.flash.authenticate: ' + e);
		}
	},

	/*
	 * CREATE
	 */
	/**
	 * @param JsonObject
	 *            project
	 * @param int
	 *            position (default is 0)
	 * 
	 */
	addProject : function(project, position) {
		try {

			// th.log(JSON.parse(project))
			if (typeof project != 'object') {
				project = JSON.parse(project);
			}
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().addProject(project, position);
			}
		} catch (e) {
			th.log('ERROR: th.flash.addProject: ' + e);
		}

	},

	/**
	 * @param JsonObject
	 *            project
	 */
	updateProject : function(project) {
		try {

			// th.log(JSON.parse(project));

			if (typeof project != 'object') {
				project = JSON.parse(project);
			}
			try {
				if (th.flash.flStatusTimeline == FL_LOADED) {
					th.flash._getFlashEmbed().updateProject(project);
				}
			} catch (e) {
				th.log(e);
			}
			// th.log("updateProject end ");
		} catch (e) {
			th.log('ERROR: th.flash.updateProject: ' + e);
		}
	},

	/**
	 * @param String
	 *            projectId
	 */
	deleteProject : function(projectId) {
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().deleteProject(projectId);
			}
		} catch (e) {
			th.log('ERROR: th.flash.deleteProject: ' + e);
		}

	},

	/**
	 * @param Array
	 *            projectIdArray
	 */
	updateProjectOrder : function(projectIdArray) {
		// th.log("updateProjectOrder begin: ");
		// th.log(projectIdArray);
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().updateProjectOrder(projectIdArray);
			}
		} catch (e) {
			th.log('ERROR: th.flash.updateProjectOrder: ' + e);
		}
		// th.log("updateProjectOrder end");
	},

	/**
	 * @todo
	 */
	sortProjects : function() {
	},

	/**
	 * @param String
	 *            projectId
	 * @param String
	 *            mediaId
	 * @param String
	 *            mediaCategory
	 */
	setTopMedia : function(projectId, mediaId) {
		// th.log("setTopMedia begin ");
		// th.log("projectId+"+ projectId);
		// th.log("mediaId+"+ mediaId);
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().setTopMedia(projectId, mediaId);
			}
		} catch (e) {
			th.log('ERROR: th.flash.setTopMedia: ' + e);
		}
		// th.log("setTopMedia end ");
	},

	/**
	 * @param JsonObject
	 *            media
	 * @param String
	 *            projectId
	 * @param String
	 *            mediaCategory
	 * @param int
	 *            position (default is 1)
	 * 
	 * @see Manager.php Line 801
	 */
	addMedia : function(media, projectId, mediaCategory, position) {
		// th.log("addMedia begin: ")
		// th.log(media)
		// th.log(projectId)
		// th.log(mediaCategory)
		// th.log(position)

		if (typeof media != 'object') {
			media = JSON.parse(media);
		}
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().addMedia(media, projectId,
						mediaCategory, position);
			}
		} catch (e) {
			th.log('ERROR: th.flash.addMedia: ' + e);
		}
		// th.log("addMedia end ");

	},

	/**
	 * @param JsonObject
	 *            media
	 * @param String
	 *            projectId
	 * @param String
	 *            mediaCategory
	 * 
	 * @see Manager.php Line 801
	 */
	updateMedia : function(media, projectId, mediaCategory) {
		// th.log("updateMedia begin: ")
		// th.log(media)
		// th.log(projectId)
		// th.log(mediaCategory);
		if (typeof media != 'object') {
			media = JSON.parse(media);
		}
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().updateMedia(media, projectId,
						mediaCategory);
			}
		} catch (e) {
			th.log('ERROR: th.flash.updateMedia: ' + e);
		}
		// th.log("updateMedia end");
	},

	/**
	 * @param String
	 *            mediaId
	 * @param String
	 *            projectId
	 * @param String
	 *            mediaCategory
	 * 
	 * @see th.myprofile.medialist Line 296 postData += comma + 'delItemId[]=' +
	 *      item.id; <=== media id
	 * @see th.myprofile.medialist Line
	 */
	deleteMedia : function(mediaId, projectId, mediaCategory) {
		// th.log("deleteMedia begin: ")
		// th.log(mediaId)
		// th.log(projectId)
		// th.log(mediaCategory);
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().deleteMedia(mediaId, projectId,
						mediaCategory);
			}
		} catch (e) {
			th.log('ERROR: th.flash.deleteMedia: ' + e);
		}
		// th.log("deleteMedia end ")
	},

	/**
	 * @param String
	 *            projectId
	 * @param String
	 *            mediaId
	 * @param String
	 *            fromMediaCategory
	 * @param String
	 *            toMediaCategory
	 * 
	 */
	moveMediaToCategory : function(projectId, mediaId, fromMediaCategory,
			toMediaCategory) {
		// th.log("moveMediaToCategory begin: ")
		// th.log(projectId)
		// th.log(mediaId)
		// th.log(fromMediaCategory)
		// th.log(toMediaCategory)
		// th.log("moveMediaToCategory end ")
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().moveMediaToCategory(projectId,
						mediaId, fromMediaCategory, toMediaCategory);
			}
		} catch (e) {
			th.log('ERROR: th.flash.moveMediaToCategory: ' + e);
		}
	},

	/**
	 * @param String
	 *            projectId
	 * @param String
	 *            mediaCategory
	 * @param Array
	 *            mediaIdArray
	 * @return void
	 */
	updateMediaOrder : function(projectId, mediaCategory, mediaIdArray) {
		// th.log("updateMediaOrder begin: ")
		// th.log(projectId)
		// th.log(mediaCategory)
		// th.log(mediaIdArray)
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().updateMediaOrder(projectId,
						mediaCategory, mediaIdArray);
			}
		} catch (e) {
			th.log('ERROR: th.flash.updateMediaOrder: ' + e);
		}
		// th.log("updateMediaOrder end ");
	},

	/*
	 * Profile
	 */

	/**
	 * @param JsonObject
	 *            userData return void
	 */
	updateUserData : function(userData) {
		// th.log("updateUserData begin: ")
		// th.log(userData)
		// th.log("updateUserData end");

		if (typeof userData != 'object') {
			userData = JSON.parse(userData);
		}
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().updateUserData(userData);
			}
		} catch (e) {
			th.log('ERROR: th.flash.updateUserData: ' + e);
		}

	},

	/*
	 * flash calls
	 */

	/**
	 * @param String
	 *            nickname
	 * 
	 */
	shareProfile : function(nickname) {
		try {
			th.ui.panels.load('/profile/share?nickname=' + nickname,
					'#pnl_Share', null, null, true);
		} catch (e) {
			th.log('ERROR: th.flash.shareProfile: ' + e);
		}
	},

	/**
	 * @param String
	 *            url
	 * @return void
	 */
	goToWebsite : function(url) {
		// include http
		if (url[0].indexOf("http://") == -1) {
			sUrl = 'http://' + url[0];
		} else {
			sUrl = url[0];
		}
		window
				.open(
						sUrl,
						'talenthousewindow',
						'width=800,height=600,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
	},

	/**
	 * @param String
	 *            nickname
	 * @return void
	 */
	showComments : function(nickname) {
		th.ui.panels.load('/myprofile/' + nickname, '#pnl_Myprofile', null,
				null, true);
	},

	/**
	 * @param String
	 *            nickname
	 * @return void
	 */
	showUserpage : function(nickname) {
		try {
			th.ui.panels.load('/myprofile/' + nickname, '#pnl_Myprofile', null,
					null, true);
		} catch (e) {
			th.log('ERROR: th.flash.showUserpage: ' + e);
		}
	},

	/**
	 * @param String
	 *            nickname
	 */
	editTimeline : function(nickname) {
		// th.log("editTimeline: "+ nickname);
		th.ui.panels.load('/myprofile/projects/edit', '#pnl_Create', true,
				'null', true);
	},

	/**
	 * @param String
	 *            nickname
	 */
	editCommunities : function(nickname) {
		th.ui.panels.load('/myaccount/panel/show', '#pnl_Myaccount', true,
				function() {
					th.ui.panels.load(
							'/myaccount/panel/show/mycommunitysites/0',
							'#content_communitysites');
					th.ui.panels.markTabActive('#communities1');
				}, true);
	},

	/**
	 * @param String
	 *            nickname
	 */
	editProfile : function(nickname) {
		th.ui.panels.load('/myaccount/panel/show', '#pnl_Myaccount', true,
				function() {
					th.ui.panels.load(
							'/myaccount/panel/show/mycreativeprofile/0',
							'#content_creativeprofile');
					th.ui.panels.markTabActive('#editprofile1');
				}, true);
	},

	/**
	 * @param String
	 *            nickname
	 */
	changeProfilePic : function(nickname) {
		th.ui.panels.load('/myaccount/panel/show', '#pnl_Myaccount', true,
				function() {
					th.ui.panels.load(
							'/myaccount/panel/show/myprofilepicture/0',
							'#content_profilepicture');
					th.ui.panels.markTabActive('#profilepicture1');
				}, true);
	},

	/*
	 * ARTIST/TIMELINE Load, Show, Hide functions
	 */

	pnlIdArtists :'#flashContentArtists',
	pnlIdTimeline :'#flashContentTimeline',

	// Current Active or Requested Flash Panel
	activeFlashId :'#flashContentArtists', // or "flashContentTimeline"
	queueloadUserId :'#flashContentUser',

	flStatusArtists :FL_NOTLOADED, // one of: [ FL_NOTLOADED , FL_LOADING ,
									// FL_LOADED ]
	flStatusTimeline :FL_INIT, // one of: [ FL_NOTLOADED , FL_LOADING ,
								// FL_LOADED ]

	// Used by flash for when player is not loaded; to load the user on init
	authQueue : [],
	loadUserProjectQueue : [],

	onInitialized : function() {

		if (th.flash.flStatusTimeline == FL_PRELOADING) {
			return;
		}

		// Update status
	th.flash.flStatusTimeline = FL_LOADED;

	// Make sure this (or last requested) player is visible
	th.flash.show();

	// if user logged in WHILE player was in the middle of loading (*sigh*)
	if (th.flash.authQueue.length > 0) {
		var aEvt = th.flash.authQueue.pop();
		if (typeof aEvt == 'function') {
			aEvt();
		}
		th.flash.authQueue = [];
	}
	;

	// if show project/user requested WHILE player was in the middle of loading
	// (*sigh*)
	if (th.flash.loadUserProjectQueue.length > 0) {
		var aEvt = th.flash.loadUserProjectQueue.pop();
		if (typeof aEvt.exec == 'function') {
			aEvt.exec();
		}
		th.flash.loadUserProjectQueue = [];
	}
	;

	/**
	 * Prevent mousewheel moving browser window when over flash
	 * $(th.flash.pnlIdTimeline).mousewheel(function(event, intDelta){
	 * 
	 * var tX = event.pageX - $(th.flash.pnlIdTimeline).offset().left; var tY =
	 * event.pageY - $(th.flash.pnlIdTimeline).offset().top;
	 *  // Do not process flash scrolls in the user profile area if ( tX >= 230 ) {
	 * var o = {x: tX, y: tY, delta: intDelta, ctrlKey: event.ctrlKey, altKey:
	 * event.altKey, shiftKey: event.shiftKey};
	 * 
	 * 
	 * try{ th.flash._getFlashEmbed().handleWheel(o); }catch(e){ th.log('erro: ' +
	 * e); }
	 * 
	 * event.preventDefault(); } });
	 */

},


noflashLayer: function() {
	
},


onInitializedFeaturedArtists : function() {
	// Update status
	th.flash.flStatusArtists = FL_LOADED;

	// Make sure this (or last requested) player is visible
	th.flash.show();

	/*
	 * if($.browser.msie && $.browser.version < 8 ){
	 * $('artistsVis').css('margin-left', '0px'); } else {
	 * $('#artistsVis').removeClass( 'swf_hidden' );
	 * $('#artistsVis').addClass('swf_visible'); }
	 */

	if (th.flash.flStatusTimeline == FL_INIT) {
		th.flash.preloadTimeline();
	}

},

/**
 * @method th.flash.load
 * 
 * Loads the timeline with a specified user
 * 
 */
load: function(showType, playerNickname, preload) {
	// th.log(th.flash.flStatusTimeline + ' th.flash.load ( showType ,
	// playerNickname ,preload ) [' + showType + '][' + playerNickname + '][' +
	// preload + ']');

	if ( swfobject.hasFlashPlayerVersion("9") == false ) {
		$('#noflashLayer').css('display','block');
		$('#flashContentTimeline').css('display','none');
		$('#flashContentArtists').css('display','none');
		$('#welcomeToTH').css('display','block');
		ARTISTS_TUNNEL_HEIGHT = "330px";
		$('#flash').css('min-height', ARTISTS_TUNNEL_HEIGHT);
		return;
	} else {
		$('#noflashLayer').css('display','none');
	}
	
	if (typeof preload == 'undefined' || preload == false) {
		// Hides Other Player & Displays the showType Player or :
		th.flash.show(showType);
	}

	switch (showType) {

	case 'artists':

		try {

			// if not loaded, launch SWF object:
			if (th.flash.flStatusArtists == FL_NOTLOADED) {
				var artistsParams = {
					allowScriptAccess :"always",
					menu :"false",
					scale :"noScale",
					bgcolor :"#000000",
					wmode :"opaque"
				};

				// Load Flash Object
				swfobject.embedSWF(artistsFlashUrl, "flashContentArtists",
						"1100", "300", "9.0.0",
						th.params.bucketPath + '/flash/expressInstall.swf',
						artistsFlashvars, artistsParams);

				// Update status
				th.flash.flStatusArtists = FL_LOADING;

			}
		} catch (e) {
			th.log('th.flash.load ( showType , playerNickname ) [' + showType
					+ '][' + playerNickname + ']');
		}

		// show panel (if not loaded, possible)
		break;

	case 'timeline':

		try {

			timelineFlashvars = {
				'application-context' :timelineContext,
				'sessionId' :timelineSessionId,
				'playerNickname' :playerNickname,
				'showUserpageButton' :true
			};
			var timelineParams = {
				allowFullscreen :"true",
				allowScriptAccess :"always",
				menu :"false",
				scale :"noScale",
				bgcolor :"#F5F5F5",
				wmode :"opaque"
			};

			if (typeof preload != 'undefined' && preload == true) {

				// logged in, include nickname
				if (typeof timelineNickname != 'undefined'
						&& timelineNickname != '') {
					timelineFlashvars = $.extend(timelineFlashvars, {
						'nickname' :timelineNickname
					});
				}

				// Load Flash Object
				swfobject.embedSWF(timelineFlashUrl, "flashContentTimeline",
						"1", "1", "9.0.0",
						th.params.bucketPath + '/flash/expressInstall.swf',
						timelineFlashvars, timelineParams);

				th.flash.flStatusTimeline = FL_PRELOADING;
			} else {
				if (th.flash.flStatusTimeline == FL_PRELOADING) {
					// th.log('WIPING OUT EXISTING PLAYER');
					$('#timelineContainer').html('');
					$('#timelineContainer').prepend(
							'<div id="flashContentTimeline"></div>');
					th.flash.flStatusTimeline = FL_NOTLOADED;
				} else {
					if (th.flash.flStatusTimeline != FL_LOADED) {
						th.flash.flStatusTimeline = FL_NOTLOADED;
					}
				}
			}

			if (th.flash.flStatusTimeline == FL_NOTLOADED) {
				$('#flash').css('margin-left', '0px');
				$('#flash').css('min-height', '440px');
				$('#timelineContainer').css('width', '964px');
				$('#timelineContainer').css('margin', 'auto');
				$('#timelineLayer').css('width', '100%');

				// logged in, include nickname
				if (typeof timelineNickname != 'undefined'
						&& timelineNickname != '') {
					timelineFlashvars = $.extend(timelineFlashvars, {
						'nickname' :timelineNickname
					});
				}

				// Load Flash Object
				swfobject.embedSWF(timelineFlashUrl, "flashContentTimeline",
						"964", "440", "9.0.0",
						th.params.bucketPath + '/flash/expressInstall.swf',
						timelineFlashvars, timelineParams);

				th.flash.flStatusTimeline = FL_LOADING;

				// th.log('STATUS: ' + th.flash.flStatusTimeline);
			}
		} catch (e) {
			th.log('th.flash.load ( showType , playerNickname ) [' + showType
					+ '][' + playerNickname + ']');
		}

		break;
	}

	// th.log('EXIT LOAD STATUS: ' + th.flash.flStatusTimeline);

},

// Used for login overlays etc.
	blur : function() {
		th.flash.hide('', true);
	},

	unblur : function() {
		th.flash.show('', true);
	},

	show : function(showType, unblurAction) {

		try {
			// th.log('th.flash.show ( showType , unblurAction ) [' + showType +
			// '][' + unblurAction + ']');

	if (showType == 'artists') {
		// Set artist as 'active'
	th.flash.activeFlashId = th.flash.pnlIdArtists;
}
if (showType == 'timeline') {
	// Set timeline as 'active'
	th.flash.activeFlashId = th.flash.pnlIdTimeline;
}

if (th.flash.activeFlashId == th.flash.pnlIdArtists) {

	if (unblurAction != true) {
		$('#flash').css('min-height', ARTISTS_TUNNEL_HEIGHT);
		$('#flash').css('margin-left', '-62px');

		th.flash.hide('timeline', unblurAction);
	}

	if (th.flash.flStatusArtists = FL_LOADED) {
		$('#flash').css('min-height', ARTISTS_TUNNEL_HEIGHT);
		$('#flash').css('margin-left', '-62px');

		// Unpause Image refresh
		if (typeof $('#flashContentArtists').show == 'function') {
			$('#flashContentArtists').show();
		}
	}
}

if (th.flash.activeFlashId == th.flash.pnlIdTimeline) {
	th.flash.hide('artists', unblurAction);

	// Kill Welcome Panel
	$('#welcomeToTH').css('display', 'none');
	$('#welcomeToTH').html('');
	ARTISTS_TUNNEL_HEIGHT = '300px';

	if (unblurAction != true) {

		$('#flash').css('margin-left', '0px');
		$('#flash').css('min-height', '440px');
		if ($.browser.msie && $.browser.version < 8) {
			// $(th.flash.pnlIdTimeline).css('margin-left', '0px');
			$('#timelineContainer').css('margin-top', '0');
		} else {
			$(th.flash.pnlIdTimeline).removeClass('swf_hidden');
			$(th.flash.pnlIdTimeline).addClass('swf_visible');
		}
	}

	if (th.flash.flStatusTimeline == FL_LOADED) {
		// Unpause Timeline
		try {
			if (th.flash.flStatusTimeline == FL_LOADED) {
				th.flash._getFlashEmbed().show();

				$('#flash').css('margin-left', '0px');
				$('#flash').css('min-height', '440px');
			}
		} catch (e) {
			th.log(e);
		}
	}
}
} catch (e) {
th.log('th.flash.show ( showType ) [' + showType + ']');
}

return;
},

hide : function(hideType, blurAction) {

// ToReplace is set true when we are hiding to replace the flash player
	// with another (e.g. in this function); it is undefined or false when
	// we are hiding for an overlay

	// th.log('th.flash.hide ( hideType , blurAction ) [' + hideType + '][' +
	// blurAction + ']');

	// if blur, hide active only:
	if (blurAction == true && hideType != 'timeline' && hideType != 'artists') {
		if (th.flash.activeFlashId == th.flash.pnlIdArtists) {
			hideType = 'artists';
		} else {
			if (th.flash.activeFlashId == th.flash.pnlIdTimeline) {
				hideType = 'timeline';
			} else {
				return;
			}
		}
	}

	// NOT EQUALS != used so that undefined and empty string will execute
	if (hideType != 'timeline') {

		// Pause Image refresh
		if (th.flash.flStatusArtists = FL_LOADED) {
			if (blurAction != true) {
				// Pause Feat. Artists
				if (typeof $('#flashContentArtists').hide == 'function') {
					$('#flashContentArtists').hide();
				}

			}
		}

	}

	// NOT EQUALS != used so that undefined and empty string will execute
	if (hideType != 'artists') {
		// HIDE pnlTimeline
		if (th.flash.flStatusTimeline != FL_PRELOADING) {
			if (blurAction != true) {
				// th.log('HIDING TIMELINE!');
				if ($.browser.msie && $.browser.version < 8) {
					$('#timelineContainer').css('margin-top', '-800');
				} else {
					$(th.flash.pnlIdTimeline).addClass('swf_hidden');
					$(th.flash.pnlIdTimeline).removeClass('swf_visible');
				}
			}
		}

		if (th.flash.flStatusTimeline == FL_LOADED) {

			if (blurAction != true) {
				// Pause Timeline
				try {
					if (th.flash.flStatusTimeline == FL_LOADED) {
						th.flash._getFlashEmbed().hide();
					}
				} catch (e) {
					th.log(e);
				}

			}
		}

	}

	return;
},

preloadTimeline : function() {
	th.flash.load('timeline', '', true);

	// th.log('PRELOAD TIMELINE COMPLETE');
}

}