﻿/// <reference path="jQuery/jquery-1.4.4-vsdoc.js" />


// jQuery Shortcut Event
// F1 - F12 = 112 - 123
var ShiftKeyValue = 16;
var CtrlKeyValue = 17;
var AltKeyValue = 18;

var ShiftKeyIsPressed = false;
var CtrlKeyIsPressed = false;
var AltKeyIsPressed = false;

$(document).keyup(function(e)
{
    switch (e.which)
    {
        case ShiftKeyValue:
            ShiftKeyIsPressed = false;
            break;

        case CtrlKeyValue:
            CtrlKeyIsPressed = false;
            break;

        case AltKeyValue:
            AltKeyIsPressed = false;
            break;
    }

    return true;
});

$(document).keydown(function (e)
{
    switch (e.which)
    {
        case ShiftKeyValue:
            ShiftKeyIsPressed = true;
            break;

        case CtrlKeyValue:
            CtrlKeyIsPressed = true;
            break;

        case AltKeyValue:
            AltKeyIsPressed = true;
            break;

        case 118: // F7
            if (ShiftKeyIsPressed && (typeof ShortCut_Shift_F7 == 'function'))
                ShortCut_Shift_F7();
            if (CtrlKeyIsPressed && (typeof ShortCut_Ctrl_F7 == 'function'))
                ShortCut_Ctrl_F7();
            if (AltKeyIsPressed && (typeof ShortCut_Alt_F7 == 'function'))
                ShortCut_Alt_F7();
            break;

        case 119: // F8
            if (ShiftKeyIsPressed && (typeof ShortCut_Shift_F8 == 'function'))
                ShortCut_Shift_F8();
            if (CtrlKeyIsPressed && (typeof ShortCut_Ctrl_F8 == 'function'))
                ShortCut_Ctrl_F8();
            if (AltKeyIsPressed && (typeof ShortCut_Alt_F8 == 'function'))
                ShortCut_Alt_F8();
            break;

        case 120: // F9
            if (ShiftKeyIsPressed && (typeof ShortCut_Shift_F9 == 'function'))
                ShortCut_Shift_F9();
            if (CtrlKeyIsPressed && (typeof ShortCut_Ctrl_F9 == 'function'))
                ShortCut_Ctrl_F9();
            if (AltKeyIsPressed && (typeof ShortCut_Alt_F9 == 'function'))
                ShortCut_Alt_F9();
            break;

        case 121: // F10
            if (ShiftKeyIsPressed && (typeof ShortCut_Shift_F10 == 'function'))
                ShortCut_Shift_F10();
            if (CtrlKeyIsPressed && (typeof ShortCut_Ctrl_F10 == 'function'))
                ShortCut_Ctrl_F10();
            if (AltKeyIsPressed && (typeof ShortCut_Alt_F10 == 'function'))
                ShortCut_Alt_F10();
            break;
    }

    return true;
});

