var exists;
var allStretch;
var moreHidden;

//the main function, call to the effect object
function init(){
	var divs = document.getElementsByClassName("stretcher");
	allStretch = new fx.MultiFadeSize(divs, {duration: 400});

	items = document.getElementsByClassName("display");
	for (i = 0; i < items.length; i++){
		var h4 = items[i];
		div = h4.nextSibling;
		h4.title = h4.className.replace("display ", "#");

		if (window.location.href.indexOf(h4.title) < 0) {
			allStretch.hide(div, 'height');
			if (exists != true) exists = false;
		} else {
			showHideMoreLinks('more' + h4.title);
			exists = true;
		}
		h4.onclick = function() {
			allStretch.showThisHideOpen(this.nextSibling, 100, 'height');
			showHideMoreLinks(this.id);
		}
	}
	// rest of article paras are now child[3] not child[1]
	//if (exists == false) showHideMoreLinks('');
}

function showHideMoreLinks(s) {
	// show all more links
	var moreLinks = document.getElementsByClassName("display");
	for (x = 0; x < moreLinks.length; x++) {
		var moreStyle = document.getElementById(moreLinks[x].id).style;
		if (moreStyle.display == 'none') moreStyle.display = 'block';
		// hide clicked more link
		if (s == moreLinks[x].id) moreStyle.display = 'none';
	}
}