
var App = {
	prepareSecondNav : function(trigger){
			$('#SecNav a').click(function(){
				$('#SecNav .on').removeClass('on');
				$(this).parent('li').addClass('on');
				JSQueryString.changeQuery($(this).attr('class'));
				App.fadeInButton(this);
			});

			$('#SecNav a').hover(
				function(){
					if($(this).parent('li').hasClass('on') == false)
						App.mouseOverButton(this);
				},
				function(){
					if($(this).parent('li').hasClass('on') == false)
						App.mouseOutButton(this);
				}
			);
			if(trigger == 'trigger'){
				$('#SecNav a:first').trigger('click');
			}
	},
	fadeInButton : function(element){
		$('#SecNav').find('img:visible').fadeOut('slow');
		$(element).find('img').fadeIn('slow');
	},
	mouseOverButton : function(element){
		$(element).find('img').fadeIn('slow');
	},
	mouseOutButton : function(element){
		$(element).find('img').fadeOut('slow');
	},
	getTextContents : function(section){
		var text = $(".c .text");
		var h = 0;
		text.animate({opacity:0, height:"0px"},1000,function(){
			$.post("../assets/ajax/ajax.php?action=returnContent",{section:section},function(data){
				text.html(data);
				text.children().each(function(){
					var m_top = $(this).css('margin-top');
					var m_bot = $(this).css('margin-bottom');
					m_top = m_top.substring(0,m_top.length-2);
					m_bot = m_bot.substring(0,m_bot.length-2);
					h += $(this).height() + Number(m_top) + Number(m_bot);
				});
				text.animate({opacity:1, height:(h+10)},1000);
			});
		});
	},
	bindFocus:function(el){
		$(el).focus(function(){
			this.value = ($(this).val() == this.defaultValue) ? "" : $(this).val();
		});
	},
	bindBlur:function(el){
		$(el).blur(function(){
			this.value = ($(this).val() == "") ? this.defaultValue : $(this).val();
		});
	}
}