﻿/*
    Global Stunts
    Main JavaScript Routines - must be included on every page
    Requires jQuery 1.6 (jquery-1.6.min.js)
    
    CHANGELOG
    ---------
    Created 16th June (AM)
    Modified 16th June (AM)
    ---------

*/

// MODIFY SETTINGS BELOW THIS LINE --------------------------------------------------
// NB - if you make changes please add the date and initials to the changelog above

// home page Productions image fader settings
var hpFadeTime = 1000;        // length of time it takes an image to fade in or out
var hpFadeInterval = 5000;    // length of time between fades

var hpNominationSpeed = 2000;       // how long it takes each nomination to scroll into and out of view
var hpNominationInterval = 5000;    // how long each nomination is displayed on the home page




// END OF MODIFIABLE SETTINGS --------------------------------------------------------


var nomItems = null;    // the nomination items
var nomPtr = -1;
var tNom = null;

function nextNomination() {
    if (nomPtr > -1) {
        clearTimeout(tNom);
        $(nomItems[nomPtr]).animate(
        { 'top': '-=100px' }, hpNominationSpeed, 'linear', function () { $(this).css('top', '200px'); });
    }
    nomPtr++;
    if (nomPtr >= nomItems.length)
        nomPtr = 0;
    $(nomItems[nomPtr]).animate(
        { 'top': '-=200px' },
        { duration: hpNominationSpeed }
    );
    tNom = setTimeout('nextNomination()', hpNominationInterval);
}


$(document).ready(function () {
    $('#HeaderLink').click(function () {
        window.location.href = '/Default.aspx';
    });
    $('a[rel="external"]').attr('target', '_blank');
    $('img[rel="fady"]').css('display', 'none');
    $('img[rel="fady"]').fadeIn(1000);
    nomItems = $('.NominationItem');
    nextNomination();
});
