function showsubmenu(sid)
{
whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none")
{
eval("submenu" + sid + ".style.display=\"\";");
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
}
}


function turnit(ss)
{
 if (ss.style.display=="none") 
{	
  ss.style.display="";
  //i_id.src="../images/z_open.gif";   
}
 else
  {ss.style.display="none";
   //i_id.src="../images/z_Close.gif";
}
}



function closemenu()
{
     tb1.style.display="none";
     //img1.src="../images/z_Close.gif";

     tb2.style.display="none";
     //img2.src="../images/z_Close.gif";

   tb3.style.display="none";
   //img3.src="../images/z_Close.gif";

   //ShowTb4.style.display="none";
   //img4.src="../images/z_Close.gif";
   
   //ShowTb5.style.display="none";
   //img5.src="../images/z_Close.gif";

   
   //ShowTb6.style.display="none";
   // img6.src="../images/z_Close.gif";
  
    // ShowTb7.style.display="none";
    // img7.src="../images/z_Close.gif";

   //ShowTb8.style.display="none";
   //img8.src="../images/z_Close.gif";
   
   //ShowTb9.style.display="none";
  //img9.src="../images/z_Close.gif";

   
   //ShowTb10.style.display="none";
  //img10.src="../images/z_Close.gif";
}

function getimg(img,i_id)
{
	
  img.src="Images/title_0"+i_id+".jpg";   
}


function checkvalid()
{

    if (document.myform.Title.value=="" ) {
       window.alert("标题不能为空!");
       document.myform.Title.focus();
       return (false);
    }
    if (document.myform.UpdateTime.value=="" ) {
       window.alert("时间不能为空!");
       document.myform.UpdateTime.focus();
       return (false);
    }
	
    if (document.myform.Content.value=="" ) {
       window.alert(" 内容不能为空!");
       document.myform.Content.focus();
       return (false);
    }
	
	
	return (true);
}

function MM_jumpMenu(targ,selObj,restore){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//添加图片
function AddItem(strFileName,ImgWidth,ImgHeight){
  if(document.myform.DefaultPicUrl.value==''){
     document.myform.DefaultPicUrl.value=strFileName;
  }
  document.myform.DefaultPicList.options[document.myform.DefaultPicList.length]=new Option(strFileName,strFileName);
  document.myform.DefaultPicList.selectedIndex+=1;
  if(document.myform.UploadFiles.value==''){
	document.myform.UploadFiles.value=strFileName;
  }
  else{
    document.myform.UploadFiles.value=document.myform.UploadFiles.value+"|"+strFileName;
  }
  if(document.myform.ImgWidth.value==''){
   document.myform.ImgWidth.value=ImgWidth;
   document.myform.ImgHeight.value=ImgHeight;
  }else{
   document.myform.ImgWidth.value=document.myform.ImgWidth.value+"|"+ImgWidth;
   document.myform.ImgHeight.value=document.myform.ImgHeight.value+"|"+ImgHeight;
  }
}

//删除图片
function DelItem(seledIndex){

var str1=parent.myform.DefaultPicList.options[seledIndex].value;

if (parent.myform.DefaultPicList.selectedIndex==-1){
     return;
}


if (seledIndex==0){
       alert("已经没有图片或您选择的不是上传的文件!");
}else{
   
   
   if (parent.myform.DefaultPicUrl.value==parent.myform.DefaultPicList.options[seledIndex].value){
       parent.myform.DefaultPicUrl.value="";
   }
  if(parent.myform.DelFile.value==''){
	parent.myform.DelFile.value=parent.myform.DefaultPicList.options[seledIndex].value;
  }
  else{
    parent.myform.DelFile.value=parent.myform.DelFile.value+"|"+parent.myform.DefaultPicList.options[seledIndex].value;
  }
  
   parent.myform.UploadFiles.value=WHstr(parent.myform.UploadFiles.value,seledIndex-1);   
   parent.myform.ImgWidth.value=WHstr(parent.myform.ImgWidth.value,seledIndex);
   parent.myform.ImgHeight.value=WHstr(parent.myform.ImgHeight.value,seledIndex);
   eval("parent.myform.DefaultPicList.options.remove("+seledIndex+")");
   
}

if(seledIndex==0){
   alert("操作失败!");
}else{
   alert("删除["+str1+"]成功!");
   }
}


//删除数据无素
function WHstr(strs,seledIndex){
  
   var str1=strs.split("|");
   var str2;
   
   if(isNaN(seledIndex)||seledIndex>str1.length)
      {return false;}
  
   for(var i=seledIndex;i<str1.length;i++)
    {
      str1[i]=str1[i+1];
    }
    str1.length-=1;
	str2=str1.join("|");
  	return(str2);
}
//文本框内容被选
function fontchuli(){
if ((document.selection)&&(document.selection.type == "Text")) {
var range = document.selection.createRange();
var ch_text=range.text;
fontend="<img src="+document.myform.DefaultPicList.options[document.myform.DefaultPicList.selectedIndex].value+">";
range.text = ch_text + fontend;
} 
else {
document.frmAnnounce.Content.value=fontbegin+document.frmAnnounce.Content.value+fontend;
document.frmAnnounce.Content.focus();
}
}

function DefaultPic(){
if(document.myform.DefaultPicList.options[document.myform.DefaultPicList.selectedIndex].value==''){
   document.myform.DefaultPicUrl.value='';
}
}