/* START: /wp-srv/js/story/storyUtils.js */

/* import statements */
// document.write('<s\cript src="http://www.washingtonpost.com/wp-srv/js/utilsStatic.js"></s\cript>')

var active_nav_position = '' ;
var twiddle_off = '+' ;
var twiddle_on = String.fromCharCode(187) ;

function showExpandoDown(id_nav,class_name,id_expando) {
	id_nav = fixActiveNavName(id_nav);
	if ( document.getElementById(id_nav) && document.getElementById(id_expando) ) {
		replaceClassName(id_nav,class_name,class_name+'-active');
		replaceLastInstanceOf(id_nav,twiddle_off,twiddle_on);
		showContentDown(id_nav,id_expando,{x:0,y:-1});
		//hideTags('form','wrapperMainCenter');
	}
}
function showExpandoUp(id_nav,class_name,id_expando) {
	id_nav = fixActiveNavName(id_nav);
	if ( document.getElementById(id_nav) && document.getElementById(id_expando) ) {
		replaceClassName(id_nav,class_name,class_name+'-active');
		replaceLastInstanceOf(id_nav,twiddle_off,twiddle_on);
		showContentUp(id_nav,id_expando,{x:0,y:1});
		//hideTags('form','wrapperMainCenter');
	}
}
function showExpando(id_nav,class_name,id_expando) {
	id_nav = fixActiveNavName(id_nav);
	if ( document.getElementById(id_nav) && document.getElementById(id_expando) ) {
		replaceClassName(id_nav,class_name,class_name+'-active');
		showContent(id_expando);
		replaceLastInstanceOf(id_nav,twiddle_off,twiddle_on);
		//hideTags('form','wrapperMainCenter');
	}
}
function hideExpando(id_nav,class_name,id_expando) {
	id_nav = fixActiveNavName(id_nav);
	if ( document.getElementById(id_nav) && document.getElementById(id_expando) ) {
		replaceClassName(id_nav,class_name+'-active',class_name);
		hideContent(id_expando);
		replaceLastInstanceOf(id_nav,twiddle_on,twiddle_off);
		showTags('form','wrapperMainCenter');
	}
}
function setActiveNavPosition(name) {
	active_nav_position = name ;
}
function fixActiveNavName(id_name) {
	id_name = id_name.replace("POS",active_nav_position);
	return id_name ;
}
function appendSidToAnchor(a) {
	var url = a.href ;
	if ( typeof thisItem != "undefined" && typeof thisItem.story_active != "undefined" && typeof thisItem.story_active.id != "undefined" && thisItem.story_active.id != "" ) {
		if ( url.indexOf("sid=ST") == -1 ) {
			url += ( url.indexOf('?') == -1 ) ? '?' : '&' ;
			url += "sid="+thisItem.story_active.id ;
		}
	}
	a.href = url ;
}
function appendPositionToAnchor(a,pos) {
	if ( typeof otto != 'undefined' && otto.wasTestAlreadyRun('wp_storynav') ) {
		var url = a.href ;
		if ( url.match("(([\?&]s_pos=)[^&]*)") ) {
			var keyvalue = RegExp.$1 ;
			var key = RegExp.$2 ;
			url = url.replace(keyvalue, key+pos ) ;
		} else {
			url += ( url.indexOf('?') == -1 ) ? '?' : '&' ;
			url += "s_pos="+pos ;
		}
		a.href = url ;
	}
}
/* END: /wp-srv/js/story/storyUtils.js */