/**
 * 页面工具栏对象
 * @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="30px";
	toolDiv.id = "pageToolBarDiv";
	return toolDiv;
}

/**
 * 将对象转换成字符串
 */
PageToolBar.prototype.toString=function()
{
	var str;
	//总体Div构建
	if(document.all==null)
	{
		str='<div style="width:50%;margin-left:40%;height:30px;margin-top:5px;">';
	}else{
		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:20px;";
	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:20px;width:100px;border:1px solid #a9bfd3;";

	var currentPage =  window.location.href;
	
	//预览编辑
	str+='<div id="jspStatic" style="width:50%;float:left;">';
	str+='<div style="'+buttonCenter+'">';
	if(currentPage.indexOf("?pOperateType=view") != -1)
	{
		currentPage = currentPage.split("?pOperateType=view")[0];
		str+='<a style="'+buttonStyle+'" href='+currentPage+'>编辑</a>';
	}
	else
	{
		currentPage = currentPage + "?pOperateType=view";
		str+='<a style="'+buttonStyle+'" href='+currentPage+'>预览</a>';
	}
	str+='</div>';
	str+='</div>';
	
	var contextPath = window.document.getElementById("contextPath").value;//得到路径前缀
	var pageUrl = contextPath + "/app/olwcms/list.jsp?pageUrl=" + currentPage + "&siteCode="+siteCode;
	
	//板块管理Div构建
	str+='<div id="DivManage" style="width:50%;float:left;" >';
	str+='<div style="'+buttonCenter+'">';
	str+='<a style="'+buttonStyle+'" target="_" href="'+pageUrl+'">后台管理</a>';
	str+='</div>';
	str+='</div>';
	
	str+='</div>';
	return str;
}