// JavaScript Document

function appear_legal() {
   var legalPopup = $('legal_popup');
   var fx = legalPopup.effects({duration: 1000});
   fx.start({'opacity':1});
   //original function
   //new Effect.Appear('legal_popup', { duration: 0.5});
   //return false;
}

function disappear_legal() {
	 var legalPopup = $('legal_popup');
   var fx = legalPopup.effects({duration: 1000});
   fx.start({'opacity':0});
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	//if it's already open then shut it as a toggle.
	if(document.getElementById(id).style.display == 'block' || document.getElementById(id).style.display == ''){
		hideallids();
	}else{
		if (document.getElementById) { // DOM3 = IE5, NS6
			document.getElementById(id).style.display = 'block';
		}
		else {
			if (document.layers) { // Netscape 4
				document.id.display = 'block';
			}
			else { // IE 4
				document.all.id.style.display = 'block';
			}
		}
		//change the arrow to point down
		document.getElementById(id+"_arrow").style.background = 'url(/wp-content/themes/hecht-solberg/images/arrow-down.gif) no-repeat';
		
		//close everything else
		//loop through the array and hide each element by id
		for (var i=0;i<ids.length;i++){
			if(ids[i] != id){
				hidediv(ids[i]);
				//change the arrow to point to the right
				document.getElementById(ids[i]+"_arrow").style.background = 'url(/wp-content/themes/hecht-solberg/images/arrow-right.gif) no-repeat';
			}
		}	
	}
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
		//change the arrow to point to the right
		document.getElementById(ids[i]+"_arrow").style.background = 'url(/wp-content/themes/hecht-solberg/images/arrow-right.gif) no-repeat';
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function toggleFOC(type) {
	
	switch(type){
	case "show":  
	  document.getElementById("toggleMe").style.visibility = "visible";
	  break;
	case "hide":
	  document.getElementById("toggleMe").style.visibility = "hidden";
	  break;
	}
}

function toggleBLS(type) {
	
	switch(type){
	case "show":  
	  document.getElementById("toggleMe2").style.visibility = "visible";
	  break;
	case "hide":
	  document.getElementById("toggleMe2").style.visibility = "hidden";
	  break;
	}
}