//更新图片和视频
function updateBlogItemBlogIndex(itemId){
	var html=document.getElementById(itemId+"0").innerHTML;
	var url="/admin/video/updateBlogIndex.action";
	var pars="";
	if(html=="显示"){
		pars="itemId="+itemId+"&&status="+0;
		$.ajax({
		type: "GET",
		url: url,
		data: pars,
		dataType: "json",
		success:function(xml){
		var value=xml.message[0].result;
		var itemId=xml.message[0].id;
		var html=document.getElementById(itemId+"0").innerHTML;
		if(value=="0"){
			if(html=="显示"){
				document.getElementById(itemId+"0").innerHTML="隐藏";
			}else if(html=="隐藏"){
				document.getElementById(itemId+"0").innerHTML="显示";
			}
		}else if(value=="error"){
			alert("您没有正确访问地址!");
		}
		}
	});
	}else if(html=="隐藏"){
		pars="itemId="+itemId+"&&status="+1;
		$.ajax({
		type: "GET",
		url: url,
		data: pars,
		dataType: "json",
		success:function(xml){
		var value=xml.message[0].result;
		var itemId=xml.message[0].id;
		var html=document.getElementById(itemId+"0").innerHTML;
		if(value=="0"){
			if(html=="显示"){
				document.getElementById(itemId+"0").innerHTML="隐藏";
			}else if(html=="隐藏"){
				document.getElementById(itemId+"0").innerHTML="显示";
			}
		}else if(value=="error"){
			alert("您没有正确访问地址!");
		}
		}
	});
	}
}	
function updateBlogItemStatus(itemId){
	var html=document.getElementById(itemId+"1").innerHTML;
	var url="/admin/video/updateStatus.action";
	var pars="";
	if(html=="公开"){
		pars="itemId="+itemId+"&&status="+0;
		$.ajax({
		type: "GET",
		url: url,
		data: pars,
		dataType: "json",
		success:function(xml){
		var value=xml.message[0].result;
		var itemId=xml.message[0].id;
		var html=document.getElementById(itemId+"1").innerHTML;
		if(value=="0"){
			if(html=="公开"){
				document.getElementById(itemId+"1").innerHTML="隐藏";
			}else if(html=="隐藏"){
				document.getElementById(itemId+"1").innerHTML="公开";
			}
		}else if(value=="error"){
			alert("您没有正确访问地址!");
		}
			
		}
	});
	}else if(html=="隐藏"){
		pars="itemId="+itemId+"&&status="+1;
		$.ajax({
		type: "GET",
		url: url,
		data: pars,
		dataType: "json",
		success:function(xml){
		var value=xml.message[0].result;
		var itemId=xml.message[0].id;
		var html=document.getElementById(itemId+"1").innerHTML;
		if(value=="0"){
			if(html=="公开"){
				document.getElementById(itemId+"1").innerHTML="隐藏";
			}else if(html=="隐藏"){
				document.getElementById(itemId+"1").innerHTML="公开";
			}
		}else if(value=="error"){
			alert("您没有正确访问地址!");
		}
			}
		});
	}
}
/*
function postChangeBlogItemStatus(url,pars){
	var myAjax = new Ajax.Request(
	                    url,
	                    {method: 'post', postBody:pars , onComplete: showChangeBlogItemStatus , onFailure:showFailed}
	                    );
}
*/
/*
function postChangeBlogItemBlogIndex(url,pars){
	var myAjax = new Ajax.Request(
	                    url,
	                    {method: 'post', postBody:pars , onComplete: showChangeBlogItemBlogIndex , onFailure:showFailed}
	                    );
}
function showChangeBlogItemBlogIndex(request){
	var doc=request.responseXML.documentElement;
	var node=doc.getElementsByTagName('result');
	var value=node[0].firstChild.nodeValue;
	var itemId=node[1].firstChild.nodeValue;
	var html=document.getElementById(itemId+"0").innerHTML;
	if(value=="0"){
		if(html=="显示"){
			document.getElementById(itemId+"0").innerHTML="隐藏";
		}else if(html=="隐藏"){
			document.getElementById(itemId+"0").innerHTML="显示";
		}
	}else if(value=="error"){
		alert("您没有正确访问地址!");
	}
}
*/
/*
function showChangeBlogItemStatus(request){
	var doc=request.responseXML.documentElement;
	var node=doc.getElementsByTagName('result');
	var value=node[0].firstChild.nodeValue;
	var itemId=node[1].firstChild.nodeValue;
	var html=document.getElementById(itemId+"1").innerHTML;
	if(value=="0"){
		if(html=="公开"){
			document.getElementById(itemId+"1").innerHTML="隐藏";
		}else if(html=="隐藏"){
			document.getElementById(itemId+"1").innerHTML="公开";
		}
	}else if(value=="error"){
		alert("您没有正确访问地址!");
	}
}
function showFailed(request)
{
	alert("连接失败....");
}

*/
//视频图片blog投票
function votePicture(itemId){
	var url="/photo/votePicture.action";
	var pars="itemId="+itemId;
	$.ajax({
		type: "GET",
		url: url,
		data: pars,
		dataType: "json",
		success:function(xml){
		var value=xml.message[0].result;
		var itemId=xml.message[0].id;
		if(value=="0"){
		var count=document.getElementById(itemId);
		if(count!=null){
			count.innerHTML=parseInt(count.innerHTML)+1+"票";	
		}
		var count1=document.getElementById("total");
		var count2=document.getElementById("today");
		if(count1!=null && count2!=null){
			count1.innerHTML=parseInt(count1.innerHTML)+1;
			count2.innerHTML=parseInt(count2.innerHTML)+1;
		}
		alert("投票成功!");
	}else if(value=="error"){
		alert("您没有正确访问地址!");
	}else if(value=="1"){
		alert("您已经投过票了，请不要重复投!");
	}else if(value=="2"){
		alert("您还没有登录!");
	}
			}
		});
}
/*
function postVotePicture(url,pars){
	var myAjax = new Ajax.Request(
	                    url,
	                    {method: 'post', postBody:pars , onComplete: showVotePicture , onFailure:showFailed}
	                    );
}
function showVotePicture(request){
	var doc=request.responseXML.documentElement;
	var node=doc.getElementsByTagName('result');
	var value=node[0].firstChild.nodeValue;
	var itemId=node[1].firstChild.nodeValue;
	if(value=="0"){
		var count=document.getElementById(itemId);
		if(count!=null){
			count.innerHTML=parseInt(count.innerHTML)+1+"票";	
		}
		var count1=document.getElementById("total");
		var count2=document.getElementById("today");
		if(count1!=null && count2!=null){
			count1.innerHTML=parseInt(count1.innerHTML)+1;
			count2.innerHTML=parseInt(count2.innerHTML)+1;
		}
		alert("投票成功!");
	}else if(value=="error"){
		alert("您没有正确访问地址!");
	}else if(value=="1"){
		alert("您已经投过票了，请不要重复投!");
	}else if(value=="2"){
		alert("您还没有登录!");
	}
}
*/
function voteVideo(itemId){
	var url="/video/voteVideo.action";
	var pars="itemId="+itemId;
	$.ajax({
		type: "GET",
		url: url,
		data: pars,
		dataType: "json",
		success:function(xml){
		var value=xml.message[0].result;
		var itemId=xml.message[0].id;
		if(value=="0"){
		var count=document.getElementById(itemId);
		if(count!=null){
			count.innerHTML=parseInt(count.innerHTML)+1+"票";
		}
		
		var count1=document.getElementById("total");
		var count2=document.getElementById("today");
		if(count1!=null && count2!=null){
			count1.innerHTML=parseInt(count1.innerHTML)+1;
			count2.innerHTML=parseInt(count2.innerHTML)+1;
		}
		alert("投票成功!");
	}else if(value=="error"){
		alert("您没有正确访问地址!");
	}else if(value=="1"){
		alert("您已经投过票了，请不要重复投!");
	}else if(value=="2"){
		alert("您还没有登录!");
	}
			}
		});
}
/*
function postVoteVideo(url,pars){
	var myAjax = new Ajax.Request(
	                    url,
	                    {method: 'post', postBody:pars , onComplete: showVoteVideo , onFailure:showFailed}
	                    );
}
function showVoteVideo(request){
	var doc=request.responseXML.documentElement;
	var node=doc.getElementsByTagName('result');
	var value=node[0].firstChild.nodeValue;
	var itemId=node[1].firstChild.nodeValue;
	if(value=="0"){
		var count=document.getElementById(itemId);
		if(count!=null){
			count.innerHTML=parseInt(count.innerHTML)+1+"票";
		}
		
		var count1=document.getElementById("total");
		var count2=document.getElementById("today");
		if(count1!=null && count2!=null){
			count1.innerHTML=parseInt(count1.innerHTML)+1;
			count2.innerHTML=parseInt(count2.innerHTML)+1;
		}
		alert("投票成功!");
	}else if(value=="error"){
		alert("您没有正确访问地址!");
	}else if(value=="1"){
		alert("您已经投过票了，请不要重复投!");
	}else if(value=="2"){
		alert("您还没有登录!");
	}
}
*/
function voteBlog(){
	var url="/voteBlog.action";
	var pars="";
	$.ajax({
                 type: "GET",
                 url: url,
                 dataType: "json",
                 success: function(xml) {
                     showVoteBlogFinal(xml.message[0].result);
                 }
             }); 
}
function postVoteBlog(url,pars){
	var myAjax = new Ajax.Request(
	                    url,
	                    {method: 'post', postBody:pars , onComplete: showVoteBlog , onFailure:showFailed}
	                    );
}
function showVoteBlog(request){
	var doc=request.responseXML.documentElement;
	var node=doc.getElementsByTagName('result');
	var value=node[0].firstChild.nodeValue;
	showVoteBlogFinal(value);
}
function showVoteBlogFinal(value){
	if(value=="0"){
		var count1=document.getElementById("total");
		var count2=document.getElementById("today");
		if(count1!=null && count2!=null){
			count1.innerHTML=parseInt(count1.innerHTML)+1;
			count2.innerHTML=parseInt(count2.innerHTML)+1;
			alert("投票成功!");
		}else{
			alert("投票成功!");
		}
		
	}else if(value=="1"){
		alert("您已经投过票了，请不要重复投!");
	}else if(value=="2"){
		alert("您还没有登录!");
	}
}