var menushow;
function showmenu(menu){ 
    if(menushow) 
    menushow.style.visibility="hidden" 
    menushow=menu 
    menu.style.visibility="visible" 
} 
function hidemenu(menu){ 
    menu.style.visibility="hidden" 
} 
function hideshow() 
{ 
    if(menushow) 
    menushow.style.visibility="hidden" 
}

function expand(str_str) {   
    if (document.all.item("div_"+str_str).style.display=='none') {
	    document.all.item("div_"+str_str).style.display='block';
		document.all.item("img_"+str_str).src='images/tree6.gif';
	}
    else {
        document.all.item("div_"+str_str).style.display='none';
		document.all.item("img_"+str_str).src='images/tree5.gif';
	}	
}

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 CheckAll(thisform)
{
	for (var i=0;i<thisform.elements.length;i++)
    {
	var e = thisform.elements[i];
	if (e.Name != "chkAll"&&e.disabled!=true)
		e.checked = thisform.chkAll.checked;
    }
}
function ConfirmDel(thisform)
{
	if(confirm("确定要删除选中的记录吗？"))
	    return true;
	else
	    return false;
}
function unselectall(thisform)
{
    if(thisform.chkAll.checked)
	{
		thisform.chkAll.checked = thisform.chkAll.checked&0;
    } 	
}

function helpscript(n){
	txtRun=n;window.open('admin_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("admin_templates_view.asp","templates_view")
}

//图片预揽功能
var sFromUrl = "http://";
// 初始值
function showimages(Obj){
	sFromUrl =  Obj.value;
	var sHTML = '<img src="'+sFromUrl+'" border="0" align=center onmousewheel="return bbimg(this)" onload="javascript:if(this.width>screen.width-800)this.style.width=screen.width-800;"';
	sHTML = sHTML+'>';
	if (sFromUrl.length<10){sHTML='';}
	document.getElementById('showimage').innerHTML = sHTML;
}
//图片预揽功能

function bbimg(o){
var zoom = parseInt(o.style.zoom, 10) || 100;
zoom -= event.wheelDelta / 12;
if(zoom > 0) {
o.style.zoom = zoom + '%';
}
return false;
}

//跳转函数
function JumpMenu(targ,selObj){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
}


var ColorImg;
var ColorValue;
function hideColourPallete() {
	document.getElementById("colourPalette").style.visibility="hidden";
}
function Getselcolor(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";
}


//selected下拉列表选取表单()
function BoardJumpListSelect(boardid,selectname,fristoption,fristvalue,RequestClassID){
	var sObj = document.getElementById(selectname);
	if (sObj)
	{
		sObj.options[0] =  new Option(fristoption, fristvalue);
		if (RequestClassID == boardid)
		{
			sObj.value = boardid;
			sObj.options[sObj.selectedIndex].style.color = "#ff0000";
		}else{
			sObj.options[0].selected = true;
		}
	}
}

//绑定选择状态
function GetCheckType(P_Name,P_Checked){
	document.all(P_Name).checked = P_Checked;
}

