// JavaScript Document
// This function fade the color of the menu items
function addFadeEffectToMenuItems() {
	$("#switches li").hover(function () {
			var $this = $(this);
			// On hover, make the color white
			if (!$this.hasClass('active'))
				$this.highlightFade({speed:300,start:'#7e7e7e',end:'#fff',attr:'color'});
		}, function() {
			var $this = $(this);
			// Make the color back to the original
			if (!$this.hasClass('active'))
				$this.highlightFade({speed:300,start:'#fff',end:'#7e7e7e',attr:'color'});
	});
	$("#switches li a").hover(function () {
			var $this = $(this);
			// On hover, make the color white
			if (!$this.hasClass('active'))
				$this.highlightFade({speed:300,start:'#7e7e7e',end:'#fff',attr:'color'});
		}, function() {
			var $this = $(this);
			// Make the color back to the original
			if (!$this.hasClass('active'))
				$this.highlightFade({speed:300,start:'#fff',end:'#7e7e7e',attr:'color'});
	});
}

function addFadeEffectToCloseButton() {
	// Fade in/out over close button in subproject
	$(".close").fadeTo(250, 0.7); // This sets the opacity of the thumbs to fade down to 20% when the page loads
	$(".close").hover(function(){
			$(this).fadeTo(300, 1.0); // This should set the opacity to 100% on hover
		},function(){
			$(this).fadeTo(300, 0.7); // This should set the opacity back to 20% on mouseout  
	});
}

function addFadeEffectToThumbnailPhotos() {
	$(".thumbnailphoto").fadeTo(250, 0.2); // This sets the opacity of the thumbs to fade down to 20% when the page loads
    $(".thumbnailphoto").hover(function(){
            $(this).fadeTo(300, 1.0); // This should set the opacity to 100% on hover
        },function(){
            $(this).fadeTo(300, 0.2); // This should set the opacity back to 20% on mouseout
            
    });
}

function addDefaultEffectOnContactInfo() {
	// Clears and puts back the default texts on the contact form
	$('#inputContactName').focus(function(){
		if(this.value=='NUME...')
		{
			this.value='';
		}
	});
	$('#inputContactName').blur(function(){
		if(this.value=='')
		{
			this.value='NUME...';
		}
	});
	
	$('#inputContactEmail').focus(function(){
		if(this.value=='EMAIL...')
		{
			this.value='';
		}
	});
	$('#inputContactEmail').blur(function(){
		if(this.value=='')
		{
			this.value='EMAIL...';
		}
	});
	
	$('#inputContactMessage').focus(function(){
		if(this.value=='MESAJ...')
		{
			this.value='';
		}
	});
	$('#inputContactMessage').blur(function(){
		if(this.value=='')
		{
			this.value='MESAJ...';
		}
	});
}

function addHoverEffectOnMainProjects() {
	// Handles the slide down effect of the main project boxgrid - shows the project name, description and visit link
	$('.boxgrid.slidedown').hover(function(){
		$(".cover", this).stop().animate({top:'275px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'430px'},{queue:false,duration:300});
	});
}
