/*
 * @author : Justin Morrow
 * @description : jQuery methods
 *
 */
jQuery(document).ready(function($) {
									
		//refresh cufon after all ajax requests
		$(document).ajaxSuccess(function() {
			Cufon.refresh();
		});

//VML them bad boys	
Cufon.replace('.navigation ul li a, #login form span, #contact form p span, .message, .quote p em, .two-col-content-inner h2, .sidebar-inner h2,   .category-links li a, .tweet_list li, .lfm_song, .lfm_song, .lfm_album, .lfm_artist, .list-view h3, .grid-view h3',{
			hover: true
		});
		
		// Twitter API
		$(".tweet").tweet({
            username: "justinmorrow",
            join_text: "auto",
            avatar_size: 0,
            count: 5,
            auto_join_text_default: "I said,",
            auto_join_text_ed: "I",
            auto_join_text_ing: "I was",
            auto_join_text_reply: "I replied to",
            auto_join_text_url: "I was checking out",
            loading_text: "loading tweets..."
        });
		
		// Last FM API
		$('div#lastfm').lastFM({
			username: 'badbrains83',
			apikey: 'a950ddeec568074046f787e684c7f924',
			number: 4,
			artSize: 'medium',
			noart: 'img/noartwork.gif',
			onComplete: function(){
		}
		});

		// jQuery UI tool tips
		$(".quote a[title], .callout a[title]").tooltip({
			offset: [20, 0],
			effect: 'slide'});
		
		// jQuery Drop down
		$(".category-select").click(function(){
				$(".categories").slideToggle("fast");
		});
				
		// Custom method for categorizing and displaying portfolio peices
		$(".category").click(function(){

				var category = this.id;
				var hideShow = "'.list-view li." + category + ", .grid-view li." + category +  "'";
				
				$(".list-view li, .grid-view li").hide();
				$(".categories").slideToggle("fast");
				$(hideShow).fadeIn("slow");
			
			});
		
		$("#all").click(function(){
				
				$(".list-view li, .grid-view li").hide();
				//$(".categories").slideToggle("fast");
				$(".list-view li, .grid-view li").fadeIn("slow");
				
			});
			
		$(".show-all").click(function(){
				$(".post").hide();
				$(".post").fadeIn("slow");
			});
			
		$(".show-magento").click(function(){
				$(".post").hide();
				$(".magento").fadeIn("slow");
			});
			
		$(".show-wordpress").click(function(){
				$(".post").hide();
				$(".wordpress").fadeIn("slow");
			});

		
		// Login drop down toggle
		$(".login-toggle, .login-close").click(function(){
				$("html, body").animate( { scrollTop: 0 }, 'fast' );
				$("#login").slideToggle("fast");
				$("#contact, .error").hide();
				$(this).toggleClass("active"); return false;
			});

		// Login drop down close
		$(".contact-toggle, .contact-close").click(function(){
				$("html, body").animate( { scrollTop: 0 }, 'slow' );
				$("#contact").slideToggle("fast");
				$("#login, .error").hide();
				$(this).toggleClass("active"); return false;
			});
			
		// Choose list or grid view	
		$(".choose-list").click(function(){
			$(".list-view, .grid-view").hide();
			$(".list-view").fadeIn("slow");
		});
		
		$(".choose-grid").click(function(){
			$(".list-view, .grid-view").hide();
			$(".grid-view").fadeIn("slow");
		});
		
		// System Messages
		$(".message").delay(3000).slideToggle(function(){
			window.location.replace("http://www.morrowinteractive.com");
		});

		// Goofy hover logo
		/*$(".logo-img").hover( function() {
			this.src = this.src.replace("mi_logo","mi_logo_hover");
		},
		function(){
			this.src = this.src.replace("mi_logo_hover","mi_logo");
		});	*/	
		
		$(".logo-img").raptorize();	

		// Scroll back to top
		$(".top-link").click(function(){
			$("html, body").animate( { scrollTop: 0 }, 'fast' );
		});
		
		$(".contact-message").click(function(){
			this.value = "";
		});
		
				
});

