/**
	07/20/2009-01:52:12 PM - cmwise: appearing on /libraries/bierce_scitech/research_tools/index.dot
*/

function fetchSubjectLetterData(thisLetter)
{
	jQuery.get("researchindexsubjhelper.dot?letter="+thisLetter, function(data)
	{
		var out="";
		recordCount=jQuery(data).find('result').find('record').length;
		if(recordCount>0)
		{
			jQuery(data).find('result').find('record').each(function()
			{
				var category_subject = jQuery(this).attr('category_subject'),inode=jQuery(this).attr('inode'), oddoreven = jQuery(this).attr('oddoreven');
				liClass = (oddoreven%2!=0)?"alt alphaLI":"alphaLI";
				out += "<li class=\""+liClass+"\"><a href=\"/libraries/bierce_scitech/research_tools/research_tools_listing.dot?ctg="+inode+"\">"+category_subject+"</a></li>";
			});
		} else {
			out="Currently there are no resources for this selection";
		}
		jQuery("#secondresults .listing").fadeOut('fast',function()
		{
			jQuery("#secondresults .listing").empty().append(out).fadeIn('slow');
		});
		
	});
}
jQuery(document).ready(function()
{
	
	fetchSubjectLetterData('a');
	jQuery(".subjectAZ li").eq(0).css({"background-image":"url(/libraries/bierce_scitech/global/images/template/subject_over.gif)","background-repeat":"no-repeat"});
	jQuery(".subjectAZ li").click(function()
	{
		outErr = "";
		thisIndex = jQuery(".subjectAZ li").index(jQuery(this));
		jQuery(".subjectAZ li").each(function(j)
		{
			if(j==thisIndex)
			{
				jQuery(this).css({"background-image":"url(/libraries/bierce_scitech/global/images/template/subject_over.gif)","background-repeat":"no-repeat"});
				outErr += " +"+j;
			} else {
				jQuery(this).css({"background-image":"none"});
				outErr += " -"+j;
			}
		});
		var thisLetter = jQuery(this).attr('id');
		fetchSubjectLetterData(jQuery(this).attr('id').replace('subject',''));
	});
});


