$(document).ready(function() {
	
	//Visszahivás nyitó
	$('#submit-vissza').click(function () {		
		
		//Get the data from all the fields
		var name = $('input[name=nev]');
		var telefonszam = $('input[name=telefonszam]');
		var urlap = $('input[name=urlapvissza]');

		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		if (name.val()=='') {
			name.addClass('hightlight');
			return false;
		} else name.removeClass('hightlight');
		
		if (telefonszam.val()=='') {
			telefonszam.addClass('hightlight');
			return false;
		} else telefonszam.removeClass('hightlight');
		
		//organize the data properly
		var data = 'name=' + name.val() + '&telefonszam=' + encodeURIComponent(telefonszam.val()) + '&urlap=' + urlap.val();
		
		//disabled all the text fields
		// $('.text').attr('disabled','true');
		
		//show the loading sign
		$('.loading-vissza').show();
		
		//start the ajax
		$.ajax({
			//this is the php file that processes the data and send mail
			url: "hirlevelprocess.php",	
			
			//GET method is used
			type: "GET",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
			//success
			success: function (html) {				
				//if process.php returned 1/true (send mail success)
				if (html==1) {					
					//hide the form
					$('.form-vissza').fadeOut('slow');					
					
					//show the success message
					$('.done-vissza').fadeIn('slow');
					
				//if process.php returned 0/false (send mail failed)
				} else alert('Váratlan hiba történt, kérjük próbálja meg később!');				
			}		
		});
		
		//cancel the submit button default behaviours
		return false;
	});	
});

$(document).ready(function() {
	
	//Visszahivás jobb
	$('#submit-vissza-jobb').click(function () {		
		
		//Get the data from all the fields
		var name = $('input[name=nev]');
		var telefonszam = $('input[name=telefonszam]');
		var urlap = $('input[name=urlapvissza]');

		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		if (name.val()=='') {
			name.addClass('hightlight');
			return false;
		} else name.removeClass('hightlight');
		
		if (telefonszam.val()=='') {
			telefonszam.addClass('hightlight');
			return false;
		} else telefonszam.removeClass('hightlight');
		
		//organize the data properly
		var data = 'name=' + name.val() + '&telefonszam=' + encodeURIComponent(telefonszam.val()) + '&urlap=' + urlap.val();
		
		//disabled all the text fields
		// $('.text').attr('disabled','true');
		
		//show the loading sign
		$('.loading-vissza').show();
		
		//start the ajax
		$.ajax({
			//this is the php file that processes the data and send mail
			url: "hirlevelprocess.php",	
			
			//GET method is used
			type: "GET",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
			//success
			success: function (html) {				
				//if process.php returned 1/true (send mail success)
				if (html==1) {					
					//hide the form
					$('.form-vissza-jobb').fadeOut('slow');					
					
					//show the success message
					$('.done-vissza-jobb').fadeIn('slow');
					
				//if process.php returned 0/false (send mail failed)
				} else alert('Váratlan hiba történt, kérjük próbálja meg később!');				
			}		
		});
		
		//cancel the submit button default behaviours
		return false;
	});	
});	
	

$(document).ready(function() {
	
	//Hirlevél nyitó
	$('#submit').click(function () {		
		
		//Get the data from all the fields
		var name = $('input[name=hirlnev]');
		var email = $('input[name=hirlemail]');
		var urlap = $('input[name=urlap]');

		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		if (name.val()=='') {
			name.addClass('hightlight');
			return false;
		} else name.removeClass('hightlight');
		
		if (email.val()=='') {
			email.addClass('hightlight');
			return false;
		} else email.removeClass('hightlight');
		
		//organize the data properly
		var data = 'name=' + name.val() + '&email=' + email.val() + '&urlap=' + urlap.val();
		
		//disabled all the text fields
		// $('.text').attr('disabled','true');
		
		//show the loading sign
		$('.loading').show();
		
		//start the ajax
		$.ajax({
			//this is the php file that processes the data and send mail
			url: "hirlevelprocess.php",	
			
			//GET method is used
			type: "GET",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
			//success
			success: function (html) {				
				//if process.php returned 1/true (send mail success)
				if (html==1) {					
					//hide the form
					$('.form').fadeOut('slow');					
					
					//show the success message
					$('.done').fadeIn('slow');
					
				//if process.php returned 0/false (send mail failed)
				} else alert('Váratlan hiba történt, kérjük próbálja meg később!');				
			}		
		});
		
		//cancel the submit button default behaviours
		return false;
	});	
});	

$(document).ready(function() {
	
	//Hirlevél jobb
	$('#submit-hirlevel-jobb').click(function () {		
		
		//Get the data from all the fields
		var name = $('input[name=hirlnev]');
		var email = $('input[name=hirlemail]');
		var urlap = $('input[name=urlap]');

		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		if (name.val()=='') {
			name.addClass('hightlight');
			return false;
		} else name.removeClass('hightlight');
		
		if (email.val()=='') {
			email.addClass('hightlight');
			return false;
		} else email.removeClass('hightlight');
		
		//organize the data properly
		var data = 'name=' + name.val() + '&email=' + email.val() + '&urlap=' + urlap.val();
		
		//disabled all the text fields
		// $('.text').attr('disabled','true');
		
		//show the loading sign
		$('.loading').show();
		
		//start the ajax
		$.ajax({
			//this is the php file that processes the data and send mail
			url: "hirlevelprocess.php",	
			
			//GET method is used
			type: "GET",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
			//success
			success: function (html) {				
				//if process.php returned 1/true (send mail success)
				if (html==1) {					
					//hide the form
					$('.form-hirlevel-jobb').fadeOut('slow');					
					
					//show the success message
					$('.done-hirlevel-jobb').fadeIn('slow');
					
				//if process.php returned 0/false (send mail failed)
				} else alert('Váratlan hiba történt, kérjük próbálja meg később!');				
			}		
		});
		
		//cancel the submit button default behaviours
		return false;
	});	
});	


$(document).ready(function() {
	
	//Hibabejelentés
	$('#submit-hibabej').click(function () {		
		
		//Get the data from all the fields
		var name = $('input[name=name]');
		var email = $('input[name=email]');
		var ceg = $('input[name=ceg]');
		var telefon = $('input[name=telefon]');
		var szervizhiba = $('textarea[name=szervizhiba]');
		var urlap = $('input[name=urlap]');

		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		if (name.val()=='') {
			name.addClass('hightlight');
			return false;
		} else name.removeClass('hightlight');
		
		if (ceg.val()=='') {
			ceg.addClass('hightlight');
			return false;
		} else ceg.removeClass('hightlight');
		
		if (telefon.val()=='') {
			telefon.addClass('hightlight');
			return false;
		} else telefon.removeClass('hightlight');
		
		if (email.val()=='') {
			email.addClass('hightlight');
			return false;
		} else email.removeClass('hightlight');
		
		//organize the data properly
		var data = 'name=' + encodeURIComponent(name.val()) + '&email=' + encodeURIComponent(email.val()) + '&ceg=' + 
		encodeURIComponent(ceg.val()) + '&telefon=' + encodeURIComponent(telefon.val()) + '&szervizhiba=' + encodeURIComponent(szervizhiba.val()) + '&urlap=' + urlap.val();
		
		//disabled all the text fields
		// $('.text').attr('disabled','true');
		
		//show the loading sign
		$('.loading').show();
		
		//start the ajax
		$.ajax({
			//this is the php file that processes the data and send mail
			url: "urlapprocess.php",	
			
			//GET method is used
			type: "GET",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
			//success
			success: function (html) {				
				//if process.php returned 1/true (send mail success)
				if (html==1) {					
					//hide the form
					$('.ajanlatkeresf').height('100px');
					$('.hibabejf').height('100px');
					$('.hibabejfal').height('0px');
					$('.hibaform').fadeOut('slow');
					$('.kieg-fej').fadeOut('slow');
					$('.kieg-valaszt').fadeOut('slow');
					$('.hibaform-csillag').fadeOut('slow');
					$('.hibabejgomb').fadeOut('slow');
					$('.hibabejtorgomb').fadeOut('slow');					
					
					//show the success message
					$('.hibaform-done').fadeIn('slow');
					
				//if process.php returned 0/false (send mail failed)
				} else alert('Váratlan hiba történt, kérjük próbálja meg később!');				
			}		
		});
		
		//cancel the submit button default behaviours
		return false;
	});	
});
$(document).ready(function() {
	
	//Általános űrlap
	$('#submit-altform').click(function () {		
		
		//Get the data from all the fields
		var name = $('input[name=name]');
		var email = $('input[name=email]');
		var ceg = $('input[name=ceg]');
		var telefon = $('input[name=telefon]');
		var kerdes = $('textarea[name=kerdes]');
		var targoncaigeny = $('textarea[name=targoncaigeny]');
		var szervizhiba = $('textarea[name=szervizhiba]');
		var urlap = $('input[name=urlap]');
		var cimezett = $('input[name=cimezett]');
		var markafuggetlen = "nem";
		var alkatresz = "nem";
		var hasznalttargonca = "nem";
		var berlet = "nem";
		var takarito = "nem";
		var ujtargonca = "nem";
		var raklap = "nem";
		var gumiakku = "nem";
		var logisztika = "nem";
		var munkavedelem = "nem";
		var emelofal = "nem";
		var rampa = "nem";
		var viszontelado = "nem";
		var hirlevel = "nem";

		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		if (name.val()=='') {
			name.addClass('hightlight');
			return false;
		} else name.removeClass('hightlight');
		
		if (ceg.val()=='') {
			ceg.addClass('hightlight');
			return false;
		} else ceg.removeClass('hightlight');
		
		if (telefon.val()=='') {
			telefon.addClass('hightlight');
			return false;
		} else telefon.removeClass('hightlight');
		
		if (email.val()=='') {
			email.addClass('hightlight');
			return false;
		} else email.removeClass('hightlight');
		
		if($('#chmark').attr('checked') == true) {var markafuggetlen = "igen";}
		if($('#chalk').attr('checked') == true) {var alkatresz = "igen";}
		if($('#chhasznalt').attr('checked') == true) {var hasznalttargonca = "igen";}
		if($('#chberlet').attr('checked') == true) {var berlet = "igen";}
		if($('#chtakarito').attr('checked') == true) {var takarito = "igen";}
		if($('#chuj').attr('checked') == true) {var ujtargonca = "igen";}
		if($('#chraklap').attr('checked') == true) {var raklap = "igen";}
		if($('#chgumiakku').attr('checked') == true) {var gumiakku = "igen";}
		if($('#chlogiszt').attr('checked') == true) {var logisztika = "igen";}
		if($('#chmunkaved').attr('checked') == true) {var munkavedelem = "igen";}
		if($('#chemelofal').attr('checked') == true) {var emelofal = "igen";}
		if($('#chrampa').attr('checked') == true) {var rampa = "igen";}
		if($('#chviszont').attr('checked') == true) {var viszontelado = "igen";}
		if($('#chhirlevel').attr('checked') == true) {var hirlevel = "igen";}
		
		//organize the data properly
		var data = 'name=' + encodeURIComponent(name.val()) + '&email=' + encodeURIComponent(email.val()) + '&ceg=' + 
		encodeURIComponent(ceg.val()) + '&telefon=' + encodeURIComponent(telefon.val()) + '&kerdes='  + encodeURIComponent(kerdes.val()) + '&targoncaigeny=' + encodeURIComponent(targoncaigeny.val()) + '&szervizhiba=' + encodeURIComponent(szervizhiba.val()) + '&urlap=' + urlap.val() + '&markafuggetlen=' + markafuggetlen + '&alkatresz=' + alkatresz + '&hasznalttargonca=' + hasznalttargonca + '&berlet=' + berlet + '&takarito=' + takarito + '&ujtargonca=' + ujtargonca + '&raklap=' + raklap + '&gumiakku=' + gumiakku + '&logisztika=' + logisztika + '&munkavedelem=' + munkavedelem + '&emelofal=' + emelofal + '&rampa=' + rampa + '&viszontelado=' + viszontelado + '&hirlevel=' + hirlevel + '&cimezett=' + encodeURIComponent(cimezett.val());
		
		//disabled all the text fields
		// $('.text').attr('disabled','true');
		
		//show the loading sign
		$('.loading').show();
		
		//start the ajax
		$.ajax({
			//this is the php file that processes the data and send mail
			url: "urlapprocess.php",	
			
			//GET method is used
			type: "GET",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
			//success
			success: function (html) {				
				//if process.php returned 1/true (send mail success)
				if (html==1) {					
					//hide the form
					$('.altformf').height('100px');
					$('.hibabejf').height('100px');
					$('.hibabejfal').height('0px');
					$('.altform').fadeOut('slow');
					$('.altform-plusz').fadeOut('slow');
					$('.kieg-fej').fadeOut('slow');
					$('.kieg-valaszt').fadeOut('slow');
					$('.altform-csillag').fadeOut('slow');
					$('.hibabejgomb').fadeOut('slow');
					$('.hibabejtorgomb').fadeOut('slow');					
					
					//show the success message
					$('.altform-done').fadeIn('slow');
					
				//if process.php returned 0/false (send mail failed)
				} else alert('Váratlan hiba történt, kérjük próbálja meg később!');				
			}		
		});
		
		//cancel the submit button default behaviours
		return false;
	});	
});
