
// JavaScript Document

/*faq*/
// function for the link that turns them all off
function toggleAllOff(){
	
	if(document.getElementById("togglelisting") != null){
		var heading = document.getElementById("togglelisting").getElementsByTagName('dt');
		var desc = document.getElementById("togglelisting").getElementsByTagName('dd');

		for (var i = 0; i < desc.length; i++) { 
			heading[i].className = 'collapsed';
			desc[i].className = 'hide';
		}
		
	}
}

// function for the link that turns them all on
function toggleAllOn(){
	var heading = document.getElementById("togglelisting").getElementsByTagName('dt');
var desc = document.getElementById("togglelisting").getElementsByTagName('dd');

	for (var i = 0; i < desc.length; i++) { 
		heading[i].className = 'expanded';
		desc[i].className = 'show';
	}

}

//function toggleNext(el) {
//	
// var next=el.nextSibling;
//
// next.style.display=((next.style.display=="none") ? "block" : "none");
//}


//makes the definition lists click-able
function displayToggle(){

	
	if(document.getElementById("togglelisting") != null){
		var heading 	= document.getElementById("togglelisting").getElementsByTagName('dt');
		var desc 		= document.getElementById("togglelisting").getElementsByTagName('dd');
	}

	toggleAllOff(); // calls the toggle all off function to turn all the answers off when the page is loaded	
	 
	 if(heading != null){
		 for (i=0; i<heading.length; i++) { // loops through the jobs a
			 heading[i].onclick=function() { // shows the desc onclick
			 
			 	
				
			 	var next = this.nextSibling;
				while(next.nodeType != 1) next=next.nextSibling; // if it gets to a non-element node, go to the next one
				//change class of current dt
				this.className=((this.className=="collapsed") ? "expanded" : "collapsed");
				//chage class of the following dd
				next.className=((next.className=="hide") ? "show" : "hide");
					
			}
		 }
	 }
}

function togglelistingControls(){
	var togglecontrols=document.getElementById('togglelistingcontrols')
    if (togglecontrols){ 
	togglecontrols.style.display = "block";
	    var ToggleListON = document.getElementById('togglelistingexpandAll');
	    var ToggleListOFF = document.getElementById('togglelistingcollapseAll'); 
		
		    if (ToggleListON && ToggleListOFF){				
				ToggleListON.onclick = function() { toggleAllOn(); }
				ToggleListON.title = "Show all";
				ToggleListON.href = "#e";
			   	ToggleListOFF.onclick = function() { toggleAllOff(); } 
 			   	ToggleListOFF.title = "Hide all";
				ToggleListOFF.href = "#c";
			}
    }
}
/*end faq*/

/*menu of services*/
// function for the link that turns them all off
function toggleMenuAllOff(){
	
	if(document.getElementById("menulisting") != null){
		var heading = document.getElementById("menulisting").getElementsByTagName('dt');
		var desc = document.getElementById("menulisting").getElementsByTagName('dd');

		for (var i = 0; i < desc.length; i++) { 
			heading[i].className = 'collapsed';
			desc[i].className = 'hide';
		}
		
	}
}

// function for the link that turns them all on
function toggleMenuAllOn(){
	var heading = document.getElementById("menulisting").getElementsByTagName('dt');
var desc = document.getElementById("menulisting").getElementsByTagName('dd');

	for (var i = 0; i < desc.length; i++) { 
		heading[i].className = 'expanded';
		desc[i].className = 'show';
	}

}

//makes the definition lists click-able
function displayMenuToggle(){

	
	if(document.getElementById("menulisting") != null){
		var heading 	= document.getElementById("menulisting").getElementsByTagName('dt');
		var desc 		= document.getElementById("menulisting").getElementsByTagName('dd');
	}

	toggleMenuAllOff(); // calls the toggle all off function to turn all the answers off when the page is loaded	
	 
	 if(heading != null){
		 for (i=0; i<heading.length; i++) { // loops through the jobs a
			 heading[i].onclick=function() { // shows the desc onclick
			 
			 	
				
			 	var next = this.nextSibling;
				while(next.nodeType != 1) next=next.nextSibling; // if it gets to a non-element node, go to the next one
				//change class of current dt
				this.className=((this.className=="collapsed") ? "expanded" : "collapsed");
				//chage class of the following dd
				next.className=((next.className=="hide") ? "show" : "hide");
					
			}
		 }
	 }
}

function menulistingControls(){
	var togglecontrols=document.getElementById('menulistingcontrols')
    if (togglecontrols){ 
	togglecontrols.style.display = "block";
	    var ToggleListON = document.getElementById('menulistingexpandAll');
	    var ToggleListOFF = document.getElementById('menulistingcollapseAll'); 
		
		    if (ToggleListON && ToggleListOFF){				
				ToggleListON.onclick = function() { toggleMenuAllOn(); }
				ToggleListON.title = "Show all";
				ToggleListON.href = "#e";
			   	ToggleListOFF.onclick = function() { toggleMenuAllOff(); } 
 			   	ToggleListOFF.title = "Hide all";
				ToggleListOFF.href = "#c";
			}
    }
}
/*end faq*/



function load_functions(){
	displayToggle();
	togglelistingControls();
	displayMenuToggle();
	menulistingControls();
}