textonly = {
	textOnly: false,
	toggle: function(me){
		if(!textonly.textOnly){
			textonly.removeImages(me);
			textonly.textOnly = true;
		}else{
			textonly.restoreImages(me);
			textonly.textOnly = false;
		}
	},
	removeImages: function(me){
		me.$$revert = me.innerHTML;
		me.innerHTML = 'Standard View';
		//We convert images into <spans> with alt as the content, and a $$revert property containing the original element!!
		images = $$('img');
		images.each(function(other,i){
			myspan = document.createElement('span');
			if(other.alt != undefined){
				myspan.$$revert = other.clone();
				myspan.innerHTML = other.alt;
				myspan.className = 'ddWasImage';
				$(myspan).replaces(other);
			}
		});
		links = $$('link');
		links.each(function(other,i){
			if(other.rel == 'stylesheet' && other.title == 'Main style'){
				other.href = 'css/text-only.css';
			}
		});
	},
	restoreImages: function(me){
		me.innerHTML = me.$$revert;
		images = $$('.ddWasImage');
		images.each(function(other,i){
			myImage = $(other.$$revert).clone();
			$(myImage).replaces(other);
		});
		links = $$('link');
		links.each(function(other,i){
			if(other.rel == 'stylesheet' && other.title == 'Main style'){
				other.href = 'css/style.css';
			}
		});
	}
}
colapseabless = {
	hideclass: 'hidemenao',
	init: function(){
		head2s = $$('h2');
		colapseables = new Array();
		head2s.each(function(other, i){
			if(other.innerHTML == 'Browse' || other.innerHTML == 'Navigation' || other.innerHTML == 'Engage'){
				colapser = other;
				colapsee = $(other).getNext('div');
				colapseabless.initinner(colapsee);
				colapser.$$colapsee = colapsee;
				//colapser.addEvent('click', colapseabless.colapse);
			}
		});
	},
	initinner: function(other){
		as = other.getElements('a');
		var colapser;var colapsee;var other; //Variables in JS are all to easily passed between functions. So we need to make sure we don't override our callers variables!
		as.each(function(other, j){
			if(other.href.match(/\#$/)){ //We're not going anywhere...
				colapser = other;
				colapsee = $(other).getNext('ul');
				if(colapsee != null){
					other.href = 'javascript:void(1);';
					colapser.$$colapsee = colapsee;
					colapser.addEvent('click', colapseabless.colapse);
				}
			}
		});
	},
	colapse: function(){
		other = $(this.$$colapsee);
		if(other.hasClass(colapseabless.hideclass)){
			$(this).removeClass('colapseablessON');
			other.removeClass(colapseabless.hideclass);
		}else{
			$(this).addClass('colapseablessON');
			other.addClass(colapseabless.hideclass);
		}
	}
}
$(document.window).addEvent('load', function(){
if($('toggletextonly') != null){
	$('toggletextonly').addEvent('click', function(){
		textonly.toggle(this);
	});
	colapseabless.init();
}
});
