function toggle(id){
	var  div = document.getElementById(id);
	 
	if(div.style.display == 'none' || div.style.visibility == 'hidden'){
		div.style.display= 'block';
		div.style.visibility = 'hidden';
		toggleDiv(id,"open");
	}else{
		toggleDiv(id,"close");
	}
	
}

function closeDivs(){
	document.getElementById('div_1').style.visibility = 'hidden';
	document.getElementById('div_2').style.visibility = 'hidden';
	document.getElementById('div_3').style.visibility = 'hidden';
	document.getElementById('div_4').style.visibility = 'hidden';
	document.getElementById('div_1').style.display = 'none';
	document.getElementById('div_2').style.display = 'none';
	document.getElementById('div_3').style.display = 'none';
	document.getElementById('div_4').style.display = 'none';
}


// The class name of toggle objects which will be initially hidden
var toggleDivClassName = "toggle";
// This controls how slowly the div initially starts moving.
// Lower values case a slower initial move speed. Must be > 1
var toggleDivSpeedMultiplier = 2;
// The delay between each move.
var toggleDivDelay = 10;

// If you only want one toggle DIV to be open at any time, set this to true
var toggleDivOnlyOneOpen = false;

// An array to hold references to all toggleDiv objects on the page
var toggleDivs = new Array();
// Contains the IDs of divs currently being toggled, so you can't stop one mid-open or close
var togglingDivs = new Object();



 
function toggleDiv(divId,action) {
	var d = document.getElementById(divId);
	//if (d==null || d.tagName!="DIV" || !d.offsetHeight || togglingDivs[divId]) { return; }

	d.style.overflow = "hidden";
	if (action=="open" || (typeof(action)=="undefined" && d.style.visibility=="hidden")) {
	 
	// open it
	var originalHeight = d.offsetHeight;
	var height = 1;
	d.style.height = height+"px";
	d.style.visibility = "visible";
	d.style.position="static";
	togglingDivs[divId] = true;
	 setTimeout("toggleObject('"+divId+"','open',"+originalHeight+","+height+")",toggleDivDelay);
	 }
	 else if (action=="close" || (typeof(action)=="undefined" && d.style.visibility=="visible")) {
	// close it
	 var originalHeight = d.offsetHeight;
	 var height = originalHeight;
	 togglingDivs[divId] = true;
	 setTimeout("toggleObject('"+divId+"','close',"+originalHeight+","+height+")",toggleDivDelay);
	 }
}


function toggleObject(divId, openClose, originalHeight, height) {
	 var d = document.getElementById(divId);
	  if (d==null || d.tagName!="DIV") { return; }
	 
	  if (openClose=="open") {
	  height = height * toggleDivSpeedMultiplier;
	  if (height > originalHeight) {
	  d.style.height = originalHeight+"px";
	  delete togglingDivs[divId];
	  }
	 else {
	 d.style.height = height+"px";
	 setTimeout("toggleObject('"+divId+"','"+openClose+"',"+originalHeight+","+height+")",toggleDivDelay);
	 }
	 }
	 else {
	 height = height * (1/toggleDivSpeedMultiplier);
	 if (height <= 1) {
	 d.style.position = "absolute";
	 d.style.visibility = "hidden";
	 d.style.height = originalHeight+"px";
	 delete togglingDivs[divId];
	 }
	 else {
	 d.style.height = height+"px";
	 setTimeout("toggleObject('"+divId+"','"+openClose+"',"+originalHeight+","+height+")",toggleDivDelay);
	 }
	 }
}
