/****************************************
|
| ScriptReaction
| Multi Media Development
|
| Created by: Kevin Biskaborn
| Copyright 2012 ScriptReaction
| https://www.scriptreaction.ca
|
*****************************************
| Load Dependencies : None
| Run Dependencies : None
****************************************/
var Global = {
includePrefix: "",
controls: {
allowImageAltStripping: true
},
preload: function (){
this.addEvent( window, "load", this.postload );
},
postload: function (){
Global.format.pageImages();
},
exists: function ( object ){
return ( typeof( object ) == "undefined" ) ? false : true;
},
addEvent: function ( object, eventType, functionName ){
if( object.addEventListener ){
object.addEventListener( eventType, functionName, false );
return true;
}
else if( object.attachEvent )
return object.attachEvent( "on" + eventType, functionName );
else
return false;
},
attach: {
cssLink: function ( fileId ){
output = "";
output += "";
this.toDoc( output );
},
jsLink: function ( fileId ){
output = "";
output += "";
this.toDoc( output );
},
toDoc: function ( output ){
document.writeln( output );
}
},
format: {
pageImages: function (){
if( Global.exists( BrowserDetector ) && BrowserDetector.isIE() ){
var imageArray = document.images;
var whichImage;
for( var i = 0; i < imageArray.length; i++ ){
whichImage = imageArray[ i ];
whichImage.galleryimg = "no";
if( Global.controls.allowImageAltStripping )
whichImage.alt = "";
}
}
}
},
display: {
goTop: function (){
var y1=y2=y3=0;if(document.documentElement){y1=document.documentElement.scrollTop||0;};if(document.body){y2=document.body.scrollTop||0;};
y3=window.scrollY||0;var y=Math.max(y1,Math.max(y2,y3));window.scrollTo(0,Math.floor(y/1.4));if(y>0){window.setTimeout("Global.display.goTop()",25);};
}
},
modify: {
setDivContent: function ( divId, content ){
if( document.all )
this.divContent( document.all[ divId ], content );
else
this.divContent( document.getElementById( divId ), content );
},
divContent: function ( div, content ){
if( div )
div.innerHTML = content;
},
setAlpha: function ( object, opacity ){
opacity = ( opacity == 100 ) ? 99.999 : opacity;
object.style.filter = "alpha(opacity:" + opacity + ")"; //ie/win
object.style.KHTMLOpacity = opacity/100; //safari<1.2,konqueror
object.style.MozOpacity = opacity/100; //older mozilla/firefox
object.style.opacity = opacity/100; //safari 1.2,newer firefox/mozilla,css3
}
},
email: {
count: 0,
attach: function ( requestObj ){
var output = "";
var address = this.build( requestObj );
if( address ){
output += "";
output += "";
output += address + "";
}
if( output )
Global.attach.toDoc( output );
},
build: function ( requestObj ){
var output = null;
var domain = ( typeof( requestObj.d ) == "undefined" ) ? null : requestObj.d.slice( 2 );
var ext = ( typeof( requestObj.e ) == "undefined" ) ? "com" : requestObj.e.slice( 2 );
var user = ( typeof( requestObj.u ) == "undefined" ) ? null : requestObj.u.slice( 2 );
if( domain && user )
this[ "emailObj_" + ++this.count ] = output = user + "@" + domain + "." + ext;
return output;
},
execute: function (){
var id = parseInt( arguments[ 0 ] );
if( id && id > 0 && this[ "emailObj_" + id ] )
top.location.href = "mailto:" + this[ "emailObj_" + id ];
}
}
}
/******** GLOBAL LAUNCH ********/
Global.preload();
/****************************************
|
| ScriptReaction
| Created by: Kevin Biskaborn
| Copyright 2012 ScriptReaction
| https://www.scriptreaction.ca
|
****************************************/
var JS_Format = {
array: {
itemExistsInArray: function ( needle, haystackArray ){
var output = false;
for( var i = 0; i < haystackArray.length; i++ ){
if( haystackArray[ i ] == needle ){
output = true;
break;
}
}
return output;
},
unique: {
//accepts object arrays by reference
//otherwise, use: myArray = addItem( newItem, myArray );
addItem: function ( itemToAdd, haystackArray ){
if( !JS_Format.array.itemExistsInArray( itemToAdd, haystackArray ) )
haystackArray.push( itemToAdd );
return haystackArray;
},
removeItem: function ( itemToRemove, haystackArray ){
for( var i = 0; i < haystackArray.length; i++ ){
if( haystackArray[ i ] == itemToRemove ){
haystackArray.splice( i, 1 );
break;
}
}
return haystackArray;
}
},
clear: function ( inputArray ){
return inputArray.splice( 0, inputArray.length );
},
shuffle: function ( inputArray ){
var output = new Array();
var index;
// continue extracting items while the array has more to give
while( inputArray.length > 0 ){
// get the next index to be extracted
index = JS_Format.number.randomize.fromZero( inputArray.length );
// add the element at that index to the output
output.push( inputArray[ index ] );
// remove the element from the array
inputArray.splice( index, 1 );
}
return output;
},
strip: {
lastElementIfEmpty:function ( inputArray ){
// get the last index in the array
var lastIndex = inputArray.length - 1;
// get the last element in the array
var lastElement = inputArray[ lastIndex ];
// determine if the element is empty
if( lastElement == "" || lastElement == null )
// remove the last element
inputArray.splice( lastIndex, 1 );
return inputArray;
}
}
},
string: {
trim: {
doubleSpace: function ( str ){
return str.replace( /\s\s/, " " );
},
left: function ( str ){
return str.replace( /^\s+/, "" );
},
right: function ( str ){
return str.replace( /\s+$/, "" );
},
full: function ( str ){
return this.right( this.left( str ) );
}
},
strip: {
htmlTags: function ( inputString ){
return inputString.replace( /(<([^>]+)>)/ig, "" );
}
},
condition: {
beginsWith: function ( inputString, prefix ){
if( inputString.substring( 0, prefix.length ) == prefix )
return true;
else
return false;
},
endsWith: function ( inputString, suffix ){
if( inputString.substring( inputString.length - suffix.length, inputString.length ) == suffix )
return true;
else
return false;
}
},
remove: {
prefix: function ( inputString, prefix ){
if( JS_Format.string.condition.beginsWith( inputString, prefix ) )
return inputString.substring( prefix.length, inputString.length );
else
return inputString;
},
suffix: function ( inputString, suffix ){
if( JS_Format.string.condition.endsWith( inputString, suffix ) )
return inputString.substring( 0, inputString.length - suffix.length );
else
return inputString;
}
},
parseQueryStringToObject: function ( queryString ){
var output = new Object();
//remove the leading query string char
queryString = JS_Format.string.remove.prefix( queryString, "?" );
//remove the trailing query string char
queryString = JS_Format.string.remove.suffix( queryString, "&" );
//split the query string
//into individual data items
var dataItemArray = queryString.split( "&" );
//create variable containers
var dataItem = "";
var itemArray = Array();
//cycle through all data items
for( var i = 0; i < dataItemArray.length; i++ ){
dataItem = dataItemArray[ i ];
//split the data item
//into id and value pairs
itemArray = dataItem.split( "=" );
//add the item to the output
output[ itemArray[ 0 ] ] = itemArray[ 1 ];
}
return output;
},
parseSpanClassTags: function ( inputString ){
return JS_Format.string.parseClassTags( inputString, "span" );
},
parseClassTags: function ( inputString, tagName ){
var output = "";
// specify the separation delimiters
var delimStart = "%%=";
var delimEnd = "%%;"
// split the input string on all end delimiters
// sample elements at this point: className=value
var arrayOfEntries = inputString.split( delimEnd );
// check if the last element is empty
arrayOfEntries = JS_Format.array.strip.lastElementIfEmpty( arrayOfEntries );
// create loop containers
var entry, pairArray, nameOfClass, tagContents;
// cycle through all the entries
for( var i = 0; i < arrayOfEntries.length; i++ ){
// get the next entry
entry = arrayOfEntries[ i ];
// split he entry into a class/value pair
pairArray = entry.split( delimStart );
// extract pair values
nameOfClass = pairArray[ 0 ];
tagContents = pairArray[ 1 ];
// buld the tag
// and add it to the output stream
output += "<" + tagName + " class=\"" + nameOfClass + "\">";
output += tagContents;
output += "" + tagName + ">";
}
return output;
},
escapeURL: function ( inputURL ){
// escape standard chars
var output = escape( inputURL );
// replace forwrd slashes
return output.replace( /\//gi, "%2F" );
}
},
number: {
padding: {
prefix_zero: function ( inputNumber, size ){
return this.prefix( inputNumber.toString(), "0", size );
},
prefix: function ( numberString, padCharString, size ){
while( numberString.length < size )
numberString = padCharString + numberString;
return numberString;
}
},
randomize: {
fromOneToMax: function ( maximum ){
this.fromZero( maximum ) + 1;
},
fromZero: function ( maximum ){
return Math.floor( Math.random() * maximum );
}
}
},
date: {
monthCodeArrays: {
code3_short: Array( "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" )
}
},
time: {
millisecondsToFormattedTimeDisplay: function ( ms, showMsInOutputFlag ){
var output = "";
var string_ms = "";
var string_s = "";
var string_m = "";
var string_h = "";
// --------------------------------------
// get the seconds
var seconds = Math.floor( ms / 1000 );
// get the leftover ms
ms = ms % 1000;
// check if milliseconds should be added to the output
if( showMsInOutputFlag )
string_ms = JS_Format.number.padding.prefix_zero( ms, 3 );
// get the minutes
var minutes = Math.floor( seconds / 60 );
// get the leftover seconds
seconds = seconds % 60;
// get the formatted seconds
string_s = JS_Format.number.padding.prefix_zero( seconds, 2 );
// get the hours
var hours = Math.floor( minutes / 60 );
// get the leftover minutes
minutes = minutes % 60;
// get the formatted minutes
string_m = JS_Format.number.padding.prefix_zero( minutes, 2 );
// get the days
var day = Math.floor( hours / 60 );
// get the leftover hours
hours = hours % 60;
// get the formatted hours
string_h = JS_Format.number.padding.prefix_zero( hours, 2 );
// --------------------------------------
// format the output
output += string_h + ":";
output += string_m + ":";
output += string_s;
// check if milliseconds should be added to the output
if( showMsInOutputFlag )
output += "." + string_ms;
return output;
}
},
elementClass: {
addToElement: function ( elementObject, classToAdd ){
this.set( elementObject, this.add( classToAdd, elementObject.className ) );
},
removeFromElement: function ( elementObject, classToRemove ){
this.set( elementObject, this.remove( classToRemove, elementObject.className ) );
},
add: function ( classToAdd, className ){
classArray = className.split( " " );
if( !JS_Format.array.itemExistsInArray( classToAdd, classArray ) )
classArray.push( classToAdd );
return classArray.join( " " );
},
remove: function ( classToRemove, className ){
classArray = className.split( " " );
for( var i = 0; i < classArray.length; i++ ){
if( classArray[ i ] == classToRemove ){
classArray.splice( i, 1 );
break;
}
}
return classArray.join( " " );
},
set: function ( elementObject, newClassString ){
elementObject.className = newClassString;
},
existsOnElement: function ( elementObject, className ){
//create a class exists flag
var classExists = false;
//verify that the object has a className parameter
if( elementObject.className ){
//get an array of all the classes on the element
var classArray = elementObject.className.split( " " );
//check whether the requested class exists in the array
classExists = JS_Format.array.itemExistsInArray( className, classArray );
}
return classExists;
}
},
elementAlpha: {
info: {
defaultFadeSpeed: 20
},
empty: function ( objectElement ){
this.set( objectElement, 0 );
},
fill: function ( objectElement ){
this.set( objectElement, 100 );
},
set: function ( objectElement, targetAlpha ){
Global.modify.setAlpha( objectElement, targetAlpha );
},
fadeIn: function ( inputObject ){
inputObject.initialAlpha = 0;
inputObject.targetAlpha = 100;
inputObject.fadeDirection = 1;
var fader = new JS_Format.elementAlpha.activeFader( inputObject );
fader.apply( fader );
},
fadeOut: function ( inputObject ){
inputObject.initialAlpha = 100;
inputObject.targetAlpha = 0;
inputObject.fadeDirection = -1;
var fader = new JS_Format.elementAlpha.activeFader( inputObject );
fader.apply( fader );
},
activeFader: function ( inputObject ){
this.activeObject = inputObject[ "objectElement" ];
this.fadeDirection = inputObject[ "fadeDirection" ];
this.targetAlpha = inputObject[ "targetAlpha" ];
this.initialAlpha = inputObject[ "initialAlpha" ];
this.activeAlpha = this.initialAlpha;
this.onFinishMethod = ( !( typeof( inputObject[ "onFinishMethod" ] ) == null ) )
? inputObject[ "onFinishMethod" ] : "";
//get the fade speed
this.fadeSpeed = ( !(typeof( inputObject[ "fadeSpeed" ] ) == null) )
? inputObject[ "fadeSpeed" ] : JS_Format.elementAlpha.info.defaultFadeSpeed;
this.fadeJump = 10;
this.updateAlpha = function (){
JS_Format.elementAlpha.set( this.activeObject, this.activeAlpha );
}
this.onFinish = function (){
if( typeof( this.onFinishMethod ) != "undefined" && !( this.onFinishMethod == "" ) )
eval( this.onFinishMethod )();
}
//set the active object to its initial alpha
this.updateAlpha();
this.apply = function ( fadeObject ){
var fadeComplete = false;
if( fadeObject.fadeDirection > 0 ){
//FADING IN
if( fadeObject.activeAlpha < fadeObject.targetAlpha )
fadeObject.activeAlpha += fadeObject.fadeJump;
else {
fadeObject.activeAlpha = fadeObject.targetAlpha;
fadeComplete = true;
}
}
else {
//FADING OUT
if( fadeObject.activeAlpha > fadeObject.targetAlpha )
fadeObject.activeAlpha -= fadeObject.fadeJump;
else {
this.activeAlpha = fadeObject.targetAlpha;
fadeComplete = true;
}
}
//update the new alpha
fadeObject.updateAlpha();
//check for fade completion
if( fadeComplete )
fadeObject.onFinish();
else
setTimeout( fadeObject.apply, fadeObject.fadeSpeed, fadeObject );
}
}
},
divElement: {
getById: function ( id ){
return document.getElementById( id );
},
setDisplay_block: function ( divElement ){
this.setStyle.divDisplay( divElement, "block" );
},
setDisplay_none: function ( divElement ){
this.setStyle.divDisplay( divElement, "none" );
},
setDivContent_byDivId: function ( divId, newContents ){
Global.modify.setDivContent( divId, newContents );
},
setDivContent_byDivElement: function ( divElement, newContents ){
Global.modify.divContent( divElement, newContents );
},
getDivContent_byDivElement: function ( divElement ){
return divElement.innerHTML;
},
refreshDivContent: function ( divElement ){
this.setDivContent_byDivElement( divElement, this.getDivContent_byDivElement( divElement ) );
},
setStyle: {
divDisplay: function( divElement, displayMode ){
divElement.style.display = displayMode;
},
divBackgroundImage: function ( divElement, bgImagePath ){
var newBg = ( bgImagePath == "none" ) ? bgImagePath : "url(" + bgImagePath + ")";
divElement.style.backgroundImage = newBg;
}
},
getAllOnPage_usingClass: function ( classNameString ){
return JS_Format.get.allElementsOnPage_usingClass( "div", classNameString );
}
},
file: {
get: {
extension: function ( filePathString ){
var extStartIndex = filePathString.lastIndexOf( "." );
return filePathString.slice( extStartIndex + 1, filePathString.length );
}
}
},
get: {
arrayOfElementsByTagName: function ( tagName ){
return document.getElementsByTagName( tagName );
},
allElementsOnPage_usingClass: function ( elementTag, classNameString ){
//create output container
var outputArray = new Array();
//get all elements with the requested tag name
var arrayOfElements = this.arrayOfElementsByTagName( elementTag );
//create element container
var element;
//cycle through all elements
for( var i in arrayOfElements ){
//get the next element
element = arrayOfElements[ i ];
//test if the element is using the requested class
if( JS_Format.elementClass.existsOnElement( element, classNameString ) )
//add the element to the output array
outputArray.push( element );
}
return outputArray;
}
}
}
/****************************************
|
| ScriptReaction
| Multi Media Development
|
| Created by: Kevin Biskaborn
| Copyright 2011 ScriptReaction
| https://www.scriptreaction.ca
|
*****************************************
| Load Dependencies : Global{}
| Run Dependencies : None
****************************************/
var BrowserDetector = {
info: {
type: "",
version: -1
},
controls: {
useBrowserSpecificCSS: true
},
preload: function (){
this.detect.clientBrowser();
this.populate.css();
},
detect: {
clientBrowser: function (){
if( window.XMLHttpRequest ){
if( window.ActiveXObject ){ //IE 7
BrowserDetector.info.type = "ie";
BrowserDetector.info.version = 7;
return;
}
else { // Opera, Safari, Firefox
BrowserDetector.info.type = "gecko";
return;
}
}
else { //IE6 and below
BrowserDetector.info.type = "ie";
BrowserDetector.info.version = 6;
}
}
},
populate: {
css: function (){
if( BrowserDetector.controls.useBrowserSpecificCSS && BrowserDetector.isIE() ){
var cssUrl = "";
if( BrowserDetector.info.version > 6 )
cssUrl = "global_fixIE7";
//else
//cssUrl = "global_fixIE6";
Global.attach.cssLink( cssUrl );
}
}
},
isIE: function (){
return ( this.info.type == "ie" ) ? true : false;
}
}
/******** GLOBAL LAUNCH ********/
BrowserDetector.preload();
/****************************************
|
| ScriptReaction
| Element Accessor
|
| Created by: Kevin Biskaborn
| Copyright 2012 ScriptReaction
| https://www.scriptreaction.ca
|
****************************************/
var ElementAccessor = {
get: function ( elementId ){
return document.getElementById( elementId );
},
// gets ALL elements in a series
// running from element ZERO to element TOTAL - 1
getArrayOfAllElementsInSeries: function ( elementPrefix, elementTotal ){
// create the output container
var arrayOfElements = Array();
// verify the total is valid
if( elementTotal > 0 )
arrayOfElements = ElementAccessor.getArrayOfElementsInSeries(
elementPrefix, 0, elementTotal - 1
);
return arrayOfElements;
},
// gets ALL elements in a series
// running from the specified starting number to the ending number
getArrayOfElementsInSeries: function ( elementPrefix, startNum, endNum ){
// create the output container
var arrayOfElements = Array();
// cycle through the requested series
for( var i = startNum; i <= endNum; ++i )
arrayOfElements.push( ElementAccessor.get( elementPrefix + i ) );
return arrayOfElements;
},
// gets the FIRST link anchor tag inside the requested element
getFirstAnchorTagInsideElement: function ( elementObject ){
return elementObject.getElementsByTagName( "a" )[ 0 ];
}
}
/****************************************
|
| ScriptReaction
| Four Block Timer
|
| Created by: Kevin Biskaborn
| Copyright 2012 ScriptReaction
| https://www.scriptreaction.ca
|
****************************************/
var FourBlockTimer = {
settings: {
runningTimerAnimationDelay: 25 // time in milliseconds
},
get: {
elementById: function ( id ){
return document.getElementById( id );
},
timerDataObjectById: function ( id ){
return FourBlockTimer.data[ "timer_" + id ];
}
},
data: {
timer_1: {
isRunning: false,
dateObject: {},
timeValues: {
ms_base: 0,
ms_live: 0,
ms_animation: 0
}
},
timer_2: {
isRunning: false,
dateObject: {},
timeValues: {
ms_base: 0,
ms_live: 0,
ms_animation: 0
}
},
timer_3: {
isRunning: false,
dateObject: {},
timeValues: {
ms_base: 0,
ms_live: 0,
ms_animation: 0
}
},
timer_4: {
isRunning: false,
dateObject: {},
timeValues: {
ms_base: 0,
ms_live: 0,
ms_animation: 0
}
}
},
launch: function (){
FourBlockTimer.TimerCore.updateAllTimers();
},
TimerCore: {
startTimer: function ( timerId ){
// force a single timer start into the array function
FourBlockTimer.TimerCore.startTimers_fromArray( [ timerId ] );
},
startTimers_fromArray: function ( arrayOfTimerIds ){
// THIS IS THE STARTER FOR ALL TIMERS
// the first step is to ALWAYS STOP ALL TIMERS
FourBlockTimer.TimerCore.stopAllTimers();
// next, cycle through the requested array
// and run the timer(s)
for( var i in arrayOfTimerIds )
FourBlockTimer.TimerCore.runTimer( arrayOfTimerIds[ i ] );
},
runTimer: function ( timerId ){
// get the requested timer data object
var timerDataObj = FourBlockTimer.get.timerDataObjectById( timerId );
// reset the timer animation counter
timerDataObj.timeValues.ms_animation = 0;
// check if the timer is already running
if( !timerDataObj.isRunning ){
// register the current time
timerDataObj.dateObject = new Date();
// update the base ms value
// which is equal to the PREVIOUS LIVE value
timerDataObj.timeValues.ms_base = timerDataObj.timeValues.ms_live;
// mark the timer as running
timerDataObj.isRunning = true;
}
},
stopTimer: function ( timerId ){
// get the requested timer data object
var timerDataObj = FourBlockTimer.get.timerDataObjectById( timerId );
// mark the timer as NOT running
timerDataObj.isRunning = false;
// remove the running appearance
FourBlockTimer.TimerDisplay.modify.removeRunningAppearance( timerId );
},
stopAllTimers: function (){
// stop all timers individually
for( var i = 1; i <= 4; i++ )
FourBlockTimer.TimerCore.stopTimer( i );
},
updateAllTimers: function (){
// update all timers individually
for( var i = 1; i <= 4; i++ )
FourBlockTimer.TimerCore.updateTimer( i );
// create a new interval
setTimeout( FourBlockTimer.TimerCore.updateAllTimers, 1 );
},
updateTimer: function ( timerId ){
// get the requested timer data object
var timerDataObj = FourBlockTimer.get.timerDataObjectById( timerId );
// verify that the timer is running
if( timerDataObj.isRunning ){
// get the current date object
var currentDateObj = new Date();
// get the timer date object
// the last time the timer was started
var timerDateObj = timerDataObj.dateObject;
// update the millisecond value
// stored by the timer
// this is done by adding the current amount
// PLUS the additional time from when the timer was last started
timerDataObj.timeValues.ms_live = timerDataObj.timeValues.ms_base + ( currentDateObj.getTime() - timerDateObj.getTime() );
// set the formatted time display
FourBlockTimer.TimerDisplay.modify.setTimerDisplay(
timerId,
JS_Format.time.millisecondsToFormattedTimeDisplay( timerDataObj.timeValues.ms_live, true )
);
// increment the animation counter
timerDataObj.timeValues.ms_animation++;
// check if the threshold is exceeded
if( timerDataObj.timeValues.ms_animation >= FourBlockTimer.settings.runningTimerAnimationDelay ){
// reset the animation counter
timerDataObj.timeValues.ms_animation = 0;
// toggle the display appearance
FourBlockTimer.TimerDisplay.modify.toggleDisplayAppearance( timerId );
}
}
}
},
TimerBlock: {
get: {
timerBlockById: function ( timerBlockId ){
return FourBlockTimer.get.elementById( "timerBlock_" + timerBlockId );
}
},
action: {
mouseClick: function ( timerBlockId ){
FourBlockTimer.TimerCore.startTimer( timerBlockId );
}
},
modify: {
markAsSelected_fromArray: function ( arrayOfTimerBlockIds ){
// cycle through all ids
for( i in arrayOfTimerBlockIds )
FourBlockTimer.TimerBlock.modify.markAsSelected( arrayOfTimerBlockIds[ i ] );
},
markAsNotSelected_fromArray: function ( arrayOfTimerBlockIds ){
// cycle through all ids
for( i in arrayOfTimerBlockIds )
FourBlockTimer.TimerBlock.modify.markAsNotSelected( arrayOfTimerBlockIds[ i ] );
},
markAsSelected: function ( timerBlockId ){
FourBlockTimer.TimerBlock.modify.selectedState( timerBlockId, true );
},
markAsNotSelected: function ( timerBlockId ){
FourBlockTimer.TimerBlock.modify.selectedState( timerBlockId, false );
},
selectedState: function ( timerBlockId, isSelectedFlag ){
// get the requested block
var timerBlock = FourBlockTimer.TimerBlock.get.timerBlockById( timerBlockId );
// get the anchor tag
var anchorTag = ElementAccessor.getFirstAnchorTagInsideElement( timerBlock );
// check the selected flag status
if( isSelectedFlag )
JS_Format.elementClass.addToElement( anchorTag, "active" );
else
JS_Format.elementClass.removeFromElement( anchorTag, "active" );}
}
},
TimerDisplay: {
get: {
timerDisplayById: function ( timerId ){
return FourBlockTimer.get.elementById( "timerDisplay_" + timerId );
}
},
action: {
mouseOver: function ( timerBlockId ){
FourBlockTimer.TimerBlock.modify.markAsSelected( timerBlockId );
},
mouseOut: function ( timerBlockId ){
FourBlockTimer.TimerBlock.modify.markAsNotSelected( timerBlockId );
}
},
modify: {
setTimerDisplay: function ( timerId, timeString ){
// get the requested timer display
var timerDsp = FourBlockTimer.TimerDisplay.get.timerDisplayById( timerId );
// set the display value
Global.modify.divContent( timerDsp, timeString );
},
altAppearanceClassName: "altAppearance",
toggleDisplayAppearance: function ( timerId ){
// get the requested timer display
var timerDsp = FourBlockTimer.TimerDisplay.get.timerDisplayById( timerId );
// check if the class exists
if( JS_Format.elementClass.existsOnElement( timerDsp, FourBlockTimer.TimerDisplay.modify.altAppearanceClassName ) )
FourBlockTimer.TimerDisplay.modify.removeRunningAppearance( timerId );
else
FourBlockTimer.TimerDisplay.modify.addRunningAppearance( timerId );
},
addRunningAppearance: function ( timerId ){
// get the requested timer display
var timerDsp = FourBlockTimer.TimerDisplay.get.timerDisplayById( timerId );
// add the appearance
JS_Format.elementClass.addToElement( timerDsp, FourBlockTimer.TimerDisplay.modify.altAppearanceClassName );
},
removeRunningAppearance: function ( timerId ){
// get the requested timer display
var timerDsp = FourBlockTimer.TimerDisplay.get.timerDisplayById( timerId );
// add the appearance
JS_Format.elementClass.removeFromElement( timerDsp, FourBlockTimer.TimerDisplay.modify.altAppearanceClassName );
}
}
},
SwitchBlock: {
action: {
mouseOver: function ( switchCode ){
switch ( switchCode ){
case "N":
FourBlockTimer.TimerBlock.modify.markAsSelected_fromArray( [ 1, 2 ] );
break;
case "E":
FourBlockTimer.TimerBlock.modify.markAsSelected_fromArray( [ 2, 4 ] );
break;
case "S":
FourBlockTimer.TimerBlock.modify.markAsSelected_fromArray( [ 3, 4 ] );
break;
case "W":
FourBlockTimer.TimerBlock.modify.markAsSelected_fromArray( [ 1, 3 ] );
break;
}
},
mouseOut: function ( switchCode ){
switch ( switchCode ){
case "N":
FourBlockTimer.TimerBlock.modify.markAsNotSelected_fromArray( [ 1, 2 ] );
break;
case "E":
FourBlockTimer.TimerBlock.modify.markAsNotSelected_fromArray( [ 2, 4 ] );
break;
case "S":
FourBlockTimer.TimerBlock.modify.markAsNotSelected_fromArray( [ 3, 4 ] );
break;
case "W":
FourBlockTimer.TimerBlock.modify.markAsNotSelected_fromArray( [ 1, 3 ] );
break;
}
},
mouseClick: function ( switchCode ){
switch ( switchCode ){
case "N":
FourBlockTimer.TimerCore.startTimers_fromArray( [ 1, 2 ] );
break;
case "E":
FourBlockTimer.TimerCore.startTimers_fromArray( [ 2, 4 ] );
break;
case "S":
FourBlockTimer.TimerCore.startTimers_fromArray( [ 3, 4 ] );
break;
case "W":
FourBlockTimer.TimerCore.startTimers_fromArray( [ 1, 3 ] );
break;
case "X":
FourBlockTimer.TimerCore.stopAllTimers();
break;
}
}
}
}
}