// Slideshow (Nivo Slider)
$(window).load(function() {
    $('#slideshow').nivoSlider({
        effect:'sliceDownRight', //Specify sets like: 'fold,fade,sliceDown'
        slices:10,
        animSpeed:700, //Slide transition speed
        pauseTime:10000,
        startSlide:0, //Set starting Slide (0 index)
        directionNav:true, //Next & Prev
        directionNavHide:true, //Only show on hover
        controlNav:false, //1,2,3...
        controlNavThumbs:false, //Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, //Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', //Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
        keyboardNav:true, //Use left & right arrows
        pauseOnHover:true, //Stop animation while hovering
        manualAdvance:false, //Force manual transitions
        captionOpacity:1, //Universal caption opacity
        beforeChange: function(){},
        afterChange: function(){},
        slideshowEnd: function(){}, //Triggers after all slides have been shown
        lastSlide: function(){}, //Triggers when last slide is shown
        afterLoad: function(){} //Triggers when slider has loaded
    });
});

// Cufon
Cufon.replace('h2');
Cufon.replace('li.reference h3, .page-template-page-references-php h3');
Cufon.replace('.page h1, .single h1, .search h1, .category h1, .archive h1');
Cufon.replace('.xoxo h3, .user_meta h3');
Cufon.replace('.hentry h3, .single-reference .entry h3, h3#comments-title, h3#reply-title, h3#comments-header, .tf-header h2, .sf-menu ul li a');
Cufon.replace('.caption-bottom');

// Last childNodes
$("ul li:last").addClass("last");

// Form ürítés
$(document).ready(function() {
	$('input[type="text"], textarea').addClass("idleField");
	$('input[type="text"], textarea').focus(function() {
	$(this).removeClass("idleField").addClass("focusField");
		if (this.value == this.defaultValue){
			this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
	});
   	$('input[type="text"], textarea').blur(function() {
	$(this).removeClass("focusField").addClass("idleField");
		if ($.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}
	});
});

// Képfelirat
$(function(){
	$('img.captify').captify({
		// all of these options are... optional
		// ---
		// speed of the mouseover effect
		speedOver: 'fast',
		// speed of the mouseout effect
		speedOut: 'normal',
		// how long to delay the hiding of the caption after mouseout (ms)
		hideDelay: 0,	
		// 'fade', 'slide', 'always-on'
		animation: 'slide',		
		// text/html to be placed at the beginning of every caption
		prefix: '',		
		// opacity of the caption on mouse over
		opacity: '1',					
		// the name of the CSS class to apply to the caption box
		className: 'caption-bottom',	
		// position of the caption (top or bottom)
		position: 'bottom',
		// caption span % of the image
		spanWidth: '100%'
	});
});

// TipTip
$(function(){
	$(".tiptop").tipTip({defaultPosition:"top"});
});

// Tartalomhoz ugrás
function goToByScroll(id){
	$('html,body').animate({scrollTop: $("#"+id).offset().top}, 1000);
}

// Szegély fade effekt
$(function(){
    $('#home-blog-container ul li img, .caption-wrapper').hover(function(){
        $(this).stop().animate({ borderColor: '#24ABE2' }, 500);
    },
	function() {
        $(this).stop().animate({ borderColor: 'transparent' }, 500);
    });
});

// User kép effekt
$(function() {
	$('ul.team li').hover(function(){
		$(this).find('img').animate({top:'153px'},{queue:false,duration:500});
	}, function(){
		$(this).find('img').animate({top:'0px'},{queue:false,duration:500});
	});
});

//
$(document).ready(function(){ 
	$("ul.sf-menu").superfish({ 
            delay:       200,                            // one second delay on mouseout 
            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
            speed:       'fast',                          // faster animation speed 
            autoArrows:  false,                           // disable generation of arrow mark-up 
            dropShadows: false                            // disable drop shadows 
        }); 
});
