/** * Master animation controller * * @changes 2011-01-04 / cs / created * * @copyright Copyright © Copyright © 2005-2011 / CHILIBYTES / www.chilibytes.com * @author cs * @version 1.0.0 * * @package de.tanzschulerank * @subpackage gui * */ /** * Namespaces */ if ( !window.de ) window.de = {}; if ( !de.tanzschulerank ) de.tanzschulerank = {}; if ( !de.tanzschulerank.gui ) de.tanzschulerank.gui = {}; /** * Includes */ /** * Constructor * * @access public */ de.tanzschulerank.gui.YouTubeController = function() { // Constructor this.constructor = de.tanzschulerank.gui.YouTubeController; } de.tanzschulerank.gui.YouTubeController.prototype.Initialize = function() { this.YouTubeChannelSearch(); } de.tanzschulerank.gui.YouTubeController.prototype.YouTubeChannelSearch = function() { var ytChannelTag = document.getElementById( 'ytChannelTag' ); var ytVideoPlayerTag = document.getElementById( 'ytVideoPlayer' ); if ( ytChannelTag != null && ytVideoPlayerTag != null ) { var videoBar; var options = { string_allDone : " ", largeResultSet : true, horizontal : false, thumbnailSize : GSvideoBar.THUMBNAILS_MEDIUM, autoExecuteList : { cycleTime : GSvideoBar.CYCLE_TIME_MEDIUM, cycleMode : GSvideoBar.CYCLE_MODE_LINEAR, executeList : ["ytchannel:tanzschulerank"] } } videoBar = new GSvideoBar(ytChannelTag, ytVideoPlayerTag, options ); } } /** * Master animation controller * * @changes 2011-01-04 / cs / created * * @copyright Copyright © Copyright © 2005-2011 / CHILIBYTES / www.chilibytes.com * @author cs * @version 1.0.0 * * @package de.tanzschulerank * @subpackage gui * */ /** * Namespaces */ if ( !window.de ) window.de = {}; if ( !de.tanzschulerank ) de.tanzschulerank = {}; if ( !de.tanzschulerank.gui ) de.tanzschulerank.gui = {}; /** * Includes */ var ControlEventHandler = com.chilibytes.phx.gui.ControlEventHandler; var Motion = com.chilibytes.phx.gui.animation.Motion; var Scaling = com.chilibytes.phx.gui.animation.Scaling; var Fading = com.chilibytes.phx.gui.animation.Fading; var Sprite = com.chilibytes.phx.gui.animation.Sprite; var DoNothing = com.chilibytes.phx.gui.animation.DoNothing; var Animation = com.chilibytes.phx.gui.animation.Animation; var AnimationSequence = com.chilibytes.phx.gui.animation.AnimationSequence; var QuadraticBezierProcess = com.chilibytes.phx.gui.animation.QuadraticBezierProcess; var BounceProcess = com.chilibytes.phx.gui.animation.BounceProcess; var SlurpProcess = com.chilibytes.phx.gui.animation.SlurpProcess; var GammaProcess = com.chilibytes.phx.gui.animation.GammaProcess; var LinearProcess = com.chilibytes.phx.gui.animation.LinearProcess; var Base64 = com.chilibytes.phx.common.Base64; var Environment = com.chilibytes.phx.net.web.Environment; /** * Constructor * * @access public */ de.tanzschulerank.gui.AnimationController = function() { // Constructor this.constructor = de.tanzschulerank.gui.AnimationController; this.fControlEventHandler = new ControlEventHandler(); // divs and imgs for animations this.fShutDivA = new Array(); this.fShutImgA = new Array(); this.fMenuDivA = new Array(); this.fMenuImgA = new Array(); this.fMenuGlow = null; this.fMenuShadeDiv = null; this.fFacebookDiv = null; this.fFacebookImg = null; this.fAdtvDiv = null; this.fAdtvImg = null; // start page shutter animation this.fShutterOpenA = new Array(); // registration form animation this.fFormOut = null; this.fFormIn = null; this.fFormIsOut = false; // menu action animation this.fMenuOpenSequenceA = new Array(); this.fMenuShadeSequence = null; this.fPlayerContainer = null; // menu transition animations this.fMenuTransitionUpA = new Array; this.fMenuTransitionDownA = new Array; this.fIsMenuEnabled = true; // employee shutters this.fEmployeeDivA = new Array(); this.fEmployeeImgA = new Array(); this.fEmployeeOpenA = new Array(); // link animations this.fLinkFacebook = null; this.fLinkAdtv = null; // full page shading, blocks all user interaction this.fShadeAll = null; // please wait image this.fWaitDiv = null; } /** * Starts various initialization processes * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.Initialize = function() { this._InitializeMenuDivs(); this._InitializeShutters(); this._InitializeFormScroll(); this._InitializeMenuAction(); this._InitializeMenuTransition(); this._InitializeLinkIcons(); this._InitializeEmployeeShutters(); } /** * Determines, whether the current mouseover object is a child of the root object, to keep mouseover valid * * @param eventP triggered event * @param rootObject the object on whose children mouseover shall also be valid * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._IsEventValid = function( eventP, rootObject ){ var relatedTarget = null; if ( eventP.type == "mouseover" ) { relatedTarget = ( eventP.fromElement ? eventP.fromElement : eventP.relatedTarget ); } else if ( eventP.type == "mouseout" ) { relatedTarget = ( eventP.toElement ? eventP.toElement : eventP.relatedTarget ); } return ( !this._IsChildOf( relatedTarget, rootObject ) && ( relatedTarget != rootObject ) ); } /** * Determines, whether an object is a child object of another object * * @param child the child object to test * @param parent the parent object * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._IsChildOf = function( child, parent ){ if( child != null ) { while( child.parentNode ) { if( (child = child.parentNode) == parent ) { return true; } } } return false; } /** * On a menu div, determines the menu number (1-6) * * @param div the menu div * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._GetMenuNo = function( div ) { if( div != null ) { return parseInt( div.id.substring(4,5) ) - 1; } else { return null; } } /** * Initializes the divs used in menu animations * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._InitializeMenuDivs = function() { var divA = document.getElementsByTagName( "div" ); for ( var i = 0; i < divA.length; i++ ) { if ( divA[i].id.indexOf( "shut" ) != -1 ) { var n = this._GetMenuNo( divA[i] ); this.fShutDivA[n] = divA[i]; this.fShutImgA[n] = document.getElementById( this.fShutDivA[n].id+"img" ); } if ( divA[i].id.indexOf( "menu" ) != -1 ) { var n = this._GetMenuNo( divA[i] ); this.fMenuDivA[n] = divA[i]; this.fMenuImgA[n] = document.getElementById( this.fMenuDivA[n].id+"img" ); } } this.fMenuGlow = document.getElementById( "menuglow" ); this.fPlayerContainer = document.getElementById( "playerContainer" ); this.fMenuShadeDiv = document.getElementById( "bgshade" ); this.fWaitDiv = document.getElementById( 'wait' ); } //------------------------------------------------------------------------------------------------------------------ // // shutters on start page // //------------------------------------------------------------------------------------------------------------------ /** * Initializes the start page shutter animations * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._InitializeShutters = function() { var process = new QuadraticBezierProcess(); process.SetParameter( "x", 0.4 ); process.SetParameter( "y", 1 ); for ( var n = 0; n <= 5; n++ ) { if ( this.fShutDivA[n] != null && this.fShutImgA[n] != null ) { this.fControlEventHandler.AttachOnMouseOverEvent( this.fShutDivA[n], this, this.EventOnShutterAction, true ); this.fControlEventHandler.AttachOnMouseOutEvent( this.fShutDivA[n], this, this.EventOnShutterAction, false ); this.fShutterOpenA[n] = new Animation( 500 ); this.fShutterOpenA[n].AddElement( new Motion( this.fShutImgA[n], "absolute", 0, 0, 0, 260, process ) ); } } } /** * Starts start page shutter animations, differentiates between running and resting animation status * * @param eventP triggered event * @param control element that triggered the event * @param directionOpen direction of shutter anmiation: true = 'open shutter', false = 'close shutter' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnShutterAction = function( eventP, control, directionOpen ) { if ( this._IsEventValid( eventP, control ) && this.fIsMenuEnabled ) { var self = this; var n = this._GetMenuNo( control ); var anim = this.fShutterOpenA[n]; var delay = ( directionOpen ? 0 : 100 ) if (anim.IsRunning() ) { window.setTimeout( function() { self.ShutterActionDelay( anim, directionOpen ); }, delay); } else { anim.Run( null, null, directionOpen); } } } /** * Runs start page shutter animations (called after delay to make them look more mass inert) * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.ShutterActionDelay = function( anim, directionOpen ) { anim.Stop(); var t = anim.GetProgress() * anim.GetDuration(); if ( directionOpen ) { anim.Run( t, null, true); } else { anim.Run( null, t, false); } } //------------------------------------------------------------------------------------------------------------------ // // menu inflation / deflation and background shading // //------------------------------------------------------------------------------------------------------------------ /** * Initializes menu animations, including background shading * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._InitializeMenuAction = function() { var menuInflateA = new Array(); var menuDownA = new Array(); for ( var n = 0; n <= 5 ; n++ ) { // attach mouse events this.fControlEventHandler.AttachOnMouseOverEvent( this.fMenuDivA[n], this, this.EventOnMenuAction, true ); this.fControlEventHandler.AttachOnMouseOutEvent( this.fMenuDivA[n], this, this.EventOnMenuAction, false ); // menu animations menuInflateA[n] = new Animation( 500 ); menuDownA[n] = new Animation( 500 ); var menuProcess = new QuadraticBezierProcess(); menuProcess.SetParameter( "x", 0.4 ); menuProcess.SetParameter( "y", 1 ); if ( this.fMenuDivA[n] != null && this.fMenuImgA[n] != null ) { menuInflateA[n].AddElement( new Motion( this.fMenuDivA[n], "absolute", n*95, 30, n*57, 30, menuProcess ) ); menuInflateA[n].AddElement( new Scaling( this.fMenuDivA[n], "absolute", 20, 20, 210, 210, menuProcess ) ); menuInflateA[n].AddElement( new Scaling( this.fMenuImgA[n], "absolute", 68, 68, 258, 258, menuProcess ) ); menuDownA[n].AddElement( new Motion( this.fMenuImgA[n], "absolute", 0, 0, 0, 260, menuProcess ) ); } this.fMenuOpenSequenceA[n] = new AnimationSequence( true ); this.fMenuOpenSequenceA[n].AddAnimation( menuInflateA[n] ); this.fMenuOpenSequenceA[n].AddAnimation( menuDownA[n] ); } // background shading var menuShade = new Animation( 500 ); var shadeProcess = new QuadraticBezierProcess(); shadeProcess.SetParameter( "x", 0.6 ); shadeProcess.SetParameter( "y", 0 ); if ( this.fMenuShadeDiv != null ) { menuShade.AddElement( new Fading( this.fMenuShadeDiv, 0, 0.5, shadeProcess ) ); menuShade.AttachOnAnimationCompleteEvent( this, this.DisableShadeDiv ); } if( this.fMenuGlow != null ) { menuShade.AddElement( new Motion( this.fMenuGlow, "relative", 0, 0, 15, 15, menuProcess ) ); menuShade.AddElement( new Scaling( this.fMenuGlow, "absolute", 100, 100, 70, 70, menuProcess ) ); } var menuShadePause = new Animation( 500 ); // pause before un-shading menuShadePause.AddElement( new DoNothing() ); this.fMenuShadeSequence = new AnimationSequence ( true ); this.fMenuShadeSequence.AddAnimation( menuShade ); this.fMenuShadeSequence.AddAnimation( menuShadePause ); // shade all animation for 'wait' screen this.fShadeAll = new Animation( 300 ); this.fShadeAll.AddElement( new Fading( this.fMenuShadeDiv, 0, 0.5, shadeProcess ) ); } /** * Event for menu animation * * @param eventP triggering event * @param control element that triggered the event * @param directionOpen determines direction of animation: true = 'obpn menu', false = 'close menu' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnMenuAction = function( eventP, control, directionOpen ) { if ( this._IsEventValid( eventP, control ) && this.fIsMenuEnabled ) { var self = this; var delay = 200; var n = this._GetMenuNo( control ); if (directionOpen) { delay = 0; for ( var i = 0; i <= 5 ; i++ ) { this.fMenuDivA[i].style.zIndex = ( i == n ? 5 : 1); } this.fMenuShadeDiv.style.visibility = "visible"; if ( this.fPlayerContainer != null ) { this.fPlayerContainer.style.visibility = "hidden"; } } if ( this.fMenuOpenSequenceA[n].IsRunning() ) { window.setTimeout( function() { self.MenuActionDelay( n, directionOpen ); }, delay); } else { this.fMenuOpenSequenceA[n].Run( directionOpen ); } if ( this.fMenuShadeSequence.IsRunning() ) { this.fMenuShadeSequence.Stop(); this.fMenuShadeSequence.Continue( directionOpen ); } else { this.fMenuShadeSequence.Run( directionOpen ); } } } /** * Runs menu animation (called after delay to make it look more mass inert) * * @param targetSequence animation sequence for a specific menu shutter * @param directionOpen determines direction of animation: true = 'open menu', false = 'close menu' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.MenuActionDelay = function( targetSequence, directionOpen ) { this.fMenuOpenSequenceA[targetSequence].Stop(); this.fMenuOpenSequenceA[targetSequence].Continue( directionOpen ); } /** * Disables visibility of the full shade div element when not in use * * @param isRunning determines, whether menu animation is running * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.DisableShadeDiv = function( isRunning ) { if ( !isRunning ) { this.fMenuShadeDiv.style.visibility = "hidden"; if ( this.fPlayerContainer != null ) { this.fPlayerContainer.style.visibility = "visible"; } } } /** * Runs shade all animation ('wait' screen) * * @param directionShade direction of shading process: true = 'shade', false = 'release shade' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.ShadeAll = function( directionShade ) { var self = this; if (directionShade) { this.fMenuShadeDiv.style.zIndex = 10; this.fMenuShadeDiv.style.visibility = "visible"; window.setTimeout( function() { self.fWaitDiv.style.visibility = "visible"; }, 300); this.fShadeAll.Stop(); this.fShadeAll.Run( null, null, true ); } else { this.fShadeAll.Stop(); this.fShadeAll.Run( null, null, false ); this.fWaitDiv.style.visibility = "hidden"; window.setTimeout( function() { self.UnshadeAllDelay(); }, 300); } } /** * Runs animation to release shade (called after delay) * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.UnshadeAllDelay = function() { this.fMenuShadeDiv.style.zIndex = 2; this.fMenuShadeDiv.style.visibility = "hidden"; } //------------------------------------------------------------------------------------------------------------------ // // menu transition (menu <-> start page) // //------------------------------------------------------------------------------------------------------------------ /** * Initializes the menu transition animations from start page to menu bar * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._InitializeMenuTransition = function() { var anchor = document.getElementById( 'homelink' ); if ( anchor != null ) { this.fControlEventHandler.AttachOnClickEvent( anchor, this, this.EventOnMenuTransitionDown, anchor.href ); } var anchor = document.getElementById( 'imprintlink' ); if ( anchor != null ) { this.fControlEventHandler.AttachOnClickEvent( anchor, this, this.EventOnMenuTransitionUp, -1 ); } for ( var n = 0; n <= 5; n++ ) { this.fMenuTransitionUpA[n] = new Animation( 700 ); this.fMenuTransitionDownA[n] = new Animation( 700 ); var process = new QuadraticBezierProcess(); process.SetParameter( "x", 0.4 ); process.SetParameter( "y", 1 ); // transition down (menu -> start page) if ( this.fMenuDivA[n] != null && this.fMenuImgA[n] != null ) { this.fMenuTransitionDownA[n].AddElement( new Motion( this.fMenuDivA[n], "absolute", 95 * n, 30, 285 * ( n % 3 ), 125 + 285 * Math.floor( n / 3 ), process ) ); this.fMenuTransitionDownA[n].AddElement( new Scaling( this.fMenuDivA[n], "absolute", 20, 20, 210, 210, process ) ); this.fMenuTransitionDownA[n].AddElement( new Scaling( this.fMenuImgA[n], "absolute", 68, 68, 258, 258, process ) ); } // transition up (start page -> menu) if ( this.fShutDivA[n] != null && this.fShutImgA[n] != null ) { var anchorA = this.fShutDivA[n].getElementsByTagName( 'a' ); for ( var i = 0; i < anchorA.length; i++ ) { if ( anchorA[i] != null ) { this.fControlEventHandler.AttachOnClickEvent( anchorA[i], this, this.EventOnMenuTransitionUp, n ); } } this.fMenuTransitionUpA[n].AddElement( new Motion( this.fShutDivA[n], "absolute", 285 * ( n % 3 ), 125 + 285 * Math.floor( n / 3 ), 95 * n, 30, process ) ); this.fMenuTransitionUpA[n].AddElement( new Scaling( this.fShutDivA[n], "absolute", 210, 210, 20, 20, process ) ); this.fMenuTransitionUpA[n].AddElement( new Scaling( this.fShutImgA[n], "absolute", 258, 258, 68, 68, process ) ); } } } /** * Event for moving shutter boxes up (start page -> menu) * * @param eventP triggered event * @param control menu anchor link that triggered the event * @param n menu box number (0-5) * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnMenuTransitionUp = function( eventP, control, n ) { var self = this; var delay = 0; var target = control.href ? control.href : ''; this.fIsMenuEnabled = false; if ( n>=0 && n<=5 ) { this.fShutterOpenA[n].Run( null, null, false ); delay = 500; } window.setTimeout( function() { self.fMenuTransitionUpA[0].Run(); }, delay + 0 ); window.setTimeout( function() { self.fMenuTransitionUpA[1].Run(); }, delay + 200 ); window.setTimeout( function() { self.fMenuTransitionUpA[2].Run(); }, delay + 400 ); window.setTimeout( function() { self.fMenuTransitionUpA[3].Run(); }, delay + 600 ); window.setTimeout( function() { self.fMenuTransitionUpA[4].Run(); }, delay + 800 ); window.setTimeout( function() { self.fMenuTransitionUpA[5].Run(); }, delay + 1000 ); window.setTimeout( function() { window.location.href = target; }, delay + 2000 ); window.setTimeout( function() { self.fWaitDiv.style.visibility='visible'; }, delay + 1500 ); return false; // prevent execution of html "a href" } /** * Event for moving shutter boxes down (menu -> start page) * * @param eventP triggered event * @param control anchor link that triggered the event * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnMenuTransitionDown = function( eventP, control ) { var self = this; var target = control.href ? control.href : ''; this.fIsMenuEnabled = false; var mainwrapper = document.getElementById( 'mainwrapper' ); mainwrapper.style.visibility = 'hidden'; if ( this.fMenuGlow != null ) { this.fMenuGlow.style.visibility = 'hidden'; } if ( this.fPlayerContainer != null ) { this.fPlayerContainer.style.visibility = "hidden"; } window.setTimeout( function() { self.fMenuTransitionDownA[0].Run(); }, 1000 ); window.setTimeout( function() { self.fMenuTransitionDownA[1].Run(); }, 800 ); window.setTimeout( function() { self.fMenuTransitionDownA[2].Run(); }, 400 ); window.setTimeout( function() { self.fMenuTransitionDownA[3].Run(); }, 300 ); window.setTimeout( function() { self.fMenuTransitionDownA[4].Run(); }, 200 ); window.setTimeout( function() { self.fMenuTransitionDownA[5].Run(); }, 0 ); window.setTimeout( function() { window.location.href = target }, 2000 ); window.setTimeout( function() { self.fWaitDiv.style.visibility='visible'; }, 2000 ); return false; // prevent execution of html "a href" } //------------------------------------------------------------------------------------------------------------------ // // registration form // //------------------------------------------------------------------------------------------------------------------ /** * Initializes scrolling animation of registration forms * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._InitializeFormScroll = function() { this.fFormOut = new Animation( 1000 ); this.fFormIn = new Animation( 1000 ); this.fFormOut.AttachOnAnimationCompleteEvent( this, this.EventOnScrollFormOutCompleted ); this.fFormIn.AttachOnAnimationCompleteEvent( this, this.EventOnScrollFormInCompleted ); var process = new BounceProcess(); process.SetParameter( 'amount', 0.07 ); process.SetParameter( 'bounceoff', true ); var targetObject = document.getElementById( "form" ); var targetObject2 = document.getElementById( "formfinalizer" ); if ( targetObject != null && targetObject2 != null ) { this.fFormOut.AddElement( new Motion( targetObject, "absolute", 285, 0, 570, 0, process ) ); this.fFormOut.AddElement( new Motion( targetObject2, "absolute", 285, 0, 570, 0, process ) ); this.fFormIn.AddElement( new Motion( targetObject, "absolute", 570, 0, 285, 0, process ) ); this.fFormIn.AddElement( new Motion( targetObject2, "absolute", 570, 0, 285, 0, process ) ); } } /** * animation to scroll registration forms in or out * * @params directionOut determines scroll direction: true = 'show form', false = 'hide form' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.ScrollForm = function( directionOut ) { if ( this.fFormIn != null && this.fFormOut != null ) { this.ShowSelectBoxIE6Fix( directionOut ); // fix for IE6 problems with select boxes and z-indices if ( directionOut ) { this.fFormIn.Stop(); this.fFormOut.Run(); } else if ( this.fFormIsOut || ( this.fFormOut.GetProgress() < 1 && this.fFormOut.GetProgress() > 0 ) ) { this.fFormOut.Stop(); this.fFormIn.Run(); } } } /** * Event on scroll form in animation completed * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnScrollFormInCompleted = function() { this.fFormIsOut = false; } /** * Event on scroll form out animation completed * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnScrollFormOutCompleted = function() { this.fFormIsOut = true; } /** * fixes IE6 display problems with select boxes and z-indices on form scroll * * @params directionShow determines scroll direction: true = 'show form', false = 'hide form' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.ShowSelectBoxIE6Fix = function( directionShow ) { if ( Environment.CurrentClientBrowser() == CB_ENVIRONMENT_BROWSER_IDENT_IE6x ) { var select = document.getElementById( 'i_rate' ); if ( select !=null ) { if ( directionShow ) { window.setTimeout( function() { select.style.visibility = 'visible'}, 200 ); } else { select.style.visibility = 'hidden'; } } } } //------------------------------------------------------------------------------------------------------------------ // // link icons // //------------------------------------------------------------------------------------------------------------------ /** * Initializes animations of footer bar link icon * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._InitializeLinkIcons = function() { var process = new BounceProcess(); process.SetParameter( "amount", 0.4 ); process.SetParameter( "bounceoff", false ); this.fFacebookDiv = document.getElementById( "facebook" ); this.fFacebookImg = document.getElementById( "facebookimg" ); if ( this.fFacebookDiv != null && this.fFacebookImg != null ) { this.fControlEventHandler.AttachOnMouseOverEvent( this.fFacebookDiv, this, this.EventOnLinkFacebook, true ); this.fControlEventHandler.AttachOnMouseOutEvent( this.fFacebookDiv, this, this.EventOnLinkFacebook, false ); this.fLinkFacebook = new Animation( 200 ); this.fLinkFacebook.AddElement( new Motion( this.fFacebookDiv, "relative", 0, 0, -5, -8, process ) ); this.fLinkFacebook.AddElement( new Scaling( this.fFacebookDiv, "absolute", 20, 20, 30, 30, process ) ); this.fLinkFacebook.AddElement( new Scaling( this.fFacebookImg, "absolute", 20, 20, 30, 30, process ) ); } this.fAdtvDiv = document.getElementById( "adtv" ); this.fAdtvImg = document.getElementById( "adtvimg" ); if ( this.fAdtvDiv != null && this.fAdtvImg != null ) { this.fControlEventHandler.AttachOnMouseOverEvent( this.fAdtvDiv, this, this.EventOnLinkAdtv, true ); this.fControlEventHandler.AttachOnMouseOutEvent( this.fAdtvDiv, this, this.EventOnLinkAdtv, false ); this.fLinkAdtv = new Animation( 200 ); this.fLinkAdtv.AddElement( new Motion( this.fAdtvDiv, "relative", 0, 0, -6, -8, process ) ); this.fLinkAdtv.AddElement( new Scaling( this.fAdtvDiv, "absolute", 24, 20, 36, 30, process ) ); this.fLinkAdtv.AddElement( new Scaling( this.fAdtvImg, "absolute", 24, 20, 36, 30, process ) ); } } /** * Runs animation for facebook icon * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnLinkFacebook = function( eventP, control, directionOpen ) { if ( this._IsEventValid( eventP, control ) ) { var anim = this.fLinkFacebook; this.fFacebookDiv.style.zIndex = 2; this.fAdtvDiv.style.zIndex = 1; if (anim.IsRunning() ) { anim.Stop(); } anim.Run( null, null, directionOpen); } } /** * Runs animation for adtv icon * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnLinkAdtv = function( eventP, control, directionOpen ) { if ( this._IsEventValid( eventP, control ) ) { var anim = this.fLinkAdtv; this.fFacebookDiv.style.zIndex = 1; this.fAdtvDiv.style.zIndex = 2; if (anim.IsRunning() ) { anim.Stop(); } anim.Run( null, null, directionOpen); } } //------------------------------------------------------------------------------------------------------------------ // // employee shutters // //------------------------------------------------------------------------------------------------------------------ /** * Initializes animations on employee shutters on 'us' page * * @access public */ de.tanzschulerank.gui.AnimationController.prototype._InitializeEmployeeShutters = function() { this.fEmployeeDivA[1] = document.getElementById( "andi" ); this.fEmployeeImgA[1] = document.getElementById( "andiimg" ); this.fEmployeeDivA[2] = document.getElementById( "sabrina" ); this.fEmployeeImgA[2] = document.getElementById( "sabrinaimg" ); this.fEmployeeDivA[3] = document.getElementById( "marcel" ); this.fEmployeeImgA[3] = document.getElementById( "marcelimg" ); this.fEmployeeDivA[4] = document.getElementById( "lukas" ); this.fEmployeeImgA[4] = document.getElementById( "lukasimg" ); var process = new QuadraticBezierProcess(); process.SetParameter( "x", 0.4 ); process.SetParameter( "y", 1 ); for ( n = 1; n <= 4; n++) { if ( this.fEmployeeDivA[n] != null && this.fEmployeeImgA[n] != null ) { this.fControlEventHandler.AttachOnMouseOverEvent( this.fEmployeeDivA[n], this, this.EventOnEmployeeShutter, true ); this.fControlEventHandler.AttachOnMouseOutEvent( this.fEmployeeDivA[n], this, this.EventOnEmployeeShutter, false ); this.fEmployeeOpenA[n] = new Animation( 500 ); this.fEmployeeOpenA[n].AddElement( new Motion( this.fEmployeeImgA[n], "absolute", 0, 0, 0, 260, process ) ); } } } /** * Event for employee shutter animation * * @param eventP triggered event * @param control element that triggered the event * @param directionOpen direction of animation: true = 'open shutter', false = 'close shutter' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EventOnEmployeeShutter = function( eventP, control, directionOpen ) { if ( this._IsEventValid( eventP, control ) ) { var self = this; var anim = null; if ( control.id == "andi" ) { anim = this.fEmployeeOpenA[1] } else if ( control.id == "sabrina" ) { anim = this.fEmployeeOpenA[2] } else if ( control.id == "marcel" ) { anim = this.fEmployeeOpenA[3] } else if ( control.id == "lukas" ) { anim = this.fEmployeeOpenA[4] } var delay = ( directionOpen ? 0 : 100 ) if (anim.IsRunning() ) { window.setTimeout( function() { self.EmployeeShutterDelay( anim, directionOpen ); }, delay); } else { anim.Run( null, null, directionOpen); } } } /** * Runs employee shutter animations (called after delay to make them look more mass inert) * * @param anim animation to run * @param directionOpen direction of animation: true = 'open shutter', false = 'close shutter' * * @access public */ de.tanzschulerank.gui.AnimationController.prototype.EmployeeShutterDelay = function( anim, directionOpen ) { anim.Stop(); var t = anim.GetProgress() * anim.GetDuration(); if ( directionOpen ) { anim.Run( t, null, true); } else { anim.Run( null, t, false); } } /** * Page controller * * @changes 2011-04-02 / mb / created * * @copyright Copyright © Copyright © 2005-2011 / CHILIBYTES / www.chilibytes.com * @author mb * @version 1.0.0 * * @package de.tanzschulerank * @subpackage gui * */ /** * Namespaces */ if ( !window.de ) window.de = {}; if ( !de.tanzschulerank ) de.tanzschulerank = {}; if ( !de.tanzschulerank.gui ) de.tanzschulerank.gui = {}; /** * Includes */ var AbstractWindowEvents = com.chilibytes.phx.gui.AbstractWindowEvents; var ControlEventHandler = com.chilibytes.phx.gui.ControlEventHandler; var Base64 = com.chilibytes.phx.common.Base64; var Environment = com.chilibytes.phx.net.web.Environment; var Form = com.chilibytes.phx.gui.Form; var YouTubeController = de.tanzschulerank.gui.YouTubeController; var AnimationController = de.tanzschulerank.gui.AnimationController; /** * Constructor * * @access public */ de.tanzschulerank.gui.PageController = function() { // Constructor this.constructor = de.tanzschulerank.gui.PageController; // Super class AbstractWindowEvents.call( this ); this.fControlEventHandler = new ControlEventHandler(); // Misc controller this.fAnimationController = new AnimationController(); this.fYouTubeController = new YouTubeController(); this.fForm = null; } /** * Inherit from window events */ var _pageControllerInheritP = function() {}; _pageControllerInheritP.prototype = AbstractWindowEvents.prototype; de.tanzschulerank.gui.PageController.prototype = new _pageControllerInheritP(); /** * @{inheritdoc} */ de.tanzschulerank.gui.PageController.prototype.WindowOnLoad = function( eventP ) { this.Initialize(); if ( this.fAnimationController != null ) this.fAnimationController.Initialize(); if ( this.fYouTubeController != null ) this.fYouTubeController.Initialize(); } de.tanzschulerank.gui.PageController.prototype.Initialize = function() { // Get all galleries var anchorA = document.getElementsByName( 'svgallery' ); for( var i=0; i -1 ) ) { var metaRaw = object.id.substring( idPrefix.length ); var metaA = eval( '(' + Base64.Decode( metaRaw ) + ')' ); if ( metaA != null && svObject ) { svObject.addVariable( 'xmlDataPath', metaA['GalleryPath'] ); svObject.write( metaA['ContainerID'] ); } } } /** * Sends mail */ de.tanzschulerank.gui.PageController.prototype.EventOnSendButtonClick = function( eventP, object ) { if ( this.fForm != null && this.fForm.Validate() ) { if ( this.fAnimationController != null ) this.fAnimationController.ShadeAll( true ); this.fForm.Submit(); } } /** * Callback function from server */ de.tanzschulerank.gui.PageController.prototype.EventOnFormSent = function( eventP ) { if ( this.fAnimationController != null && this.fForm != null ) { this.fForm.Reset(); this.fAnimationController.ScrollForm( false ); this.fAnimationController.ShadeAll( false ); } } /** * Callback function from server */ de.tanzschulerank.gui.PageController.prototype.EventOnFormError = function( exception ) { console.log( exception ); } /** * Event on event detail click */ de.tanzschulerank.gui.PageController.prototype.EventOnEventDetailClick = function( eventP, control ) { var eventDetailHeader = document.getElementById( "eventdetailheader" ); var eventDetailText = document.getElementById( "eventdetailtext" ); if ( eventDetailText && eventDetailHeader && control ) { var eventdata = document.getElementById( control.id+"_formdata" ); var eventDataA = null; if ( eventdata.firstChild.data != null ) { eventDataA = eval( "(" + Base64.Decode( eventdata.firstChild.data ) + ")" ); } if ( eventDataA != null ) { if ( eventDetailHeader.firstChild ) eventDetailHeader.removeChild( eventDetailHeader.firstChild ); if ( eventDetailText.firstChild ) eventDetailText.removeChild( eventDetailText.firstChild ); eventDetailHeader.appendChild( document.createTextNode( eventDataA["Title"] ) ); // Add as html eventDetailText.innerHTML = eventDataA["Description"]; if ( eventDataA["Categories"] && eventDataA["Categories"].length > 0 ) { var formEvent = document.getElementById( 'i_event' ); formEvent.value = eventDataA["Title"]; var formDate = document.getElementById( 'i_date' ); formDate.value = eventDataA["Date"]; var formEventTickets = document.getElementById( 'eventformtickets' ); if ( formEventTickets ) { var formRateA = eventDataA["Categories"]; var oldContainer = document.getElementById( 'ticketcontainer' ); if ( oldContainer ) { formEventTickets.removeChild( oldContainer ) } var ticketContainer = document.createElement('div'); ticketContainer.setAttribute( 'id', 'ticketcontainer', 0 ); formEventTickets.appendChild( ticketContainer ); for (i = 0; i<=formRateA.length-1; i++ ) { var formRateA = eventDataA["Categories"]; var formRateDescA = eventDataA["Descriptions"]; var label = document.createElement('label'); ticketContainer.appendChild( label ); var input = document.createElement('input'); input.className = 'i_ticket'; input.setAttribute( 'id', 'i_ticket'+(i+1), 0 ); input.setAttribute( 'value', '0', 0 ); input.setAttribute( 'name', input.id, 0 ); ticketContainer.appendChild( input ); label.appendChild( document.createTextNode( formRateA[i] ) ); label.setAttribute( 'for', 'i_ticket'+(i+1), 0 ); var inputLabel = document.createElement('input'); inputLabel.setAttribute( 'type', 'hidden', 0 ); inputLabel.setAttribute( 'id', 'i_ticketlabel'+(i+1), 0 ); inputLabel.setAttribute( 'value', formRateA[i], 0 ); inputLabel.setAttribute( 'name', inputLabel.id, 0 ); if ( this.fForm != null ) { this.fForm.ControlAdd( input ); this.fForm.ControlAdd( inputLabel ); } ticketContainer.appendChild( document.createElement('br') ); if ( formRateDescA[i] ) { ticketContainer.appendChild( document.createTextNode( formRateDescA[i] ) ); ticketContainer.appendChild( document.createElement('br') ); } ticketContainer.appendChild( document.createElement('br') ); } } if ( this.fAnimationController != null ) this.fAnimationController.ScrollForm( true ); } else if ( this.fAnimationController != null ) { this.fAnimationController.ScrollForm( false ); } } } } /** */ de.tanzschulerank.gui.PageController.prototype.EventOnHandleFormScroll = function( eventP, control, direction ) { var formdata = null; if ( this.fAnimationController != null ) { if ( control != null ) formdata = document.getElementById( control.id+'_formdata' ); if ( formdata != null ) { var formDataA = null; if ( formdata.firstChild.data != null ) { formDataA = eval( "(" + Base64.Decode( formdata.firstChild.data ) + ")" ); } if ( formDataA != null ) { var formCourse = document.getElementById( 'i_course' ); formCourse.value = formDataA["course"]; var formDate = document.getElementById( 'i_date' ); formDate.value = formDataA["date"]; var formRate = document.getElementById( 'i_rate' ); var formRateA = formDataA["RateArray"]; formRate.length = 0; for (i = 0; i<=formRateA.length-1; i++ ) { var entry = new Option( formRateA[i], formRateA[i], false, false ); formRate.options[formRate.length] = entry; } } } this.fAnimationController.ScrollForm( direction ) } } // Create singleton instance var PageController = new de.tanzschulerank.gui.PageController();