﻿// Quote Rotator
var currentQuoteIndex = 0;
var quotes = new Array();
quotes[0] = '<div>"Nothing beats the Wii & Xbox lunchtime tournies for me." <div class="author">- Kevin (Developer)</div></div>',
        quotes[1] = '<div>"I can\'t stand any of my workmates. See you guys Friday night for happy hour!" <div class="author">- Dave (Information Architect)</div></div>',
        quotes[2] = '<div>"I\'m quite attached to my extremely comfortable office chair and am tempted to bring it home with me each night." <div class="author">- Tom (IT)</div></div>',
        quotes[3] = '<div>"No one bothers me if I don’t want them to." <div class="author">- James (Developer)</div></div>',
        quotes[4] = '<div>"Everyone bothers me all the time. (but I guess that\'s what I am here for)" <div class="author">- Nick (IT)</div></div>',
        quotes[5] = '<div>"My boss is a family-first kind of boss. No kidding - he has 5 kids of his own!" <div class="author">- Alex (User Interface Engineer)</div></div>',
        quotes[6] = '<div>"We work on some very important projects and I know first-hand that our clients really value our work." <div class="author">- Warren (Developer)</div></div>',
        quotes[7] = '<div>"Before I started working at Parse3, I was spending at least 4 hours every day commuting to and from Manhattan.  If you think about it, that\'s 20 hours a week that could be spent doing something other than sitting on a train." <div class="author">- Jim (Project Manager)</div></div>',
        quotes[8] = '<div>"My state-of-the-art work station is really cool.  What... it is!" <div class="author">- Jon (Developer)</div></div>'

$(document).ready(function() {
    $('#quote').html(quotes[0]);
    setInterval(SwitchQuote, 10000);
});

function SwitchQuote() {
    $('#quote').fadeOut('slow', function() {
        $('#quote').html(quotes[currentQuoteIndex]);
    });

    $('#quote').fadeIn('slow');

    if (currentQuoteIndex == quotes.length - 1)
        currentQuoteIndex = 0;
    else
        currentQuoteIndex++;
}

var Globals = {
    //Ex: CallPageMethod("PageMethodName", "page.aspx", {'parameter':'value'}, FunctionToCallOnSuccess, FunctionToCallOnError);
    //Ex2: CallPageMethod("ServiceMethodName", "services/service.asmx", {'collection': ['obj1':'value1','obj2':'value2','obj3':'value3']}, FunctionToCallOnSuccess, FunctionToCallOnError);
    CallPageMethod: function(fn, methodpath, dto, successFn, errorFn) {
        $.ajax({
            type: "GET",
            contentType: "application/json; charset=utf-8",
            url: methodpath + "/" + fn,
            data: dto,
            dataType: "json",
            success: successFn,
            error: errorFn
        });
    },

    getParameterByName: function(name) {
        name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
        var regexS = "[\\?&]" + name + "=([^&#]*)";
        var regex = new RegExp(regexS);
        var results = regex.exec(window.location.href);
        if (results == null)
            return "";
        else
            return results[1];
    }
};

