﻿$(document).ready(function() {
    Cufon.replace('h1, h2, .accordion h3, a.button, ul#menu li a strong, .costs, .amount, .period, .tabs li a', { fontFamily: 'Myriad Pro' });
    Cufon.replace('.module.news h2, .module.about h2', { fontFamily: 'ITC Stone Serif Std' });

    $('.faq h4').click(function() {
        $(this).next().toggle();
        return false;
    }).next().hide();

    var last;
    $('.accordion h3').click(function() {
        $(last).parent().toggleClass("active");
        $(last).next().height("0px");
        $(this).next().height("105px");
        $(this).parent().toggleClass("active");
        last = $(this);
        return false;
    }).next().height("0px");
    $('.accordion li.active').find("ul").height("105px");
    last = $('.accordion li.active h3');

    $('input.go').click(function(e) {
        window.location = "/net/search.aspx?query=" + $('input.text').val();
        e.preventDefault();
    })


    /* identity theft insurance  */

    $(".tabs").tabs({
        show: function(event, ui) {
            Cufon.refresh('.tabs li a');
        },
        fx: { opacity: 'toggle', duration: 250 }
    });

    $('.start .button').click(function(e) {
        e.preventDefault();
        $('.initial').removeClass('initial');
        $(this).parent().parent().addClass('active');
    })

    $('.slide h4').click(function(e) {
        e.preventDefault();
        //$('.slide.active .tabs').animate({ width: "0px" }, 505);
        
        $('.slide.active').addClass('last').animate({ width: "57px" }, 505);
        $(this).parent().addClass('next').show().animate({ width: "615px" }, 500, onHide);
        $(this).parent().find('.tabs').show();//.animate({ width: "597px" }, 505);
        $(this).hide();
    });

    function onHide() {
        $('.slide.last h4').removeAttr('style');
        $('.slide.last').removeAttr('style').removeClass('active');
        $('.slide.next').removeClass('next').addClass('active');
        $('.slide .tabs').removeAttr('style');
    }

});