
	
	function GetCookie(strName)
	{
		var rgCookies = document.cookie.split("; ");
		
		for (var i=0; i < rgCookies.length; i++)
		{
			var aCrumb = rgCookies[i].split("=");
			if ( aCrumb[0] == strName )
			{
				return unescape(aCrumb[1]);
			}
		}
		
		return "";
	}


	function toggleDescriptions( fUseForm )
	{
		var strShowDescription = GetCookie(g_strShowDescriptionCookieId);

		if ("false" == strShowDescription)
		{
			document.cookie = g_strShowDescriptionCookieId + "=true";
		}
		else 
		{
			document.cookie = g_strShowDescriptionCookieId + "=false";
		}
		reloadPage( fUseForm, false );
	}

	function setSortByRank( fUseForm )
	{
		var strOrderByPropList = g_strSearchSortByRank + g_strSearchSortDesc;
		document.cookie = g_strSortByCookieId + "=" + strOrderByPropList;
		reloadPage( fUseForm, true );
	}

	function setSortByAuthor( fUseForm )
	{
		var strOrderByPropList = GetCookie( g_strSortByCookieId ); 
		if ( g_strSearchSortByAuthor + g_strSearchSortAsc == strOrderByPropList )
		{
			strOrderByPropList = g_strSearchSortByAuthor + g_strSearchSortDesc;
		}
		else
		{
			strOrderByPropList = g_strSearchSortByAuthor + g_strSearchSortAsc;
		}
		document.cookie = g_strSortByCookieId + "=" + strOrderByPropList;
		reloadPage( fUseForm, true );
	}

	function setSortByTitle( fUseForm )
	{
		var strOrderByPropList = GetCookie( g_strSortByCookieId ); 
		if ( g_strSearchSortByTitle + g_strSearchSortAsc == strOrderByPropList )
		{
			strOrderByPropList = g_strSearchSortByTitle + g_strSearchSortDesc;
		}
		else
		{
			strOrderByPropList = g_strSearchSortByTitle + g_strSearchSortAsc;
		}
		document.cookie = g_strSortByCookieId + "=" + strOrderByPropList;
		reloadPage( fUseForm, true );
	}

	function setSortByDate( fUseForm )
	{
		var strOrderByPropList = GetCookie( g_strSortByCookieId ); 
		if ( g_strSearchSortByDate + g_strSearchSortDesc == strOrderByPropList )
		{
			strOrderByPropList = g_strSearchSortByDate + g_strSearchSortAsc;
		}
		else
		{
			strOrderByPropList = g_strSearchSortByDate + g_strSearchSortDesc;
		}
		document.cookie = g_strSortByCookieId + "=" + strOrderByPropList;
		reloadPage( fUseForm, true );
	}

	function reloadPage( fUseForm, fStartFromHitZero )
	{
		if ( fUseForm )
		{
			if ( fStartFromHitZero )
			{
				document.forms[g_strSearchFormId].elements[g_strStartResultsRowId].value = "0";
			}
			return issueLastQuery( g_strDocResultsFormId );
		}
		else
		{
			location.reload();
			return true;
		}
	}


// Print Function

var gAutoPrint = true; // Flag for whether or not to automatically call the print function

function SpecialPrint(pDivSection)
{
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';
		
		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}	

		html += '\n</HEAD>\n<BODY style="font-family: Verdana, Arial, Helvetica, sans-serif;font-style: normal">\n<TABLE width="630">\n<TR>\n<TD>\n';
		
		var printReadyElem = document.getElementById(pDivSection);

		if (printReadyElem != null)
		{
			html += printReadyElem.innerHTML;
		}
		else
		{
			alert("No printing area defined for this page");
			return;
		}

		html += '\n</TD>\n</TR>\n</TABLE>\n</BODY>\n</HTML>';

		var printWin = window.open("","SpecialPrint");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
		printWin.print();
	}
	else
	{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}
}

/*****************************************
* Print iframes
******************************************/

function PrintFrame(FrmName)
{
	try
	{
		window.frames[FrmName].focus(); 
		window.frames[FrmName].print();
	}
	catch(Ex)
	{
		alert('For security reasons your browser does not allow you to print this section. \nPlease right click on the document you want to print out and select "Print"');
	}
	//
	//var PrintDoc = window.open(FrmName, PrintDoc, "toolbar=no,location=no");
	//PrintDoc.print();
}


function addToFavorites(urlAddress, pageName)
{
	if (window.external)
	{
		window.external.AddFavorite(urlAddress,pageName)
	}
	else
	{ 
		alert("Sorry! Your browser doesn't support this function.");
	}
}


/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

if (document.getElementById)
{	//DynamicDrive.com change
	document.write('<style type="text/css">\n')
	document.write('.submenu{display: none;}\n')
	document.write('</style>\n')
}

function SwitchMenu(obj)
{

	if(document.getElementById)
	{
		var el = document.getElementById(obj);
		var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el)
		{
			if(el.style.display != "block")
			{ //DynamicDrive.com change
				for (var i=0; i<ar.length; i++)
				{
					if (ar[i].className=="submenu") //DynamicDrive.com change
					ar[i].style.display = "none";
				}
				el.style.display = "block";
			}
			else
			{
				el.style.display = "none";
			}
		}
	}
}



/***********************************************
* Jump To Top Link Script- © Dynamic Drive (www.dynamicdrive.com)
* Last updated Nov 13th, 03'.
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Specify the text to display
var displayed="<nobr><b><font color='#000000' size='-1'>^ Top</font></b></nobr>"

///////////////////////////Do not edit below this line////////////

var logolink='javascript:window.scrollTo(0,0)'
var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function regenerate(){
window.location.reload()
}
function regenerate2(){
if (ns4)
setTimeout("window.onresize=regenerate",400)
}

if (ie4||ns6)
document.write('<span id="logo" style="position:absolute;top:-300px;z-index:100">'+displayed+'</span>')

function createtext(){ //function for NS4
staticimage=new Layer(5)
staticimage.left=-300
staticimage.document.write('<a href="'+logolink+'">'+displayed+'</a>')
staticimage.document.close()
staticimage.visibility="show"
regenerate2()
staticitns()
}

function staticit()
{ 
	//function for IE4/ NS6
	var w2=ns6? pageXOffset+w : ietruebody().scrollLeft+w
	var h2=ns6? pageYOffset+h : ietruebody().scrollTop+h
	if(crosslogo != null)
	{
		crosslogo.style.left=w2+"px"
		crosslogo.style.top=h2+"px"
	}
}

function staticit2(){ //function for NS4
staticimage.left=pageXOffset+window.innerWidth-staticimage.document.width-28
staticimage.top=pageYOffset+window.innerHeight-staticimage.document.height-10
}

function inserttext()
{ 
	//function for IE4/ NS6
	if (ie4)
		crosslogo=document.all.logo
	else if (ns6)
		crosslogo=document.getElementById("logo")
	if(crosslogo != null)
	{
		crosslogo.innerHTML='<a href="'+logolink+'">'+displayed+'</a>'
		w=ns6 || window.opera? window.innerWidth-crosslogo.offsetWidth-20 : ietruebody().clientWidth-crosslogo.offsetWidth-10
		h=ns6 || window.opera? window.innerHeight-crosslogo.offsetHeight-15 : ietruebody().clientHeight-crosslogo.offsetHeight-10
		crosslogo.style.left=w+"px"
		crosslogo.style.top=h+"px"
	}
	else
	{
		w=ns6;
		h=ns6;
	}
	if (ie4)
		window.onscroll=staticit
	else if (ns6)
		startstatic=setInterval("staticit()",100)
}

if (ie4||ns6){
if (window.addEventListener)
window.addEventListener("load", inserttext, false)
else if (window.attachEvent)
window.attachEvent("onload", inserttext)
else
window.onload=inserttext
window.onresize=new Function("window.location.reload()")
}
else if (ns4)
window.onload=createtext

function staticitns(){ //function for NS4
startstatic=setInterval("staticit2()",90)
}