<?php
$types = array('image'=>'Image', 'video'=>'Video','doc'=>'Doc','link'=>'Link');
$videotypes = array(''=> '','flash'=>'Flash', 'youtube'=>'Youtube','vimeo'=>'Vimeo','quicktime'=>'QuickTime');
$linktargets = array('_self'=>'Self', '_blank'=>'Blank');
?>

<script>
    jQuery.noConflict();
    jQuery(document).ready(function(){
        jQuery('.item-help').click(function(){
    jQuery('.help').show(300);
    return false;
    });
    if (jQuery("#portfolio-type").val()!=='video') jQuery('#portfolio-video').hide(250);
    
   jQuery("#portfolio-type").change(function () {
        var val = jQuery(this).val();
        if (val=='video'){
            jQuery('#portfolio-video').show(250);
        }else{jQuery('#portfolio-video').hide(250);}
        });
       
   
});
    
</script>
<div id="portfolio">
 <div class="item">
     <div class="item-title">
         <h4><?php _e("Type", "paula"); ?></h4>
             
     </div>
     <p class="help"><?php _e("Type of Page",'paula'); ?></p>
     <p class="item-description"><?php _e("Specifies the type of portfolio post",'paula'); ?></p>
     <div class="item-content">
         <?php $metabox->the_field('portfolio_type'); ?>
         <select id="portfolio-type" data-mini="true"  name="<?php $metabox->the_name(); ?>">
                   <?php
                   $value = $metabox->get_the_value();
                  
                    foreach ($types as $key => $tra) { ?>
                            <option <?php echo ($key == $value || (!array_key_exists($value, $types) && $tra == 'image')) ? 'selected="selected"' : ''; ?> value="<?php echo $key; ?>"><?php echo $tra; ?></option>  
                    <?php } ?>
        </select>
         </br>
         <div id="portfolio-video" >
          <?php $metabox->the_field('portfolio_video_player'); ?>
             <label><?php _e("Player",'paula'); ?></label>
         <select id="portfolio-videotype" data-mini="true"  name="<?php $metabox->the_name(); ?>">
                   <?php
                   $value = $metabox->get_the_value();
                  
                    foreach ($videotypes as $key => $tra) { ?>
                            <option <?php echo ($key == $value || (!array_key_exists($value, $videotypes) && $tra == '')) ? 'selected="selected"' : ''; ?> value="<?php echo $key; ?>"><?php echo $tra; ?></option>  
                    <?php } ?>
        </select>
             <label><?php _e("Width",'paula'); ?></label>
              <?php $metabox->the_field('portfolio_video_width');
         $value = $metabox->get_the_value();?>
             <input type="text" size="4" name="<?php $metabox->the_name(); ?>" value="<?php echo ($value)?$value:'640';?>" /><span>px&nbsp;&nbsp;</span>
             <label><?php _e("Height",'paula'); ?></label>
              <?php $metabox->the_field('portfolio_video_height');
         $value = $metabox->get_the_value();?>
             <input type="text" size="4" name="<?php $metabox->the_name(); ?>" value="<?php echo ($value)?$value:'480';?>" /><span>px </span> </br>
             
             <label><?php _e("Source Media (url)",'paula'); ?></label>
              <?php $metabox->the_field('portfolio_video_src');
         $value = $metabox->get_the_value();?>
             <input type="text"  name="<?php $metabox->the_name(); ?>" value="<?php echo ($value)?$value:'';?>" />
             
         </div>
     </div>    
 </div>   
 
<div class="item">
     <div class="item-title">
         <h4><?php _e("URL Link (optional)", "paula"); ?></h4>
         
         <p class="help"></p>
     </div>
     <p class="item-description"><?php _e("This link override page or post link.", "paula"); ?></p>
     <div class="item-content">
         <?php $metabox->the_field('portfolio_link');
         $value = $metabox->get_the_value();?>
         <label>Link:</label>
         <input type="text" name="<?php $metabox->the_name(); ?>" value="<?php echo ($value)?$value:'';?>" />
         <?php $metabox->the_field('portfolio_targetlink');
         $value = $metabox->get_the_value();?>
         <label>Target:</label>
         <select name="<?php $metabox->the_name(); ?>">
                   <?php
                   $value = $metabox->get_the_value();
                  
                    foreach ($linktargets as $key => $tra) { ?>
                            <option <?php echo ($key == $value || (!array_key_exists($value, $linktargets) && $tra == 'image')) ? 'selected="selected"' : ''; ?> value="<?php echo $key; ?>"><?php echo $tra; ?></option>  
                    <?php } ?>
        </select>
         
     </div>    
 </div>     
    
    
    
    
    
</div>
    
    
    
  