// Read a page's GET URL variables and return them as an associative array.
function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');

    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }

    return vars;
}

var hash = getUrlVars();

$("document").ready(function() {
	
	var voletOuvert = $('.hiddenLabel').text();
	
	if((voletOuvert > 0) && (voletOuvert < 5))
	{
		voletOuvert = voletOuvert-1;
	
		$(".titleAccordion a:eq("+ voletOuvert +")").addClass("selected");
		$(".titleAccordion a:eq("+ voletOuvert +")").parent().addClass("open");
		$(".titleAccordion a:eq("+ voletOuvert +")").parent().next().toggle();
	}
	
	$(".titleAccordion a").click(function(){
		if($(this).hasClass("selected"))
		{
			$(this).removeClass("selected");
			$(this).parent().removeClass("open");
		}
		else
		{
			$(this).addClass("selected");
			$(this).parent().addClass("open");
		}
		$(this).parent().next().toggle();
	});
	
	//If Custom view activate, display lightbox
	if(hash['account']=="deleted"){
		
		var cookieValue = $.cookie('showAccountDeletedPopup');
		//if popup has already displayed
		if(cookieValue=='true')
		{
			var newURL = "/account-deleted.aspx?placeValuesBeforeTB_=savedValues&amp;TB_iframe=true&amp;height=375&amp;width=400&amp;modal=true";
			tb_show("", newURL);
		}
		else
		{
			document.location.href = "/default.aspx";
		}
	}
	
});






