$(document).ready(function(){
	
	alert = function() {};

	if ($('html').width() > 1024) {
		$('#mycarousel').show();
		jQuery('#mycarousel').jcarousel({
			scroll: 1,
			auto: 4,
			wrap: "circular",
			animation: "1",
			easing: 'linear'
		});
	}  
	$('.e-m-a-j-l-i-k em').html('@');
	$('.e-m-a-j-l-i-k a').attr('href', 'mailto:info@tomasplechac.cz');
		
	$('#contactMe .formHover').hover(
		function () {
			$(this).addClass("borderHover");
		},
		function () {
			$(this).removeClass("borderHover");
		}
	);
	
	$(window).scroll(function () {
		if ($(this).scrollTop() > 0) {
			$('.up').fadeIn();
		} else {
			$('.up').fadeOut();
		}
	});

	$('.up').hide();
	$('.up, .sendmetoContact').bind('click',function(event){
		var $anchor = $(this);
		$('html, body').stop().animate({
			scrollTop: $($anchor.attr('href')).offset().top
		}, 1000);
		event.preventDefault();
	});
	
	$('.contactMe').bind('click',function(event){
		var $anchor = $(this);
		$('html, body').stop().animate({
			scrollTop: $($anchor.attr('href')).offset().top
		}, 1000);
		$('#nameValue').focus();
		event.preventDefault();
	});
	
	// create a style switch button
	var btn ="<a href='javascript:void(0)' class='btn'>Změnit grafické znázornění</a>";
	
	var switcher = $(btn).toggle(
		function(){
			$("#tags ul").hide().addClass("alt").fadeIn("fast");
		},
		function(){
			$("#tags ul").hide().removeClass("alt").fadeIn("fast");
		}
	);
 	$('#tags').append(switcher);
	
	
	// create a sort by alphabet button
	var sortabc = $('<a href="javascript:void(0)" class="btn">Seřadit činnosti abecedně</a>').toggle(
		function(){
			$("#tags ul li").tsort({order:"asc"});
		},	
		function(){
			$("#tags ul li").tsort({order:"desc"});
		}		
		);
 	$('#tags').append(sortabc);		
	
	// create a sort by alphabet button	
	var sortstrength = $('<a href="javascript:void(0)" class="btn">Seřadit činnosti dle relevance</a>').toggle(
		function(){
			$("#tags ul li").tsort({order:"desc",attr:"class"});
		},	
		function(){
			$("#tags ul li").tsort({order:"asc",attr:"class"});
		}		
		);
 	$('#tags').append(sortstrength);	
	
	$('.close').click(
			function () {
				$('.success').hide();
			}
		);		
	

	
});


function resizeFn() {
	if ($('html').width() < 1000) {
		window.location = "http://www.tomasplechac.cz/";
	}
	else if ($('html').width() > 1000) {
		window.location = "http://www.tomasplechac.cz/";
	}
}	

