var inDuration = 0.3; //01////////////////////////////////////////////////////////////////////////////////////// var busy_01 = false; var over_01 = false; var currentState_01 = 0; // state 0 -> none; // state 1 -> shrink and bring to front; // state 2 -> grow to full size; // state 3 -> decide if to return to small state or wait for click; // state 4 -> shrink and bring to back; // state 5 -> scale to original small state; // state 6 -> reset to state 0; function setIndex_01(zIndex){ logo_01.style.zIndex = zIndex; } function mouseOver_01(b){ over_01 = b; } function regMouseEventReceiver_01(r){ switch(currentState_01){ case 0: case 5: case 6: r.onmouseover = function() {mouseOver_01(true); changeToState_01(1);} r.onmouseout = function() {mouseOver_01(false);} break; case 2: r.onmouseover = function() {mouseOver_01(true);} r.onmouseout = function() {mouseOver_01(false); if(!busy_01){changeToState_01(4);}} break; default: break; } } function unRegMouseEvents_01(r){ r.onmouseover = null; r.onmouseout = null; } function changeToState_01(name){ currentState_01 = name; switch(name){ case 1: if(busy_01) break; else if(!over_01) break; JSTweener.addTween(img_logo_01.style, {onComplete:changeToState_01, onCompleteParams:[2], time: inDuration, transition: 'easeOutQuad', suffix: {width:"px", height:"px"}, width: 31, height: 12}); busy_01 = true; break; case 2: regMouseEventReceiver_01(img_logo_01); unRegMouseEvents_01(logo_01); setIndex_01("100"); JSTweener.addTween(img_logo_01.style, {onComplete:changeToState_01, onCompleteParams:[3], time: inDuration, transition: 'easeOutQuad', suffix: {width:"px", height:"px"}, width: 180.5, height: 70.5}); break; case 3: if(!over_01){ changeToState_01(4); break; } else busy_01 = false; break; case 4: busy_01 = true; JSTweener.addTween(img_logo_01.style, {onComplete:changeToState_01, onCompleteParams:[5], time: inDuration, transition: 'easeOutQuad', suffix: {width:"px", height:"px"}, width: 31, height: 12}); break; case 5: busy_01 = true; setIndex_01("1"); unRegMouseEvents_01(img_logo_01); JSTweener.addTween(img_logo_01.style, {onComplete:changeToState_01, onCompleteParams:[6], time: inDuration, transition: 'easeOutQuad', suffix: {width:"px", height:"px"}, width: 81, height: 32}); break; case 6: busy_01 = false; regMouseEventReceiver_01(logo_01_trigger); unRegMouseEvents_01(logo_01); if(over_01){ changeToState_01(1); } break; default: break; } } //02////////////////////////////////////////////////////////////////////////////////////// var busy_02 = false; var over_02 = false; var currentState_02 = 0; // state 0 -> none; // state 1 -> shrink and bring to front; // state 2 -> grow to full size; // state 3 -> decide if to return to small state or wait for click; // state 4 -> shrink and bring to back; // state 5 -> scale to original small state; // state 6 -> reset to state 0; function setIndex_02(zIndex){ logo_02.style.zIndex = zIndex; } function mouseOver_02(b){ over_02 = b; } function regMouseEventReceiver_02(r){ switch(currentState_02){ case 0: case 5: case 6: r.onmouseover = function() {mouseOver_02(true); changeToState_02(1);} r.onmouseout = function() {mouseOver_02(false);} break; case 2: r.onmouseover = function() {mouseOver_02(true);} r.onmouseout = function() {mouseOver_02(false); if(!busy_02){changeToState_02(4);}} break; default: break; } } function unRegMouseEvents_02(r){ r.onmouseover = null; r.onmouseout = null; } function changeToState_02(name){ currentState_02 = name; switch(name){ case 1: if(busy_02) break; else if(!over_02) break; JSTweener.addTween(img_logo_02.style, {onComplete:changeToState_02, onCompleteParams:[2], time: inDuration, transition: 'easeOutQuad', suffix: {width:"px", height:"px"}, width: 31, height: 12}); busy_02 = true; break; case 2: regMouseEventReceiver_02(img_logo_02); unRegMouseEvents_02(logo_02); setIndex_02("100"); JSTweener.addTween(img_logo_02.style, {onComplete:changeToState_02, onCompleteParams:[3], time: inDuration, transition: 'easeOutQuad', suffix: {width:"px", height:"px"}, width: 180.5, height: 70.5}); break; case 3: if(!over_02){ changeToState_02(4); break; } else busy_02 = false; break; case 4: busy_02 = true; JSTweener.addTween(img_logo_02.style, {onComplete:changeToState_02, onCompleteParams:[5], time: inDuration, transition: 'easeOutQuad', suffix: {width:"px", height:"px"}, width: 31, height: 12}); break; case 5: busy_02 = true; setIndex_02("1"); unRegMouseEvents_02(img_logo_02); JSTweener.addTween(img_logo_02.style, {onComplete:changeToState_02, onCompleteParams:[6], time: inDuration, transition: 'easeOutQuad', suffix: {width:"px", height:"px"}, width: 81, height: 32}); break; case 6: busy_02 = false; regMouseEventReceiver_02(logo_02_trigger); unRegMouseEvents_02(logo_02); if(over_02){ changeToState_02(1); } break; default: break; } }