/*

*/ 
 function MM_goToURL() {
	var I, args=MM_goToURL.arguments; document.MM_returnValue = false;
	for (I=0; I<(args.length-1); I+=2) eval(args[I]+".location='"+args[I+1]+"'");
}	
function openScript(url, width, height){
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',' );
}
//调整textarea大小
function openurl(mylink,width,height)
{
	window.open(mylink,'','top=50,left=150,width='+width+',height='+height+',scrollbars=yes')
}
function admin_Size(num,objname)
{
	var obj=document.getElementById(objname)
	if (parseInt(obj.rows)+num>=3) {
		obj.rows = parseInt(obj.rows) + num;	
	}
	if (num>0)
	{
		obj.width="90%";
	}
}
//转换提交action,用于中文后台操作,change submit
function Csubmit(saction,sconfirm)	{
		if (sconfirm==""){
			document.myform.action=saction;
			myform.submit();
		}
		else {
			if (Cconfirm(sconfirm)==true) {
				document.myform.action=saction;
				myform.submit();
			}
		}
}
function Cconfirm (str){
	if (str != "") {
		if (confirm(str)) {
			return true;
		}
		else {
		return false;
		}
	}
	else {
		return true;
	}	
}

//前台提交,确认/
function Dosubmit(saction,sconfirm)	{
		if (Doconfirm(sconfirm)==true) {
			document.myform.action=saction;
			myform.submit();
		}
}

function Doconfirm (str){
	if (str != "") {
		if (confirm(lang[str])) {
			return true;
		}
		else {
		return false;
		}
	}
	else {
		return true;
	}	
}

//预览
function runscript(n){
	txtRun=n;window.open("../show.asp","show")
}

//下拉菜单
function showsubmenu(id){
	whichEl = eval("submenu" + id);
	if (whichEl.style.display == "none"){
		eval("submenu" + id + ".style.display=\"\";");
	}
	else{
		eval("submenu" + id + ".style.display=\"none\";");
	}
}


function showtopflag(value1){
	window.showModelessDialog('admin_template.asp?action=getflag&tp='+value1+'&id=0','','dialogWidth:720px; dialogHeight:600px; help: no; scroll: yes; status: yes');
}

//弹出标签对话框
function adminimg(fid,channelid,objname1){
  var arr=window.showModalDialog('admin_img.asp?fid='+fid+'&cid='+channelid,'','dialogWidth:600px; dialogHeight:600px; help: no; scroll: yes; status: yes');
	if(arr!=null){
		var obj = document.getElementById(objname1);
		obj.innerHTML=arr;
	}
}

//弹出对话框并返回信息
function JDialog(objname,urlname,width,heigth){
  var arr=window.showModalDialog(urlname,'','dialogWidth:'+width+'px; dialogHeight:'+heigth+'px; help: no; scroll: yes; status: yes');
	if(arr!=null){
		var obj = document.getElementById(objname);
		obj.value=arr;
	}
}

//showModelessDialog方式,弹出对话菜单
function showdialog(actionurl,value1,value2,width,heigth){
	var arr=window.showModelessDialog(webdir+'dialog/'+actionurl+'.asp?value1='+value1+'&value2='+value2,'','dialogWidth:'+width+'px; dialogHeight:'+heigth+'px; help: no; scroll: yes; status: yes');
}

//选定菜单的某项
/* 使用方法:
<SCRIPT LANGUAGE="JavaScript">
CheckSel('名称','<%=value%>');
</SCRIPT>
*/
function CheckSel(Voption,Value)
{
	var obj = document.getElementById(Voption);
	for (i=0;i<obj.length;i++){
		if (obj.options[i].value==Value){
		obj.options[i].selected=true;
		break;
		}
	}
}
//单选表单选取 Obj 表单名，VAL所选的值
//chkradio(document.myform.cha_opentype,'value')
function chkradio2(Voption,Value)
{
	var obj = Voption;
	for (i=0;i<obj.length;i++){
		if (obj[i].value==Value){
		obj[i].checked=true;
		break;
		}
	}
}
function chkradio(Voption,Value)
{
	var obj = document.getElementById(Voption);
	for (i=0;i<obj.length;i++){
		if (obj.options[i].value==Value){
		obj.options[i].checked=true;
		break;
		}
	}
}
function CheckAll(form) {  
	for (var i=0;i<form.elements.length;i++)  {  
		var e = form.elements[i];  
		if (e.name != 'chkall')  
		e.checked = true // form.chkall.checked;  
	}  
} 
function unselectall(thisform){
	if(thisform.chkAll.checked){
		thisform.chkAll.checked = thisform.chkAll.checked&0;
	}   
 }
//反选
function ContraSel(form) {
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if (e.name != 'chkall')
		e.checked=!e.checked;
	}
}
//<A onclick="return confirmaction('您确认要还原成原始设置吗?')" HREF="admin_setup.asp?action=re_basic"><FONT COLOR="#FF0000">还原为默认设置</FONT></A>
function confirmaction(mess)
{
	if(confirm(mess))
		return true;
	else
		return false;
}

//自动返回网页
function backurl()
	{
	MM_goToURL('self',document.getElementById('backurl').href);
	return document.MM_returnValue
}


function ToValue(type,objname,strvalue)
{ 
	var obj=document.getElementById(objname)
	if (type=="add"){
		var stemp=obj.value.replace(strvalue,'')
		obj.value=stemp+strvalue;
		}
	else if (type=="+"){obj.value=parseInt(obj.value)+parseInt(strvalue);}
	else{obj.value=strvalue;}
	obj.focus(); 
 return; 
}

//点击后自动复制
function copyText(text){
	window.clipboardData.setData("text",text);
}
function copycontent(){
	copyText (document.getElementById("contenttext").value)
}

function copyurl(objname){
	
	var obj=document.getElementById(objname);
	if(obj.length==0) {
		return false;
		}
	else 
		{
		var url=obj.value; 
		window.clipboardData.setData("text",url);
	}
}
//跟据ID得到元素对象
function getobj(id){
	return document.getElementById(id);
}
//判断用户是否设置了单选按钮
function ischeckedradio(formid,radioname){
	var f=getobj(formid);
	for (var i=0;i<f.elements.length;i++){
		if(f.elements[i].name==radioname&&f.elements[i].checked) return true;
	}
	return false;
}

//替换文本域
function showeditor()
	{
	var oFCKeditor = new FCKeditor( 'content' ) ;
	oFCKeditor.ReplaceTextarea();
	}



//弹出窗口
function showinnew(obj,width,height) {
    URL=obj.href;
    var left = ( screen.width - width ) / 2;
    var top = ( screen.height - height ) / 2;
    window.open(URL,'','width='+width+',height='+height+',top='+top+',left='+left+',scrollbars=1,resizable=0');
    return false;
}
//跳转网页
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}



//=====================================输入检测
//空值检测,双语提示,inputtitle=ID inputname=文本框注释
function chkempty(inputtitle,inputname){
	var obj = document.getElementById(inputtitle);
	if (obj.value=="" ){
		alert(inputname+lang["main_mustadd"]);
		obj.focus();
		return false;
	}
	return true;
}

//正在执行操作提示,要求把需要变为提示的地方用<span id="prosing">括起
function probar(){
	var obj=document.getElementById("prosing")
	obj.innerHTML= "正在提交,请稍等..."
}

