<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>vodcms.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="../../images/admin/public.css" rel="stylesheet" type="text/css" />
<link href="../../images/admin/style.css" rel="stylesheet" type="text/css" />
<script src="<?php echo $this->basedir;?>js/jquery.js" language="javascript"></script>
<script language="javascript">
$(document).ready(function() {
	//setime(10);
	//$('#float').floatdiv('middle');
<?php
if ($this->modify['type'] != 'picture' && $this->modify['type'] !='swf'){?>
	$('#upload').hide();
	$('#link').hide();
<?php }elseif ($this->modify['type'] != 'video' && $this->modify['type'] != 'flv'){?>
	$('#shipin').hide();
<?php }
if ($this->modify['position'] != 3){?>
	$('#time').hide();
<?php }?>
<?php
if ($this->modify['type'] != 'code'){?>
	$('#code').hide();
<?php }?>

}
)
function showType(v){
<?php
if ($this->modify['type'] != 'picture' && $this->modify['type'] !='swf'){?>
	$('#upload').hide();
	$('#link').hide();
<?php }elseif ($this->modify['type'] != 'video' && $this->modify['type'] != 'flv'){?>
	$('#shipin').hide();
<?php }
if ($this->modify['position'] != 3){?>
	$('#time').hide();
<?php }?>
<?php
if ($this->modify['type'] != 'code'){?>
	$('#code').hide();
<?php }?>
	switch(v){
		case 'picture':
		case 'swf':
			$('#upload').show();
		break;
		case 'video':
		case 'flv':
			$('#shipin').show();
		break;
		case 'code':
		$('#code').show();
		break;
	}
}
function showTag(v){
	if (v == 'tag'){
		$('#tag').val('');
		$('#tag').attr('readonly', '');
	}else{
		$('#tag').val(v);
		$('#tag').attr('readonly', 'ture');
	}
}
function check(){
	if (document.form1.type.value == 0){
		alert('请选择广告类型');
		document.form1.type.focus();
		return false;
	}
	if (document.form1.position.value == ''){
		alert('请选择广告位置');
		document.form1.position.focus();
		return false;
	}
	if (document.form1.title.value == ''){
		alert('请选择广告名称');
		document.form1.title.focus();
		return false;
	}
	if (document.form1.type.value == 'code'){
		if (document.form1.code.value == ''){
			alert('请选择广告代码');
			document.form1.code.focus();
			return false;
		}
	}
	if (document.form1.position.value == 3){
		if (document.form1.start.value == ''){
			alert('请填写广告开始时间:单位秒');
			document.form1.start.focus();
			return false;
		}
		if (document.form1.end.value == ''){
			alert('请填写广告播放的时间:单位秒');
			document.form1.end.focus();
			return false;
		}
	}
	if ($('#type').val() == 'video' || $('#type').val() =='flv'){
		if (document.form1.video.value == '' || document.form1.video.value == 'http://'){
			alert('请填写视频文件地址');
			document.form1.video.focus();
			return false;
		}
	}
	if (document.form1.title.value == ''){
		alert('请填广告说明!限100个字符内!');
		document.form1.title.focus();
		return false;
	}
	return true;
}
function showtime(v){
	if (v == 3){
		$('#time').show();
	}else{
		$('#time').hide();
	}
}
function delfile(o, filename){
	var parent = o.parentNode;
	parent.innerHTML  = '<input name="file" type="file" id="file" /><input name="delfile" type="hidden" id="delfile" value="'+filename+'" />';
	
}
</script>
<body>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
  <tr align="center" valign="top">
    <td width="*" align="center" valign="top">
	<!-- ######### begin ######### -->
      <div class="Block">
      <div class="BlockBar">修改广告插播资料</div>
	  <form action="<?php echo $this->installdir;?>smil/modify/" method="post" enctype="multipart/form-data" name="form1" id="form1" onsubmit="return check();">
      <table width="100%" border="0" cellpadding="1" cellspacing="1" class="tab">
	  <tr class="row">
	    <td width="12%" class="align-right">广告类型：</td>
	    <td width="88%">
		<select name="type" id="type" onchange="showType(this.value)">
	          <option value="0">请选择广告类型</option>
	          <option value="picture" <?php if($this->modify['type'] == 'picture'){echo 'selected';}?>>图片广告</option>
	          <option value="swf" <?php if($this->modify['type'] == 'swf'){echo 'selected';}?>>FLASH广告</option>
	          <option value="video" <?php if($this->modify['type'] == 'video'){echo 'selected';}?> >视频广告</option>
	          <option value="flv" <?php if($this->modify['type'] == 'flv'){echo 'selected';}?> >FLV广告</option>
	          <option value="code">JS或者HTML</option>
	          </select>
	      *必选	        </td>
	  </tr>
	  <tr class="row">
	    <td class="align-right">广告名称：</td>
	    <td><input name="title" type="text" id="title" size="30" value="<?php echo $this->modify['title'];?>" />
	      *请填写广告的描述（50个字符）</td>
	    </tr>
	  <tr class="row">
	    <td class="align-right">广告位置：</td>
	    <td><select name="position" id="position" onchange="showtime(this.value)">
	      <option value="0" <?php if($this->modify['position'] ==0) echo 'selected';?>>片头广告</option>
	      <option value="1">片尾广告</option>
	      <option value="2">缓冲广告</option>
	      <option value="3">自定义时间</option>
	      </select>	    </td>
	    </tr>
	  <tr class="row" id="code">
	    <td class="align-right">JS&amp;HTML：</td>
	    <td><textarea name="code" cols="50" rows="4"><?php echo $this->modify['code'];?></textarea></td>
	    </tr>
	  <tr class="row">
	    <td class="align-right">广告时长：</td>
	    <td><input name="end" type="text" id="end" size="7" value="<?php echo $this->modify['end'];?>" />
	      (单位秒)</td>
	    </tr>
	  <tr class="row" id="time">
	    <td class="align-right">开始时间：</td>
	    <td><input name="start" type="text" id="start" size="7" value="<?php echo $this->modify['start'];?>" /> 
	      
	       
	      (单位秒)</td>
	    </tr>
	  <tr class="row" id="shipin">
	    <td class="align-right">视频文件地址：</td>
	    <td><input name="video" type="text" id="video" value="<?php echo $this->modify['video'];?>" size="50" />	      
	      *目前只支持flv rmvb wmv rm 格式</td>
	    </tr>
	  <tr class="row" id="upload">
	    <td class="align-right">图片/SWF：</td>
	    <td><?php 
				if ($this->modify['filename']){?><?php echo $this->modify['filename'];?>
				<input name="delete" type="button" value="更新图片" onclick="delfile(this, '<?php echo base64_encode(strrev($this->modify['filename']));?>')" /><?php }else{?>
				  <input name="filename" type="file" id="filename" />*只允许上传图片文件以及FLASH文件<?php }?>	    </td>
	    </tr>
	  <tr class="row" id="link">
	    <td class="align-right">连接：</td>
	    <td><input name="url" type="text" id="url" size="50" value="<?php echo $this->modify['url'];?>" />
	      图片或者字幕滚动时候的连接地址</td>
	    </tr>
	  <tr class="row">
	    <td class="align-right">&nbsp;</td>
	    <td>
	      <input type="submit" class="btn" value="保存修改" />
		  <input type="hidden" value="<?php echo $this->modify['id'];?>" name="id" />
	      <input name="Submit" type="button" class="btn" value="返回上一页" onclick="history.back()" /></td>
	    </tr>
      </table>
	  </form>
	  </div>
    </td>
  </tr>
</table>

<?php
echo $this->render('copyright');
?>
</body>
</html>