		var vyska = screen.height
			avyska = screen.availHeight
			desktop = window.innerHeight;


if(desktop > 660)
{ 
	
$('#ShowCard').click(function() {
	
	
			
				
				margin = 50;
			
			$('#Sign').fadeOut(250, function(){
			
				
				$('#Container').animate({
				marginTop: margin},500);
		
			
			
			
			
			
			$('#Header menu').fadeIn(500, function(){
				
			$('#Arrow').fadeIn(250);
			
			
				
			});
			
			});
});

	
$('#HideCard').click(function() {
	
					
				margin = 1080;
			
			
			
				
				$('#Container').animate({
				marginTop: margin},500);
		
			
			
			
			
			
			$('#Arrow').fadeOut(500, function(){
				
			
			$('#Header menu').fadeOut(1000);
			$('#Sign').fadeIn(500);
				
			});
			
         			
});

}else{
	
	
	$('#ShowCard').fadeOut(10);
	$('#HideCard').fadeOut(10);
	$('#Sign').fadeOut(500, function(){
			
	$('#Container').animate({
				marginTop: "50px"},1000);
	
	});
}
/* Contact Form Scripts */



$('#CFName').focus(function(){
	//on focus to input
	
	//check if text is predefined or filled by user
	if($(this).val() == 'Tell us your name ...')
	{
	//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() != 'Tell us your name ...' && $(this).val()=='')
	{
	//case that field is empty
		
	
		$(this).removeClass('ForFill');
		//remove class PreFilled
		$(this).addClass('PreFilled');
		//add Class For Fill
		$(this).val('Tell us your name ...');
		//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() == '... and your 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() != '... and your email.' && $(this).val()=='')
	{
	//case that field is empty
		
	
		$(this).removeClass('ForFill');
		//remove class PreFilled
		$(this).addClass('PreFilled');
		//add Class For Fill
		$(this).val('... and your 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() == 'Write your message here')
	{
	//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() != 'Write your message here' && $(this).val()=='')
	{
	//case that field is empty
		
	
		$(this).removeClass('ForFill');
		//remove class PreFilled
		$(this).addClass('PreFilled');
		//add Class For Fill
		$(this).val('Write your message here');
		//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 == 'Tell us your name ...') {
                    $('#WarningMsg').html('Enter your name, please!');
					$('#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('Enter valid email, please!');
					$('#CFEmail').addClass('error');
					return false;
					}

                
                if (message == '' || message == 'Write your message here') {
					$('#WarningMsg').html('Enter message, please!');
					$('#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( data );
				
      }
    );
  });






$('.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(){
	
	$('#Arrow').animate({
		marginLeft: "432px",
	}, ArrowTime);
	$('#Arrow').removeClass().addClass('AboutMe');
	
});


$('#tab-portfolio').click(function(){
	
	$('#Arrow').animate({
		marginLeft: "545px",
	}, ArrowTime);
	$('#Arrow').removeClass().addClass('Portfolio');
	
});


$('#tab-social').click(function(){
	
	$('#Arrow').animate({
		marginLeft: "640px",
	}, ArrowTime);
	$('#Arrow').removeClass().addClass('Social');
	
});

$('#tab-contact').click(function(){
	
	$('#Arrow').animate({
		marginLeft: "733px",
	}, ArrowTime);
		
	$('#Arrow').removeClass().addClass('Contact');
	
});




$('#b1').click(function(){
	
	$('#p2').fadeOut(PhotoSliderTime, function(){
		
		$('#p3').fadeOut(PhotoSliderTime, function(){
			
			$('#p1').fadeIn(PhotoSliderTime);
			$('#b2').removeClass().addClass('Button');
			$('#b3').removeClass().addClass('Button');
			$('#b1').removeClass().addClass('ButtonActive');
			
		})
	});
});


$('#b2').click(function(){
	
	$('#p1').fadeOut(PhotoSliderTime, function(){
		
		$('#p3').fadeOut(PhotoSliderTime, function(){
			
			$('#p2').fadeIn(PhotoSliderTime);
			$('#b2').removeClass().addClass('ButtonActive');
			$('#b3').removeClass().addClass('Button');
			$('#b1').removeClass().addClass('Button');
		})
		
		
	});
	
	
	
});

$('#b3').click(function(){
	
	$('#p1').fadeOut(PhotoSliderTime, function(){
		
		$('#p2').fadeOut(PhotoSliderTime, function(){
			
			$('#p3').fadeIn(PhotoSliderTime);
			$('#b2').removeClass().addClass('Button');
			$('#b3').removeClass().addClass('ButtonActive');
			$('#b1').removeClass().addClass('Button');
		})
		
		
	});
	
	
	
});


$('.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);
	
	
});



$('#p-b1').click(function(){
	
	$('#PortfolioContainer3').fadeOut(PortfolioTime, function(){
		
		$('#PortfolioContainer2').fadeOut(PortfolioTime, function(){
			
			$('#PortfolioContainer1').fadeIn(PortfolioTime);
			$('#p-b2').removeClass().addClass('Button');
			$('#p-b3').removeClass().addClass('Button');
			$('#p-b1').removeClass().addClass('ButtonActive');
			
		})
		
		
	});
	
	
	
});

$('#p-b2').click(function(){
	
	$('#PortfolioContainer3').fadeOut(PortfolioTime, function(){
		
		$('#PortfolioContainer1').fadeOut(PortfolioTime, function(){
			
			$('#PortfolioContainer2').fadeIn(PortfolioTime);
			$('#p-b1').removeClass().addClass('Button');
			$('#p-b3').removeClass().addClass('Button');
			$('#p-b2').removeClass().addClass('ButtonActive');
			
		})
		
		
	});
	
	
	
});




$('#p-b3').click(function(){
	
	$('#PortfolioContainer1').fadeOut(PortfolioTime, function(){
		
		$('#PortfolioContainer2').fadeOut(PortfolioTime, function(){
			
			$('#PortfolioContainer3').fadeIn(PortfolioTime);
			$('#p-b2').removeClass().addClass('Button');
			$('#p-b1').removeClass().addClass('Button');
			$('#p-b3').removeClass().addClass('ButtonActive');
			
		})
		
		
	});
	
	
	
});


	

