$(document).ready(function() {
	
	 $('.coda-nav a').css('opacity', 0.4);
	 $('.coda-nav a.current').css('opacity', 1);
	 $('#coda-nav-1').css('opacity', 0);
	 
	 $(function () {
		$('.coda-slider').hover(function() { 
			$('#coda-nav-1').stop().animate({"opacity": 1}); 
		}, function () {
			$('#coda-nav-1').stop().animate({"opacity": 0})
		});
	});
	
	$(function () {
		$('#coda-nav-1').hover(function() { 
			$(this).stop().animate({"opacity": 1}); 
		}, function () {
			$(this).stop().animate({"opacity": 1})
		});
	});
	
	$(function () {
		$('.coda-nav a').hover(function() { 
			$(this).stop().animate({"opacity": 1}); 
		}, function () {
			$(this).stop().animate({"opacity": 0.4})
		});
	});
	 
	 $('ul.sf-menu').superfish({ 
		delay:       500,   
		speed:       100,     
		autoArrows:  false,    
		dropShadows: false,
		pathClass:  'current-menu-item',
		pathLevels: 2
	});

	$('.accordion').accordion( {
		collapsible: true,
		autoHeight: true
	});
	
	$(".box-header").toggle(function () {
		$(this).addClass("arrow-up");
		}, 
		function () {
		$(this).removeClass("arrow-up");
		}
	);
	
	
   $('span.image').each(function()
   {
      $(this).qtip({
         content: {
			prerender: true,
			text: '<img class="load" src="' +$(this).attr('title')+ '" alt="" />'
		 },
         style: {
			 width: 500,
			 height: 250,
			 padding: 0,
			 border: {
				 width: 5,
				 color: '#2c2c2c'
		  	 },
			 background: 'url(images/loader.gif) #fff no-repeat center'
		 },
		 position: { 
		 	target: 'mouse' ,
			corner: {
				  target: 'bottomLeft',
				  tooltip: 'bottomLeft'
			   }
		},
		show: {
			delay: 1,
			effect: {
				length: 0
			}
		}
      });
   });
   
   $('.steve-comments a[rel]').each(function()
   {
      $(this).qtip({
         content: {
			prerender: true,
			text: '<strong>Post:</strong> ' + $(this).attr('rel')
		 },
         style: {
			 width: 'auto',
			 padding: 5,
			 border: {
				 width: 0,
				 color: '#dfdfdf'
		  	 },
			 background: '#000',
			 color: '#fff',
			 fontSize: '10px'
		 },
		 position: { 
		 	target: 'mouse' ,
			corner: {
				  target: 'bottomLeft',
				  tooltip: 'bottomLeft'
			   }
		},
		show: {
			delay: 1,
			effect: {
				length: 0
			}
		}
      });
   });
   
   $(function () {
		$('.image img').hover(function() { 
			$(this).stop().animate({"opacity": 0.5}); 
		},
		function() { 
			$(this).stop().animate({"opacity": 1}); 
		});
	});
	
	$(function () {
		$('.pointer').hover(function() { 
			$(this).stop().animate({"opacity": 0.5}); 
		}, function () {
			$(this).stop().animate({"opacity": 1})
		});
	});
	
});

var i = 0;//initialize
var int=0;//Internet Explorer Fix
$(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded
	var int = setInterval("doThis(i)",1);//500 is the fade in speed in milliseconds
});

function doThis() {
	var images = $('.image img').length;//count the number of images on the page
	if (i >= images) {// Loop the images
		clearInterval(int);//When it reaches the last image the loop ends
	}
	$('.image img:hidden').eq(0).fadeIn(500);//fades in the hidden images one by one
	i++;//add 1 to the count
}

