

	
header_kepekSzama = 5;
header_kepMagassag = 268;
header_kepvaltasSebessege = 5000; // 5 sec
header_animacioHossza = 2000; // fel sec


fo_kepMagassag = 190;
fo_kepvaltasSebessege = 5000; // 5 sec
fo_animacioHossza = 200; // fel sec

j = 2;

animateFogadjOrokbeI = 1;
fogadjOrokbeTimer = 0;

jQuery(document).ready(function() {

	fo_kepekSzama = jQuery(".kutya_kep").length;

	//animateFogadjOrokbe2();

	jQuery("#kutyak_prev").click(function() {
		if(animateFogadjOrokbeI > 1) animateFogadjOrokbeI--;
		else animateFogadjOrokbeI = fo_kepekSzama;

		var i = animateFogadjOrokbeI;
		$("#kutyak_scroller").animate({
			top: ((i==1)?0:"-"+(fo_kepMagassag*(i-1)))+"px"
			}, fo_animacioHossza, "easeOutExpo");

	//clearTimeout(fogadjOrokbeTimer);
	//fogadjOrokbeTimer = setTimeout("animateFogadjOrokbe2()", 5000);

	});
	 
	jQuery("#kutyak_next").click(function() {
		animateFogadjOrokbeI++;
	      
		if(animateFogadjOrokbeI > fo_kepekSzama) animateFogadjOrokbeI = 1;

		var i = animateFogadjOrokbeI;
		$("#kutyak_scroller").animate({
			top: ((i==1)?0:"-"+(fo_kepMagassag*(i-1)))+"px"
			}, fo_animacioHossza, "easeOutExpo");

	//clearTimeout(fogadjOrokbeTimer);
	// fogadjOrokbeTimer = setTimeout("animateFogadjOrokbe2()", 5000);
	});









	//$("#header").css( {backgroundPosition: "0 0"} )
	animateHeader(1);
	

	
	
	
	var search_input = $("#search_input");
	search_input.focus(function() {
		if(search_input.val() == "Keresés")
			search_input.val("")
	});
	
	search_input.blur(function() {
		if(search_input.val() == "")
			search_input.val("Keresés")
	})
  
	var search_input2 = $("#search_input2");
	search_input2.focus(function() {
		if(search_input2.val() == "Keresés")
			search_input2.val("")
	});
	
	search_input2.blur(function() {
		if(search_input2.val() == "")
			search_input2.val("Keresés")
	})

	
	var email_input = $("#email_input");
	email_input.focus(function() {
		if(email_input.val() == "E-mail:")
			email_input.val("")
	});
	
	email_input.blur(function() {
		if(email_input.val() == "")
			email_input.val("E-mail:")
	})

	
	
	
	// fogadj orokbe forgo
	jQuery("#fogadj_orokbe_kep").click(function() {
		jQuery("img", this).css("opacity", 0);
		animateFogadjOrokbe( j );
		j++;
		
		if( fo_kepekSzama < j ) j=1;
	});
	
	
	
	
	
	// galeria
	/* if( $('ul.galleria').length > 0 ) { 
		$('ul.galleria').galleria({
			history   : true, // activates the history object for bookmarking, back-button etc.
			clickNext : true, // helper for making the image clickable
			insert    : '#main_image', // the containing selector for our main image
			onImage   : function(image,caption,thumb) { // let's add some image effects for demonstration purposes

				// fade in the image & caption
				image.css('display','none').fadeIn(1000);
				caption.css('display','none').fadeIn(1000);

				// fetch the thumbnail container
				var _li = thumb.parents('li');

				// fade out inactive thumbnail
				_li.siblings().children('img.selected').fadeTo(500,0.3);

				// fade in active thumbnail
				thumb.fadeTo('fast',1).addClass('selected');

				// add a title for the clickable image
				image.attr('title','Következő kép >>');
			},
			onThumb : function(thumb) { // thumbnail effects goes here

				// fetch the thumbnail container
				var _li = thumb.parents('li');

				// if thumbnail is active, fade all the way.
				var _fadeTo = _li.is('.active') ? '1' : '0.3';

				// fade in the thumbnail when finnished loading
				thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);

				// hover effects
				thumb.hover(
				function() { thumb.fadeTo('fast',1); },
				function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active
				)
			}
		});
	} */



	jQuery("#overlay, .hirlevel_box_close").click(function () {
		jQuery("#overlay, .hirlevel_box").hide();
	});

	var actual_hirlevel_page = 0;
	var hirlevel_page_cnt = jQuery(".hirlevel_page").length - 1;
	jQuery("#hirlevelek_regebbiek").click(function () {
		
		var left = (jQuery("#hirlevelek_scroller").css("left").replace("px", ""))*1;

		if( left > -hirlevel_page_cnt*240) {
			actual_hirlevel_page--;
			jQuery("#hirlevelek_scroller").animate({
				left: (actual_hirlevel_page*240)+"px"
			},500);
		}
		
	})

	jQuery("#hirlevelek_ujabbak").click(function () {

		var left = (jQuery("#hirlevelek_scroller").css("left").replace("px", ""))*1;

		if( left < -240) {
			actual_hirlevel_page++;
			jQuery("#hirlevelek_scroller").animate({
				left: (actual_hirlevel_page*240)+"px"
			},500);
		}
		else {
			jQuery("#hirlevelek_scroller").animate({
				left: "0px"
			},500);
		}

	})




	// allatkereso cimke pulzalas
	pulsateAllatkeresoSav();





});


function pulsateAllatkeresoSav() {
	jQuery("#allatkereso").animate({
		opacity: 0.5
	}, 2000).animate({
		opacity: 1
	}, 2000);

	setTimeout("pulsateAllatkeresoSav()", 4000);
}





function animateHeader(i) {
	
	//$("#header").animate({ backgroundPosition: "0px "+((i==1)?0:"-"+(header_kepMagassag*(i-1)))+"px"}, header_animacioHossza, "easeOutExpo");
	$("#header_img").animate({
		top: ((i==1)?0:"-"+(header_kepMagassag*(i-1)))+"px"
	}, header_animacioHossza, "easeOutExpo");
	//	jQuery("#header_img").css( "top", ((i==1)?0:"-"+(header_kepMagassag*(i-1)))+"px");

	//document.getElementById("header_img").style.top = ((i==1)?0:"-"+(header_kepMagassag*(i-1)))+"px";

	if( i == header_kepekSzama ) i = 1;
	else i++;
	
	setTimeout( "animateHeader("+i+")", header_kepvaltasSebessege);
	
}


function animateFogadjOrokbe2() {

	if( animateFogadjOrokbeI == fo_kepekSzama ) animateFogadjOrokbeI = 1;
	else animateFogadjOrokbeI++;
	
	$("#kutyak_scroller").animate({
		top: ((animateFogadjOrokbeI==1)?0:"-"+(fo_kepMagassag*(animateFogadjOrokbeI-1)))+"px"
		}, fo_animacioHossza, "easeOutExpo");


	fogadjOrokbeTimer = setTimeout( "animateFogadjOrokbe2()", fo_kepvaltasSebessege);

}


function animateFogadjOrokbe(i) {

	
	$("#fogadj_orokbe").animate({
		backgroundPosition: "0px "+((i==1)?0:"-"+(fo_kepMagassag*(i-1)))+"px"
		}, fo_animacioHossza, "easeOutExpo");
	
	if( i == fo_kepekSzama ) i = 1; 
	else i++;
	
//setTimeout( "animateFogadjOrokbe("+i+")", fo_kepvaltasSebessege);
	
}

// lightboxos tartalom megjelenites. az id-vel meghatarozott reteget jeleniti meg
function showBox( id ) {
	
	if( jQuery("#"+id).css("display") == 'block' ) {
		jQuery("#overlay").hide();
		jQuery("#"+id).hide();
	}
	else {
		jQuery("#overlay").show().height( jQuery(document).height() + "px");
		jQuery("#"+id).show().css("top", (jQuery(document).scrollTop()*1 + 20) + "px");
	}

}



