<style>
	td{
		padding: 2px 0 2px 20px;
		vertical-align: top;
		color: #555;
	}
	
	#uploadForm input[type=text], select, textarea{
		border: 1px solid #555;
		padding: 3px;
		width: 280px;
		background: #ddd;
	}
	
	.percentage{
		float: right;
	}
	
	.percentage img{
		margin: 0 !important;
	}
	
	.s-jobbratav{
		padding-right: 20px;
	}
	
	.szamla{
		display: none;
	}
	
</style>

<div style="width: 872px;">
<form action="/services/submit<?=$infix?>" method="post" id="uploadForm">
<input type="hidden" name="service" value="<?=$infix?>" />
<input type="hidden" name="darab" value="<?=$ar?>" />
<input type="hidden" name="tenyleges" value="<?=$tenyleges?>" />

<h2 class="s-h2"><span class="services-kek"><?=lang('services_'.$infix)?></span> <span style="color: #c0c0c0;">&#8211;</span> <?=lang('services_orderp')?></h2>

<span class="s-h2" style="font-size: 16px; margin-left: 10px;"><?=$csomag?></span><br /><br />

<span class="s-h2" style="font-size: 16px; margin-left: 10px;">Ár: <?=$alapar?> + Áfa
<?if($ar>3):?> + <?=lang('services_prices_50fee')?> = <?=($tenyleges*1.5)?> Ft + Áfa<?endif;?></span>
<br><br>

<div class="bigstep-box-top1">
<span class="s-h2"><?=lang('services_signup')?></span> <span class="services-vilagos__" style="font-size: 14px; margin-left: 15px; color: #707070;"><?=lang('services_fillform')?></span>

</div>
<div class="bigstep-box">

<?if($_SESSION['szolg_hiba']!=""):?>
	<div style="text-align: center; color: #c00;"><?=$_SESSION['szolg_hiba']?></div>
	<?
		$_SESSION['szolg_hiba'] = "";
		unset($_SESSION['szolg_hiba']);
	?>
<?endif;?>

<table>
<tr>
	<td><?=lang('name')?>: *</td>
	<td class="s-jobbratav"><input type="text" name="name" id="name" /></td>
	<td><?=lang('events_form_zip')?>: *</td>
	<td><input type="text" name="zip" id="zip" /></td>
</tr>
<tr>
	<td><?=lang('services_from_com')?>:</td>
	<td class="s-jobbratav"><input type="text" name="company" id="company" /></td>
	<td><?=lang('events_form_city')?>: *</td>
	<td><input type="text" name="city" id="city" /></td>
</tr>
<tr>
	<td><?=lang('email')?>: *</td>
	<td class="s-jobbratav"><input type="text" name="email" id="email" /></td>
	<td><?=lang('services_from_str')?>: *</td>
	<td><input type="text" name="street" id="street" /></td>
</tr>
<tr>
	<td><?=lang('services_from_pho')?>: *</td>
	<td class="s-jobbratav">
		<input type="text" name="tel" id="tel" /><br /><br /><br /><br /><br />
		<input type="checkbox" name="kuloncim" id="kuloncim" /> A számlát egy külön címre kérem kiállítani:
	</td>
	<td><?=lang('message')?>:</td>
	<td>
		<textarea rows="6" cols="30" name="comment" id="comment"></textarea>
	</td>
</tr>
<tr class="szamla">
	<td colspan="3"><h3 style="color: #707070;">Számlázási adatok:</h3></td>
</tr>
<tr class="szamla">
	<td><?=lang('name')?>:</td>
	<td class="s-jobbratav">
		<input type="text" name="sz_name" id="sz_name" />
	</td>
	<td><?=lang('events_form_zip')?>:</td>
	<td class="s-jobbratav">
		<input type="text" name="sz_zip" id="sz_zip" />
	</td>
</tr>
<tr class="szamla">
	<td><?=lang('events_form_city')?>:</td>
	<td>
		<input type="text" name="sz_city" id="sz_city" />
	</td>
	<td><?=lang('services_from_str')?>:</td>
	<td>
		<input type="text" name="sz_street" id="sz_street" />
	</td>
</tr>
</table>
</div>
<div class="bigstep-box-bottom"></div>

<div id="btnsend" class="bt-start" onclick="checkForm()"><?=lang('services_orderp')?></div>

</form>
</div>



<script type="text/javascript">
	
	jQuery(document).ready(function($){
		$('.szamla').css({'display':''});
		
		$('#kuloncim').click(function(){
			//be vagy ki
			if( $(this).attr('checked') === true ){
		//		alert("be");
				$('.szamla').css({'display':'table-row'});
			}else{
		//		alert("ki");
				$('.szamla').css({'display':'none'});
				$('#sz_name').val('');
				$('#sz_zip').val('');
				$('#sz_city').val('');
				$('#sz_street').val('');
			}
		});
		
	});
	
	
	function checkForm()
	{
		var nameok  = false;
		var emailok = false;
		var telok   = false;
		var irszok  = false;
		var varosok = false;
		var utcaok  = false;
		var at = '@';
		var dot = '.';


		var name  = jQuery('#name');
		var email = jQuery('#email');
		var tel   = jQuery('#tel');
		var irsz  = jQuery('#zip');
		var cim   = jQuery('#city');
		var utca  = jQuery('#street');
		var kuloncim  = $('#kuloncim').attr('checked');

		if(name.val() == '' || name.val() == '<?=$this->lang->line('downloads_error_empty_field')?>')
		{
			name.val('<?=$this->lang->line('downloads_error_empty_field')?>');
			name.css({ 'background-color': '#F9D3D3' });
		}
		else{
			name.css({ 'background-color': '#EEEEEE' });
			nameok = true;
		}


		if(tel.val() == '' || tel.val() == '<?=$this->lang->line('downloads_error_empty_field')?>')
		{
			tel.val('<?=$this->lang->line('downloads_error_empty_field')?>');
			tel.css({ 'background-color': '#F9D3D3' });
		}
		else if( !telefonCheck(tel.val()) ){
			tel.val('<?=$this->lang->line('downloads_error_tel_field')?>');
			tel.css({ 'background-color': '#F9D3D3' });
		}
		else
		{
            tel.css({ 'background-color': '#EEEEEE' });
			telok = true;
		}


		if(email.val() == '' || email.val() == '<?=$this->lang->line('downloads_error_empty_field')?>')
		{
			email.val('<?=$this->lang->line('downloads_error_empty_field')?>');
			email.css({ 'background-color': '#F9D3D3' });
		}
		else
		{
			if(email.val().indexOf(at)==-1 || email.val().indexOf(at)==0 || email.val().indexOf(at)==email.val().length-1 || email.val().indexOf(dot)==-1 || email.val().indexOf(dot)==0 || email.val().indexOf(dot)>=email.val().length-2)
			{
				email.val('<?=$this->lang->line('downloads_error_email_field')?>');
				email.css({ 'background-color': '#F9D3D3' });
			}
			else
			{
				email.css({ 'background-color': '#EEEEEE' });
				emailok = true;
			}

		}
		
		
		
		if(irsz.val() == '' || irsz.val() == '<?=$this->lang->line('downloads_error_empty_field')?>')
		{
			irsz.val('<?=$this->lang->line('downloads_error_empty_field')?>');
			irsz.css({ 'background-color': '#F9D3D3' });
		}
		else{
			irsz.css({ 'background-color': '#EEEEEE' });
			irszok = true;
		}
		
		
		if(cim.val() == '' || cim.val() == '<?=$this->lang->line('downloads_error_empty_field')?>')
		{
			cim.val('<?=$this->lang->line('downloads_error_empty_field')?>');
			cim.css({ 'background-color': '#F9D3D3' });
		}
		else{
			cim.css({ 'background-color': '#EEEEEE' });
			varosok = true;
		}
		
		
		if(utca.val() == '' || utca.val() == '<?=$this->lang->line('downloads_error_empty_field')?>')
		{
			utca.val('<?=$this->lang->line('downloads_error_empty_field')?>');
			utca.css({ 'background-color': '#F9D3D3' });
		}
		else{
			utca.css({ 'background-color': '#EEEEEE' });
			utcaok = true;
		}
		
		
		if( (kuloncim==false || szamlaadatcheck()) && nameok==true && telok==true && emailok==true && irszok==true && varosok==true && utcaok==true )
		{
			jQuery('#uploadForm').submit();
		}

    }



	function teszt(adat,minta){
		for (var i=0; i<adat.length; i++)
			if (minta.indexOf(adat.charAt(i)) == -1)
				return false;

		return true;
	}

	function tartalmaz(adat,minta){
		for (var i=0; i<adat.length; i++)
			if (minta.indexOf(adat.charAt(i)) != -1)
				return true;
		return false;
	}

	function telefonCheck(ertek){
		if (ertek == "") return false;
		if (ertek.length < 6 ) return false;
		if (!teszt(ertek,"1234567890()/- ") || !tartalmaz(ertek,"1234567890")){
		//	alert("Ez nem jó telefonszám!");
			return false;
		}
		else{
			return true;
		}
	}

	function szamlaadatcheck(){
		var nameok  = false;
		var irszok  = false;
		var varosok = false;
		var utcaok  = false;

		var name  = jQuery('#sz_name');
		var irsz  = jQuery('#sz_zip');
		var cim   = jQuery('#sz_city');
		var utca  = jQuery('#sz_street');
		
		if(name.val() == '' || name.val() == '<?=$this->lang->line('downloads_error_empty_field')?>')
		{
			name.val('<?=$this->lang->line('downloads_error_empty_field')?>');
			name.css({ 'background-color': '#F9D3D3' });
		}
		else{
			name.css({ 'background-color': '#EEEEEE' });
			nameok = true;
		}
		
		
		if(irsz.val() == '' || irsz.val() == '<?=$this->lang->line('downloads_error_empty_field')?>')
		{
			irsz.val('<?=$this->lang->line('downloads_error_empty_field')?>');
			irsz.css({ 'background-color': '#F9D3D3' });
		}
		else{
			irsz.css({ 'background-color': '#EEEEEE' });
			irszok = true;
		}
		
		
		if(cim.val() == '' || cim.val() == '<?=$this->lang->line('downloads_error_empty_field')?>')
		{
			cim.val('<?=$this->lang->line('downloads_error_empty_field')?>');
			cim.css({ 'background-color': '#F9D3D3' });
		}
		else{
			cim.css({ 'background-color': '#EEEEEE' });
			varosok = true;
		}
		
		
		if(utca.val() == '' || utca.val() == '<?=$this->lang->line('downloads_error_empty_field')?>')
		{
			utca.val('<?=$this->lang->line('downloads_error_empty_field')?>');
			utca.css({ 'background-color': '#F9D3D3' });
		}
		else{
			utca.css({ 'background-color': '#EEEEEE' });
			utcaok = true;
		}
		
		
		
		if(nameok==true && irszok==true && varosok==true && utcaok==true)
			return true;
		else
			return false;
	}
	
</script>

	