<!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);
}
)
function showType(v){
	$('#upload').hide();
	$('#js').hide();
	$('#link').show();
	switch(v){
		case 'picture':
		case 'swf':
			$('#upload').show();
		break;
		case 'code':
		case 'html':
			$('#js').show();
			$('#link').hide();
		break;
	}
}
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+'" />';
	
}
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.type.value == 'picture' || document.form1.type.value =='swf'){
		if (document.form1.height.value == ''){
			alert('请填写图片或者FLASH的高度');
			document.form1.height.focus();
			return false;
		}
		if (document.form1.width.value == ''){
			alert('请填写图片或者FLASH的宽度');
			document.form1.width.focus();
			return false;
		}
	}
	if (document.form1.tag.value == ''){
		alert('请填写调用标记!限20个字符内!');
		document.form1.tag.focus();
		return false;
	}
	return true;
}
function getTag(v){
	alert(v)
	alert('代码已经复制到粘贴板!');
}
</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;?>bill/modify/" method="post" enctype="multipart/form-data" name="form1" id="form1">
      <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="selected"';}?> >图片广告</option>
	          <option value="swf" <?php if($this->modify['type'] == 'swf'){echo 'selected="selected"';}?> >FLASH广告</option>
	          <option value="text" <?php if($this->modify['type'] == 'text'){echo 'selected="selected"';}?> >文字广告</option>
	          <option value="code" <?php if($this->modify['type'] == 'code'){echo 'selected="selected"';}?> >JS代码广告</option>
	          <option value="html" <?php if($this->modify['type'] == 'html'){echo 'selected="selected"';}?> >html代码广告</option>
	          </select>*必选</td>
	  </tr>
	  <tr class="row">
	    <td class="align-right">广告位置：</td>
	    <td><select name="position" id="position" onchange="showTag(this.value)">
		<option value="">请选择广告位置</option>
		<?php foreach($this->position as $key=>$position){
			if($key == $this->modify['position']){?>
	      <option value="<?php echo $key;?>" selected="selected"><?php echo $position;?></option>
		  <?php }else{?>
		  <option value="<?php echo $key;?>"><?php echo $position;?></option>
		  
		  <?php } }?>
		   <option value="tag">自定义</option>
	      </select>	    </td>
	    </tr>
	  <tr class="row">
	    <td class="align-right">调用标记：</td>
	    <td><input name="tag" type="text" id="tag" value="<?php echo $this->modify['tag'];?>" /></td>
	    </tr>
	  <tr class="row <?php if(in_array($this->modify['type'], array('code','html'))===false){echo 'None';}?>" id="js">
	    <td class="align-right">代码内容：</td>
	    <td><textarea name="code" cols="50" rows="4" id="code"><?php echo $this->modify['code'];?></textarea></td>
	    </tr>
	  <tr class="row <?php if(in_array($this->modify['type'],  array('picture', 'swf')) ===false) echo 'None';?>" 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="logo" type="file" id="logo" /><?php }?></td>
	    </tr>
	  <tr class="row">
	    <td class="align-right">尺寸：</td>
	    <td>宽：
	      <input name="width" type="text" id="width" value="<?php echo $this->modify['width'];?>" size="5" maxlength="5" />
	      高：
	      <input name="height" type="text" id="height" value="<?php echo $this->modify['height'];?>" size="5" maxlength="5" /> 
	      *选择图片或者FLASH时请填写宽与高 </td>
	    </tr>
	  <tr class="row">
	    <td class="align-right">广告说明：</td>
	    <td><input name="title" type="text" id="title" size="50" value="<?php echo $this->modify['title'];?>" />
	      *</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" name="id" value="<?php echo $this->modify['id'];?>" />
	      <input name="Submit" type="button" class="btn" value="返回上一页" onclick="history.back()" /></td>
	    </tr>
      </table>
	  </form>
	  </form>
	  </div>
    </td>
  </tr>
</table>
<?php
echo $this->render('copyright');
?>
</body>
</html>

