﻿$(document).ready(function() {
initToggledLinks();
});

function initToggledLinks() {

var i;
var a_toggled = $('a.toggled');     //closed by deafult
var a_toggled_single = $('a.toggled-single'); //closed by default and only one block may be opened at a time
var a_toggled_open = $('a.toggled-open');   //open by default



var flag = 1;
//close all closed by default
a_toggled.each(function() {
    if (flag == 1) {
        flag = 0;
    }
    else {
        $(this).addClass('toggled-off');
        $(this.hash).hide();
    }
});

a_toggled_single.each(function() {
    if (flag == 1) {
        flag = 0;
    }
    else {
        $(this).addClass('toggled-off');
        $(this.hash).hide();
    }
});

a_toggled.click(function() {
    i = this.hash;
    $(this).toggleClass('toggled-off');
    $(i).toggle(300);
    return (false);
});

a_toggled_open.click(function() {
    i = this.hash;
    $(this).toggleClass('toggled-off');
    $(i).toggle(300);
    return (false);
});

a_toggled_single.click(function() {
    i = this.hash;
    a_toggled_single.each(function() {
        if (i != this.hash) {
            $(this).addClass('toggled-off');
            $(this.hash).hide();
        }
    });
    $(this).toggleClass('toggled-off');
    $(i).toggle(300);
    return (false);
});
}
