﻿/// <reference path="jquery-1.4.1-vsdoc.js" />

Cufon.replace('#topMenu li.selected a', {
    textShadow: '-1px 1px rgba(200, 200, 200, 0.6)',
    fontFamily: 'TradeGothic'
});
Cufon.replace('#topMenu li[class!=selected] a', {
    textShadow: '-1px 1px rgba(51, 51, 51, 0.6)',
    fontFamily: 'TradeGothic'
});
Cufon.replace('.tradeGothic, .BigButton', { fontFamily: 'TradeGothic' });
Cufon.replace('.tradeGothicCondensed', { fontFamily: 'TradeGothicCondensed' });

// init code
var loadedImages = []; // this must be outside any function to remain in scope all the time

$(function () {
    $(".jRollOver").each(function () {

        var normalSrc = $(this).attr("src");

        // don't do rollovers for IE6 if image is PNG
        if ($.browser.msie && $.browser.version.substr(0, 1) < 7 && normalSrc.match(".png$"))
            return;

        var hoverSrc = normalSrc.replace("_normal", "_over");

        // preload rollovers
        var cacheImage = document.createElement('img');
        cacheImage.src = hoverSrc;
        loadedImages.push(cacheImage);

        // setup rollover
        $(this).hover(function () {
            $(this).attr("src", hoverSrc);
        },
        function () {
            $(this).attr("src", normalSrc);
        });
    });


    // handle vote submission
    $(".jactive td label").click(function () {
        var target = $(this).siblings();
        target.attr('checked', 'checked');
        poll_vote(target.attr("name").substring("poll_".length), target.val());
    });

    $(".jtext").each(function () {
        $(this).data('caption', $(this).val());
    });

    $(".jtext").focus(function () {
        $(this).removeClass("blur");
        if ($(this).val() == $(this).data('caption'))
            $(this).val("");
    });
    $(".jtext").blur(function () {
        if ($(this).val() == "" || $(this).val() == $(this).data('caption')) {
            $(this).val($(this).data('caption'));
            $(this).addClass("blur");
        }
    });
});