﻿Cufon.replace('.tabs', { fontFamily: 'Helvetica Neue LT Pro', hover: true });
Cufon.replace('.li-home selected', { fontFamily: 'Helvetica Neue LT Pro', hover: true });
Cufon.replace('.nav', { fontFamily: 'Helvetica Neue LT Pro', hover: true });
Cufon.replace('h1', { fontFamily: 'Neutraliser' });
Cufon.replace('h2', { fontFamily: 'Helvetica Neue LT Pro' });
Cufon.replace('h2.N', { fontFamily: 'Neutraliser' });
Cufon.replace('h3', { fontFamily: 'Helvetica Neue LT Pro' });
Cufon.replace('a.cufon', { fontFamily: 'Neutraliser' });

var FlowPlayerInstances = 0;

$(function () {

    // -- Disable the skype plugin
    window.setTimeout(function () {
        $('.skype_pnh_container').html('');
        $('.skype_pnh_print_container').removeClass('skype_pnh_print_container');
    }, 800);

    var searchOnSelect = function () { var e = $(this); if (e.val() == 'search site') e.val(''); }
    var searchOnDeSelect = function () { var e = $(this); if (e.val() == '') e.val('search site'); }

    $('input.searchText')
			.focus(searchOnSelect)
			.blur(searchOnDeSelect)
			.val('search site');

    $(".indexPost2 img").css({ opacity: 0 });
    $(".indexPost2 img").fadeTo("fast", 1);

    $(".indexPost2").hover(function () {
        $(this).find('img').fadeTo("fast", 0.5);
    }, function () {
        $(this).find('img').fadeTo(800, 1);
    });

    $(".indexPost img").css({ opacity: 0 });
    $(".indexPost img").fadeTo("slow", 1);
    $(".indexPost").hover(function () {
        $(this).find('img').fadeTo("slow", 0.7);
    }, function () {
        $(this).find('img').fadeTo("slow", 1);
    });

    $("#mainbanner").cycle({
        fx: "fade", timeout: 4000
    });

    // -- Evil hackesque type thing to get iPad/iPod video rendering working.
    if (!$.browser.msie) {
        $("object").each(
            function () {
                var config = $(this).children("param").attr("value");
                var configJson = jQuery.parseJSON(config.substr(7));
                var id = "FlowPlayerInstance-" + FlowPlayerInstances;
                var href = configJson.clip.url;
                var img = configJson.canvas.backgroundImage;
                var style = "height: " + $(this).attr("height") + "px; width: " + $(this).attr("width") + "px; display: block;";

                $(this).parent().append('<div class="flowplayer"><a href="' + href + '" id="' + id + '" style="' + style + '"><img src="' + img + '" alt=""></a></div>');
                $(this).remove();
                $f(id, $(this).attr("data"), configJson).ipad().play();

                FlowPlayerInstances++;
            }
        );
    }
});
