<script type="text/javascript">
jQuery(document).ready(function($){
	
	$('#mehet').click(function(){
		
		var error = "";
		var errorki = "";
		
		if( $('#nev').val() == "" ){
			error += "Nincs név";
			$('#nev').css({ 'background-color': '#FFAA44' });
		}else
			$('#nev').css({ 'background-color': '' });
		
		if( $('#tel').val() == "" ){
			error += "Nincs telefon";
			$('#tel').css({ 'background-color': '#FFAA44' });
		}else
			$('#tel').css({ 'background-color': '' });
		
		var email = $('#email');
		if(email.val() == '' || email.val() == '<?=$this->lang->line('downloads_error_empty_field')?>')
		{
			email.css({ 'background-color': '#FFAA44' });
			error += "Nincs e-mail";
		}
		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': '#FFAA44' });
				error += "Hibás e-mail cím";
			}
			else
			{
				email.css({ 'background-color': '' });
			}

		}
		
		
		if(error == "")
			$('#registration_form').submit();
		
		return false;
	});
	
});

</script>

<h1><?=$cimlap->page_title?></h1>
<?=$cimlap->page_body?>

<style type="text/css">

    div.registration_form_container{
        margin: 15px 0 0 0;
        border: 1px solid #c4c4c4;
    }
    
    div.error{
        color: red;
        text-align: center;
    }
    
    div.event_chooser td.full{
        background: url('/public/img/bg/jqueryui/c1bebe_light_gray_crossed.png') repeat scroll 50% 50% #c1bebe;
    }
	
	div.registration_form_container input[type="text"] {
		width: 320px;
	}
	
	#registration_form li{
		list-style-type: none;
	}

</style>


<div class="registration_form_container">
<?=form_open('events/oktatoivizsga', array('id' => 'registration_form'))?>
<?=form_hidden('do', 'OK')?>
<div style="text-align: center">

<?if($error!==""):?><div style="color: #f00; text-align: center;"><?=$error?></div><?endif;?>

<ul>
	<?//=print_r($idopontok);?>
	<?foreach($idopontok as $date):?>
		<li>
			<input type="radio" name="test_id" value="<?=$date->test_id?>" <?if($esemid == $date->test_id):?> checked="checked"<?endif;?> />
			<?=substr($date->test_begin_time,0,-3)?>
			- 
			<?if(substr($date->test_begin_time,0,-9) != substr($date->test_end_time,0,-9)):?>
				<?=substr($date->test_end_time,0,-9)?>
			<?endif;?>
			<?=substr($date->test_end_time,-8,5)?>
		</li>
	<?endforeach;?>
		<li><input type="radio" name="test_id" value="-1" /> Egyéni időpontot kérek</li>
	
</ul>
</div>

<table cellpadding="5" cellspacing="0" align="center" width="450px">
		<tr>
			<td><strong><?=lang('events_form_name')?>:</strong></td>
			<td><input type="text" name="nev" id="nev" value="<?=$this->input->post('nev')?>" /></td>
		</tr>
		<tr>
			<td><?=lang('events_form_city')?>:</td>
			<td><input type="text" name="varos" value="<?=$this->input->post('varos')?>" /></td>
		</tr>
		<tr>
			<td>Iskola:</td>
			<td><input type="text" name="cegnev" value="<?=$this->input->post('cegnev')?>" /></td>
		</tr>
		<tr>
			<td><?=lang('events_form_zip')?>:</td>
			<td><input type="text" name="irsz" value="<?=$this->input->post('irsz')?>" /></td>
		</tr>
		<tr>
			<td><?=lang('events_form_address')?>:</td>
			<td><input type="text" name="cim" value="<?=$this->input->post('cim')?>" /></td>
		</tr>
		<tr>
			<td><strong><?=lang('events_form_phone')?>:</strong></td>
			<td><input type="text" name="tel" id="tel" value="<?=$this->input->post('tel')?>" /></td>
		</tr>
		<tr>
			<td nowrap="nowrap"><strong><?=lang('events_form_email')?>:</strong></td>
			<td><input type="text" name="email" id="email" value="<?=$this->input->post('email')?>" /></td>
		</tr>
		<tr>
			<td><?=lang('events_form_comment')?>:</td>
			<td><input type="text" name="comment" value="<?=$this->input->post('comment')?>" /></td>
		</tr>
		<tr>
			<td align="center" colspan="4">
				<input name="mehet" type="submit" id="mehet" value='<?=lang('events_form_sub_reg')?>' />
			</td>
		</tr>
	</table>
<?=form_close()?>
</div>