{if $contact_fields}
<div style="margin: 20px 0 5px 0">
<!-- JS Stuff -->
<script language="javascript" src="{$jspath}/jvalidate.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
{include file="$incpath/other/validate_conf.tpl"}
<!--
$(document).ready(function() {ldelim}
	var validator = $("#{$form_id}").validate(
	{ldelim}
		rules: 
		{ldelim} 
			{strip}
			'{#Contact_myName#}': {ldelim}required:true{rdelim},
			'{#Contact_myEmail#}': {ldelim}required:true,email:true{rdelim},
			{foreach from=$contact_fields item=cf name=valic}
			'{$cf->Name}': 
			{ldelim}
				{if $cf->Email=='1'}email:true{if $cf->Pflicht==1 || $cf->Zahl==1},{/if}{/if}
				{if $cf->Pflicht=='1'}required:true{if $cf->Zahl==1},{/if}{/if}
				{if $cf->Zahl=='1'}number:true{/if}
			{rdelim}
			{if !$smarty.foreach.valic.last},{/if}
			{/foreach}
			{if $use_code==1}
			,scode:{ldelim}required: true, number:true, remote: "index.php?p=contact&secure_check=1"{rdelim}
			{/if}
		{/strip}
		{rdelim},
		
		messages: 
		{ldelim}
			scode: {ldelim}remote:'{#Validate_wrong#}'{rdelim}
		{rdelim},
			
		submitHandler: function(form) 
		{ldelim} 
			jQuery(form).ajaxSubmit({ldelim}
					target: "#{$contact_id}",
					success: showResponse,
					clearForm: false,
					resetForm: true
				{rdelim});
		{rdelim},
		
		success: function(label) 
		{ldelim}
			label.html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;").addClass("checked");
		{rdelim}
	{rdelim});
{rdelim});

function showResponse(responseText, statusText){ldelim}
jQuery.blockUI(
{ldelim} 
message: '<h2>{#Contact_thankyou#}</h2>'
{rdelim}); 
setTimeout(jQuery.unblockUI, 2000); 
{rdelim}

function submitOtherData()
{ldelim}
	document.getElementById('___hmail').value = document.getElementById('ye_{$form_id}').value;
	document.getElementById('___hname').value = document.getElementById('yn_{$form_id}').value;
{rdelim}
-->
</script>
<!-- JS Stuff -->

<div class="round">
<div class="contact_form">
{*
<h3>{$contact_title}</h3>
<br />
<br />
{if $form_intro}
<div class="comment_intro">
{$form_intro|koobispecialchars}
</div>
{/if}
*}

<form onsubmit="submitOtherData();" id="{$form_id}" method="post" enctype="multipart/form-data" action="index.php?p=contact">
<input type="hidden" name="__hmail" id="___hmail" />
<input type="hidden" name="__hname" id="___hname" />


<p><label><input class="input" id="yn_{$form_id}" style="width:200px" name="{#Contact_myName#}" type="text" value="{$smarty.session.user_name}" /> <strong>{#Contact_myName#}</strong></label></p>
<p><label><input class="input" id="ye_{$form_id}" style="width:200px" name="{#Contact_myEmail#}" type="text" value="{$smarty.session.login_email}" /> <strong>{#Contact_myEmail#}</strong></label></p>


{foreach from=$contact_fields item=cf}



 {if $cf->Typ=='textfield'}
    <p>
 <label>
    <input name="{$cf->Name}" type="text" class="input" id="cf_{$cf->Id}" style="width:200px" value="{$cf->Werte|koobispecialchars}" maxlength="255" /> <strong>{$cf->Name|koobispecialchars}</strong></label>
    </p>
 {elseif $cf->Typ=='radio'}
  <p>
 <strong>{$cf->Name|koobispecialchars}</strong><br />
 <span id="cf_{$cf->Id}"></span>
 {foreach from=$cf->OutElemVal item=rw name=rwn}
 	<label><input type="radio" name="{$cf->Name}" value="{$rw}" {if $smarty.foreach.rwn.first}checked="checked"{/if} />{$rw}</label>
 {/foreach}
 </p>
 {elseif $cf->Typ=='checkbox'}
 <p>
 <strong>{$cf->Name|koobispecialchars}</strong><br />
 <span id="cf_{$cf->Id}"></span>
 {foreach from=$cf->OutElemVal item=rw name=rwn}
 	<label><input type="checkbox" name="{$cf->Name}[]" value="{$rw}" {if $smarty.foreach.rwn.first}checked="checked"{/if} />{$rw}</label>
 {/foreach}
 </p>
 
 {elseif $cf->Typ=='dropdown'}
 <p>
 <label><select id="cf_{$cf->Id}" class="input" style="width:205px" name="{$cf->Name}"> 
 {foreach from=$cf->OutElemVal item=rw name=rwn}
 <option value="{$rw}">{$rw}</option>
 {/foreach}
 </select>
 <strong>{$cf->Name|koobispecialchars}</strong></label>
 </p>
 {elseif $cf->Typ=='textarea'}
 <p>
 <label><strong>{$cf->Name|koobispecialchars}</strong><br />
 <textarea class="input" id="cf_{$cf->Id}" name="{$cf->Name}" cols="30" rows="5" style="width:98%; height:180px"></textarea>
 </label>
 </p>
 
  {/if}


{/foreach}

{if $form_attachment}
<p>
<strong>{#Contact_attachmentInf#}</strong>
<br />
Senden Sie uns ein Anlage mit, falls Sie m&ouml;chten (Gerne auch ZIP - Archive).
<br />
{section name=xx loop=$form_attachment}
<p><input name="files[]" type="file"  class="input" size="35" style="width:255px"  /></p>

{/section}
</p>
{/if}


{if $use_code==1}
<p>
<label for="secc_{$cf->Id}"><strong>{#Reg_SmallQ#}</strong></label>
<br />
{#Reg_SmallH#}&nbsp;&nbsp;&nbsp;<span id="{$contact_id}" style="font-weight:bold">{$contact_secure}</span> =
<input class="input" id="secc_{$cf->Id}" name="scode" type="text" style="width:50px;" value="{$smarty.request.scode|koobispecialchars}" maxlength="5" />
</p>
{else}
{/if}



<input type="hidden" name="id" value="{$form_id_raw}" />
<input type="submit" class="button" value="{#Contact_ButtonSend#}" />

</form>

</div>
</div>
</div>
{/if}