function ajanlatkeres(){
	data = $('#ajanlatform').serialize();
	$.ajax({
	   type: "POST",
	   url: "ajanlatkeres",
	   data: data,
	   success: function(msg){
		 $('#eredmeny').html(msg);
	   }
	 });

 }
 
 function megveszem(){
	data = $('#megveszem').serialize();
	$.ajax({
	   type: "POST",
	   url: "megveszem",
	   data: data,
	   success: function(msg){
		 $('#eredmeny').html(msg);
	   }
	 });

 }
 
 
 
 function slideol(k){
	fooldal_state = k;
	fooldal_stop = 1;
	$('#gomb0').attr('src', "css/images/aktiv.png");
	$('#gomb1').attr('src', "css/images/aktiv.png");
	$('#gomb2').attr('src', "css/images/aktiv.png");
	$('#gomb3').attr('src', "css/images/aktiv.png");
	$('#gomb'+k).attr('src', "css/images/inaktiv.png");
	$('#haromtermekinner').animate({ 'marginLeft': ''+(k * -260)+'px' }, {easing: 'easeOutCubic'}, 400);
    fooldal_stop = 0;
 }
 
 
 function fooldalslide(k){
	fooldal_stop = 1;
	fooldal_state = k;
	$('#haromtermekinner').animate({ 'marginLeft': ''+(k * -500)+'px' }, {easing: 'easeOutCubic'}, 400);
	$('#idetlenseg0').css('font-weight', 'normal');
	$('#idetlenseg1').css('font-weight', 'normal');
	$('#idetlenseg2').css('font-weight', 'normal');
	
	$('#idetlenseg0').css('color', '#3FB013');
	$('#idetlenseg1').css('color', '#3FB013');
	$('#idetlenseg2').css('color', '#3FB013');
	
	$('#idetlenseg0').css('text-decoration', 'none');
	$('#idetlenseg1').css('text-decoration', 'none');
	$('#idetlenseg2').css('text-decoration', 'none');
	
    $('#idetlenseg'+k).css('font-weight', 'bold');
    $('#idetlenseg'+k).css('color', '#EF920E');
	$('#idetlenseg'+k).css('text-decoration', 'underline');
    fooldal_stop = 0;
 } 
 
 var fooldal_state = 0;
 var fooldal_stop = 0;
 function lapozfojobbra(){
	if (fooldal_stop > 0)
		return;
	if(fooldal_state == 3){
		fooldal_state = 0;
	}
	fooldalslide(fooldal_state);
	fooldal_state++;
 }
 
 var fooldal_state = 0;
 var fooldal_stop = 0;
 function lapozajanlatjobbra(){
	if (fooldal_stop > 0)
		return;
	if(fooldal_state == 4){
		fooldal_state = 0;
	}
	ajanlatslide(fooldal_state);
	fooldal_state++;
 }
 
 function ajanlatslide(k){
	fooldal_state = k;
	fooldal_stop = 1;
	$('#haromtermekinner').animate({ 'marginLeft': ''+(k * -560)+'px' }, {easing: 'easeOutCubic'}, 400);
	$('#idetlenseg0').css('font-weight', 'normal');
	$('#idetlenseg1').css('font-weight', 'normal');
	$('#idetlenseg2').css('font-weight', 'normal');
	$('#idetlenseg3').css('font-weight', 'normal');
	
	$('#idetlenseg0').css('color', '#3FB013');
	$('#idetlenseg1').css('color', '#3FB013');
	$('#idetlenseg2').css('color', '#3FB013');
	$('#idetlenseg3').css('color', '#3FB013');
	
	$('#idetlenseg0').css('text-decoration', 'none');
	$('#idetlenseg1').css('text-decoration', 'none');
	$('#idetlenseg2').css('text-decoration', 'none');
	$('#idetlenseg3').css('text-decoration', 'none');
	
    $('#idetlenseg'+k).css('font-weight', 'bold');
    $('#idetlenseg'+k).css('color', '#EF920E');
	$('#idetlenseg'+k).css('text-decoration', 'underline');
    fooldal_stop = 0;


	h = $('#ajanlat'+k).height();
	h = Math.max(h, 200);
	$('#haromtermek').height(h+20);
	$('#haromtermekinner').height(h+20);
 }
 
 var fooldal_state = 0;
 var fooldal_stop = 0;
 function lapozjobbjobbra(){
	if (fooldal_stop > 0)
		return;
	if(fooldal_state == jobbdarab){
		fooldal_state = 0;
	}
	slideol(fooldal_state);
	fooldal_state++;
	
 }
 
 $().ready(function(){
	
	if($('#ajanlat0').length > 0){
		//setInterval("lapozajanlatjobbra()", 10000);
	}else if($('#rightajanlatok').length > 0){	
		setInterval("lapozjobbjobbra()", 10000);
	}else if($('#tovabbihirek').length > 0){		
		//nothing;
	}else{
		setInterval("lapozfojobbra()", 10000);
	}
 });
 
 hirpos = 0;
 function hirbalra(){
	if(hirpos < 1)
		return;
	hirpos--;
	$('#haromtermekinner').animate({ 'marginLeft': ''+(hirpos * -500)+'px' }, {easing: 'easeOutCubic'}, 400);
	$('#oldalszam').html(hirpos+1);
 } 
 
 function hirjobbra(){
	hirpos++;
	$('#haromtermekinner').animate({ 'marginLeft': ''+(hirpos * -500)+'px' }, {easing: 'easeOutCubic'}, 400);
	$('#oldalszam').html(hirpos+1);
 } 
 
 function up(){
	$('html,body').animate({scrollTop:0}, {easing: 'easeOutCubic'}, 600);
 }