function doClick(o,k,z,h,m,n){
	 o.className=z;
	 var j;
	 var id;
	 var e;
	 for(var i=1;i<=k;i++){
	   id =m+i;
	   j = document.getElementById(id);
	   e = document.getElementById(n+i);
	   if(id != o.id){
	   	 j.className=h;
	   	 e.style.display = "none";
	   }else{
			e.style.display = "block";
	   }
	 }
}

function CheckAdminuserForm() {
  if ((document.myform.username.value.length)<2||(document.myform.username.value.length)>24)  {
    alert('注意了!用户名最短一个字符,最长25个字符！');
    document.myform.username.focus();
    return false;
  }
  if ((document.myform.password.value.length)<2||(document.myform.password.value.length)>24) {
    alert('注意了!密码最短一个字符,最长25个字符！');
    document.myform.password.focus();
    return false;
  }
  if ((document.myform.password1.value.length)<2||(document.myform.password1.value.length)>24) {
    alert ('注意了！重复密码最短一个字符,最长25个字符');
    document.myform.password1.focus();
    return(false);
  }
}


function topwin(myurl){ 
//document.getElementById("mymain").style.display="block";
//document.getElementById("mymain").innerHTML="数据正在载入中....";
window.showModelessDialog(myurl+"&Rnd="+ Math.random(),"","dialogWidth:960px;dialogHeight:800px;scroll:auto;status:no;help:0;resizable:1;") 
} 


function show2(id,allnum,iscon){
for(i=1;i<=allnum;i++){
document.getElementById("fh_"+i).className=''; 
if(iscon==1){
document.getElementById("Fa_"+i).style.display='none';}
}
document.getElementById("fh_"+id).className='current'; 
if(iscon==1){
document.getElementById("Fa_"+id).style.display='block';}
}

// 修改编辑栏高度
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%";
	}
}

function helpscript(n){
	txtRun=n;window.open('../helpview.asp','admin_help','toolbar=no,menubar=no,scrollbars=no, resizable=1, location=no, status=no,top=0,left=0,width=600,height=300')

}

function runscript(n){
	txtRun=n;window.open("../templates_view.asp","templates_view")
}
function rundvscript(n,astr){
	txtRun=n;window.open("http://bbs.niutou.net/loadtemplates.asp?"+astr+"","loadtemplates")
}

var ColorImg;
var ColorValue;
function hideColourPallete() {
	document.getElementById("colourPalette").style.visibility="hidden";
}
function Getcolor(img_val,input_val){
	var obj = document.getElementById("colourPalette");
	ColorImg = img_val;
	ColorValue = document.getElementById(input_val);
	if (obj){
	obj.style.left = getOffsetLeft(ColorImg) + "px";
	obj.style.top = (getOffsetTop(ColorImg) + ColorImg.offsetHeight) + "px";
	if (obj.style.visibility=="hidden")
	{
	obj.style.visibility="visible";
	}else {
	obj.style.visibility="hidden";
	}
	}
}
//Colour pallete top offset
function getOffsetTop(elm) {
	var mOffsetTop = elm.offsetTop;
	var mOffsetParent = elm.offsetParent;
	while(mOffsetParent){
		mOffsetTop += mOffsetParent.offsetTop;
		mOffsetParent = mOffsetParent.offsetParent;
	}
	return mOffsetTop;
}

//Colour pallete left offset
function getOffsetLeft(elm) {
	var mOffsetLeft = elm.offsetLeft;
	var mOffsetParent = elm.offsetParent;
	while(mOffsetParent) {
		mOffsetLeft += mOffsetParent.offsetLeft;
		mOffsetParent = mOffsetParent.offsetParent;
	}
	return mOffsetLeft;
}
function setColor(color)
{
	if (ColorValue){ColorValue.value = color;}
	if (ColorImg){ColorImg.style.backgroundColor = color;}
	document.getElementById("colourPalette").style.visibility="hidden";
}