﻿
function setupAccordion() {
    $("div.formContainer h3.accordion-head").next().hide();
    $("div.formContainer h3.accordion-head.current").next().addClass("current").show();

    $("div.formContainer h3.accordion-head.enable").bind("click",function() {
        if ($(this).next().is(":hidden")) {
            $("div.formContainer h3.accordion-head.current").removeClass("current").next().removeClass("current").slideUp();
            $(this).addClass("current").next().addClass("current").slideDown();
        }

	$(this).nextAll("div.formContainer h3.accordion-head.enable").removeClass("enable").unbind("click");
    });
}

function accordionGoStep(index) {
    var valid = validateAll('#formDetail' + index);
    if (valid) {
        jQuery("#accordionHead" + (index + 1)).addClass("enable");
        setupAccordion();
        jQuery("#accordionHead" + (index + 1)).click();
        jQuery("#accordionHead" + index + ' a.extraLink').show();
        location.href = "#step" + (index + 1) + "Address";
    }
}


function resizeFont(level) {
    var size = "62.5%";
    switch (level) {
        case "medium":
            size = "70.3%";
            pageTracker._trackEvent('Fontsize', 'Normal');
            break;
        case "big":
            size = "78.2%";
            pageTracker._trackEvent('Fontsize', 'Big');
            break;
        case "small":
            pageTracker._trackEvent('Fontsize', 'Small');
            break;
    }    
    jQuery("body").css("font-size", size);
}

function beautyTooltip(selector,contentSelector, content) {
var options = {
    trigger: 'click',
        contentSelector: contentSelector,
        //width: 100,
        fill: '#f00',
        positions: ['right'],
        cssStyles: { backgroundImage: 'url(/Template/EON/BinaryResource/images/redBg.gif)', backgroundRepeat: 'repeat', color: '#fff' },
        strokeWidth: 0,
        spikeLength: 10,
        spikeGirth: 10,
        padding: 5,
        cornerRadius: 0,
        closeWhenOthersOpen: true
    };

   if(content)
{
    jQuery(selector).bt(content,options);
}
else
{
 jQuery(selector).bt(options);
}
}

jQuery(function() {
    $(".firstLevelMenu>li.expandable:has(ul)").toggle(
                function() {
                    $(this).children("ul").slideUp();
                },
	            function() {
	                $(this).addClass('current').children("ul").slideDown();
	            }
	            );


    $(".secondLevelMenu li.expandable:has(ul)").toggle(

	            function() {
	                $(this).addClass('current').children("ul").slideDown();
	            },

	            function() {
	                $(this).children("ul").slideUp();
	            }
	            );


    $(".secondLevelMenu li:not(:has(ul))").click(function(event) { event.stopPropagation(); });


    setupAccordion();
});