var newBlogHTML = "";
var newBlogName = "";
var newBlogChildHTML = "";
var newBlogChildName = "";
function enterEdit(type,blogID)
{   
	var pars = "";
	if(type == 'name')
	{
		var txtBlogName = $.trim($("#txtBlogName").val());
		if(txtBlogName == '')
		{
			alert("请输入博客名称！");
			return;
		}
		pars = "opta=updateBlogName&blogID="+blogID+"&blogName="+encodeURI(txtBlogName)+"&rnd="+Math.random();
		//alert($("txtBlogName").value);               
	}
	else
	{
		var txtBlogChildName = $.trim($("#txtChildBlogName").val());
		pars = "opta=updateBlogChildName&blogID="+blogID+"&blogChildName="+encodeURI(txtBlogChildName)+"&rnd="+Math.random();
	}
	 $.ajax({
	   type: "POST",
	   url: "/Blog/Ajax/AjaxPage.aspx",
	   data: pars,
	   success: function(request){
			if(type == 'name')
				newBlogName = $.trim($("#txtBlogName").val())
			 else
				newBlogChildName = $.trim($("#txtChildBlogName").val());
			 
			 if(type == 'name'){
				$("#blogName").html(newBlogName+"<span id=\"editBlogName\" style=\"display:none;color:#db4612;font-size:14px;\">[编辑]</span>");
				//$("blogName").innerHTML = $("blogName").innerHTML;
				newBlogHTML = $("#blogName").html();
			 }
			 else{
				$("#blogChildName").html(newBlogChildName+"<span id=\"editChildBlogName\" style=\"display:none;color:#db4612;font-size:14px;\">[编辑]</span>");
				//$("blogChildName").innerHTML = $("blogChildName").innerHTML;
				newBlogChildHTML = $("#blogChildName").html();
			 }
	   }

	 });   
	
}
function cancelEdit(type)
{
	if(type == 'name')
	{
		$("#blogName").html(newBlogHTML==""?blogName:newBlogHTML);		
	}
	else
	{
		$("#blogChildName").html(newBlogChildHTML==""?blogChileName:newBlogChildHTML);
	}
}


function CheckForm()
{
	if($.trim($("#txtUserName").val()) == "" || $.trim($("#txtPass").val()) == "")
	{
		alert("请输入用户名和密码");
		return;
	}
	
	var pars = "opta=login&uName="+$.trim($("#txtUserName").val())+"&uPass="+$.trim($("#txtPass").val())+"&rnd="+Math.random();
	
	$.ajax({
	   type: "POST",
	   url: "/Ajax/AjaxPage.aspx",
	   data: pars,
	   success: function(request){
			if(request == "ok")
			{
				alert("登录成功");					
				$("#windowClose").click();
				//CloseMiddleElement();
			}
			else
			{
				alert("用户名或者密码错误");
			}
	   }

	 });
}



(function($){
	$.fn.slide = function(options){
		var defaults = {
			sLength :10	//缩进长度						
		}
		var options = $.extend(defaults,options);
		
		this.each(function(){
			//var thisObj = $(this);						
			//thisObj.find("a").each(function(){
				var className = $(this).attr("class");				
				$(this).mouseover(function(){						
					$(this).animate({marginLeft :options.sLength+'px'}, {queue:false, duration:300});								
					
				}).mouseout(function(){
					
					$(this).animate({marginLeft :'0px'}, {queue:false, duration:300});
					
				});
		//	});				
			
		});
	};
})(jQuery);
