function toggleDivs( divs, display ){
	
	for (var i=0; i < divs.length; i++) {
		toggleDiv( divs[i], display );
	};
	
}

function toggleDiv( id, display ){
	
	var div = document.getElementById( id );
	
	if ( div != null ){
		
		if ( div.style.display == "none" ){
			div.style.display = display;
		}else{
			div.style.display = "none";
		}	
	}
}


///// overlays and messages ////////


function showMsg(){

	offsetPanel( "flash_msg" );
	new Effect.Appear("flash_msg", {duration: .2});
	showModal();	
}

function hideMsg(){
	new Effect.Fade("flash_msg", { duration: .2 });
	hideModal();
}


function showModal(){
	var modal 			= 	document.getElementById( 'modal' );
	new Effect.Appear("modal", {duration: .2});
	
}

function hideModal(){
	new Effect.Fade("modal", {duration: .2});	
}



////////////////////////// UTILITIES ////////////////////////////////////

function offsetPanel( divId ){
	
	var msg				= 	document.getElementById( divId );
	msg.style.display 	= 	"block";
	var overlayHeight	= 	msg.clientHeight;
	msg.style.marginTop		= 	-(overlayHeight/2) + "px";
	
}

function getMaxScroll() {
  return document.documentElement.scrollHeight;
}

function getWinSize(){
	return document.documentElement.clientHeight;
}

function getScrollOffset(){
	
	if (navigator.appName == "Microsoft Internet Explorer"){
		var offset = document.body.scrollTop;
	}else{
		offset = window.pageYOffset;
	}
	
	return offset;
	
}
