﻿$(document).ready(function() {
    //if JS enabled then hide second part of form
    $('#taxschool').hide();
    $('#franchise').hide();
    $('#about').hide();
    
    //progress form
    $("#taxpreptab a").click(showtaxprep);
    $("#taxschooltab a").click(showtaxschool);
    $("#franchisetab a").click(showfranchise);
    $("#abouttab a").click(showabout);
  });


    function showtaxprep() {
        $('li#taxpreptab').addClass('current');
        $('li#taxschooltab').removeClass('current');
        $('li#franchisetab').removeClass('current');
        $('li#abouttab').removeClass('current');
          
        $('#taxprep').show();
        $('#taxschool').hide();
        $('#franchise').hide();
        $('#about').hide();
        return false;
    }

    function showtaxschool() {
        $('li#taxpreptab').removeClass('current');
        $('li#taxschooltab').addClass('current');
        $('li#franchisetab').removeClass('current');
        $('li#abouttab').removeClass('current');

        $('#taxprep').hide();
        $('#taxschool').show();
        $('#franchise').hide();
        $('#about').hide();
        return false;
    }
    
    function showfranchise() 
    {
        $('li#taxpreptab').removeClass('current');
        $('li#taxschooltab').removeClass('current');
        $('li#franchisetab').addClass('current');
        $('li#abouttab').removeClass('current');

        $('#taxprep').hide();
        $('#taxschool').hide();
        $('#franchise').show();
        $('#about').hide();
        return false;
    }
    
    function showabout() {
        $('li#taxpreptab').removeClass('current');
        $('li#taxschooltab').removeClass('current');
        $('li#franchisetab').removeClass('current');
        $('li#abouttab').addClass('current');

        $('#taxprep').hide();
        $('#taxschool').hide();
        $('#franchise').hide();
        $('#about').show();
        return false;
    }



    // get the correct flash item
    $(document).ready(function() {
        var flashidx = $.cookie("flashidx");
        if (flashidx == null) {
            flashidx = 0;
        }

        swfobject.embedSWF(flasharray[flashidx], "flash-area", "780", "395", "9.0.0", false, flashvars, params, attributes);

        if (flashidx == flasharray.length - 1) {
            flashidx = 0;
        }
        else {
            flashidx++;
        }
        $.cookie("flashidx", flashidx);


        //handle enter key in homepage locate an office
        $("#header_locator_input").keypress(function(e) {
            if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
                document.location = '/OfficeLocator/Search-Results/?loc=' + escape($('#header_locator_input').val());
                return false;
            } else {
                return true;
            }
        });

        $('#find_office_btn').click(function() {
        document.location = '/OfficeLocator/Search-Results/?loc=' + escape($('#header_locator_input').val());
            return false;

        });
        $('a#hp_start_now').hover(
			function() {
			    $('#hp_online_packages').css({ 'backgroundPosition': 'left bottom' });
			}, function() {
			    $('#hp_online_packages').css({ 'backgroundPosition': 'left top' });
			});
			$('a#hp_dare_to_compare_btn').hover(
			    function() {
			    $('#hp_dtc_coupon').css({ 'backgroundPosition': 'left bottom' });
			}, function() {
			$('#hp_dtc_coupon').css({ 'backgroundPosition': 'left top' });
			});
			
			$('#fifty-off-learn-more').bt({
            contentSelector: "$('#fifty-off-learn-more-text').html()", /*get text of inner content of hidden div*/
            trigger: 'click',
            padding: 15,
            width: 300,
            height: 200,
            spikeLength: 10,
            spikeGirth: 10,
            cornerRadius: 0,
            fill: 'white',
            strokeWidth: 1,
            shadow: true,
            shadowOffsetX: 3,
            shadowOffsetY: 3,
            shadowBlur: 8,
            shadowColor: 'rgba(0,0,0,.9)',
            offsetParent: 'body',
            shadowOverlap: false,
            strokeStyle: '#ca2406;',
            closeWhenOthersOpen: true,
            cssStyles: { color: '#444', fontWeight: 'normal', fontFamily: 'Arial' }

        });
    });

//hide addressbar on iPhone
//	addEventListener('load', function() { 
//		setTimeout(hideAddressBar, 0); 
//	}, false);
//	function hideAddressBar() { 
//		window.scrollTo(0, 1); 
//	}
