$(document).ready(function(){ 	

		//imagefade

		$('#maincontentindex').innerfade({
			animationtype: 'fade', 
			speed: 'slow', 
			timeout: 10000, 
			type: 'sequence', 
			containerheight: '374px' 
		}); 
		
		//twitter feeds
		
        $(".tweet").tweet({
            username: "kustomflow",
            join_text: "auto",
            count: 1,
            auto_join_text_default: "",
            auto_join_text_ed: "",
            auto_join_text_ing: "",
            auto_join_text_reply: "In reply to",
            auto_join_text_url: "Checking out",
            loading_text: "loading tweets..."
        });
		
		//hover gallery
		
		$("ul.gallery li").hover(function() { //On hover...

			var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'

			//Set a background image(thumbOver) on the <a> tag - Set position to bottom
			$(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});

			//Animate the image to 0 opacity (fade it out)
			$(this).find("span").stop().animate({opacity: 0}, 300);

		} , function() { //on hover out...

			//Animate the image back to 100% opacity (fade it back in)
			$(this).find("span").stop().animate({opacity: 1}, 300);

		});	
		
		//scroller on about page

		$('#slide').cycle({
			fx: 'scrollHorz', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
			timeout: 0 
		});
			$('#goto1').click(function() { 
			$('#slide').cycle(0); 
			return false; 
		});
		$('#goto2').click(function() { 
			$('#slide').cycle(1); 
			return false; 
		});
		$('#goto3').click(function() { 
			$('#slide').cycle(2); 
			return false; 
		});	
		$('#goto4').click(function() { 
			$('#slide').cycle(3); 
			return false; 
		});	
		
		$('.target').bt({
			padding: 10,
			width: 100,
			spikeLength: 10,
			spikeGirth: 15,
			cornerRadius: 0,
			positions: 'bottom',
			fill: 'rgba(204, 204, 204, .6)',
			cssStyles: {color: '#FFF', fontWeight: 'bold'}
		});

		// rel external js
		function externalLinks() {
		if (!document.getElementsByTagName) return;
		var anchors = document.getElementsByTagName("a");
		for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") &&
		   anchor.getAttribute("rel") == "external")
			anchor.target = "_blank";
		}
		}
		window.onload = externalLinks;		
	
	} 
); 
