// jQuery
$(document).ready(function() {

	// Main Navigation Button Rollovers
	$('#navigation a').hover(
		function(){
			if( !$(this).parent().hasClass('on') ){
				$('img', this).attr('src', 'images/ui/nav/'+$(this).attr('name')+'_on.gif');
			}
		},
		function(){
			if( !$(this).parent().hasClass('on') ){
				$('img', this).attr('src', 'images/ui/nav/'+$(this).attr('name')+'.gif');
			}
		}
	);

	// Login/Logout Button Rollovers
	$('#login_btn, #logout_btn').hover(
		function(){
			$(this).attr('src', 'images/ui/'+$(this).attr('id')+'_on.png');
		},
		function(){
			$(this).attr('src', 'images/ui/'+$(this).attr('id')+'.png');
		}
	);

	// Turn all links with rel="external" into target="_blank"
	$('a').each(function(i){
		if( $(this).attr('rel') == 'external'){
			$(this).attr('target', '_blank');
		}
	});

	// Create 'More Information' toggle links
	$("a.toggle").text('More Information.');
	$("a.toggle").next().toggle();
	$("a.toggle").click(function(){
		$(this).next().toggle("slow", function(e){
			if( $(this).css('display') == 'none' ){
				$(this).prev().text('More Information.');
			}else{
				$(this).prev().text('Less Information.');
			}
		});
		return false;
	});

}); // END DOCUMENT.READY


// Get Variable From Query String
// Modified, but based on http://www.bloggingdeveloper.com/post/JavaScript-QueryString-ParseGet-QueryString-with-Client-Side-JavaScript.aspx
function getQuerystring(key, query){
	query = ( query == '' || query == null ) ? window.location.href : query;
	key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
	var qs = regex.exec(query);
	return qs == null ? '' : qs[1];
}

/*

// Suckerfish
sfHover = function() {
	document.getElementById("productsBtn").onmouseover=function() {
		document.getElementById("productsMenu").style.left="0px";
	}
	document.getElementById("productsBtn").onmouseout=function() {
		document.getElementById("productsMenu").style.left="-999em";
	}
	var sfEls = document.getElementById("browseType").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
*/