		var vyska = screen.height
			avyska = screen.availHeight
			
		var elt = document.getElementById('tab-aboutme');
		elt.style.color='#e48500'; 

/* Contact Form Scripts */

$('#CFName').focus(function(){
	//on focus to input
	
	//check if text is predefined or filled by user
	if($(this).val() == 'Entrez votre nom ...')
	{
	//case that text is predefined by script
		$(this).val('');
	//set value on ''
	$(this).removeClass('PreFilled', function(){
		//remove class PreFilled
		$(this).addClass('ForFill');
		//add Class For Fill
	});
	}else{
	//in case that user filled into form
	return true;	
		
	}
	
	
	
});

$('#CFName').focusout(function(){
	//on focusout from input
	
	//check if text is predefined or filled by user
	if($(this).val() != 'Entrez votre nom ...' && $(this).val()=='')
	{
	//case that field is empty
		
	
		$(this).removeClass('ForFill');
		//remove class PreFilled
		$(this).addClass('PreFilled');
		//add Class For Fill
		$(this).val('Entrez votre nom ...');
		//set value on default
		
	
	}else{
	//in case that user filled into form
	return true;	
		
	}
	
});




$('#CFEmail').focus(function(){
	//on focus to input
	
	//check if text is predefined or filled by user
	if($(this).val() == '... et votre email.')
	{
	//case that text is predefined by script
		$(this).val('');
	//set value on ''
	$(this).removeClass('PreFilled', function(){
		//remove class PreFilled
		$(this).addClass('ForFill');
		//add Class For Fill
	});
	}else{
	//in case that user filled into form
	return true;	
		
	}
	
});

$('#CFEmail').focusout(function(){
	//on focusout from input
	
	//check if text is predefined or filled by user
	if($(this).val() != '... et votre email.' && $(this).val()=='')
	{
	//case that field is empty
	
		$(this).removeClass('ForFill');
		//remove class PreFilled
		$(this).addClass('PreFilled');
		//add Class For Fill
		$(this).val('... et votre email.');
		//set value on default
		
	
	}else{
	//in case that user filled into form
	return true;	
		
	}
});



$('#CFMsg').focus(function(){
	//on focus to input
	
	//check if text is predefined or filled by user
	if($(this).val() == 'Ecrivez votre message ici')
	{
	//case that text is predefined by script
		$(this).val('');
	//set value on ''
	$(this).removeClass('PreFilled', function(){
		//remove class PreFilled
		$(this).addClass('ForFill');
		//add Class For Fill
	});
	}else{
	//in case that user filled into form
	return true;	
		
	}
	
	
	
});

$('#CFMsg').focusout(function(){
	//on focusout from input
	
	//check if text is predefined or filled by user
	if($(this).val() != 'Ecrivez votre message ici' && $(this).val()=='')
	{
	//case that field is empty
		
	
		$(this).removeClass('ForFill');
		//remove class PreFilled
		$(this).addClass('PreFilled');
		//add Class For Fill
		$(this).val('Ecrivez votre message ici');
		//set value on default
		
	
	}else{
	//in case that user filled into form
	return true;	
		
	}
	
});


  $("#CForm").submit(function(event) {

    event.preventDefault(); 
	
	
    var $form = $( this ),
        name = $form.find( 'input[name="name"]' ).val(),
		email = $form.find( 'input[name="email"]' ).val(),
		message = $form.find( 'textarea[name="message"]' ).val(),
        url = $form.attr( 'action' );
		bigurl = url + '?rec=' + ContactFormReciever + '&token=' + Token + '&sub=' + ContactFormSubject;
		
		
		if (name =='' || name == 'Entrez votre nom ...') {
                    $('#WarningMsg').html('Entrez votre nom, s\'il vous plait!');
					$('#CFName').addClass('error');
                    return false;
               		 } else { $('#WarningMsg').html('');
					 $('#CFName').removeClass('error');
					 
					 }
					 //We tried, if isn't nickname empty. In case of empty nickname return error
               
	   var result = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$/.test(email);
	   //Here we are testing email from user, if it is email
	   
			if(result == true){
			$('#WarningMsg').html('');
			$('#CFEmail').removeClass('error');
			
			} else { 
			$('#WarningMsg').html("Entrez votre email s'il vous plait!");
			$('#CFEmail').addClass('error');
			return false;
			}

                
		if (message == '' || message == 'Ecrivez votre message ici') {
			$('#WarningMsg').html("Entrez votre message s'il vous plait!'");
			$('#CFMsg').addClass('error');
			$('#CFMsg').removeClass('okey');	
			return false;
		} else {
		
		$('#WarningMsg').html('');
		$('#CFMsg').removeClass('error');
		$('#CFMsg').addClass('okey');	
			
		}
				//And finally - we are trying, if is something written in textarea for message
		
		
		
    $.post( bigurl, { name: name, email: email, message: message },
      function( data ) {
		  
	  							
				$("#ContactForm").empty();
          		$("#ContactForm").append( "<p style='font-size:18px;margin-top:100px;'> Votre message a bien &eacute;t&eacute; envoy&eacute; !</p>" );
			
      }
    );
  });



$('.PortfolioItem').click(function(event){

event.preventDefault();


$('#LightboxClose').fadeIn(500);
	
$('#Lightbox').fadeIn(LightboxShowTime);

var rel =  $(this).find('a').attr('rel');

if(rel  == 'video')
{
	
	var source = $(this).find('.VideoIframe').html();
	
	$('#Lightbox').html(source);
	
	
}else{



var source = $(this).find('a').attr('href');


var html = '<img id="LightboxImage" src="' + source + '" alt="' + source + '" />';

$('#Lightbox').html(html);


var caption = $(this).find('a').attr('title');

$('#LightboxCaption').empty().html(caption).fadeIn(LightboxShowTime);


}
	
});



$('#Lightbox').click(function(){
	
	$('#LightboxClose').fadeOut(LightboxHideTime);
	$('#Lightbox').fadeOut(LightboxHideTime);
	$('#LightboxCaption').fadeOut(LightboxHideTime);

});

$('#LightboxCaption').click(function(){
	
	$('#LightboxClose').fadeOut(LightboxHideTime);
	$('#Lightbox').fadeOut(LightboxHideTime);
	$('#LightboxCaption').fadeOut(LightboxHideTime);
	
});

$('#LightboxClose').click(function(){
	
	$('#LightboxClose').fadeOut(LightboxHideTime);
	$('#Lightbox').fadeOut(LightboxHideTime);
	$('#LightboxCaption').fadeOut(LightboxHideTime);
	
});


$('#tab-aboutme').click(function(){
	
	var elt = document.getElementById('tab-aboutme');
	elt.style.color='#e48500'; 
	var elt = document.getElementById('tab-portfolio');
	elt.style.color='#FFF'; 
	var elt = document.getElementById('tab-social');
	elt.style.color='#FFF'; 
	var elt = document.getElementById('tab-contact');
	elt.style.color='#FFF'; 
	
	$('#Arrow').animate({
		marginLeft: "432px",
	}, ArrowTime);
	$('#Arrow').removeClass().addClass('AboutMe');
	
});


$('#tab-portfolio').click(function(){
	
	var elt = document.getElementById('tab-aboutme');
	elt.style.color='#FFF'; 
	var elt = document.getElementById('tab-portfolio');
	elt.style.color='#e48500'; 
	var elt = document.getElementById('tab-social');
	elt.style.color='#FFF'; 
	var elt = document.getElementById('tab-contact');
	elt.style.color='#FFF'; 
	
	$('#Arrow').animate({
		marginLeft: "545px",
	}, ArrowTime);
	$('#Arrow').removeClass().addClass('Portfolio');
	
});


$('#tab-social').click(function(){
	
	var elt = document.getElementById('tab-aboutme');
	elt.style.color='#FFF'; 
	var elt = document.getElementById('tab-portfolio');
	elt.style.color='#FFF'; 
	var elt = document.getElementById('tab-social');
	elt.style.color='#e48500'; 
	var elt = document.getElementById('tab-contact');
	elt.style.color='#FFF'; 
	
	$('#Arrow').animate({
		marginLeft: "640px",
	}, ArrowTime);
	$('#Arrow').removeClass().addClass('Social');
	
});

$('#tab-contact').click(function(){
	
	var elt = document.getElementById('tab-aboutme');
	elt.style.color='#FFF'; 
	var elt = document.getElementById('tab-portfolio');
	elt.style.color='#FFF'; 
	var elt = document.getElementById('tab-social');
	elt.style.color='#FFF'; 
	var elt = document.getElementById('tab-contact');
	elt.style.color='#e48500'; 
	
	$('#Arrow').animate({
		marginLeft: "733px",
	}, ArrowTime);
		
	$('#Arrow').removeClass().addClass('Contact');
	
});



$('.PortfolioItem img').hover(function(){
	
	$(this).animate({
		marginTop: "-5px",
		marginBottom: "5px"
	},200);
	var $div = $(this).parent().parent();
	$div.find('.caption').fadeIn(500);
	

	
});

$('.caption').mouseout(function(){
	
	
	$('.caption').fadeOut(50);
	
	var $div = $(this).parent();
	$div.find('img').animate({
		marginTop: "0",
		marginBottom: "0"
	},100);
	
	
});
	

