//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Articles JS
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//Document Ready +++++
$(function() {			
	//Detect IE and Redirect
	if($.browser.msie && location.href.indexOf("ie.html") == "-1"){
		window.location="/ui/errors/ie.html";
	}  
	//Click Action
	$("li#nav-portfolio a, li#nav-about a, li#nav-contact a,a.button-proposal,input#submit,li#nav-article a, li#nav-comments a, li#nav-respond a,a.article-list").mousedown(function(){ $(this).addClass("pressed"); });
		$("li#nav-portfolio a, li#nav-about a, li#nav-contact a,a.button-proposal,input#submit,li#nav-article a, li#nav-comments a, li#nav-respond a,a.article-list").mouseout(function(){ $(this).removeClass("pressed"); }).mouseup(function(){  $(this).removeClass("pressed"); })
		
	//Scroll To Animation
	//Articles Nav - Initialization
	$("li#nav-article a").addClass("enabled");
	$("li#nav-comments a").addClass("enabled");
	$("li#nav-respond a").addClass("enabled");
	
	//Article Nav - Only allow them to click article it if it's enabled
	if($("li#nav-article a").hasClass("enabled")){
		$("li#nav-article a").click(function(e){
			e.preventDefault();
			//Turn off the button
			$(this).removeClass("enabled");
			//Scroll
			$.scrollTo("#page", 1000, {easing:"easeOutExpo",offset:-50, onAfter:function(){ 
				$(this).addClass("enabled");
			}} );
		});
	}
	//Comments Nav - Only allow them to click comments it if it's enabled
	if($("li#nav-comments a").hasClass("enabled")){
		$("li#nav-comments a").click(function(e){
			e.preventDefault();
			//Turn off the button
			$(this).removeClass("enabled");
			//Scroll
			$.scrollTo("#comments", 1000, {easing:"easeOutExpo",offset:-50, onAfter:function(){ 
				$(this).addClass("enabled");
			}} );
		});
	}
	//Respond Nav - Only allow them to click respond it if it's enabled
	if($("li#nav-respond a").hasClass("enabled")){
		$("li#nav-respond a").click(function(e){
			e.preventDefault();
			//Turn off the button
			$(this).removeClass("enabled");
			//Scroll
			$.scrollTo("#respond", 1000, {easing:"easeOutExpo",offset:-30, onAfter:function(){ 
				$(this).addClass("enabled");
			}} );
		});
	}
	
	//Click Action for Various Buttons (using jQuery Live so the -/+ buttons work)
	$(".jcarousel-prev,.jcarousel-next").live("mousedown", function(){ $(this).addClass("pressed"); });
		$(".jcarousel-prev,.jcarousel-next").live("mouseout", function(){ $(this).removeClass("pressed"); }).live("mouseup", function() { $(this).removeClass("pressed"); });	
	

}); //End Document Ready

