var p=urlPar("p");
var objAjax=new JAjax();
function over(obj){//覆盖的时候
	   var id=obj.id;
	   if(p!=id)
	   {
		 obj.style.backgroundImage="url(./img/over.gif)";
		 obj.childNodes[1].style.color="#000000";
		 obj.childNodes[1].style.cursor="hand";
	   }
	   else
	   {
		 obj.style.backgroundImage="url(./img/click.gif)";
		 obj.childNodes[1].style.color="#ffffff";
		 obj.childNodes[1].style.cursor="none";
	   }
	}
function leave(obj){//离开的时候
   var id=obj.id;
   if(p!=id)
   {
	 obj.style.backgroundImage="url(./img/bgColor.gif)";
	 obj.childNodes[1].style.color="#000000";
	 obj.childNodes[1].style.cursor="none";
   }  
   else
   {
	 obj.style.backgroundImage="url(./img/click.gif)";
	 obj.childNodes[1].style.color="#ffffff";
	 obj.childNodes[1].style.cursor="none";
   }    
}
function clickHelp(obj){//点击获取帮助的值
   var id=obj.id;
   p=id;
   writeFettleLeft("提示:当前显示的是"+p+"的使用帮助"); //状态栏提示  
   var helpDiv=document.getElementsByTagName("div");
   for(var i=0;i<helpDiv.length;i++)
   {  
		if(helpDiv[i].name=="helpDiv")
		  {
			  if(helpDiv[i].id!=id)
			  { 
				helpDiv[i].style.backgroundImage="url(./img/bgColor.gif)";
				helpDiv[i].childNodes[1].style.color="#000000";
				helpDiv[i].childNodes[1].style.cursor="none";
			  }
			  else
			  {
				helpDiv[i].style.backgroundImage="url(./img/click.gif)";
				helpDiv[i].childNodes[1].style.color="#ffffff";
				helpDiv[i].childNodes[1].style.cursor="none";
			  }
		 }
   }
   if(id==null||id=="")
   {
	  alert("参数传入错误!");
	  return;
   }
   else
   {
	 readHelpContent(id);
   }
}  
function clickHelpEditor(obj){//点击获取帮助的值
   var id=obj.id;
   p=id;
   editorName=id;
   writeFettleLeft("提示:当前显示的是"+p+"的使用帮助"); //状态栏提示  
   var helpDiv=document.getElementsByTagName("div");
   for(var i=0;i<helpDiv.length;i++)
   {  
		if(helpDiv[i].name=="helpDiv")
		  {
			  if(helpDiv[i].id!=id)
			  { 
				helpDiv[i].style.backgroundImage="url(./img/bgColor.gif)";
				helpDiv[i].childNodes[1].style.color="#000000";
				helpDiv[i].childNodes[1].style.cursor="none";
			  }
			  else
			  {
				helpDiv[i].style.backgroundImage="url(./img/click.gif)";
				helpDiv[i].childNodes[1].style.color="#ffffff";
				helpDiv[i].childNodes[1].style.cursor="none";
			  }
		 }
   }
   if(id==null||id=="")
   {
	  alert("参数传入错误!");
	  return;
   }
   else
   {
	 readHelpContentEditor(id);
   }
}
function readHelpContent(obj){//读取当前的使用帮助
	  var id=obj;
	  var objResponse=new JHttpResponse();
	  objResponse.write("helpName",id);
	  var out=objAjax.getText("post","index.aspx?type=getHelp",objResponse,null);
	  if(out==null||out=="")
	  {
		 document.getElementById("helpContent").innerHTML="<span style='color:red'>当前还没有该项的使用帮助！</span>";   
	  }
	  else
	  {
		document.getElementById("helpContent").innerHTML="<div style='width:100%;height:100%;text-align:left;'>"+out+"</div>";
	  }
	  var eleImg=document.getElementsByTagName("img");
	 
	  for(var i=0;i<eleImg.length;i++)
	  {
		if(eleImg[i].fileSize<1)
		{
			eleImg[i].style.display="none";
		}
	 }
}   
function readHelpContentEditor(obj){//读取当前的使用帮助
		  var id=obj;
		  editorName=id;
		  var objResponse=new JHttpResponse();
		  objResponse.write("helpName",id);
		  var out=objAjax.getText("post","index.aspx?type=getHelp",objResponse,null);
		  if(out==null||out=="")
		  {
			 editTxt.Composition.document.body.innerHTML="";   
		  }
		  else
		  {
			editTxt.Composition.document.body.innerHTML=out;
		  }
	} 
function saveHelpEditor(){//保存编辑完的内容           
	 if(editorName==null||editorName==""||typeof editorName=="undefined")
	 {
	   alert("你当前没有对任何项进行编辑");
	 }
	 else
	 {
		 var content=editTxt.Composition.document.body.innerHTML;
		 var objResponse=new JHttpResponse();
		 objResponse.write("helpContent",content);
		 objResponse.write("pName",editorName);
		 var out=objAjax.getText("post","helpEditor.aspx?type=saveHelp",objResponse,null);
		 switch(out)
		 {
		   case "ok":alert("保存成功");break;
		   default:alert(out);break;
		 }
	 }
}     