function $(id){return document.getElementById(id);}
//自动批量生成连续剧地址
function url_add(n)
{
var a="document.all.url_all_"
var b=".value"
var str='';
var url_all=eval("document.all.url_all_"+''+n+''+".value");
var url_name=eval("document.all.url_name_"+''+n+''+".value");
var url_ji=eval("document.all.url_ji_"+''+n+''+".value");
if(!url_ji) url_ji=1;

for(i=1;i<=url_ji;i++)
{
var a=i //新变量
if(url_ji<10)
	{
	i='0'+i
	}  
else if(url_ji<100)
	{
		if(i<10)
		{
		i='0'+i
		}
	} 
else if(url_ji<1000)
	{
		if(i<10)
		{
		i='00'+i
		} 
		else if(i<100)
		{
		i='0'+i
		}
	}
//组合播放地址开始
if(a==1)
	{
	str+=url_all.replace("{$}",i)+i+url_name;
	}
else	
	{	
	str+='\n'+url_all.replace("{$}",i)+i+url_name;
	}
//组合播放地址结束	
}

eval("form_url.url_intro_"+n+".value=''+str+''"); 
}
//添加数据验证函数
function CheckForm()
{
  if (document.form1.class_id.value==''){
    alert('请选择分类！');
    document.form1.class_id.focus();
    return false;
  } 
  if (document.form1.data_name.value==''){
    alert('影片名称不能为空！');
    document.form1.data_name.focus();
    return false;
  }
  if (document.form1.data_actor.value==''){
    alert('领衔主演不能为空！');
    document.form1.data_actor.focus();
    return false;
  } 
}
//添加地址验证函数
function UUUrlForm()
{
  if (document.form1.UU_url.value==''){
    alert('请添加Qvod播放地址注意换行！');
    document.form1.UU_url.focus();
    return false;
  } 
}

//添加奖品验证函数
function UUpForm()
{
  if (document.form1.p_name.value==''){
    alert('输入奖品名称！');
    document.form1.p_name.focus();
    return false;
  } 
  if (document.form1.p_how.value==''){
    alert('输入奖品数量！');
    document.form1.p_how.focus();
    return false;
  } 
   if (document.form1.p_jf.value==''){
    alert('输入兑换积分！');
    document.form1.p_jf.focus();
    return false;
  } 
}

//重要数据删除采用2次确认
function UUdel(url,str1,str2)
{
    question = confirm(str1)
    if (question != "0")
	{
	question = confirm(str2)
		if (question != "0")
		{
		//window.open("http://www.qvodcms.com")
		location.href=url;
		}
    }
}

//添加新闻验证函数
function NewsForm()
{
  if (document.form1.Title.value==''){
    alert('请填写新闻公告标题！');
    document.form1.Title.focus();
    return false;
  } 
}

//复选表单全选事件 form：表单名
function CheckAll(form){
  var tagname=(arguments.length>1)?arguments[1]:'TR';
  for (var i=0;i<form.elements.length;i++){
    var e = form.elements[i];
    if (e.name != 'chkAll' && e.disabled == false && e.type == 'checkbox') {
      e.checked = form.chkAll.checked;
      if (e.checked){hL(e,tagname)};else{dL(e,tagname)};
    }
  }
}

function hL(E,tagname){
  while (E.tagName!=tagname) {E=E.parentElement;}
  E.className='tdbg2';
}
function dL(E,tagname){
  while (E.tagName!=tagname) {E=E.parentElement;}
  E.className='tdbg';
}

//跳 转按钮
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  //eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  location.href=selObj.options[selObj.selectedIndex].value
  if (restore) selObj.selectedIndex=0;
}

//弹出退出窗口
function ops(str1,str2,str3)
{
dWin=showModalDialog(str1,window,'dialogHeight:'+str2+'px;dialogWidth:'+str3+'px;scroll:no;resizable:no;status:no;help:no');
}
//复选表单全选事件 form：表单名
function CheckAll(form){
  var tagname=(arguments.length>1)?arguments[1]:'TR';
  for (var i=0;i<form.elements.length;i++){
    var e = form.elements[i];
    if (e.name != 'chkAll' && e.disabled == false && e.type == 'checkbox') {
      e.checked = form.chkAll.checked;
      if (e.checked){hL(e,tagname)};else{dL(e,tagname)};
    }
  }
}
//生成单个网页
function ops(str1,str2,str3){
dWin=showModalDialog(str1,window,'dialogHeight:'+str2+'px;dialogWidth:'+str3+'px;scroll:no;resizable:no;status:no;help:no');
}
//更新推荐审核
function setajax(type,id,value){
	var ajax = new AJAXRequest();
	ajax.get("UU_Ajax.asp?action="+type+"&dataid="+id+"&value="+value,type+id);	
}
//更新连载专题
function setajaxct(typeid,dataid){
	var ajax = new AJAXRequest();
	if (typeid=="1") {
		var state = datacontinu.value;
		//if (isNaN(state)) {
			//alert('集数为数字');
			//return false;
		//}else 
		if(state == 'undefined' || state == ''){
			alert('集数不能为空');
			return false;
		}		
	    ajax.get("UU_Ajax.asp?action=ct&dataid="+dataid+"&value="+state,"ct"+dataid);
	}else{
		var state = specialid.value;
		ajax.get("UU_Ajax.asp?action=sp&dataid="+dataid+"&value="+state,"sp"+dataid);
	}
	closeLayer();
}
function oncompletecontent(obj){
	if(obj.responseText){
		alert(obj.responseText);
	}
}
//显示连载专题
function setday(datatype,dataid,specialid){
	var iWidth = document.documentElement.scrollWidth-20; 
	var iHeight = document.documentElement.scrollHeight; 
	var bgObj = document.createElement("div");
	bgObj.style.cssText = "position:absolute;left:0px;top:0px;width:"+iWidth+"px;height:"+Math.max(document.body.clientHeight, iHeight)+"px;filter:Alpha(Opacity=50);opacity:0.3;background-color:#ffffff;z-index:101;";
	bgObj.id="bgObj";
	document.body.appendChild(bgObj); 
	var divObj = document.createElement("div");
	divObj.style.cssText ="position: absolute;z-index:102;width:240px;height:20px;border:1px solid #5080B0;background: #E4EDF9;padding:3px 0px 3px 4px;";
	divObj.id="divObj";
	document.body.appendChild(divObj);
	var obj = document.getElementById(datatype+dataid);
	var th = obj; 
	var ttop = obj.offsetTop;
    var tleft = obj.offsetLeft; 
    while (obj = obj.offsetParent){ttop+=obj.offsetTop; tleft+=obj.offsetLeft;}
    divObj.style.top = (ttop-1)+"px";
    divObj.style.left = (tleft-1)+"px";
	if (datatype=="ct"){
		divObj.innerHTML='自定义：<input type="text" size="12" name="datacontinu"> <input type="button" value="确定" onclick="setajaxct(1,'+dataid+');"/> <input type="button" value="取消" onclick="closeLayer()"/>';
	}else{
		divObj.innerHTML="正在加载内容++++";
		var ajax = new AJAXRequest();
		ajax.get("Adn_Ajax.asp?action=zt&dataid="+dataid+"&value="+specialid, function(ajaxobj) {
		divObj.innerHTML=ajaxobj.responseText;
		});
	}
}
//关闭连载专题
function closeLayer() {
	document.body.removeChild(bgObj);
	document.body.removeChild(divObj);
}
//data_add.asp连载
function showcheckbox(cname,dname){
	if(document.getElementById(cname).checked==true){
	showThumbnail_RateOrSize(1,dname);
	}else{
	showThumbnail_RateOrSize(0,dname);
	}
}
function showThumbnail_RateOrSize(param,pname){
	if(param==1){
		document.getElementById(pname).style.display="block";
	}else{
		document.getElementById(pname).style.display="none";
	}
}
//视频分析助手
function viewGatherWin(i){
	$('gathervideo').style.display='block';
	$("gatherid").value=i;
	selfLabelWindefault('gathervideo');
}
function gathering(){
	var url=$("gatherurl").value;
	$("gatherintro").value = '数据采集中...请稍等';
	var ajax = new AJAXRequest();
	ajax.get("CaiJi/Cai_FlashInc.asp?url="+url+"",function(ajaxobj){
		      if(ajaxobj.responseText == "err"){$("gatherintro").value = "发生错误";}else{$("gatherintro").value = ajaxobj.responseText;}
			});	
}
function insertResult(){
	var id=$("gatherid").value;
	$("url_intro_"+id).value = $("gatherintro").value;
	$("gatherid").value='';
	$("gatherurl").value='';
	$("gatherintro").value='';
	hide('gathervideo');
}
function addResult(){
	var id=$("gatherid").value;
	$("url_intro_"+id).value += "\n"+$("gatherintro").value;
}
function trimOuterStr(str,outerstr){
	var len1
	len1=outerstr.length;
	if(str.substr(0,len1)==outerstr){str=str.substr(len1)}
	if(str.substr(str.length-len1)==outerstr){str=str.substr(0,str.length-len1)}
	return str
}
function reverseOrder(){
	if($('gatherintro').value==""){alert("没有地址内容");return;}
	if(navigator.userAgent.indexOf("Firefox")>0){var listArray=$('gatherintro').value.split("\n");}else{var listArray=$('gatherintro').value.split("\r\n");}
	var newStr="";
	for(var i=listArray.length-1;i>=0;i--){
			newStr+=listArray[i]+"\r\n";
	}
	$('gatherintro').value=trimOuterStr(newStr,"\r\n");
}
function replaceStr(){
	var contentObj=$('gatherintro'),str="gi";
	if(contentObj.value==""){alert("没有地址内容");return;}
	var replace1=$("replace1").value,replace2=$("replace2").value;
	var content=contentObj.value;
	var reg=new RegExp(replace1,str);
	contentObj.value=content.replace(reg,replace2);	
}
//
function selfLabelWindefault(divid){
	$(divid).style.left=(document.documentElement.clientWidth-568)/2+"px"
	//$(divid).style.top=(getScroll()+60)+"px"
	$(divid).style.top="100px"
}
function getScroll(){
    var t;if(document.documentElement&&document.documentElement.scrollTop){t=document.documentElement.scrollTop;}else if(document.body){t=document.body.scrollTop;}return(t);
}
function hide(id){//关闭层
    $(id).style.display='none';
}
//
function hL(E,tagname){
  while (E.tagName!=tagname) {E=E.parentElement;}
  E.className='tdbg2';
}
function dL(E,tagname){
  while (E.tagName!=tagname) {E=E.parentElement;}
  E.className='tdbg';
}

function selimga(toopenfilepath,myform,fromname){


	var arr= showModalDialog("UU_dialog.asp?toshowpage="+toopenfilepath, "选择文件", "dialogWidth:760px; dialogHeight:560px; help:0; scroll:1; status:0 ;center:1");
	if (arr!=null && arr!==''){
//alert(arr);
	//document.myform.Hotel_logo.value=arr ;
	document.getElementById(fromname).value=arr ;
    document.getElementById('Logo').src='../'+arr ;
	}
}


function openScript(url, width, height){
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',left=250,top=300,resizable=1,scrollbars=no,menubar=no,status=no' );
}

//文本框只能输入数字
function myKeyDown()
{
    var   k=window.event.keyCode;  

    if ((k==46)||(k==8)||(k==189)||(k==109)||(k==190)||(k==110)|| (k>=48 && k<=57)||(k>=96 && k<=105)||(k>=37 && k<=40))
    {}
    else if(k==13){
        window.event.keyCode = 9;}
    else{
        window.event.returnValue = false;}
}
//onkeydown="myKeyDown()

if(document.getElementById("lat_y")>0){
document.getElementById("emarked_img").src = "images/modify_note.gif" ;
}

function doEmark(){
 var open_url = "map.htm";
  window.open(open_url, "_blank", "height=500, width=700, top=50, left=50, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no");

}