/**
*
*	JavaScript donde hay las funciones necesarias para hacer el over de los links,
*	y de los contenidos con imagenes.
*/

var orange = "#ff9d02";
var softOrange = "#FFC78E";
var ligthOrange = "#FFE9D9";
var white = "#fff";
var newOrange = "#FFE2AE";

jQuery.fn.mouseOverAnimation = function(startColor,endColor,time) {
   //para cada uno de los elementos del objeto jQuery
   this.each(function(){
	  //ponemos el elemento link en una variable
	  
		var link = $(this);
		
		//alert("find : "+link.find('img'));
		//if($(this).has('img').length == 0){
			link.css({position:'relative',zIndex:'10',paddingLeft:'5px',
					paddingRight:'5px'});
				
			var linkWidth = link.width() + 10;
	
			link.prepend( $('<div>')
				.attr('class', 'background')
				.css({
					backgroundColor:'#FFE2AE',
					position: 'absolute',
					top:0,
					left:0,
					zIndex:-1,
					width:linkWidth, 
					height:link.height(),
					opacity:0,
					'-moz-border-radius': '6px',
  					'-webkit-border-radius': '6px',
          			'border-radius': '6px'
				})
			);
			
			link.mouseover(
				// fade background div out when cursor enters, 
				function() { 
					$(".background",link).stop().animate({opacity:1}); 
				});
			link.mouseout( 
				// fade back in when cursor leaves
				function() { 
					$(".background",link).stop().animate({opacity:0}) 
				});
		//}
	  
	  	/*
		link.mouseover(function(event){
			link.animate({ backgroundColor: newOrange }, time);

		});
		link.mouseout(function(event){
			//$("#e1_capa1").removeClass("iluminacionCapa1");
			//$("#e1_capa1").animate({ backgroundColor: "white" }, 1000);
			link.stop(true);
			//link.animate({ backgroundColor: 'transparent' }, time);
			//link.css({backgroundColor : 'transparent'});
			//link.css({ 'background-color': 'transparent' }, 600)
		});
		*/
	  
   });
   //siempre tengo que devolver this
   return this;
};


jQuery.fn.mouseOverThumbnail = function(hightLightColor,backColor,titleColor,excerpColor,time) {
	
	//para cada elemento que comparta el selector
	this.each(function(){
		var thumbnail = $(this);
		
		//si pasamos por encima del div
		thumbnail.mouseover(function(){
			var parent = thumbnail.closest('.projectThumbnail');
			parent.find('.projectThumbnailImage').animate({backgroundColor:softOrange},time);
			//parent.find('.projectThumbnailTitle').animate({color:hightLightColor},time);
			//parent.find('p').animate({color:hightLightColor},time);
		});
		thumbnail.mouseout(function(){
			var parent = thumbnail.closest('.projectThumbnail');
			parent.find('.projectThumbnailImage').stop(true).animate({backgroundColor:backColor},time);
			//parent.find('.projectThumbnailTitle').stop(true).animate({color:titleColor},time);
			//parent.find('p').stop(true).animate({color:excerpColor},time);
		});
		
	});
	
	//siempre devolver this
	return this;
};



