{include file="$gentemplates/$header_tpl"}
{strip}
	<div class="header">
	{if !isset($reg_page_title)}
	{$lang.mobile.registration}
	{else}
	{$reg_page_title}
	{/if}
	</div>
	{if $error}
	<div class="error_msg">{$error}</div>
	{/if}
	<div id="registration_form">
		<form action="registration.php" method="post" enctype="multipart/form-data">
		<input type="hidden" name="sel" value="register" />
		<input type="hidden" name="page" value="{$page}" />
                <input type="hidden" id="pair" name="pair" value="{$pair}">
		<div style="width: 99%;">
			<table width="100%" cellspacing="0" cellpadding="0">
				{foreach item=item from=$elements name=elements}
					<tr>
						<td width="50%" class="no_couple">
							{assign var="background" value="1"}
							{assign var=elem_html value=$item.elem_html}
							{include file="$site_path/$template_root/mobile_registration_edit_element.tpl"}
							{*if $item.couple}
								{assign var=elem_html value=$item.couple_elem_html}
								{assign var=couple value=1}
								</td>
								<td class="for_couple" style="{if !$pair}display:none;{/if}">
									{include file="$site_path/$template_root/mobile_registration_edit_element.tpl"}
								{assign var=couple value=0}
							{/if*}
						</td>
					</tr>
				{/foreach}
			</table>
		</div>
		<div id="btn">
			<input type="submit" value="{if $user[3] ne 1}{$lang.mobile.save}{else}{$lang.mobile.register}{/if}" class="button"/>
			{if $user[3] ne 1}&nbsp;&nbsp;&nbsp;<input type="button" value="{$lang.mobile.back_to_home}" class="button" onclick="document.location.href='homepage.php'" />{/if}
		</div>
		</form>
	</div>
{/strip}
{literal}
<script>
	function CheckValue() {
		return;
	}
		
		 
	// "getElementsByClassName" не определен IE, так что этот метод можно реализовать в JavaScript 
	if(document.getElementsByClassName == undefined) { 
	   document.getElementsByClassName = function(cl) { 
		  var retnode = []; 
		  var myclass = new RegExp('\\b'+cl+'\\b'); 
		  var elem = this.getElementsByTagName('*'); 
		  for (var i = 0; i < elem.length; i++) { 
			 var classes = elem[i].className; 
			 if (myclass.test(classes)) { 
				retnode.push(elem[i]); 
			 } 
		  } 
		  return retnode; 
	   } 
	};
		
	function Change(par) {
		elem = document.getElementsByClassName("for_couple");
		if (par == 'N') {
			for (i = 0; i < elem.length; i++) {
				elem[i].style.display = 'none';
			}
			document.getElementById('pair').value = '0';
		} else if (par == 'Y') {           
				for (i = 0; i < elem.length; i++) {
					elem[i].style.display = 'table';
				}
				document.getElementById('pair').value = '1';
		} else {
				document.getElementById('pair').value = '0';
		}
	}
		
	var couple_div = document.getElementsByClassName("for_couple");
	for (x = 0; x < couple_div.length; x++) {
		var sel_html = couple_div[x].getElementsByTagName("select");    
		for (i = 0; i < sel_html.length; i++) {
			old_name = sel_html[i].name;
			sel_html[i].setAttribute('name', 'couple_'+old_name);
		}
	}
		
	if(typeof document.getElementsByClassName('all')[0] !== 'undefined'){
		document.getElementsByClassName('all')[0].onclick = function (){
			all_checkbox = document.getElementsByClassName('id_relationship_uniq');
			if (document.getElementsByClassName('all')[0].checked){
				for (i = 0; i < all_checkbox.length; i++){
					all_checkbox[i].checked = true;
				}
			} else{
				for (i = 0; i < all_checkbox.length; i++){
					all_checkbox[i].checked = false;            
				}
			}

		}   
			
		if (document.getElementsByClassName('all')[0].checked){
			all_checkbox = document.getElementsByClassName('id_relationship_uniq');
			for (i = 0; i < all_checkbox.length; i++){
				all_checkbox[i].checked = true;
			}
		}
	}
</script>
{/literal}
{include file="$gentemplates/$footer_tpl"}