﻿$(function () {


    $('.poster a').hover(function () {
        $('.slider p', this).slideDown(500);
    }, function () {
        $('.slider p', this).slideUp(500);
    });


    var count = 0;
    $('.poster').each(function () {
        $(this).addClass("promo_" + count);
        count++;
    });


    count = 0;
    $('#landing-rotator-slides li').each(function () {
        $(this).addClass("slide_" + count);
        count++;
    });


    $("#landing-rotator-slides").cycle({
        fx: 'fade',
        flyoutSpeed: 1000,
        slideAniSpeed: 300,
        pagerAnchorBuilder: function (idx, slide) {
            // return selector string for existing anchor             
            return '#landing-rotator-pager li:eq(' + idx + ')';
        }
    });


    /* loads tweets on each page */
    $("#tweets").tweet({ join_text: "auto", username: "sundancecanada", count: 1, loading_text: "loading tweets..." });

    /* search form */
    $('.search-submit').click(function (e) {
        e.preventDefault();
        $('.search-form').submit();
    });

    $('.search-page-submit').click(function (e) {
        e.preventDefault();
        $('.search-page').submit();
    });

    $('.jquery-submit-button').click(function (e) {
        e.preventDefault();
        $('.form-jquery-submit').submit();
    });

    $('.search .text').click(function (e) {
        if ($(this).val() == $(this).attr("rel")) {
            $(this).val("");
        }


    });

    $('.search .text').blur(function (e) {
        if ($(this).val() == "") {
            $(this).val($(this).attr("rel"));
        }
    });



});

function getTimezoneName() {
    tmSummer = new Date(Date.UTC(2005, 6, 30, 0, 0, 0, 0));
    so = -1 * tmSummer.getTimezoneOffset();
    tmWinter = new Date(Date.UTC(2005, 12, 30, 0, 0, 0, 0));
    wo = -1 * tmWinter.getTimezoneOffset();

    if (-420 == so && -480 == wo) return 'PST';
    if (-360 == so && -420 == wo) return 'MST';
    if (-300 == so && -360 == wo) return 'CST';
    if (-240 == so && -300 == wo) return 'EST';
    if (-180 == so && -240 == wo) return 'AST';
    if (-150 == so && -210 == wo) return 'NST';
    return 'EST';
}

