<?
$hibauzenet = $_SESSION['default']['regoncehiba'];
unset($_SESSION['default']['regoncehiba']);
?>

<style type="text/css">
#downloadForm textarea{
	background: none repeat scroll 0 0 #EEEEEE !important;
	border: 1px solid #000000;
	padding: 2px;
}
</style>

<div style="margin: 0 -16px;">


<div id="bal" style="width: 656px; float: left;">
	<div style="padding: 0 7px 0 20px;">
	<div class="big_red_button"><?=lang('reg60nap')?></div>
	<h1 style="border: none; width: 460px;"><span class="h1s1">ARCHLine.XP</span></h1>
	<br />
	<br />
	<div class="kekcim" style="margin-top: 5px; text-align: left;">
		<?if($this->uri->segment(2)=="dealer"):?>
		Create a Nonprofit Serial Code for your client!
		<?else:?>
		<?=lang('reglepesek')?>
		<?endif;?>
	</div>
	<p><?=lang('regrovleir')?></p>
	</div>
	
	
	<?=form_open('other/registeroncesubmit', array('id' => 'downloadForm'))?>
	<?=form_hidden('do','registeronce')?>
	<?if($this->uri->segment(2)!=""):?><?=form_hidden('dealer','dealer')?><?endif;?>
	<div class="box-step-top" style="background: url(/public/img/downloads/box_step_top_no1.png)">
		<p class="steptitle"><?=lang('regarchid')?></p>
	</div>
	<div class="box-step">
		<table width="100%">
			<?if($hibauzenet):?>
			<tr>
				<td colspan="3" style="color: #dd0000;"><?=$hibauzenet?></td>
			</tr>
			<?endif;?>
			<tr>
				<td>ID*</td>
				<td><input type="text" name="id" id="id" value="<?($reonad[0]!="") ? print $reonad[0] : print "99";?>" /></td>
				<td><a href="/contact/index/archid"><?=lang('reggetid')?></a></td>
			</tr>
		</table>
		<div class="clear"></div>
	</div>
	<div class="box-step-bottom"></div>
	
	
	<div class="box-step-top" style="background: url(/public/img/downloads/box_step_top_no2.png)">
	<p class="steptitle"><?=lang('down_int_step1')?></p>
	</div>
	<div class="box-step">
		<table width="100%">
			<?if($this->uri->segment(2)=="dealer"):?>
				<tr>
					<td><label for="strName1">User <?=lang('name')?>*</label></td>
					<td><input type="text" name="strName1" id="strName1" value="<?=$reonad[1]?>" /></td>
					<td><label for="strEMail">User <?=lang('email')?>*</label></td>
					<td><input type="text" name="strEMail" id="strEMail" value="<?=$reonad[2]?>" /></td>
				</tr>
				<tr>
					<td><label for="country"><?=lang('country')?>*</label></td>
					<td>
						<select name="country" id="country">
							<option value="-1">--Choose--</option>
						<?foreach($ctr as $row):?>
							<option value="<?=$row->ctrNameEng?>">
								<?=$row->ctrNameEng?>
							</option>
						<?endforeach;?>
						</select>
					</td>
					<td><label for="email2">E-mail to reply*</label></td>
					<td colspan="3"><input type="text" name="email2" id="email2" /></td>
				</tr>
			<?else:?>
				<?=$this->load->view('form_general')?>
				<tr>
					<td><label for="passw1"><?=lang('collec_jelszo')?><?if(hun()) print '*';?>*</label></td>
					<td><input type="password" name="passw1" id="passw1" autocomplete="off" /></td>
				</tr>
				<tr>
					<td><label for="passw2"><?=lang('regjszujra')?><?if(hun()) print '*';?>*</label></td>
					<td><input type="password" name="passw2" id="passw2" autocomplete="off" /></td>
				</tr>
				<tr>
					<td><?=lang('subject')?></td>
					<td>
						<select id="tema" name="tema">
							<option selected="selected" value="<?=lang('regtargy1')?>"><?=lang('regtargy1')?></option>
						</select>
					</td>
				</tr>
				<tr>
					<td valign="top"><label for="uzenet"><?=lang('message')?></label></td>
					<td>
						<textarea rows="5" cols="50" name="uzenet" id="uzenet"><?=$reonad[5]?></textarea>
					</td>
				</tr>
			<?endif;?>
			
		</table>
	</div>
	<div class="box-step-bottom"></div>
	
	<div class="box-step-top" style="background: url(/public/img/downloads/box_step_top_no3.png)">
		<div id="btnDown" class="dlbutton"><?=lang('send')?></div>
		<p class="steptitle"><?=lang('send')?></p>
	</div>
	<div class="box-step">
		<?if($this->uri->segment(2)=="dealer"):?>
		<?=lang('regstepsealer')?>
		<?else:?>
		<?=lang('regsendinfo')?>
		<?endif;?>
		<div id="message"></div>
		<div class="clear"></div>
	</div>
	<div class="box-step-bottom"></div>
	</form>
	
	<?if(hun()):?>
	<div style="padding-left: 20px;">
	<br />** Tetszőleges jelszót választhat, amellyel a <a href="/forum" title="ARCHLine.XP fórum">fórumba</a> tud majd bejelentkezni.
	</div>
	<?endif;?>
	
</div>

<div id="jobb" style="width: 308px; float: right;">
	<?//=$cimlap->page_body ?>
	<div class="box-side-top"></div>
	<div class="box-side">
		<span class="kiscim"><?=lang('down_int_avlang')?></span><br />
		<?$nyelvek = explode(';',lang('down_int_langs'));?>
		<?if(count($nyelvek)>1):?>
		<ul style="padding: 0px; margin-bottom: 0px;">
			<?for($i=0;$i<(count($nyelvek)-1);$i++):?>
			<li><strong><?=$nyelvek[$i]?></strong></li>
			<?endfor;?>
			<li style="margin-bottom: 0px;"><strong><?=end($nyelvek)?></strong></li>
		</ul>
		<?endif;?>
	</div>
	<div class="box-side-bottom"></div>
	<div class="box-side-top"></div>
	<div class="box-side">
		<span class="kiscim" style="color: #f70404;"><?=lang('sys_req')?></span><br />
		<br />
		<div><?=lang('down_int_sysdesc')?></div>
		<div class="jobbbutton" onclick="window.location.href='/interior/system'">
			<?=lang('sys_req')?>
		</div>
		<br /><br />
	</div>
	<div class="box-side-bottom"><span style="display: none;">.</span></div>

</div>


<div class="clear"></div>


<script type="text/javascript">
jQuery(document).ready(function($){

	$('#id').focus();
	$('#strName1, #strEmail, #strTel, #id').css({ 'background-color': '#FDDA10' }).focus(function(){
		checkError($(this).attr('id'));
	});
	
	$('#btnDown').click(function(){
		checkForm();
	}).css({ 'border': 'none' }).mouseover(function(){
		$(this).css({ 'cursor': 'pointer' });
	})
});

// <![CDATA[
	function checkForm()
	{
		var firstnameok = false;
		var emailok = false;
		var countryok = false;
		var idok = false;
		var pwok = false;
		var szemadatokok = false;
		var at   = '@';
		var dot  = '.';
		
		var country = jQuery('#country');
		var firstname = jQuery('#strName1');
		var email = jQuery('#strEMail');
		var aid = jQuery('#id');
		var pw1 = jQuery('#passw1');
		var pw2 = jQuery('#passw2');
		var message = jQuery('#message');
		
		message.html('<?=$this->lang->line('downloads_wait')?>');
		
		
		if(aid.val() == '' || aid.val() == '<?=$this->lang->line('downloads_error_empty_field')?>'){
			aid.val('<?=$this->lang->line('downloads_error_empty_field')?>');
			aid.css({ 'background-color': '#F9D3D3' });
		}
		else if( aid.val().substring(0, 2)!="99" ){
			aid.val('<?=$this->lang->line('downloads_error_id_field')?>');
			aid.css({ 'background-color': '#F9D3D3' });
		}
		else{
			aid.css({ 'background-color': '#EEEEEE' });
			idok = true;
		}
		
		
		<?if($this->uri->segment(2)==""):?>
			
			var nyelv = <?if(hun()):?>'hun'<?else:?>'eng'<?endif;?>;
			if( checkFormPersonal(nyelv) ){
				szemadatokok = true;
			}
			
			if(pw1.val()==""){
				pw1.css({ 'border': '1px red solid', 'background-color': '#F9D3D3' });
			}else{
				pw1.css({ 'border': '1px black solid' });
			}
			if(pw2.val()==""){
				pw2.css({ 'border': '1px red solid', 'background-color': '#F9D3D3' });
			}else{
				pw2.css({ 'border': '1px black solid' });
			}
			
			<?$hibak=lang('forum_hibak');?>
			// mindkettő meg van adva, de nem egyezik
			if( pw1.val()!=pw2.val() && pw1.val()!="" && pw2.val()!="" ){
				pw1.css({ 'border': '1px red solid', 'background-color': '#F9D3D3' });
				pw2.css({ 'border': '1px red solid', 'background-color': '#F9D3D3' });
				alert("<?=$hibak[0]?>");
			}// túl rövid
			else if( pw1.val().length < 5 &&  pw1.val()!="" ){
				pw1.css({ 'border': '1px red solid', 'background-color': '#F9D3D3' });
				pw2.css({ 'border': '1px red solid', 'background-color': '#F9D3D3' });
				alert("<?=$hibak[1]?>");
			}else if( pw1.val()!="" && pw2.val()!="" ){
				pwok = true;
			}
		
		
		<?else:?>
		
			if(firstname.val() == '' || firstname.val() == '<?=$this->lang->line('downloads_error_empty_field')?>'){
				firstname.val('<?=$this->lang->line('downloads_error_empty_field')?>');
				firstname.css({ 'background-color': '#F9D3D3' });
			}
			else{
				firstname.css({ 'background-color': '#EEEEEE' });
				firstnameok = 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(country.val()==-1){
				country.css({ 'border': '1px red solid', 'background-color': '#F9D3D3' });
			}else{
				countryok = true;
			}
		
		<?endif;?>
		
		
		
		<?if($this->uri->segment(2)==""):?>
		if( idok==true && pwok==true && szemadatokok==true ){
		<?else:?>
		if(firstnameok==true && emailok==true && countryok==true && idok==true ){
		<?endif;?>
			jQuery('#downloadForm').submit();
		}
		else{
			message.html('<?=$this->lang->line('downloads_error_div')?>');
		}
		
	}
// ]]>
</script>

</div>