this.initNavEffects = function(nav) {
	if ($(nav).length) {
		nav = $(nav);
		
		var content = ""
		
		nav.each(function(){
			var that = $(this); 
			content = that.text();
			content = $("<span>" + content + "</span>").css('opacity', .001)
			that.append(content);
		}).hover(	function(){ $(this).find("span").stop(true, false).fadeTo(300, 1) },
					function(){ $(this).find("span").stop(true, false).fadeTo(400, .001) }
				)
		 
	}else{
		return false;
	}
};


this.initLogoHover = function(logo) {
	if ($(logo).length) {
		logo = $(logo);
		
			content = $("<span>&nbsp;</span>").css('opacity', .001)
			logo.append(content);
		
		logo.hover(	function(){ $(this).find("span").stop(true, false).fadeTo(300, 1) },
					function(){ $(this).find("span").stop(true, false).fadeTo(400, .001) }
				)
		 
	}else{
		return false;
	}
} 


this.handleExtLinks = function(links) {
	if ($(links).length) {
		$(links).attr("target", "_blank")
	}else{
		return false;
	}
} 

this.initLogin = function($loginbox) {
	var $btn, $icon;
	$btn = $loginbox.find("h4:eq(0)");
	
	$btn.toggle(function(){
		$loginbox.stop().animate({height: "180px"}, 300);
		/*	$icon.stop().fadeIn(300); 	*/	
	}, function(){
		$loginbox.stop().animate({height: "9px"}, 300);
		/* $icon.stop().fadeOut(300);	*/
	});
	
}

$(function(){
	initNavEffects("ul#mainNav a");
	initLogoHover("div#header #gnetlogo a");
	handleExtLinks("a.ext");
	initLogin($("div.r div#login"));
});
