window.addEvent('domready', function(){});


function slidein(section){
		var myFx = new Fx.Slide(section);
		myFx.slideOut();
}

function slideout(section){
		var myFx = new Fx.Slide(section);
		myFx.slideIn();
}
function hide(section){
	if(document.getElementById('s_' + section)){
		var mySlide = new Fx.Slide('s_' + section).hide();
	}
}

function show(section){
	slideout('s_' + section);
	document.getElementById('a_'+section).innerHTML = '<a style="color: #B46D03; font-style: italic;" href="javascript:minimise(\'' + section + '\');">SHOW LESS</a>';
}

function minimise(section){
	slidein('s_' + section);
	document.getElementById('a_'+section).innerHTML = '<a style="color: #F9B41D;" href="javascript:show(\'' + section + '\');">READ MORE</a>';
}

function showW(section){
	slideout('s_' + section);
	document.getElementById('a_'+section).innerHTML = '<a style="color: #FFFFFF; font-style: italic;" href="javascript:minimiseW(\'' + section + '\');">SHOW LESS</a>';
}

function minimiseW(section){
	slidein('s_' + section);
	document.getElementById('a_'+section).innerHTML = '<a style="color: #FFFFFF;" href="javascript:show(\'' + section + '\');">READ MORE</a>';
}

function checkIncomingUrl(){
	// get the incoming story parameter
	var story = gup( 'story' );
	//hide all the stories
	for(var n=1; n<10; n++){
		hide('story0' + n);
	}
	for(var n=10; n<30; n++){
		hide('story' + n);
	}
	// go to the right story
	if(story != ''){
		show(story)
		window.location.href = "#" + story;
	}
}

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}