<form class="app_form" onsubmit=" if(jQuery('#srctxt').val()!=''){
		window.location=siteInfo.baseUrl + '/videopodcast/searchvideo' + '/' + jQuery('#srctxt').val();
	}
	else{
		alert('Please enter a keyword');
	}; return false;
	">
<?php  App::Helper('Toolbar')->setTitle("Video Search")->setBtnBack()->Render(array('code'=>'videosearch_top')); ?>
<?php 
	App::Module('DataGrid') ->setDisplay('FormListing')
		->addRow('Search Keyword:','<input type="text" value="" id="srctxt" class="app_input" style="width:200px" /> <input type="Submit" value="Search" class="button" />')
		->Render()
		
?> 
</form>	 
<?php if(!empty($data['data'])):?>
	<script type="text/javascript">
	jQuery(document).ready(function () {
		jQuery('.addbutton').live('click',function(){
			var obj_form = jQuery(this).parents('form');
			var _this = this;
			jQuery(_this).attr('value','Pls wait...');
			 jQuery.ajax({
					url: siteInfo.baseUrl + "/videopodcast/addtoList",
					type: "POST",
					data: jQuery(obj_form).serialize(),
					context: document.body,
					success: function(data){
					  jQuery(_this).attr('value','Added to Gallery');
					  alert(data);
					}
				});
		});
	});
	</script>
	<br /><br />
	<?php echo($data['links']); ?>
	<br />
	<table>
	<tr>
	<?php foreach($data['data'] as $key=>$val):?>
		<?php if($key!=0 && $key%3==0):?></tr><tr><?php endif;?>
		<td style="padding:5px;">
			<form method="post" action="<?php echo $this->baseUrl('/videopodcast/addtolist');?>" onsubmit="return false" >
				<img src="<?php echo( $val['thumbnail']); ?>" /><br />
				(<?php echo $val['duration'];?> min)<br />
				<?php echo substr($val['title'],0,50); ?><br />
				<textarea name="data[video][data]" style="display:none"><?php echo base64_encode(serialize($val)); ?></textarea>
				<input type="submit" value="Add this video" class="addbutton" />
			</form>
		</td>
	<?php endforeach;?>
	</tr>
	</table>
	<br />
	<?php echo($data['links']); ?>
<?php endif;?>
<?php  App::Helper('Toolbar')->setBtnBack()->setFormJustified(true)->Render(array('code'=>'videosearch_bottom')); ?>