var temp, temp2;
function initiate(){
	temp = document.getElementById("containerul");
	for(var o=0;o<temp.getElementsByTagName("li").length;o++){
		if(temp.getElementsByTagName("li")[o].getElementsByTagName("ul").length>0){
			temp2 = document.createElement("span");
			temp2.className = "symbols";
			temp2.style.backgroundImage = "url(/images/sitemap/plus.png)";
			temp2.onclick=function(){
				showhide(this.parentNode);
			}
			temp.getElementsByTagName("li")[o].insertBefore(temp2,temp.getElementsByTagName("li")[o].firstChild)
			temp.getElementsByTagName("li")[o].getElementsByTagName("ul")[0].style.display = "none";
		}
		else{
			temp2 = document.createElement("span");
			temp2.className = "symbols";
			temp2.style.backgroundImage = "url(/images/sitemap/page.png)";
			temp.getElementsByTagName("li")[o].insertBefore(temp2,temp.getElementsByTagName("li")[o].firstChild);
		}
	}
}

function showhide(el){
	el.getElementsByTagName("ul")[0].style.display=(el.getElementsByTagName("ul")[0].style.display=="block")?"none":"block";
	el.getElementsByTagName("span")[0].style.backgroundImage=(el.getElementsByTagName("ul")[0].style.display=="block")?"url(/images/sitemap/minus.png)":"url(/images/sitemap/plus.png)";
}

$(document).ready(function() {
	initiate();
});
