var path = [];
glossar = new CookieJar({ expires:360000, path: '/' });
function showEntries(id)
{
	thisDiv = $(id);
	if (thisDiv.hasClassName('skip')) 
	{
		thisDiv.removeClassName('skip');
		path.push(id);
	}
	else 
	{
		thisDiv.addClassName('skip');
		for (i in path) { if (id == path[i]) { path.splice(i, 1); } }
	} 
}
function changeBullet(id)
{
	thisImg = $("y_"+id);
	if (thisImg.src.match(/close/g)) 
	{
		thisImg.src = "images/open.png";
		path.push("y_"+id);
	}
	else 
	{
		thisImg.src = "images/close.png";
                for (i in path) { if ("y_"+id == path[i]) { path.splice(i, 1); } }
	}
        //window.name += path;
	glossar.put('path',path);
}
function changeSubBullet(id)
{
	thisImg = $("yy_"+id);
	if (thisImg.src.match(/pfeil_rechts_s/g)) 
	{
		thisImg.src = "images/pfeil_unten_s.png";
		path.push("yy_"+id);
	}
	else 
	{
		thisImg.src = "images/pfeil_rechts_s.png";
                for (i in path) { if ("yy_"+id == path[i]) { path.splice(i, 1); } }
	} 
        //window.name += path;
	glossar.put('path',path);
}

function dynOpen(i,j)
{
	showEntries('xx_'+i+'_'+j);
	changeSubBullet(i+'_'+j)
}



document.observe("dom:loaded", function() {

/*
	$$('.faqMain, .faqContent').each(function(e,index) {
		//e.removeClassName('skip');
		//e.addClassName('hide');
	});
*/

	var path_array = glossar.get('path'); //window.name.split(",");
	for (i=0; i<path_array.length; i++)
	{
		if (path_array[i].substring(0,1)=="x")
		{	
			//console.log("e: "+path_array[i])
			showEntries(path_array[i]);
		}
		if (path_array[i].match(/yy/g)) 
		//if (path_array[i].substring(0,2)=="ii")
		{
			//console.log("ii: "+path_array[i])
			changeSubBullet(path_array[i].substring(3, path_array[i].length));
		}
		if (path_array[i].substring(0,2)=="y_")
		{
			//console.log("i: "+path_array[i])
			changeBullet(path_array[i].substring(2, path_array[i].length));
		}
	}


});
