{include file='CommonJavaScript.tpl'}
<link rel="stylesheet" type="text/css" href="{$view_styles}/popup.css" />
		{form->start name="frmEmail_{$mailType}"  method="post"}
	
		<div id="popup">
			<div id="common_message"></div>
           <div class="popup-block">
		   {if $mailType!='user'}
           <div class=" form-info">{$language.lblFormEmailPopupHead}</div>   
		   {/if}
              <div class="form_listing form-edit-content">
              <ul>			
                <li class="clearfix">
                  <div class="inner-left fixing_left mandatory"> {$language.lblSubject} </div>
                  <!--End:Left-->
                  <div class="inner-right fixing_right"> {form->textbox class="textbox txtbox-wide" name="{$subject}" validate="required" error="Please enter subject"} </div>
                  <!--End:right-->
                </li>
                <li class="clearfix">
                 <div class="inner-left fixing_left mandatory"> {$language.lblMessage} </div>
                  <!--End:Left-->
                 <div class="inner-right fixing_right"> 

				<div class="txtbox-wide fixing_left" >	{form->editor name="{$message}" validate="required" error="Please enter subject"} </div>
                  {if $page!=''}
				  <div class="select-fld_links">
                      <span class="field-list curve-3">    
            {$language.lblSelectFields}
          </span>    
                <ul class="select-fld_ul">              
						{foreach $resultElement as $element}
							 {if $element['attributeType']!='html' && $element['attributeType']!='submit'}
							 <li> {html->anchor  rel="{$element['attributeType']}_{$element['formElementID']}" content="{$element['formElementLabel']}" class='fields_elements'} </li>
							 {/if}
						{/foreach}						
                    
                    </ul>

		        </div>
				{/if}
                </div>
                  <!--End:right-->
                </li> 
                <li class="clearfix">
                  <div class="inner-left fixing_left ">&nbsp;</div>
                  <div class="inner-right fixing_right">
                    <div class="submit-block clearfix">                   
                    {form->submit name="submitEmail_{$mailType}" value="{$language.lblSubmit} " tabindex="1"} 
                      {$language.lblOr} 
                      <a href="javascript:parent.$.colorbox.close(); ">{$language.lblCancel} </a> </div>
                  
                  </div>
                </li>
              </ul>
            </div>            
                   
           </div>
          </div>
		  {form->close}
		  	{html->messages_script id="common_message"}
		  {form->editor_script names="{$message}"}
		  {form->validate_script form="frmEmail_{$mailType}"}
		  <script type="text/javascript" src="{$common_js}/validate.plugin.js"></script>
		  <script type="text/ecmascript">

$(document).ready(function(){

$(".field-list").click(function(){ 
	if($(this).siblings(".select-fld_ul").is(':visible'))
	{
	$(this).removeClass("active");
	$(".select-fld_ul").hide();
	}
	else{
	$(this).siblings(".select-fld_ul").slideDown("fast");
	$(this).addClass("active");	
	}  
});
$('body').click(function (e) {     
		if ($(".select-fld_links").has(e.target).length === 0) {
		   $(".select-fld_ul").hide();
		   $(".field-list").removeClass("active");
        }
    });
$(".fields_elements").click(function(){
	var elementid=$(this).attr('rel');
	$(".select-fld_ul").hide();
	$(".field-list").removeClass("active");
	CKEDITOR.instances['{$message}'].insertText(" [-"+$(this).text()+"-{ldelim}"+elementid+"{rdelim}]");
	
});
});

</script>
