/*

	File created by Spencer Kellis, Fall Semester 2003
	e-mail: spencerkellis@hotmail.com
	netid: ssk22

*/

/*

	Following function defined so that I can change 
	nav links easily.  Is there a better way?
	
*/

function writeNav() {
	
	var prev		= "<div class=\"nav_link\"><a onmouseover=\"lmo( this );\" onmouseout=\"lmo( this );\" href='";
	var base		= "";		//include base if you are accessing a folder within the lawreview folder
	//var ext		= "aspx";
	var ext			= ".htm";
	var current		= "http://www.law2.byu.edu/law_library/jlwi/index.htm"
	var upcoming		= "http://www.law2.byu.edu/law_library/jlwi/upcoming.htm"
	var archive		= "http://www.law2.byu.edu/law_library/jlwi/archive.htm"		
	var masthead		= "http://www.law2.byu.edu/law_library/jlwi/archives/2011/17LegalWritingii-iii.pdf"	
	var submission		= "http://www.law2.byu.edu/law_library/jlwi/submissions.htm"
	var contact		= "http://www.law2.byu.edu/law_library/jlwi/contact.htm"
	var background		= "http://www.law2.byu.edu/law_library/jlwi/background.htm"
	var goals		= "http://www.law2.byu.edu/law_library/jlwi/goals.htm"
	var edit		= "http://www.law2.byu.edu/law_library/jlwi/edit.htm"
	var policy      = "http://www.law2.byu.edu/law_library/jlwi/policy.htm"
	var aftr		= "</a></div>\n";
	var issue_block 	= "<div class=\"nav_block\"><p style=\"border-bottom:solid 1px white;\">Issues</p>";
	var info_block		= "<div class=\"nav_block\"><p style=\"border-bottom:solid 1px white;\">Information</p>";
	


	document.write( issue_block );
	document.write( prev  + current	+ "'>Current Issue"			+ aftr );
	document.write( prev  + upcoming	+ "'>Upcoming Issue"		+ aftr );
	document.write( prev  + archive	+ "'>Archived Issues"		+ aftr + "</div>" );
	document.write( info_block );
	document.write( prev  + masthead	+ "'>Masthead"				+ aftr );
	document.write( prev  + background + "'>Background"	+ aftr );
	document.write( prev  + goals + "'>Goals & Scope"		+ aftr );
	document.write( prev  + submission+ "'>Submissions"			+ aftr );
	document.write( prev  + contact	+ "'>Contact Information"	+ aftr );
	document.write( prev  + policy + "'>Editorial Board Membership Policies"	+ aftr );
	document.write( prev  + edit + "'>Procedures for Editors" + aftr + "</div>");
	 
	
	
}

/**************************************************************************

	function purpose: add << before links when the user mouses over the link
	also change border/background color on hover.	
	notes: < is &lt; and > is &gt;
	
***************************************************************************/

function lmo( obj ) 
{
	var parentDiv = obj.parentNode;
	if( obj.innerHTML.indexOf( "&lt;" ) == -1 )
	{
		obj.innerHTML = "<< " + obj.innerHTML;
		parentDiv.style.backgroundColor = "#40C8B3";
		parentDiv.style.borderWidth = "1px";
		parentDiv.style.borderStyle = "solid";
		parentDiv.style.borderColor = "#40C8B3";
	}
	else
	{
		obj.innerHTML = obj.innerHTML.substring( obj.innerHTML.lastIndexOf( "&lt;" ) + 4 );
		parentDiv.style.backgroundColor = "#08A58C";
		parentDiv.style.borderWidth = "1px";
		parentDiv.style.borderStyle = "solid";
		parentDiv.style.borderColor = "#08A58C";
	}
}

/************************************************************
	
	Edit the style sheet, property ".issue_element_abstract"
	in order to display/hide the abstract for each article.

************************************************************/

function abst( obj, i ) {

	s = document.styleSheets[0];

	/*ie uses cssRules; nn uses rules, or maybe the other way around*/
	(s.cssRules) ? c = s.cssRules : c = s.rules;
	
	/*if neither is available, we're just giving up*/
	if( !c ) return;
	
	/*locating the .issue_element_abstract element*/
	r = 0;
	while( c[++r].selectorText != ".issue_element_abstract" );
	
	/*editing the stylesheet property (display -> none or -> block)*/
	c[r].style.display == "block" ? c[r].style.display = "none" : c[r].style.display = "block";
	
	/*
	(s.insertRule) ? addRule = s.insertRule : addRule = s.addRule;
	addRule( );
	*/
	
	/*
	MAJOR PROBLEM WITH THIS CODE:
	we need to modify the display property of only one element at a time, not
	every element that has the class ".issue_element_abstract"!
	*/
}

/***************************************************************

	Used on the archive page to load a selected volume/issue

****************************************************************/

function loadArchive() 
{
	//retrieve selected volume and issue values
	var vol = document.forms[ "select_issue" ].elements[ "volume" ].value;
	
	//remember to error check: what issues are not available?
	if( vol == 1004  )
	{
		//do nothing! issues don't exist in the archive as of 13 Feb 2004
	}
	else
	{
		//load new page by setting window.location property
		window.location = "archives/" + vol  + "_1.htm";
	}
}

