function addfavourite(){
	var opt = {
			method: "post",
			parameters: {value:useridtmp},
			onSuccess: function(t) {
				$("infotext").innerHTML = _("This blog has been added as your favorite");
				showElement("infobox");
				$("infobox").focus();
				//$("favouritesblogpost_innerbody").innerHTML = t.responseText;
			},
			onFailure: function(t) {
				$("infotext").innerHTML = _("The favourite blog cannot be added");
				showElement("infobox");
				$("infobox").focus();
			}
		  }
	new Ajax.Request(addFavouritetmp, opt);
}

function showblogs(userid,blogspage){
	var opt = {
			method: "post",
			postBody: "userid="+userid+"&blogspage="+ blogspage,
			onSuccess: function(t) {
				$("blogs").innerHTML = t.responseText;
				
			},
			onFailure: function(t) {
				$("blogs").innerHTML = _("Sorry, cannot show blog's content");
				$("infotext").innerHTML = _("Sorry, cannot show blog's content");
				showElement("infobox");
				$("infobox").focus();
			}
		  }
	new Ajax.Request("/blog/showBlogs", opt);
}

function showtags(userid,tagname,blogspage){
	var opt = {
			method: "post",
			postBody: "userid="+userid+"&tagname="+encodeURIComponent(tagname)+"&blogspage="+blogspage,
			onSuccess: function(t) {
				$("blogs").innerHTML = t.responseText;
				
			},
			onFailure: function(t) {
				$("blogs").innerHTML = _("Sorry, cannot show blog's content");
				$("infotext").innerHTML = _("Sorry, cannot show blog's content");
				showElement("infobox");
				$("infobox").focus();
			}
		  }
	new Ajax.Request("/blog/showTags", opt);
}

function showcategorys(userid,catname,blogspage){
	var opt = {
			method: "post",
			postBody: "userid="+userid+"&catname="+encodeURIComponent(catname)+"&blogspage="+blogspage,
			onSuccess: function(t) {
				$("blogs").innerHTML = t.responseText;
				
			},
			onFailure: function(t) {
				$("blogs").innerHTML = _("Sorry, cannot show blog's content");
				$("infotext").innerHTML = _("Sorry, cannot show blog's content");
				showElement("infobox");
				$("infobox").focus();
			}
		  }
	new Ajax.Request("/blog/showCategorys", opt);
}

function showarchives(userid,year,month,blogspage){
	var opt = {
			method: "post",
			postBody: "userid="+userid+"&year="+encodeURIComponent(year)+"&month="+encodeURIComponent(month)+"&blogspage="+blogspage,
			onSuccess: function(t) {
				$("blogs").innerHTML = t.responseText;
				
			},
			onFailure: function(t) {
				$("blogs").innerHTML = _("Sorry, cannot show blog's content");
				$("infotext").innerHTML = _("Sorry, cannot show blog's content");
				showElement("infobox");
				$("infobox").focus();
			}
		  }
	new Ajax.Request("/blog/showArchives", opt);
}

function showHeadImage(userid,page){
	var opt = {
			method: "post",
			postBody: "id="+userid+"&page="+ page,
			onSuccess: function(t) {
				$("blogpic").innerHTML = t.responseText;
				
			},
			onFailure: function(t) {
				$("blogpic").innerHTML = "";
				$("infotext").innerHTML = _("Cannot show blog header image");
				showElement("infobox");
				$("infobox").focus();
			}
		  }
	new Ajax.Request("/blog/getHeadPic", opt);
}

function openTag2(link, tag, page){
	window.location.href  = link + urlEncode(tag) + '/' + page;
}
