jQuery.easing.def = "easeInOutQuart";
	var activePage = 0
	var refPosition
	var activeLink = 4;
	var posArray = new Array(0,-817,-817,-415,-980,0);
	$("#h_container").css ("top","-817px");
	function setMenu (id) {
		activePage=0;
		refPosition = 0;
		slideRef();
		$("#c_container").animate({ left: -(id-1)*980+"px" }, 600, "swing");
		$("#h_container").animate({ top: posArray[id]+"px" }, 1200, "swing");
		activeLink = id
	}
	function slideRef (direction) {
			$("#works_container").animate({ left: refPosition }, 800, "swing");
	}
	function refAnim (id , irany) {
		if (irany == 0) {
			$("#"+id).animate({ backgroundColor: "#3a2b1f" , color: "#a1d3d6"}, 200, "linear");
		}
		if (irany == 1) {
			$("#"+id).animate({ backgroundColor: "#a1d3d6" , color: "#3a2b1f"}, 200, "linear");
		}
	}
	
	function oktatocsomagunk_on() {
		$("#bal_oktatocsomagunk").css ("background-position","-332px");	
	}
	
	function oktatocsomagunk_off() {
		$("#bal_oktatocsomagunk").css ("background-position","0px");	
	}
	
	function tanfolyamaink_on() {
		$("#bal_tanfolyamaink").css ("background-position","-332px");	
	}
	
	function tanfolyamaink_off() {
		$("#bal_tanfolyamaink").css ("background-position","0px");	
	}
	
	function haladotarsalgas_on() {
		$("#bal_haladotarsalgas").css ("background-position","-332px");	
	}
	
	function haladotarsalgas_off() {
		$("#bal_haladotarsalgas").css ("background-position","0px");	
	}
	
	function h_menu2_on() {
		$("#menu_op2").css ("background-position","-91px");	
	}
	
	function h_menu2_off() {
		$("#menu_op2").css ("background-position","0px");	
	}
	
	function h_menu3_on() {
		$("#menu_op3").css ("background-position","-107px");	
	}
	
	function h_menu3_off() {
		$("#menu_op3").css ("background-position","0px");	
	}
	
	function h_menu4_on() {
		$("#menu_op4").css ("background-position","-129px");	
	}
	
	function h_menu4_off() {
		$("#menu_op4").css ("background-position","0px");	
	}
	
	function f_menu1_on() {
		$("#f_menu_op1").css ("background-position","-126px");	
	}
	
	function f_menu1_off() {
		$("#f_menu_op1").css ("background-position","0px");	
	}
	
	function f_menu2_on() {
		$("#f_menu_op2").css ("background-position","-93px");	
	}
	
	function f_menu2_off() {
		$("#f_menu_op2").css ("background-position","0px");	
	}
	
	function f_menu3_on() {
		$("#f_menu_op3").css ("background-position","-102px");	
	}
	
	function f_menu3_off() {
		$("#f_menu_op3").css ("background-position","0px");	
	}
	
	function f_menu4_on() {
		$("#f_menu_op4").css ("background-position","-128px");	
	}
	
	function f_menu4_off() {
		$("#f_menu_op4").css ("background-position","0px");	
	}
	
	function css_on() {
		$("#css_valid").css ("background-position","-88px");	
	}
	
	function css_off() {
		$("#css_valid").css ("background-position","0px");	
	}
	
	function xhtml_on() {
		$("#xhtml_valid").css ("background-position","-104px");	
	}
	
	function xhtml_off() {
		$("#xhtml_valid").css ("background-position","0px");	
	}
	
	function logo_on() {
		$("#logolink").css ("background-position","-251px");	
	}
	
	function logo_off() {
		$("#logolink").css ("background-position","0px");	
	}
	
	function toworkOn() {
		$("#towork").css ("background-position","-416px");	
	}
	
	function toworkOff() {
		$("#towork").css ("background-position","0px");	
	}
	
	function prevOn() {
		$(".ref_prev").css ("background-position","-97px");	
	}
	
	function prevOff() {
		$(".ref_prev").css ("background-position","0px");	
	}
	
	function nextOn() {
		$(".ref_next").css ("background-position","-166px");	
	}
	
	function nextOff() {
		$(".ref_next").css ("background-position","0px");	
	}
	
	function szolgaltatasok() {
      		var $target = $('#services');
      		$target = $target.length && $target || $('[name=' + $('#services').slice(1) +']');
      		if ($target.length) {
        		var targetOffset = $target.offset().top;
        		$('html,body').animate({scrollTop: targetOffset}, 1000, 'easeOutBack');
       			return false;
      		}
  	};
	
	function munkaink() {
		activePage++;
		if (activePage==p) {
			activePage=0;
		}
		refPosition = -1*(activePage*(980));
		slideRef();
    };
	
	//header animációk
	
$(document).ready(function(){
	$(".ref_prev").click(function(){
		activePage--;
		if (activePage==-1) {
			activePage = (p-1);
		}
		refPosition = -1*(activePage*(980));
		slideRef();
    });
	
	$(".ref_next").click(function(){
		activePage++;
		if (activePage==p) {
			activePage=0;
		}
		refPosition = -1*(activePage*(980));
		slideRef();
    });
	
	$("#towork").click(function(){
		activePage++;
		if (activePage==p) {
			activePage=0;
		}
		refPosition = -1*(activePage*(980));
		slideRef();
    });
	
	$('a[href*=#]').click(function() {
    	if (location.pathname.replace (/^\//,'') == this.pathname.replace(/^\//,'')&& location.hostname == this.hostname) {
      		var $target = $(this.hash);
      		$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
      		if ($target.length) {
        		var targetOffset = $target.offset().top;
        		$('html,body').animate({scrollTop: targetOffset}, 1000, 'easeOutBack');
       			return false;
      		}
    	}
  	});
	
	$('#menu_op1').click(function() {
      		var $target = $('#services');
      		$target = $target.length && $target || $('[name=' + $('#services').slice(1) +']');
      		if ($target.length) {
        		var targetOffset = $target.offset().top;
        		$('html,body').animate({scrollTop: targetOffset}, 1000, 'easeOutBack');
       			return false;
      		}
  	});
	
	$('#f_menu_op1').click(function() {
      		var $target = $('#services');
      		$target = $target.length && $target || $('[name=' + $('#services').slice(1) +']');
      		if ($target.length) {
        		var targetOffset = $target.offset().top;
        		$('html,body').animate({scrollTop: targetOffset}, 1000, 'easeOutBack');
       			return false;
      		}
  	});
	
	$('#f_menu_op2').click(function() {
      		var $target = $('#header');
      		$target = $target.length && $target || $('[name=' + $('#header').slice(1) +']');
      		if ($target.length) {
        		var targetOffset = $target.offset().top;
        		$('html,body').animate({scrollTop: targetOffset}, 1000, 'easeOutBack');
       			return false;
      		}
  	});
});

