/* Declare a namespace for the site */
var Collardeau = window.Site || {};

function turnOnSite() {
	alert('foo'); 
}

//function display(foo)
//{
//	alert(foo);
//}

/* Create a closure to maintain scope of the '$'
   and remain compatible with other frameworks.  */
(function($) {

	
	//same as $(document).ready();
	$(function() {
	//DEFAULT

	$('#content').fadeIn(2000); //just a bit of animation

	//display on .client section mouse over
	$('.client').hover(
		function(){
			$(this).children('img').fadeIn(200); //bring in logo
			$(this).css('background-color', '#fff'); 
			var links = $(this).find('a'); //links need to change color
			$(links).css('color', '#000');
			$(links).css('text-decoration', 'underline'); //show clearly as links
	},
		function(){ //on mouse out, reverse
			$(this).children('img').hide(); //bit slow to do that
			$(this).css('background-color', '#000'); 
			var links = $(this).find('a');
			$(links).css('color', '#fff');
			$(links).css('text-decoration', 'none');
		});

	//ajax function
	//ask server for info and loads corresponding video panel in preview window
	$('.client ul li').click(function(){
		//load a bar indicator gif first	
		$("#content").html('<img id=\'loader\' src=\'img/icons/ajax-loader3.gif\'></img>');
		var projectID = $(this).attr('id'); //which project
		var request = "video/preview/" + projectID; //hit this page
			//ajax request
			$.get(request, function(data){
			$("#content").html(data);
			});
	});
	
	//highlight links... as opposed to a:active not responding cause of jquery.  does not work in ie
	$('.editItem a').click(function(){
		$(this).css('color', '#ff4500');
	});
	
	//reveal web site screenshot on hovering link
	$('#web a').hover(
		function(){
			var id = $(this).closest("article").attr("id");
			var url = $(this).attr("href");  //to include link on image
			var path = '<a href=\'' + url + '\'><img src=\'img/screenshots/sites/' + id + '.png\'></img></a>';
			$('#content').html(path); //load the linked image 
			
	});
		
	//fades out instruction on hover, for kicks
	$('#instruction').hover(
		function(){
			$(this).fadeOut(); 
	},
		function(){ //on mouse out, reverse
			$(this).fadeIn(); 
		});
	
});

	$(window).bind("load", function() {
		
	
	});
	
	
})(jQuery);
