/**
 * 页面工具栏对象
 * @return 
 */
function PageToolBar()
{
	this.pageUrl = window.location.href;
	this.contextPath = window.document.getElementById("contextPath").value;
}

PageToolBar.prototype.createToolBar=function()
{
    var toolDiv = document.createElement("div");
	toolDiv.innerHTML = this;
	toolDiv.style.top="0px";
	toolDiv.style.border="1px solid #a9bfd3";
	toolDiv.style.textAlign = "center";
	toolDiv.style.background= "#d0def0 url("+this.contextPath+"/app/wcms/images/bg.gif) repeat";
	toolDiv.style.width = "100%";
	toolDiv.style.height="40px";
	toolDiv.id = "pageToolBarDiv";
	return toolDiv;
}

/**
 * 将对象转换成字符串
 */
PageToolBar.prototype.toString=function()
{
	//总体Div构建
	if(document.all==null)
	{
		var str='<div style="width:50%;margin-left:29%;height:30px;margin-top:5px;">';
	}else{
		var str='<div style="width:50%;height:30px;margin-top:5px;">';
	}
	//html静态化Div构建
	var buttonStyle = "border:0 none;background:transparent;cursor:pointer;"
    +"width:auto;-moz-outline:0 none;outline:0 none;height:30px;";
	if(document.all!=null)
	{
	  buttonStyle+="text-align:center;";
	}
	var buttonCenter = "background:url("+this.contextPath+"/app/wcms/images/btnbg.gif);"
	+"cursor:pointer;white-space:nowrap;height:30px;width:100px;border:1px solid #a9bfd3;";
	str+='<div id="htmlStatic" title="static to html" style="width:33%;float:left;">';
	str+='<div style="'+buttonCenter+'">';
	str+='<input type="button" value="html静态化" onclick="toStaticHtml()" style="'+buttonStyle+'"/>'
	str+='</div>';
	str+='</div>';
	
	//jsp静态化Div构建
	str+='<div id="jspStatic" title="static to jsp" style="width:33%;float:left;">';
	str+='<div style="'+buttonCenter+'">';
	str+='<input type="button" value="jsp静态化" onclick="toStaticJsp()" style="'+buttonStyle+'">';
	str+='</div>';
	str+='</div>';
	

	//板块管理Div构建
	str+='<div id="DivManage" title="div manage" style="width:33%;float:left;" >';
	str+='<div style="'+buttonCenter+'">';
	str+='<input type="button" value="板块管理" style="'+buttonStyle+'" onclick="openPanalManage()">';
	str+='</div>';
	str+='</div>';
	
	str+='</div>';
	return str;
}

/**
*开始HTML静态化
*/
function toStaticHtml()
{
    var parameArray = new Array();
	var contextPath = document.getElementById("contextPath");
	var url = contextPath.value + "/app/wcms/utilPage/pageToStaticHtml.jsp"
	var windowObject = window;
	var type = 1;
	parameArray.push(type);
	parameArray.push(windowObject);
	window.showModalDialog(url, parameArray, "dialogWidth=900px;dialogHeight=700px;center=1;status=0;resizable=yes;help=1");
}

/**
*开始JSP静态化
*/
function toStaticJsp()
{
	 var parameArray = new Array();
	var contextPath = document.getElementById("contextPath");
	var url = contextPath.value + "/app/wcms/utilPage/pageToStaticJsp.jsp"
	var windowObject = window;
	var type = 2;
	parameArray.push(type);
	parameArray.push(windowObject);
	window.showModalDialog(url, parameArray, "dialogWidth=900px;dialogHeight=700px;center=1;status=0;resizable=yes;help=1");
}

/**
*打开面板管理界面
*/
function openPanalManage()
{
	var left = (window.screen.width - 700)/2;
	var top = (window.screen.height -500)/2;
	var params = "width=730,height=640,scrollbars=yes,alwaysRaised=yes,z-look=yes,left="+left+",top="+top+",location=no";
	var contextPath = window.document.getElementById("contextPath").value;//得到路径前缀
	var pageUrl = contextPath + "/app/wcms/utilPage/panelManage.jsp";
	window.open(pageUrl ,"newOpen",params);
}

/*动态调整footer*/
(function(){
 var s=function(){
	   var fi=document.getElementById("footerInner");
	   if(fi){
		     stop();
		   }else{
			 change();
		     stop();
		   }
	 },
	 change=function(){
		 var l=document.getElementById("lk_wcms_edit_ptlSite019all"),
		     r=document.getElementById("lk_wcms_edit_footerall"),
			 inner=document.createElement("div");
			 if(!l){
				 l=document.getElementById("lk_wcms_edit_ptlSite019all")
				 };
			 if(l==null) stop();
			 inner.style.width="786px";
			 inner.style.margin="auto";
			 l.style.padding="10px 0 0 60px";
			 r.style.padding="10px 85px 0 0";
			 l.style.margin="0";
			 r.style.margin="0";
			 l.style.float="left";
			 r.style.float="right";
			 l.style.width="170px";
			 r.style.width="430px";
			 l.parentNode.insertBefore(inner,l);
			 inner.appendChild(l);
			 inner.appendChild(r);
		 },
	 stop=function(){
		 clearInterval(timmer)
		 },
	timmer=setInterval(s,1000)
})()