// JavaScript Document

var j=0;
function accordion(text)
{
if(text.toString().match("#headlines") == "#headlines")
		 {
	     j++;
		 show(j);
		  j=0;
		 }
		 else if(text.toString().match("#second") == "#second")
		 {
			 j=j+2;
			 show(j);
			j=0;
		 }
		 else
		 {
		  show(j);   
		  
		 }
		 //alert(text);
}

function show(i){
	var stretchers = document.getElementsByClassName('box');
	var toggles = document.getElementsByClassName('tab');
	var myAccordion = new fx.Accordion(
		toggles, stretchers, {opacity: false, height: true, duration: 600}
	);
	//hash functions
	var found = false;
	toggles.each(function(h3, i){
		var div = Element.find(h3, 'nextSibling');
			if (window.location.href.indexOf(h3.title) > 0) {
				myAccordion.showThisHideOpen(div);
				found = true;
			}
		});
		if (!found) myAccordion.showThisHideOpen(stretchers[i]);
}
