FANDOM


/*
*/

/** Collapsible Edittools *************************************
 *
 * Author: Dantman
 */

var edittools;
var edittools_head;
var edittools_button;
var edittools_button_text;
var edittools_content;

var edittools_cookiename = 'autoCollapseEdittools';
var edittools_cookiepos = document.cookie.indexOf(edittools_cookiename+'=');
var edittools_cookievalue = "";
if (edittools_cookiepos > -1) {
	edittools_cookiepos = edittools_cookiepos + edittools_cookiename.length + 1;
	var edittools_cookieend = document.cookie.indexOf(";", edittools_cookiepos);
	if (edittools_cookieend > -1) {
		edittools_cookievalue = document.cookie.substring(edittools_cookiepos, edittools_cookieend);
	} else {
		edittools_cookievalue = document.cookie.substring(edittools_cookiepos);
	}
}
		
addOnloadHook(setupCollapseibleEdittools);
function setupCollapseibleEdittools() {
	edittools = document.getElementById( 'edittools' );
	
	if( edittools ) {
		edittools_head    = document.getElementById( 'edittools_head' );
		edittools_content = document.getElementById( 'edittools_content' );
		edittools_button = document.createElement("a");
		edittools_button.setAttribute('id', 'edittools_button');
		edittools_button.setAttribute('href', 'javascript:void(0);');
		edittools_button.setAttribute('onclick', 'javascript: toggleEdittools(true);');
		edittools_button_text = document.createTextNode(NavigationBarHide);
		edittools_button.appendChild(edittools_button_text);
		edittools_head.getElementsByTagName('p')[0].appendChild(edittools_button);
		if( edittools_cookievalue == 'true' ) toggleEdittools(false);
	}
}
function toggleEdittools(doCookie) {
	var date = new Date();
	if( edittools_button_text.data == NavigationBarShow ) {
		date.setTime(date.getTime() - 30*86400*1000);
		edittools_button_text.data = NavigationBarHide;
		edittools_content.style.display = 'block';
		if(doCookie) document.cookie = edittools_cookiename + "=false; expires="+date.toGMTString() + "; path=/";
	} else {
		date.setTime(date.getTime() + 30*86400*1000);
		edittools_button_text.data = NavigationBarShow;
		edittools_content.style.display = 'none';
		if(doCookie) document.cookie = edittools_cookiename + "=true; expires="+date.toGMTString() + "; path=/";
	}
}

/*<pre>*/