//PJBlog 3 Ajax Action File
//Author:evio
var GetFile = ["Action.asp?action="]
var GetAction = ["Hidden&"]

// 关于 [Hidden] 标签的修复代码
function Hidden(i){
	var TempStr;
	var ajax = new AJAXRequest;
	ajax.get(
			 GetFile[0]+GetAction[0]+"TimeStamp="+new Date().getTime(),
			 function(obj) {
				 TempStr = obj.responseText;
				 if ( TempStr == "1" ){
					 $("hidden1_"+i).style.display = "";
					 $("hidden2_"+i).style.display = "none";
				 }else{
					 $("hidden1_"+i).style.display = "none";
					 $("hidden2_"+i).style.display = "";
				 }
			 }
	 );
}


//Tab
var homeTab=Class.create();
homeTab.prototype = {
    initialize:function(id,currentCss,mouseEvent){
        this.id = id;
        this.currentCss = currentCss;
        this.mouseEvent = mouseEvent;
        this.init();
    },
    
    init:function(){
        if($(this.id)){
            $(this.id).down(1).childElements().each(function(s,index){//事件绑定 | event bind
                s.observe(this.mouseEvent, this._changeTab.bindAsEventListener(this,index));
            }.bind(this));
        }
    },

    _changeTab:function(e){//事件监听,改变标题样式和显示隐藏相应层 | event listener
        var el =e.element();
        var cssN = this.currentCss;
        if (!el.hasClassName(cssN)){
            el.addClassName(cssN).siblings().each(function(s){
                s.removeClassName(cssN);
            });
            el.up(1).next().childElements()[$A(arguments).pop()].show().siblings().each(function(s){
                s.hide();
            });
        };
    }
}
document.observe("dom:loaded",function(){
    var homeTab_tabs = new homeTab("InfoTabs","current","mouseover");
	var homeTab_tabs = new homeTab("logInfo","current","mouseover");
	var homeTab_tabs = new homeTab("CmtTabs","current","click");
	var homeTab_tabs = new homeTab("PostTabs","current","click");
	var homeTab_tabs = new homeTab("LinkTabs","current","click");
	if($('loginbar')) {new Effect.Appear('loginbar');};
	if($('InfoTabs')) {new Effect.Appear('InfoTabs');};
});

