﻿// JScript 文件
function checkLoginForm()
{
   var frm=$("myform");
   var blogName=$("blogusername");
   var blogpass=$("bloguserpass");
   if(blogName.value=="")
    {
      alert("博客登录帐号不能为空！");
      blogName.focus();
      return false;
    }
    if(blogpass.value=="")
    {
      alert("登录密码不能为空！");
      blogpass.focus();
      return false;
    }
    return true;
}
function $(s)
{
 return document.getElementById(s);
}
function checkFrom()
{
  $("btnsub").disabled=true
  var tl=$("blogTitle").value;  
  tl=tl.trim();
  if(tl=="")
   {
    alert("标题不能为空哦！");
    $("blogTitle").focus();
    $("btnsub").disabled=false;
    return false;
   }  
    var Content="";
   if(navigator.appName=="Opera"){
        Content=$("#tfContent").get(0).value;
      }
    else
     {
      Content=FCKeditorAPI.GetInstance('tfContent').GetXHTML(true);
     }  
   if(Content.length<1)
    {
      alert("内容不能为空！");
      $("btnsub").disabled=false;
      return false;
    }
    $("tContent").value=   Content;
   return true;
   
}
function doCheck(ischecked)
{
  try
  {
  var check=document.getElementsByTagName("input");
  for(var i=0;i<check.length;i++)
   {
     if(check[i].name=="idlist")
      {
        check[i].checked=ischecked;
      }
   }
  
  }catch(e){}
}
function confirmDel()
{
    var ids = getChecked();
	if (ids.length == '') {
		alert('请选择要删除的日志');
		return false;
	}
	if (!confirm('真的要删除选中的日志吗？')) {
		return false;
	}
	return true;
}
function getChecked()
{
var ids="";
 try
  {
  var check=document.getElementsByTagName("input");
  for(var i=0;i<check.length;i++)
   {
     if(check[i].name=="idlist")
      {
         if(check[i].checked)
          {
           ids+=check[i].value + ',';
          }
      }
   }
  
  }catch(e){}
  return ids;
}
function CheckComment(){var c=$("comment"); var  tl=c.value.trim(); if(tl=="")  {  alert("评论内容不能为空！"); c.focus(); return false; } $("btnsub").disabled=true;  $("log").value="532";  $("user").value="678";  $("nm").value="w"; return true;}
function CheckBlogPass()
{
 var p=$("mypass");
 if(p.value.trim()=="")
  {
   alert("加密不能为空！");
   p.focus();
   return false;
  }
  return true;
}
function docheckBoxPass()
{
try
{
  var c=$("blogpass");
  if($("ischeckpass").checked)
   {
   $("blogpassdiv").style.display="block";
    c.style.display="block";
   }else
   {
   $("blogpassdiv").style.display="none";
    c.style.display="none";
   }
  }catch(e){}
}
String.prototype.trim = function() {
	var result=this.replace(/(^\s*)/g, "");
	result=result.replace(/(\s*$)/g, "");
	return result;
};
