var bodyCH=false;//记录是不是点击body右键
var optObjectID;//记录目前操作的对象编号
function c(css)
	{bodyClick.className=css;}
function link(act,txt)
	{
	document.write("<div class=link onMouseOver=this.className='overlink' onMouseOut=this.className='link' style='padding-left:16;padding-top:1;padding-bottom:1' onclick="+act+">"+txt+"</div>");
	}
/**显示**/
function showNewSiteMenu(id){
	hiddenMenu();
	if (id!=null){	
		optObjectID=id;
		bodyCH=true;
		var rightedge=event.clientX+100
		var bottomedge=document.body.clientHeight-event.clientY-25
		if (rightedge<bodyClick.offsetWidth)
			bodyClick.style.left=document.body.scrollLeft+event.clientX-bodyClick.offsetWidth;
		else
			bodyClick.style.left=document.body.scrollLeft+event.clientX
		if (bottomedge<bodyClick.offsetHeight)
			bodyClick.style.top=document.body.scrollTop+event.clientY-bodyClick.offsetHeight
		else
			bodyClick.style.top=document.body.scrollTop+event.clientY
			bodyClick.style.visibility="visible";
			window.event.returnValue = false;	
	}
	return false;
	}
function showSiteRightMenu(id){
	hiddenMenu();
	if (id!=null){	
		optObjectID=id;
		bodyCH=true;
		var rightedge=event.clientX+100
		var bottomedge=document.body.clientHeight-event.clientY-25
		if (rightedge<siteClick.offsetWidth)
			siteClick.style.left=document.body.scrollLeft+event.clientX-siteClick.offsetWidth;
		else
			siteClick.style.left=document.body.scrollLeft+event.clientX
		if (bottomedge<siteClick.offsetHeight)
			siteClick.style.top=document.body.scrollTop+event.clientY-siteClick.offsetHeight
		else
			siteClick.style.top=document.body.scrollTop+event.clientY
			siteClick.style.visibility="visible";
			window.event.returnValue = false;	
	}
	return false;
	}
function showChannelRightMenu(id){
	hiddenMenu();
	if (id!=null){	
		optObjectID=id;
		bodyCH=true;
		var rightedge=event.clientX+100
		var bottomedge=document.body.clientHeight-event.clientY-25
		if (rightedge<channelClick.offsetWidth)
			channelClick.style.left=document.body.scrollLeft+event.clientX-channelClick.offsetWidth;
		else
			channelClick.style.left=document.body.scrollLeft+event.clientX
		if (bottomedge<channelClick.offsetHeight)
			channelClick.style.top=document.body.scrollTop+event.clientY-channelClick.offsetHeight
		else
			channelClick.style.top=document.body.scrollTop+event.clientY
			channelClick.style.visibility="visible";
			window.event.returnValue = false;	
	}
	return false;
	}
function hiddenMenu(){
bodyClick.style.visibility="hidden";
siteClick.style.visibility="hidden";
channelClick.style.visibility="hidden";
}
function pop(win){
	window.open(win,'','')
}
function openNewSmall(url,width,height,id){
	var l = screen.width/2-width/2;
	var t = screen.height/2-height/2;
	newSite = window.open('','newSite','scrollbars=no,toolbar=no,menubar=no,location=no,status=no,resizable=no,width='+width+',height='+height+',left='+l+',top='+t);
	if (id)
	{
		url=url+optObjectID;
	}
	newSite.location.replace(url)
	newSite.focus();
}
function pageView(url){
	var l = screen.width;
	var t = screen.height-50;
	newSite = window.open('','newSite','scrollbars=yes,toolbar=no,menubar=no,location=no,status=no,resizable=no,width='+l+',height='+t+',left=0,top=0');
	url=url+"="+optObjectID;
	newSite.location.replace(url)
	newSite.focus();
}
//权限设置
//url是连接的地址，这里可以控制是站点权限还是频道权限
function setPower(url){
	var l = 600;
	var t = 400;
	var setPower = window.open('','setPower','scrollbars=no,toolbar=no,menubar=no,location=no,status=no,resizable=no,width='+l+',height='+t+',left=0,top=0');
	url=url+"="+optObjectID;
	setPower.location.replace(url)
	setPower.focus();
}

function postDoc(){
	var l = screen.width;
	var t = screen.height-50;
	var postdoc = window.open('','postdoc','scrollbars=no,toolbar=no,menubar=no,location=no,status=no,resizable=no,width='+l+',height='+t+',left=0,top=0');
	url="docPostShowAction.do?channelID="+optObjectID;
	postdoc.location.replace(url)
	postdoc.focus();
}
function confirmExt(url,desc,id){
	if (confirm(desc))
	{
		if (id)
		{
			window.location.href=url+optObjectID;
		}
		else{
			window.location.href=url;
		}
	}
}
function openToTarget(url,targetFrame,id){
	if (id=='Y')
	{
		url=url+optObjectID;
	}
	var str="parent."+targetFrame+".window.location.href='"+url+"';";
	eval(str);
}
function bodyC(){
	if (bodyCH==false){
		showNewSiteMenu(1);
		bodyCH=false;
		window.event.returnValue = false;
		}else{
		bodyCH=false;
		window.event.returnValue = false;
		}
}
if (document.all&&window.print){
	document.oncontextmenu=bodyC;

}

function openNode(id){
	if (id.indexOf("site")!=-1)
	{
		//id=id.substring(0,id.indexOf("site"));
		//parent.mainFrame.window.location.href="./docManagerListAction.do?siteID="+id;
		window.location.href="product.asp?id="+id;
	}
	else{
	window.location.href="product.asp?id="+id;
	}
}

function setSitePower(){
	var l = 600;
	var t =400;
	var setPower = window.open('','setPower','scrollbars=no,toolbar=no,menubar=no,location=no,status=no,resizable=no,width='+l+',height='+t+',left=0,top=0');
	url="./popedomListAction.do?siteID="+optObjectID;
	setPower.location.replace(url)
	setPower.focus();
}
function setChannelPower(){
	var l = 600;
	var t =400;
	var setPower = window.open('','setPower','scrollbars=no,toolbar=no,menubar=no,location=no,status=no,resizable=no,width='+l+',height='+t+',left=0,top=0');
	url="./popedomListAction.do?chanelID="+optObjectID;
	setPower.location.replace(url)
	setPower.focus();
}

function channelPublish(url){
	hiddenMenu();
	if (confirm("是否确定进行完全发布！"))
	{	
	var obj = new Object();
		obj.url = url+"="+optObjectID;
	window.showModalDialog("./program/publish/statusFrame.htm",obj,"dialogWidth:408px;dialogHeight:227px;center:1;scroll:1;help:0;status:0;resizable:1;edge:raised");
	/*
	var l = screen.width;
	var t = screen.height-50;
	var channelPublish = window.open('','channelPublish','scrollbars=no,toolbar=no,menubar=no,location=no,status=no,resizable=no,width='+l+',height='+t+',left=0,top=0');
	url=url+"="+optObjectID;
	channelPublish.location.replace(url)
	channelPublish.focus();*/
	}
}

function sitePublish(url){
	var l = screen.width;
	var t = screen.height-50;
	newSite = window.open('','newSite','scrollbars=yes,toolbar=no,menubar=no,location=no,status=no,resizable=no,width='+l+',height='+t+',left=0,top=0');
	url=url+"="+optObjectID;
	newSite.location.replace(url)
	newSite.focus();
}
function deleteChannel(){
	if (confirm("是否确定删除该频道，确认删除将无法恢复！"))
	{
	
	var l =100;
	var t = 20;
	var delChannelW = window.open('','delChannelW','scrollbars=yes,toolbar=no,menubar=no,location=no,status=no,resizable=no,width='+l+',height='+t+',left=0,top=0');
	delChannelW.location.replace("./channelDeleteAction.do?channelID="+optObjectID);
	delChannelW.focus();
	}
}
function deletedDocManager(){
	parent.mainFrame.window.location.href="./docCallBackAction.do?channelID="+optObjectID;
}