﻿var Framework = Framework || {};
Framework.Events = Framework.Events || {};
Framework.Controls = Framework.Controls || {};


Framework.Events.JavaScriptEvents = {
    CLICK: "click",
    MOUSE_DOWN: "mousedown",
    MOUSE_UP: "mouseup",
    MOUSE_OVER: "mouseover",
    MOUSE_OUT: "mouseout",
    KEY_UP: "keyup",
    KEY_DOWN: "keydown",
    KEY_PRESS: "keypress",
    FOCUS: "focus",
    BLUR: "blur",
    SUBMIT: "submit",
    ROW_ENTER: "rowenter",
    ROW_EXIT: "rowexit",
    AFTER_UPDATE: 'afterupdate',
    BEFORE_UNLOAD: 'beforeunload',
    BEFORE_UPDATE: 'beforeupdate',
    ERROR: 'error',
    ERROR_UPDATE: 'errorupdate',
    LOAD: 'load',
    READY_STATE_CHANGE: 'readystatechange',
    RESIZE: 'resize',
    SCROLL: 'scroll',
    SELECT_START: 'selectstart',
    UNLOAD: 'unload'
};

Framework.Events.MouseEvents = {
    CLICK: "click",
    MOUSE_DOWN: "mousedown",
    MOUSE_UP: "mouseup",
    MOUSE_OVER: "mouseover",
    MOUSE_OUT: "mouseout",
    MOUSE_MOVE: "mousemove"
};

Framework.Events.TouchEvents = {
    TOUCH_START: "touchstart",
    TOUCH_MOVE: "touchmove",
    TOUCH_END: "touchend",
    TOUCH_CANCEL: "touchcancel"
};

Framework.Events.FormElementEvents = {
    FOCUS: "focus",
    BLUR: "blur",
    SUBMIT: "submit"
};

Framework.Events.TableEvents = {
    ROW_ENTER: "rowenter",
    ROW_EXIT: "rowexit"
};

Framework.Events.WindowEvents = {
    AFTER_UPDATE: 'afterupdate',
    BEFORE_UNLOAD: 'beforeunload',
    BEFORE_UPDATE: 'beforeupdate',
    DRAG_DROP: 'dragdrop',
    ERROR: 'error',
    ERROR_UPDATE: 'errorupdate',
    LOAD: 'load',
    MOVE: 'move',
    READY_STATE_CHANGE: 'readystatechange',
    RESIZE: 'resize',
    SCROLL: 'scroll',
    SELECT_START: 'selectstart',
    UNLOAD: 'unload'
}

Framework.Events.KeyEvents = {
    KEY_UP: "keyup",
    KEY_DOWN: "keydown",
    KEY_PRESS: "keypress"
};

Framework.Events.KeyCodes = {
    ENTER: 13,
    LEFT_ARROW: 37,
    UP_ARROW: 38,
    RIGHT_ARROW: 39,
    DOWN_ARROW: 40,
    OPEN_BRACKET: 91,
    CLOSE_BRACKET: 93,
    OPEN_PARENTHESES: 40,
    CLOSE_PARENTHESES: 41
};

//*********************** Event Handler Creation ***************************
Framework.AddHandler = function (object, eventName, handler) {
    if (object.addEventListener) { object.addEventListener(eventName, handler, false); }
    else { object.attachEvent("on" + eventName, handler); }
};

Framework.RemoveHandler = function (object, eventName, handler) {
    if (object.removeEventListener) { object.removeEventListener(eventName, handler, false); }
    else { object.detachEvent("on" + eventName, handler); }
};

Framework.CreateDelegate = function (object, method) {
    return (function () { return method.apply(object, arguments); })
};


//*********************** Trigger Control Object ***************************
Framework.Controls.Trigger = function (triggerElement, triggerEvent, triggerType) {
    this.TriggerElement = triggerElement;
    this.TriggerEvent = triggerEvent;
    this.TriggerType = triggerType;

    this.OnTriggerEvent = null;
    this.OnTriggerEventWithArgs = null;

    Framework.AddHandler(this.TriggerElement, this.TriggerEvent, Framework.CreateDelegate(this, this.TriggerElementEventHandler));
    Framework.AddHandler(this.TriggerElement, this.TriggerEvent, Framework.CreateDelegate(this, this.TriggerElementEventWithArgsHandler));
};

Framework.Controls.Trigger.prototype.TriggerElementEventHandler = function () {
    if (this.OnTriggerEvent != null && this.OnTriggerEvent != undefined) {
        this.OnTriggerEvent(this.TriggerType);
    }
};

Framework.Controls.Trigger.prototype.TriggerElementEventWithArgsHandler = function (e) {
    if (this.OnTriggerEventWithArgs != null && this.OnTriggerEventWithArgs != undefined) {
        this.OnTriggerEventWithArgs(e);
    }
};



// ***********************************************************************************************************
// Name: Animation Library
// Type: Library
// Author: Cliff Gower
//************************************************************************************************************

var Framework = Framework || {};
Framework.Animation = Framework.Animation || {};

//dependencies
//Framework.EventHandling.js

Framework.Animation.AccelerationType = {
    ZERO: '(elapsedTime * (1 / duration))',
    SINUSOIDAL: 'Math.abs(Math.sin(elapsedTime * (Math.PI / (2 * duration))))',
    EASE_IN: 'Math.pow(((1 /duration) * elapsedTime), 1.25)',
    EASE_OUT: 'Math.pow(((1 /duration) * elapsedTime), .25)',
    QUADRATIC_EASE_IN: '(elapsedTime /= duration) * elapsedTime',
    QUADRATIC_EASE_OUT: '-((elapsedTime /= duration) * (elapsedTime -2))',
    CUBIC_EASE_IN: '(elapsedTime /= duration) * elapsedTime * elapsedTime',
    CUBIC_EASE_OUT: '(( elapsedTime = elapsedTime/duration - 1) * elapsedTime * elapsedTime + 1)',
    QUARTIC_EASE_IN: '(elapsedTime /= duration)* elapsedTime * elapsedTime * elapsedTime',
    QUARTIC_EASE_OUT: '-((elapsedTime = elapsedTime/duration - 1) * elapsedTime * elapsedTime * elapsedTime - 1)',
    QUINTIC_EASE_IN: '(elapsedTime /= duration) * elapsedTime * elapsedTime * elapsedTime * elapsedTime',
    QUINTIC_EASE_OUT: '((elapsedTime = elapsedTime/duration - 1) * elapsedTime * elapsedTime * elapsedTime * elapsedTime + 1)',
    SINUSOIDAL_EASE_IN: '-(Math.cos(elapsedTime/duration * (Math.PI/2)) + c)',
    SINUSOIDAL_EASE_OUT: 'Math.sin(elapsedTime/duration * (Math.PI/2))',
    CIRCULAR_EASE_IN: '-(Math.sqrt(1 - (elapsedTime /= duration) * elapsedTime) - 1)',
    CIRCULAR_EASE_OUT: 'Math.sqrt(1 - (elapsedTime = elapsedTime / duration - 1) * elapsedTime)',
    BACK_EASE_IN: '(elapsedTime /= duration) * elapsedTime * ((1.70158 + 1) * elapsedTime - 1.70158)',
    BACK_EASE_OUT: '((elapsedTime = elapsedTime / duration - 1) * elapsedTime * ((1.70158 + 1) * elapsedTime + 1.70158) + 1)',
    COSINE: 'Math.cos(elapsedTime * (Math.PI / (2 * 300)))',
    SINE: 'Math.sin(elapsedTime * (Math.PI / (2 * 300)))',
    TANGENT: 'Math.tan(elapsedTime * (Math.PI / (2 * 300)))'
};


Framework.Animation.Dimension = function (width, height) {
    this.Width = null;
    this.Height = null;

    if (width != null && width != undefined) { this.Width = width; }
    if (height != null && height != undefined) { this.Height = height; }
}


Framework.Animation.Coordinate = function (posX, posY) {
    this.PositionX = null;
    this.PositionY = null;

    if (posX != null && posX != undefined) { this.PositionX = posX; }
    if (posY != null && posY != undefined) { this.PositionY = posY; }
}

Framework.Animation.RGB = function (r, g, b) {
    this.Red = r;
    this.Green = g;
    this.Blue = b;
}

Framework.Animation.Color = function () {
    this.m_Web = null;
    this.m_RGB = null;
};

Framework.Animation.Color.prototype.Web = function (hexValue) {
    if (hexValue != null && hexValue != undefined) {
        this.m_Web = hexValue;
        this.m_RGB = Framework.Animation.ConvertHexColorToRgb(hexValue);
    }

    return this.m_Web;
}

Framework.Animation.Color.prototype.RGB = function (rgb) {
    if (rgb != null && rgb != undefined) {
        this.m_RGB = rgb;
        this.m_Web = Framework.Animation.ConvertRgbToHexColor(this.m_RGB);
    }

    return this.m_RGB;
}

Framework.Animation.GetOpacity = function (element) {
    var opacity = 100;
    if (document.attachEvent && element.currentStyle.filter) {
        var opacityString = element.currentStyle.filter;
        var matches = opacityString.match(/alpha\(opacity=(\d+)\)/);
        if (matches.length > 0) {
            opacity = (matches[1] / 10);
        }
        else {
            opacity = opacity / 10;
        }
    }
    else {
        opacity = (element.style.opacity * 10);
    }

    return opacity;

}

Framework.Animation.GetColor = function (element) {
    var color = new Framework.Animation.Color();
    if (document.attachEvent && element.currentStyle.backgroundColor) {
        color.Web(element.currentStyle.backgroundColor);
    }
    else {
        color.Web(element.style.backgroundColor);
    }

    return color;
}

Framework.Animation.HexToDecimalMap = {
    "0": 0,
    "1": 1,
    "2": 2,
    "3": 3,
    "4": 4,
    "5": 5,
    "6": 6,
    "7": 7,
    "8": 8,
    "9": 9,
    "A": 10,
    "B": 11,
    "C": 12,
    "D": 13,
    "E": 14,
    "F": 15
};

Framework.Animation.ConvertHexColorToRgb = function (hexValue) {
    var redHex = hexValue.substr(1, 2);
    var redRgb = Framework.Animation.ConvertHexColorComponentToRgbComponent(redHex);

    var greenHex = hexValue.substr(3, 2);
    var greenRgb = Framework.Animation.ConvertHexColorComponentToRgbComponent(greenHex);

    var blueHex = hexValue.substr(5, 2);
    var blueRgb = Framework.Animation.ConvertHexColorComponentToRgbComponent(blueHex);

    return new Framework.Animation.RGB(redRgb, greenRgb, blueRgb);
};

Framework.Animation.ConvertHexColorComponentToRgbComponent = function (hexColorComponent) {
    var hex1 = Framework.Animation.HexToDecimalMap[hexColorComponent.substr(0, 1).toUpperCase()];
    var hex2 = Framework.Animation.HexToDecimalMap[hexColorComponent.substr(1, 1).toUpperCase()];
    var rgb = hex1 * 16 + hex2;

    return rgb;
};

Framework.Animation.ConvertRgbToHexColor = function (rgb) {
    var hexColor = '#';
    hexColor = hexColor + Framework.Animation.ConvertRgbComponentToHex(rgb.Red);
    hexColor = hexColor + Framework.Animation.ConvertRgbComponentToHex(rgb.Green);
    hexColor = hexColor + Framework.Animation.ConvertRgbComponentToHex(rgb.Blue);

    return hexColor;
};

Framework.Animation.ConvertRgbComponentToHex = function (rgbValue) {
    var nybHexString = "0123456789ABCDEF";
    var hexValue = String(nybHexString.substr((rgbValue >> 4) & 0x0F, 1)) + nybHexString.substr(rgbValue & 0x0F, 1);
    return hexValue;
};



// ***********************************************************************************************************
// Name: Animations Library
// Type:User Library
// Author: Cliff Gower
//************************************************************************************************************

var Framework = Framework || {};
Framework.Animation = Framework.Animation || {};

//***********************  Animation Abstract Class ***************************
Framework.Animation.AnimationBase = function () {
    this.m_Element = null;
    this.m_Duration = null;
    this.m_Interval = null;
    this.m_AccelerationType = null;
    this.m_StartTime = null;
    this.m_Timer = null;

    this.OnAnimationStart = null;
    this.OnAnimationStop = null;
    this.OnAnimationComplete = null;
    this.OnAnimationTick = null;
}

Framework.Animation.AnimationBase.prototype.InitBase = function (element, duration, interval, acceleration) {
    this.m_Element = element;
    this.m_Duration = duration;
    this.m_Interval = interval;
    this.m_AccelerationType = acceleration;
}

Framework.Animation.AnimationBase.prototype.Start = function () {
    if (this.OnAnimationStart != null) {
        this.OnAnimationStart();
    }

    this.InitAnimation();

    this.m_StartTime = 0;
    this.m_Timer = setInterval(Framework.CreateDelegate(this, this.TimerIntervalHandler), this.m_Interval);
}

Framework.Animation.AnimationBase.prototype.Stop = function () {
    this.Reset();

    if (this.OnAnimationStop != null) {
        this.OnAnimationStop();
    }
}

Framework.Animation.AnimationBase.prototype.Reset = function () {
    clearInterval(this.m_Timer);
    this.m_Timer = null;
}

Framework.Animation.AnimationBase.prototype.AnimationComplete = function () {
    this.Reset();

    if (this.OnAnimationComplete != null) {
        this.OnAnimationComplete();
    }
}

Framework.Animation.AnimationBase.prototype.GetPercentChange = function (elapsedTime) {
    var duration = this.m_Duration;

    var change = eval(this.m_AccelerationType)
    return change;
}

Framework.Animation.AnimationBase.prototype.InitAnimation = function () { }

Framework.Animation.AnimationBase.prototype.Animate = function (percentChange) { }

Framework.Animation.AnimationBase.prototype.TimerIntervalHandler = function () {
    var elapsedTime = (this.m_StartTime += this.m_Interval);

    var percentChange = this.GetPercentChange(elapsedTime);
    this.Animate(percentChange);

    if (this.OnAnimationTick != null) {
        this.OnAnimationTick();
    }

    if (elapsedTime >= this.m_Duration) {
        this.AnimationComplete();
    }
}





//*********************** Resize Animation ***************************
Framework.Animation.ResizeAnimation = function (element, endWidth, endHeight, duration, interval, acceleration) {
    this.m_StartWidth = null;
    this.m_StartHeight = null;
    this.m_EndWidth = endWidth;
    this.m_EndHeight = endHeight;

    this.m_ChangeWidth = null;
    this.m_ChangeHeight = null;

    this.InitBase(element, duration, interval, acceleration);
}

Framework.Animation.ResizeAnimation.prototype = new Framework.Animation.AnimationBase();

Framework.Animation.ResizeAnimation.prototype.InitAnimation = function () {
    this.m_StartWidth = this.m_Element.clientWidth;
    this.m_StartHeight = this.m_Element.clientHeight;

    this.m_ChangeWidth = this.m_EndWidth - this.m_StartWidth;
    this.m_ChangeHeight = this.m_EndHeight - this.m_StartHeight;
}

Framework.Animation.ResizeAnimation.prototype.Animate = function (percentChange) {
    this.m_Element.style.height = Math.abs(Math.round(this.m_StartHeight + (percentChange * this.m_ChangeHeight))) + 'px';
    this.m_Element.style.width = Math.abs(Math.round(this.m_StartWidth + (percentChange * this.m_ChangeWidth))) + 'px';
}




//*********************** Move Animation ***************************
Framework.Animation.MoveAnimation = function (element, endPosX, endPosY, duration, interval, acceleration) {
    this.m_StartPosX = null;
    this.m_StartPosY = null;
    this.m_EndPosX = endPosX;
    this.m_EndPosY = endPosY;

    this.m_ChangeInPosX = null;
    this.m_ChangeInPosY = null;

    this.InitBase(element, duration, interval, acceleration);
}

Framework.Animation.MoveAnimation.prototype = new Framework.Animation.AnimationBase();

Framework.Animation.MoveAnimation.prototype.InitAnimation = function () {
    this.m_StartPosX = this.m_Element.offsetLeft;
    this.m_StartPosY = this.m_Element.offsetTop;

    this.m_ChangeInPosX = this.m_EndPosX - this.m_StartPosX;
    this.m_ChangeInPosY = this.m_EndPosY - this.m_StartPosY;
}

Framework.Animation.MoveAnimation.prototype.Animate = function (percentChange) {
    this.m_Element.style.left = Math.round(this.m_StartPosX + (percentChange * this.m_ChangeInPosX)) + 'px';
    this.m_Element.style.top = Math.round(this.m_StartPosY + (percentChange * this.m_ChangeInPosY)) + 'px';
}


//*********************** Move By Animation ***************************
Framework.Animation.MoveByAnimation = function (element, changeInPosX, changeInPosY, duration, interval, acceleration) {
    this.m_StartPosX = null;
    this.m_StartPosY = null;
    this.m_ChangeInPosX = changeInPosX;
    this.m_ChangeInPosY = changeInPosY;

    this.InitBase(element, duration, interval, acceleration);
}

Framework.Animation.MoveAnimation.prototype = new Framework.Animation.AnimationBase();

Framework.Animation.MoveAnimation.prototype.InitAnimation = function () {
    this.m_StartPosX = this.m_Element.offsetLeft;
    this.m_StartPosY = this.m_Element.offsetTop;
}

Framework.Animation.MoveAnimation.prototype.Animate = function (percentChange) {
    this.m_Element.style.left = Math.round(this.m_StartPosX + (percentChange * this.m_ChangeInPosX)) + 'px';
    this.m_Element.style.top = Math.round(this.m_StartPosY + (percentChange * this.m_ChangeInPosY)) + 'px';
}



//*********************** Horizontal Move Animation ***************************
Framework.Animation.HorizontalMoveAnimation = function (element, endPosX, duration, interval, acceleration) {
    this.m_StartPosX = null;
    this.m_EndPosX = endPosX;

    this.InitBase(element, duration, interval, acceleration);
}

Framework.Animation.HorizontalMoveAnimation.prototype = new Framework.Animation.AnimationBase();

Framework.Animation.HorizontalMoveAnimation.prototype.InitAnimation = function () {
    this.m_StartPosX = this.m_Element.offsetLeft;
    this.m_ChangeInPosX = this.m_EndPosX - this.m_StartPosX;
}

Framework.Animation.HorizontalMoveAnimation.prototype.Animate = function (percentChange) {
    this.m_Element.style.left = Math.round(this.m_StartPosX + (percentChange * this.m_ChangeInPosX)) + 'px';
}



//*********************** Horizontal Move By Animation ***************************
Framework.Animation.HorizontalMoveByAnimation = function (element, changeInPosX, duration, interval, acceleration) {
    this.m_StartPosX = null;
    this.m_ChangeInPosX = changeInPosX;

    this.InitBase(element, duration, interval, acceleration);
}

Framework.Animation.HorizontalMoveByAnimation.prototype = new Framework.Animation.AnimationBase();

Framework.Animation.HorizontalMoveByAnimation.prototype.InitAnimation = function () {
    this.m_StartPosX = this.m_Element.offsetLeft;
}

Framework.Animation.HorizontalMoveByAnimation.prototype.Animate = function (percentChange) {
    this.m_Element.style.left = Math.round(this.m_StartPosX + (percentChange * this.m_ChangeInPosX)) + 'px';
}



//*********************** Vertical Move Animation ***************************
Framework.Animation.VerticalMoveAnimation = function (element, endPosY, duration, interval, acceleration) {
    this.m_StartPosY = null
    this.m_EndPosY = endPosY;
    this.m_ChangeInPosY = null;

    this.InitBase(element, duration, interval, acceleration);
}

Framework.Animation.VerticalMoveAnimation.prototype = new Framework.Animation.AnimationBase();

Framework.Animation.VerticalMoveAnimation.prototype.InitAnimation = function () {
    this.m_StartPosY = this.m_Element.offsetTop;
    this.m_ChangeInPosY = this.m_EndPosY - this.m_StartPosY;
}

Framework.Animation.VerticalMoveAnimation.prototype.Animate = function (percentChange) {
    this.m_Element.style.top = Math.round(this.m_StartPosY + (percentChange * this.m_ChangeInPosY)) + 'px';
}



//*********************** Vertical Move Animation ***************************
Framework.Animation.VerticalMoveByAnimation = function (element, changeInPosY, duration, interval, acceleration) {
    this.m_StartPosY = null
    this.m_ChangeInPosY = changeInPosY;

    this.InitBase(element, duration, interval, acceleration);
}

Framework.Animation.VerticalMoveByAnimation.prototype = new Framework.Animation.AnimationBase();

Framework.Animation.VerticalMoveByAnimation.prototype.InitAnimation = function () {
    this.m_StartPosY = this.m_Element.offsetTop;
}

Framework.Animation.VerticalMoveByAnimation.prototype.Animate = function (percentChange) {
    this.m_Element.style.top = Math.round(this.m_StartPosY + (percentChange * this.m_ChangeInPosY)) + 'px';
}



//*********************** Opacity Animation ***************************
Framework.Animation.OpacityAnimation = function (element, endOpacity, duration, interval, acceleration) {
    this.m_StartOpacity = null;
    this.m_EndOpacity = endOpacity;
    this.m_ChangeOpacity = null;

    this.InitBase(element, duration, interval, acceleration);
}

Framework.Animation.OpacityAnimation.prototype = new Framework.Animation.AnimationBase();

Framework.Animation.OpacityAnimation.prototype.InitAnimation = function () {
    this.m_StartOpacity = Framework.Animation.GetOpacity(this.m_Element);
    this.m_ChangeOpacity = this.m_EndOpacity - this.m_StartOpacity;
}

Framework.Animation.OpacityAnimation.prototype.Animate = function (percentChange) {
    var newOpacity = Math.round(this.m_StartOpacity + (percentChange * this.m_ChangeOpacity));
    this.m_Element.style.filter = 'alpha(opacity=' + (newOpacity * 10) + ')';
    this.m_Element.style.opacity = newOpacity / 10;
}




//*********************** Color Animation ***************************
Framework.Animation.ColorAnimation = function (element, endColor, duration, interval, acceleration) {
    this.m_StartColor = null;
    this.m_EndColor = endColor;
    this.m_ChangeColor = new Framework.Animation.RGB(null, null, null);

    this.InitBase(element, duration, interval, acceleration);
}

Framework.Animation.ColorAnimation.prototype = new Framework.Animation.AnimationBase();

Framework.Animation.ColorAnimation.prototype.InitAnimation = function () {
    this.m_StartColor = Framework.Animation.GetColor(this.m_Element);
    this.m_ChangeColor.Red = this.m_EndColor.RGB().Red - this.m_StartColor.RGB().Red;
    this.m_ChangeColor.Green = this.m_EndColor.RGB().Green - this.m_StartColor.RGB().Green;
    this.m_ChangeColor.Blue = this.m_EndColor.RGB().Blue - this.m_StartColor.RGB().Blue;
}

Framework.Animation.ColorAnimation.prototype.Animate = function (percentChange) {
    var newColorRgb = new Framework.Animation.RGB(null, null, null);
    newColorRgb.Red = Math.round(this.m_StartColor.RGB().Red + (percentChange * this.m_ChangeColor.Red));
    newColorRgb.Green = Math.round(this.m_StartColor.RGB().Green + (percentChange * this.m_ChangeColor.Green));
    newColorRgb.Blue = Math.round(this.m_StartColor.RGB().Blue + (percentChange * this.m_ChangeColor.Blue));

    var newColor = new Framework.Animation.Color();
    newColor.RGB(newColorRgb);

    this.m_Element.style.backgroundColor = newColor.Web();
}



//*********************** Chevy Centennial Namespace ***************************
var ChevyCentennial = ChevyCentennial || {};


ChevyCentennial.Bracket = function (bracket, round) {
    this.Round = round;
    this.Bracket = bracket;

    Framework.AddHandler(bracket, 'mouseover', Framework.CreateDelegate(this, this.ActivateBracketPair));
    Framework.AddHandler(bracket, 'mouseout', Framework.CreateDelegate(this, this.DeactivateBracketPair));
}

ChevyCentennial.Bracket.prototype.ActivateBracketPair = function () {
    var id = this.Bracket.getAttribute("id");
    var groupId = id.substring(6);
    $("[id^=\"overlay-box\"]").show();
    $("#overlay-box" + groupId).hide();
    this.Bracket.style.cursor = "pointer";    
};

ChevyCentennial.Bracket.prototype.DeactivateBracketPair = function () {
    $("[id^=\"overlay-box\"]").hide();
};



//*********************** Modal Control ***************************
ChevyCentennial.ModalControl = function (modal) {
    this.Modal = modal;
    Framework.AddHandler(document.getElementById('modal-overlay'), 'mouseover', Framework.CreateDelegate(this, this.OverlayMouseOverHandler));
    Framework.AddHandler(document.getElementById('modal-overlay'), 'mouseout', Framework.CreateDelegate(this, this.OverlayMouseOverHandler));
};

ChevyCentennial.ModalControl.prototype.RegisterCloseTrigger = function (closeTrigger) {
    Framework.AddHandler(closeTrigger, 'click', Framework.CreateDelegate(this, this.CloseModal));
};

ChevyCentennial.ModalControl.prototype.RegisterOpenTrigger = function (openTrigger) {
    Framework.AddHandler(openTrigger, 'click', Framework.CreateDelegate(this, this.OpenModal));
};

ChevyCentennial.ModalControl.prototype.CloseModal = function () {
    $(this.Modal).hide();
    $('#modal-overlay').hide();
};

ChevyCentennial.ModalControl.prototype.OpenModal = function () {
    $(this.Modal).show();
    $('#modal-overlay').show();
};

ChevyCentennial.ModalControl.prototype.OverlayMouseOverHandler = function (e) {
    e = e || window.event;
    e.cancelBubble = true;
};




//*********************** Vote Page Spotlight Manager Control ***************************
ChevyCentennial.VotePageSpotlightManager = function () {
    this.CurrentSpotlightAction = null;
};

ChevyCentennial.VotePageSpotlightManager.prototype.AddSpotlightAction = function (action) {
    action.OnSpotlightAction = Framework.CreateDelegate(this, this.SpotlightActionHandler);
};

ChevyCentennial.VotePageSpotlightManager.prototype.SpotlightActionHandler = function (action) {
    if (this.CurrentAction != null) {
        this.CurrentAction.Stop();
    }

    this.CurrentAction = action;
    this.CurrentAction.Start();
};


//*********************** Vote Page Spotlight Action Control ***************************
ChevyCentennial.SpotLightActionState = {
    NOT_ANIMATING: 0,
    ANIMATING: 1
};

ChevyCentennial.SpotLightActionType = {
    START: 0,
    STOP: 1
};


ChevyCentennial.SpotlightAction = function (actionTriggerElement) {
    this.Trigger = actionTriggerElement;
    this.AnimationCollection = [];
    this.State = ChevyCentennial.SpotLightActionState.NOT_ANIMATING;

    this.OnSpotlightAction = null;
    this.OnMouseOver = null;
    this.OnMouseOut = null;

    Framework.AddHandler(actionTriggerElement, Framework.Events.MouseEvents.MOUSE_OVER, Framework.CreateDelegate(this, this.OnMouseoverHandler));
    Framework.AddHandler(actionTriggerElement, Framework.Events.MouseEvents.MOUSE_OUT, Framework.CreateDelegate(this, this.OnMouseoutHandler));
};

ChevyCentennial.SpotlightAction.prototype.Start = function () {
    for (var index = 0; index < this.AnimationCollection.length; index++) {
        this.AnimationCollection[index].Start();
    }

    this.State = ChevyCentennial.SpotLightActionState.ANIMATING;
};

ChevyCentennial.SpotlightAction.prototype.Stop = function () {
    for (var index = 0; index < this.AnimationCollection.length; index++) {
        this.AnimationCollection[index].Stop();
    }

    this.State = ChevyCentennial.SpotLightActionState.NOT_ANIMATING;
};

ChevyCentennial.SpotlightAction.prototype.OnMouseoverHandler = function (e) {
    e = e || window.event;
    e.cancelBubble = true;

    if (this.OnSpotlightAction != null) {
        this.OnSpotlightAction(this);
    }

    if (this.OnMouseOver != null) {
        this.OnMouseOver(this);
    }
};

ChevyCentennial.SpotlightAction.prototype.OnMouseoutHandler = function (e) {
    e = e || window.event;
    e.cancelBubble = true;

    if (this.OnMouseOut != null) {
        this.OnMouseOut(this);
    }
};


