<?php echo $header; ?>
<div id="content">
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <?php if ($error_warning) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <?php if ($success) { ?>
  <div class="success"><?php echo $success; ?></div>
  <?php } ?>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/setting.png" alt="" /> <?php echo $heading_title; ?></h1>
      <div class="buttons"><a onclick="$('#form').submit();" class="button"><?php echo $button_save; ?></a><a href="<?php echo $cancel; ?>" class="button"><?php echo $button_cancel; ?></a></div>
    </div>
    <div class="content">
      <div id="tabs" class="htabs">
		<a href="#tab-seo"><?php echo $tab_seo; ?></a>
		<a href="#tab-setting"><?php echo $tab_setting; ?></a>		
		<a href="#tab-image"><?php echo $tab_image; ?></a>		
	  </div>
      <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
    	<div id="tab-seo">
          <table class="form">
            <tr>
              <td><span class="required">*</span> <?php echo $entry_title; ?></td>
              <td><input type="text" name="config_title" value="<?php echo $config_title; ?>" />
                <?php if ($error_title) { ?>
                <span class="error"><?php echo $error_title; ?></span>
                <?php } ?></td>
            </tr>
            <tr>
              <td><?php echo $entry_meta_description; ?></td>
              <td><textarea name="config_meta_description" cols="40" rows="5"><?php echo $config_meta_description; ?></textarea></td>
            </tr>
          </table>
        </div>
        <div id="tab-setting">
          <table class="form">
            <tr>
              <td><span class="required">*</span> <?php echo $entry_name; ?></td>
              <td><input type="text" name="config_name" value="<?php echo $config_name; ?>" size="40" />
                <?php if ($error_name) { ?>
                <span class="error"><?php echo $error_name; ?></span>
                <?php } ?></td>
            </tr>
            <tr>
              <td><span class="required">*</span> <?php echo $entry_owner; ?></td>
              <td><input type="text" name="config_owner" value="<?php echo $config_owner; ?>" size="40" />
                <?php if ($error_owner) { ?>
                <span class="error"><?php echo $error_owner; ?></span>
                <?php } ?></td>
            </tr>
            <tr>
              <td><span class="required">*</span> <?php echo $entry_address; ?></td>
              <td><textarea name="config_address" cols="40" rows="5"><?php echo $config_address; ?></textarea>
                <?php if ($error_address) { ?>
                <span class="error"><?php echo $error_address; ?></span>
                <?php } ?></td>
            </tr>
            <tr>
              <td><?php echo $entry_email; ?></td>
              <td><textarea name="config_futura_email" cols="40" rows="5"><?php echo $config_futura_email; ?></textarea>
                <?php if ($error_email) { ?>
                <span class="error"><?php echo $error_email; ?></span>
                <?php } ?></td>
            </tr>
            <tr>
              <td><span class="required">*</span> <?php echo $entry_exibir; ?></td>
              <td><select name="config_futura_exibe_email">
                  <?php $cont = 1; foreach ($text_opcao_exibir as $exbir) { 
				  if($config_futura_exibe_email==$cont){
				  ?>
				  <option value="<?php echo $cont++; ?>" selected="selected"><?php echo $exbir; ?></option>
				  <?php				  
				  }else{
				  ?>
				  <option value="<?php echo $cont++; ?>"><?php echo $exbir; ?></option>
				  <?php
				  }
				  } ?>
                </select>
			</td>
            </tr>
            <tr>
              <td><span class="required">*</span> <?php echo $entry_telephone_title; ?></td>
              <td><input type="text" name="config_futura_telephone_title" value="<?php echo $config_futura_telephone_title; ?>" />
                <?php if ($error_telephone_title) { ?>
                <span class="error"><?php echo $error_telephone_title; ?></span>
                <?php } ?></td>
            </tr>			
            <tr>
              <td><span class="required">*</span> <?php echo $entry_telephone; ?></td>
              <td><input type="text" name="config_telephone" value="<?php echo $config_telephone; ?>" id="telefone" class="numeric"  />
                <?php if ($error_telephone) { ?>
                <span class="error"><?php echo $error_telephone; ?></span>
                <?php } ?></td>
            </tr>
            <tr>
              <td><?php echo $entry_fax; ?></td>
              <td><input type="text" name="config_fax" value="<?php echo $config_fax; ?>" id="fax" class="numeric" /></td>
            </tr>
			
            <tr>
              <td><?php echo $entry_telephone_extra; ?></td>
              <td><input type="text" name="config_futura_telephone_extra" value="<?php echo $config_futura_telephone_extra; ?>" id="telefoneextra" class="numeric" /></td>
            </tr>

            <tr>
              <td><?php echo $entry_celular; ?></td>
              <td>
				<input type="text" name="config_futura_celular[]" value="<?php echo $config_futura_celular[0]; ?>" class="numeric"/><br/><br/>
				<input type="text" name="config_futura_celular[]" value="<?php echo $config_futura_celular[1]; ?>" class="numeric"/><br/><br/>
				<input type="text" name="config_futura_celular[]" value="<?php echo $config_futura_celular[2]; ?>" class="numeric"/><br/><br/>				
				<input type="text" name="config_futura_celular[]" value="<?php echo $config_futura_celular[3]; ?>" class="numeric"/>
			  </td>
            </tr>			
			
          </table>
        </div>
		<div id="tab-image">
			<table class="form">
				<tr>
					<td><?php echo $entry_image; ?></td>
					<td>
					<div class="image"><img src="<?php echo $img_padrao; ?>" alt="" id="thumb-img-padrao" />					
					<input type="hidden" name="config_futura_img_padrao" value="<?php echo $config_futura_img_padrao; ?>" id="imgpadrao" />
					<br />
					<a onclick="image_upload('imgpadrao', 'thumb-img-padrao');"><?php echo $text_browse; ?></a>&nbsp;&nbsp;|&nbsp;&nbsp;<a onclick="$('#thumb-img-padrao').attr('src', '<?php echo $no_image; ?>'); $('#imgpadrao').attr('value', '');"><?php echo $text_clear; ?></a>
					</div>
					</td>
				</tr>
			</table>
		</div>		
      </form>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
function image_upload(field, thumb) {
	$('#dialog').remove();
	
	$('#content').prepend('<div id="dialog" style="padding: 3px 0px 0px 0px;"><iframe src="index.php?route=common/filemanager&token=<?php echo $token; ?>&field=' + encodeURIComponent(field) + '" style="padding:0; margin: 0; display: block; width: 100%; height: 100%;" frameborder="no" scrolling="auto"></iframe></div>');
	
	$('#dialog').dialog({
		title: '<?php echo $text_image_manager; ?>',
		close: function (event, ui) {
			if ($('#' + field).attr('value')) {
				$.ajax({
					url: 'index.php?route=common/filemanager/image&token=<?php echo $token; ?>&image=' + encodeURIComponent($('#' + field).val()),
					dataType: 'text',
					success: function(data) {
						$('#' + thumb).replaceWith('<img src="' + data + '" alt="" id="' + thumb + '" />');
					}
				});
			}
		},	
		bgiframe: false,
		width: 800,
		height: 400,
		resizable: false,
		modal: false
	});
};
//--></script> 
<script type="text/javascript"><!--
$('#template').load('index.php?route=setting/setting/template&token=<?php echo $token; ?>&template=' + encodeURIComponent($('select[name=\'config_template\']').attr('value')));
//-->
</script> 

<script type="text/javascript"><!--
$('#tabs a').tabs();
$(document).ready(function(){
	if($('input.numeric').length > 0) $('input.numeric').numeric();
	jQuery(function($){
		$("#telefone").mask("(99) 9999-9999");
		$("#telefoneextra").mask("(99) 9999-9999");			
		$("#fax").mask("(99) 9999-9999");
		$("input[name='config_futura_celular[]']").mask("(99) 9999-9999?9");
	 });		
});
//--></script>
//--></script> 
<?php echo $footer; ?>