<?php

error_reporting(E_ERROR);
include('../common.php');
include('../sql.php');

$picUrl = "";

$cache_ret = $AM_CACHE->am_get();
if (!$cache_ret){
$skey = $_REQUEST['key'];
$skey = urldecode($skey);
if ($skey=="")
	exit();
if (strlen($skey)<=2)
	exit();

$query = presearchlist($skey);
$listmov = $_TD->FM($query);
// $listmov = $_TD->FM("select vod_id,vod_name from ".tname('vod')." where (vod_name like '%$skey%') order by vod_hits desc limit 10");
if(is_array($listmov))
{
	$arr = array(
		'presearchlist' => $listmov
	);

	$str = json_encode($arr);

}
$AM_CACHE->am_set($str);
}else{
	$str = $cache_ret;
}

$callback = $_REQUEST['callback'];
if ($callback=="")
	echo $str;
else
	echo $callback."(".$str.")";


                        
?>