<script type="text/javascript">
 var emailmsg='{$language.errEmailID}';
$('#subscEmailID').each(function() {										
			var email = $('#subscEmailID').val();			
			if(email == emailmsg)
			{
			var default_value = $(this).val();			
			$(this).focus(function() {	
				if(this.value == default_value) {	
					this.value = '';	
				}	
			});	
			$(this).blur(function() {	
				if(this.value == '') {	
					this.value = default_value;	
				}	
			});
			}
			else
			{	
				return false
			}
		});

</script> 
{if isset($elementType) && is_array($elementType)}
{if in_array('state',$elementType) && in_array('country',$elementType)}
	<script>
	var stateCache={};
	function listStateAjax(countryFieldID,elements)
		{
		elements=elements.split(",");
		var stateFieldID=elements[0];
		var provinceFieldID=elements[1];
		
		var countryID=$(""+countryFieldID).val();
		$("[rel='"+provinceFieldID+"']").val('');
		if(countryID>0){	
			if($.isEmptyObject(stateCache[countryID])){
				var data = new Object();
				data.countryID 	= countryID;
				data.stateID 	= $("[rel='"+stateFieldID+"']").val();
				$.ajax({
					url: GLOBAL_BASE_PATH + "/form/ajaxState/",
					type: "POST",
					cache: true,
					data: data,
					success: function (data) {
						data=$.trim(data);
						stateCache[countryID]=data;
						if(data!=''){
							$("#li_"+stateFieldID).removeClass('hide');
							$("#li_"+provinceFieldID).addClass('hide');
							$("[rel='"+provinceFieldID+"']").val('-');
							var label=$("[rel='"+stateFieldID+"']").attr('label');
							$("[rel='"+stateFieldID+"']").html("<option value>"+label+"</option>"+data);
						}
						else{
							$("#li_"+stateFieldID).addClass('hide');
							$("#li_"+provinceFieldID).removeClass('hide');
							$("[rel='"+stateFieldID+"']").html("<option value=0>"+label+"</option>");
						} 
						/*var label=$("[rel='"+stateFieldID+"']").attr('label');
						$("[rel='"+stateFieldID+"']").html("<option value>"+label+"</option>"+data);*/
					}
					});
			}
			else{
				var data=stateCache[countryID];
				if(data!=''){
					$("#li_"+stateFieldID).removeClass('hide');
					$("#li_"+provinceFieldID).addClass('hide');
					var label=$("[rel='"+stateFieldID+"']").attr('label');
					$("[rel='"+stateFieldID+"']").html("<option value>"+label+"</option>"+data);
					$("[rel='"+provinceFieldID+"']").val('-');
				}
				else{
					$("#li_"+stateFieldID).addClass('hide');
					$("#li_"+provinceFieldID).removeClass('hide');
					$("[rel='"+stateFieldID+"']").html("<option value=0>"+label+"</option>");
				}
				/* var label=$("[rel='"+stateFieldID+"']").attr('label');
				$("[rel='"+stateFieldID+"']").html("<option value>"+label+"</option>"+data); */
			}
		}
		else if(countryID==0){
			$("[rel='"+stateFieldID+"']").html("<option value='0'>{$language.lblOther}</option>"+data);
		}
		if(countryID==''){
			var label=$("[rel='"+stateFieldID+"']").attr('label');
			$("[rel='"+stateFieldID+"']").html("<option >"+label+"</option>");
		}
	
	}
	</script>
	{/if}
{/if}

	
        <div class="form-listing-frd"> 
            <a name="formFocus"></a>
            {*   <h3 class="font-semibold">{$resultForm['formName']|default:''}</h3> *}
			{if !$formDisable|default:''}
			<!-- Begin : Visa Payment --> 
			  {assign var="labelPlacement" value=$resultForm['labelPlacement']|default:''}
			  {assign var="submitButtonValue" value=$resultForm['submitButtonValue']|default:''}
			  {assign var="fieldAlignment" value=$resultForm['fieldAlignment']|default:''}
			  {assign var="formKey" value=$resultForm['formKey']|default:''}
			  {assign var="fieldAlignment" value=$resultForm['fieldAlignment']|default:''}
			  {assign var="elementRule" value=$resultForm['elementRule']|json_decode}
			  {assign var="enableCaptcha" value=$resultForm['enableCaptcha']|default:''}
			  {assign var="enableAgreement" value=$resultForm['enableAgreement']|default:''}
			  {assign var="agreementText" value=$resultForm['agreementText']|default:''}
                          {assign var="captchaValidation" value=$resultForm['captchaValidation']|default:''}
                          {if $captchaValidation eq ''}
                                {assign var="captchaValidation" value=$language.errBusSecurityCode}
                          {/if}
              {form->start name="oorjitForm_{$formKey}" method="post" enctype="multipart/form-data"}
				
			  <fieldset>
				<div class="{if $fieldAlignment eq 'top_align_two_column'} {elseif $fieldAlignment eq 'left_align_one_column'}left_align_one_column {elseif $fieldAlignment eq 'left_align_two_column'} left_align_two_column {elseif $fieldAlignment eq 'top_align_one_column'} top_align_one_column {/if}">
					<ul class="clearfix list-unstyled row">
					{assign var="increment" value=1}
					{foreach $resultElement as $key=>$element}
						{assign var="formElementID" value=$element['formElementID']|default:''}
						{assign var="formID" value=$element['formID']|default:''}
						{assign var="attributeType" value=$element['attributeType']|default:''}
						{assign var="nextAttributeType" value=$resultElement[$key+1]['attributeType']|default:''}
						{assign var="uniqueID" value=$element['uniqueID']|default:''}
						{assign var="formElementLabel" value=$element['formElementLabel']|default:''}
						{assign var="attributeOrder" value=$element['attributeOrder']|default:''}
						{assign var="validateRule" value=$element['validateRule']|default:''}
						{assign var="extraAttributes" value=$element['extraAttributes']|json_decode}
						{* {assign var="fieldSize" value=$extraAttributes->defaults->size|default:''} *}
						{assign var="limitMax" value=$extraAttributes->defaults->limitMax|default:''}
						{assign var="tabindex" value=$extraAttributes->defaults->tabindex|default:''}
						{assign var="layout" value=$extraAttributes->defaults->layout|default:''}
						{assign var="allowedExtensions" value=$extraAttributes->defaults->allowedExtensions|default:''}
						{assign var="fieldLayout" value=$extraAttributes->fieldLayout|default:''}
						{assign var="allowUserChoice" value=$extraAttributes->allowUserChoice|default:''}
						{assign var="linkWith" value=$extraAttributes->linkWith|default:''}
						{assign var="formElementDetailID" value=$element['formElementDetailID']|default:''}
						{assign var="formElementDesc" value=$element['formElementDesc']|default:''}
						{assign var="formElementSubText" value=$element['formElementSubText']|default:''}
						{assign var="formElementPlaceHolder" value=$element['formElementPlaceHolder']|default:''}
						{assign var="formElementValue" value=$element['formElementValue']|default:''}
						{assign var="options" value=$element['options']|default:''}
						{assign var="optionID" value=$element['formElementOptionID']|default:''}
						{assign var="formValidationMessage" value=$element['formValidationMessage']|default:''}
						{assign var="formElementName" value=$attributeType|cat:"_"|cat:$formElementID}
						
						{if $attributeType!='province'}
							{assign var="increment" value=$increment+1}
						{/if}

						{if $fieldAlignment eq 'top_align_two_column'}      
							{assign var="listStyle" value="col-12 col-md-6"}
							{assign var="listLabel" value=""}
			                {assign var="listDiv" value=""}
			                {assign var="btnDiv" value=""}

		                {elseif $fieldAlignment eq 'left_align_one_column'}
			                {assign var="listStyle" value="col-12"}
			                {assign var="listLabel" value="col-12 col-md-2"}
			                {assign var="listDiv" value="col-12 col-md-10"}
			                {assign var="btnDiv" value="col-12 col-md-10"}

		                {elseif $fieldAlignment eq 'left_align_two_column'}
			                {assign var="listStyle" value="col-12 col-lg-6"}
			                {assign var="listLabel" value="col-12 col-md-4"}
			                {assign var="listDiv" value="col-12 col-md-8"}
			                {assign var="btnDiv" value="col-md-10 col-md-8 p-0"}

		                {elseif $fieldAlignment eq 'top_align_one_column'}
			                {assign var="listStyle" value="col-12"}
			                {assign var="listLabel" value=""}
			                {assign var="listDiv" value=""}
			                {assign var="btnDiv" value=""}
		                {/if}


		                {if $extraAttributes->defaults->size|default:'' eq 'small'}   
			                {assign var="fieldSize" value="col-12"}
		                {elseif $extraAttributes->defaults->size|default:'' eq 'medium'}   
			                {assign var="fieldSize" value="col-6"}
		                {elseif $extraAttributes->defaults->size|default:'' eq 'large'}   
			                {assign var="fieldSize" value="col-12"}
		                {/if}

						
						{if $attributeType=='submit' && $enableCaptcha=='Yes' && $enable_captcha=='Yes'}
						<li class="{$listStyle} clearfix fltNo">
							{* <div class="label clearfix"> *}
							<div class="{$listLabel} p-0">
									<label>
										{$language.lblSecurityCode} <span class="mndty">*</span>
									</label>
							
							
							</div>
                            <div class="field captcha {$listDiv} p-0">
                            	<div class="float-left mb-3">
									<img width="100"  height="25" hspace="0"  class="float-left"  id="captchaCode" marginwidth="0" marginheight="0"  />
									<img src="{$view_images}/reload_icon_captcha.png" hspace="0" class="float-left mx-2"  vspace="0" id="reload_icon_captcha" style="cursor:pointer;"  marginheight="0" height="18" marginwidth="0"/>
                            	</div>
                            	<div class="float-left">
									{form->textbox id="oorjitFormSecurityCode" autocomplete="off" name="oorjitFormSecurityCode"  class="form-control" maxlength="12" validate="required" validate_event="submit" error=$captchaValidation}
								</div>
							
								<span style="display:none">
									{form->textbox id="hidImageCaptchaCode"   name="hidImageCaptchaCode" class="hidden-variable"}
								</span>
								
							</div>
						</li>
						{/if}
						
						{if $enableAgreement=='Yes' && $attributeType=='submit'}
							<li class="{$listStyle} clearfix fltNo {if $fieldAlignment eq 'left_align_two_column' || $fieldAlignment eq 'top_align_two_column'}col-md-12{/if}" id="li_{$uniqueID}" data-name="agreement" >
							{* <div class="label clearfix"> *}
							<div class="{$listLabel} p-0 {if $fieldAlignment eq 'left_align_two_column'}col-md-2{/if}">
																											
									</div>
							<div class="cms_area default-style {$listDiv} p-0 {if $fieldAlignment eq 'left_align_two_column'}col-md-10{/if}">
										{form->checkbox    
										name=$formElementName  
										rel=$uniqueID
										value="1"
										caption="<label for='{$formElementName}'>{$agreementText}</label>"
										validate="required"
										error="{$language.errAgreement}"} 
									</div>
										
							</li>
						{/if}
						
						
						<li class="{$listStyle} form-group clearfix {if $attributeType=='submit'} fltNo {/if}{if $attributeType=='province'} hide{/if} {if ($fieldAlignment=='top_align_two_column' || $fieldAlignment=='left_align_two_column') && $increment%2} go-left{/if}" id="li_{$uniqueID}" data-name="{$formElementName}" data-elementid="{$formElementID}">
							{if $attributeType!='submit' && $attributeType!='html' && $attributeType!='agreement'}
									{* <div class="label clearfix"> *}
									<div class="{$listLabel} p-0">
										<label>
											{$formElementLabel} 
											{if $formElementSubText!=''}
												<span class="icon-set info-icon" title="{$formElementSubText}"></span>
											{/if}
											{if $validateRule|strstr:"required" && $formElementLabel|default:'' neq ''}
												<sup class='text-danger'>*</sup>
											{/if}
										</label>
									
									</div>

							{/if}
							{if $attributeType=='html'}
								<div class="{$listLabel} p-0">
									<label>&nbsp;</label>
								</div>
							{/if}
							<div class="field {$fieldSize} {$listDiv} {$layout} p-0"> 
								{if 	$attributeType=='text'		||
										$attributeType=='email'		||
										$attributeType=='text_opt'	||
										$attributeType=='province'	||
										$attributeType=='website'	
								}
								
									{form->textbox 
										name=$formElementName  
										rel=$uniqueID
										maxlength=$limitMax
										tabindex=$tabindex
										class="form-control" 
										validate="$validateRule" 
										value="$formElementValue"
										error=$formValidationMessage} 
									
								{else if $attributeType=='password'}
								
									{form->password 
										name=$formElementName 
										rel=$uniqueID
										tabindex=$tabindex
										class="form-control " 
										validate="$validateRule" 
										value="$formElementValue"
										error=$formValidationMessage} 
									
								{else if $attributeType=='date'}
									
									{form->textbox 
										name=$formElementName 
										rel=$uniqueID
										tabindex=$tabindex
										class="form-control" 
										validate="$validateRule" 
										value="$formElementValue"
										error=$formValidationMessage} 
									<script type="text/javascript">
											//<![CDATA[
                                            $(document).ready(function(){
												$("#{$formElementName}").datepicker();
											});
											//]]>
									</script>	
								
								{else if $attributeType=='file'}
									{assign var="displayExtension" value=""}
									{foreach $allowedExtensions as $key=>$ext}
										{if $key>0}
											{assign var='extension' value=$extension|cat:","|cat:$ext}
                                            {assign var='displayExtension' value=$displayExtension|cat:", "|cat:$ext}
										{else}
											{assign var='extension' value=$ext}
                                            {assign var='displayExtension' value=$ext}
										{/if}
									{/foreach}
									{if $extension!=''}
										{if $formElementValue!=''}
											{assign var='validateRule' value=$formElementValue|cat:"~*"|cat:$formElementName|cat:"->isFileType->"|cat:$extension}
										{else}
											{assign var='validateRule' value=$formElementName|cat:"->isFileType->"|cat:$extension}
										{/if}
										{if $formValidationMessage!=''}
											{assign var='formValidationMessage' value=$formValidationMessage|cat:"~*"|cat:$language.errFileExtension|cat:"-"|cat:$extension}
										{else}
											{assign var='formValidationMessage' value=$language.errFileExtension|cat:"-"|cat:$extension}
										{/if}
									{/if}
									{form->upload 
										name=$formElementName
										rel=$uniqueID 
										tabindex=$tabindex
										class="form-control" 
										validate="$validateRule" 
										value="$formElementValue"
										error=$formValidationMessage} 
                                        {if $displayExtension|default:'' neq ''}
                                            <small>{$language.lblFileTypes}{$displayExtension}</small>
                                        {/if}
								
								{else if $attributeType=='select'}
								
									{form->select 
										name=$formElementName
										rel=$uniqueID
										tabindex=$tabindex
										class="form-control listbox"
										validate="$validateRule" 
										value="$optionID"	 
										options=$options
										error=$formValidationMessage} 
								
								{else if $attributeType=='select_multiple'}
								
									{form->select 
										name=$formElementName 
										rel=$uniqueID
										tabindex=$tabindex
										class="form-control listbox"
										validate="$validateRule" 
										value="$optionID"	
										options=$options
										multiple="multiple"
										error=$formValidationMessage} 
								
								{else if $attributeType=='radio'}
									<div class="col">{form->radio     
										name=$formElementName  
										rel=$uniqueID
										tabindex=$tabindex
										class="customradio"
										seperator="</div><div class='col'>"
										validate="$validateRule" 
										value="$optionID"
										options=$options
										error=$formValidationMessage} 
								</div>
								{else if $attributeType=='checkbox'}
								
									<div class="col">{form->checkbox    
										name=$formElementName  
										rel=$uniqueID
										tabindex=$tabindex
										class=""
										seperator="</div><div class='col'>"
										validate="$validateRule" 
										value="$optionID"	
										options=$options
                                                                                label="true"
										error=$formValidationMessage} 
                                                                                {if $validateRule|strstr:"required" && $formElementLabel|default:'' eq ''}
                                <sup class='text-danger'>*</sup>
											{/if}
										
								</div>
								{else if $attributeType=='image'}
									{form->upload_image 
										name=$formElementName 
										rel=$uniqueID
										tabindex=$tabindex
										value="" 
										validate="$validateRule" 
										error=$formValidationMessage
										size_caption="{$language.lblMaximumFileSize}" 
										types_caption="<br/>{$language.lblFileTypes}"}
										

										
								{else if $attributeType=='country'}
									
									{if $linkWith!=''}
										
										{form->select 
											name=$formElementName  
											rel=$uniqueID
											tabindex=$tabindex
											class="form-control listbox"
											validate="$validateRule" 
											value="$optionID"	
											options=$options
											caption="->{$language.lblSelect}"
											onchange="listStateAjax('#{$formElementName}','{$linkWith}')"
											error=$formValidationMessage} 
											<script type="text/javascript">
											//<![CDATA[
                                            listStateAjax('#{$formElementName}','{$linkWith}');
											//]]>
											</script>

									{else}
										{form->select 
											name=$formElementName  
											rel=$uniqueID
											tabindex=$tabindex
											class="form-control listbox"
											validate="$validateRule" 
											value="$optionID"	
											options=$options
											caption="->{$language.lblSelect}"
											error=$formValidationMessage} 
									{/if}
								
								{else if $attributeType=='state'}
									
									{form->select 
										name=$formElementName  
										rel=$uniqueID
										tabindex=$tabindex
										class="form-control listbox"
										validate="$validateRule" 
										value="$optionID"	
										options="->{$formElementValue}"
										label="{$formElementValue}"
										error=$formValidationMessage} 

								{else if $attributeType=='businesstype'}		
										
										{form->select 
										name=$formElementName  
										tabindex=$tabindex
										rel=$uniqueID
										class="form-control listbox"
										validate="$validateRule" 
										value="$optionID"	
										content=$options
										error=$formValidationMessage} 
										
								{else if $attributeType=='textarea'}
								
									{form->textarea 
										name=$formElementName  
										rel=$uniqueID
										tabindex=$tabindex
										class="form-control textarea01" 
										rows="5" 
										validate="$validateRule"
										cols="45"
										value="$formElementValue"
										error=$formValidationMessage} 
								
									
								{else if $attributeType=='html'}
								
									<h2>{$formElementLabel} </h2>
									<div class="cms_area default-style">
										<p>
											{$formElementDesc|html_entity_decode}
										</p> 
									</div>
								
								
								{/if}
							</div>
						</li>

						{if ($fieldAlignment=='top_align_two_column' || $fieldAlignment=='left_align_two_column') && $increment%2 && $nextAttributeType!='province'}
							<li class="col-12 element-three ui-draggable clearfix"></li>
						{/if}

						{if $attributeType=='submit'}
						<li class="col-12 {$btnDiv} float-right text-right">
							{form->submit name="submitForm" class="custom-button01 btn btn-primary font-weight-bold px-4 py-2 f-13" value={$submitButtonValue}} 
						</li>
						{/if}
					{/foreach}
					</ul>
                    </div>
              </fieldset>
              {form->close} </div>
			{else}
				<h3>{$disableFormMessage}</h3>
			{/if}

</div>
		{form->validate_script form="oorjitForm_{$formKey|default:''}"} 
    
<!-- End : Outer Pane --> 
{html->messages_script id="common_message_form"}
{include file='CommonJavaScriptBottom.tpl'  }
{html->script_group_start name="{$compiled_js_path}/forminclude.js"}
   {html->script src="{$common_frontend_js}/captcha.page.js"}
   {html->script src="{$common_js}/uploadImage.plugin.js"}
 {html->script_group_end} 

<script>
{foreach $elementRule as $rule}
	$("[name='{$rule->elementTrigger}']").change(function(){
		{if $rule->elementTriggerRule=='IS'}
		
			{if $rule->recieverAction=='SHOW'}
				if(this.value=='{$rule->elementTriggerValue}'){
					$("#li_{$rule->reciever}").show();
				}
				else{
					$("#li_{$rule->reciever}").hide();
				}
			{/if}
			
			{if $rule->recieverAction=='HIDE'}
				if(this.value=='{$rule->elementTriggerValue}'){
					$("#li_{$rule->reciever}").hide();
				}
				else{
					$("#li_{$rule->reciever}").show();
				}
			{/if}
		{/if}
	});
	
	{if $rule->recieverAction=='SHOW'}
		$("#li_{$rule->reciever}").hide();
	{else if $rule->recieverAction=='HIDE'}
		$("#li_{$rule->reciever}").show();
	{/if}
{/foreach}
var editImageTitle	="{$language.lbleditImageTitle}"; 

</script>

 