﻿__$gotojoin=function(){
    aPsWar('這是會員才有的功能喔!!<BR/>如果您已經是會員請先登入.<BR/>如不是請先加入會員. <a href="'+ JsWebURL +'/j/?.pg=jon">我要加入</a>',2,'提示');
}
__$gotojoin2=function(){
    aPsWar('這是2級會員才有的功能喔!!  <a href="'+ JsWebURL +'/j/Join2.aspx">我要成為2級會員</a>',2,'提示');
}
__$notjoin2=function(){
    aPsWar('此帳號無使用',2,'提示');
}

__$gotoavt=function(avtID,avtName){
    aPsWar('這是參加活動「'+ avtName +'」的會員才能參與的討論區!! <a href="'+ JsWebURL +'/a/?.pg=avt#'+ avtID +'">查看活動</a>',2,'提示');
}

function __$Commonpushed(_classid,_thisID,_s){
     var url = "";
    url += "c=" + _classid;
    url += "&i=" + _thisID;
    url += "&s=" + _s;
   __$CommonXML("pushed",url,"pushed");
}

function __$Commonjoinlink(_userid,_linkid,_penid,_classid){
    var url = "";
    url += "Mb0301n="  + _userid;
    url += "&Mb0302c=" + _linkid;
    url += "&Mb0303c=" + _penid;
    url += "&Mb0304c=" + _classid;
    __$CommonXML("joinlink",url,"joinlink");
}

//==============AJAX SetXML==============
function __$CommonXML(funName,url,mode){
    sloading();
    path = JsWebURL + "/Common/Common.asmx/" + funName;
	xmlHttp.open('POST',path,true);
	xmlHttp.onreadystatechange= xmlHttpXML;
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(url);
   function xmlHttpXML(){
	    if (xmlHttp.readyState==4){
		    if (xmlHttp.status == 200){
		        var root;
		        if(xmlHttp.responseXML.documentElement!=null){
			        root = _clean(xmlHttp.responseXML.documentElement); //_clean for ff
			    }
                switch (mode) {
                    case "pushed":
			            var x    = root.getElementsByTagName('a')[0];
                        var msg = x.childNodes[0].childNodes[1].firstChild.nodeValue;
			            aPsWar(msg ,1,'提示');
                        break;
                    case "joinlink":
			            var x    = root.getElementsByTagName('a')[0];
                        var jud= x.childNodes[0].childNodes[0].firstChild.nodeValue;
                        var msg = x.childNodes[0].childNodes[1].firstChild.nodeValue;
			            aPsWar(msg ,1,'提示');
                        break;
                }
		    }else{
		        aPsWar('出現錯誤' + xmlHttp.status ,1,'AJAX 錯誤');
		    }
	    }
    };
}

function cfmdel()
{
  return confirm("確定要刪除?");
}

function __$$runad(adid,x){
    this.adbox = $(adid);
    this.st = $(adid+'st');
    this.stnow=null;

    if(x==null){
        for (var i=0;i < this.st.childNodes.length ;i++){
            if(this.st.childNodes[i].className=="onhover"){
                this.stnow = (i+1);break;
            }
        }
        if(this.stnow==this.st.childNodes.length){
            this.stnow = 0 ;
        }
    }else{
        this.stnow = x;
    }
    
    for (var i=0;i < this.adbox.childNodes.length-1 ;i++){
        this.adbox.childNodes[i].style.display='none';
    }
    
    for (var i=0;i < this.st.childNodes.length ;i++){
        this.st.childNodes[i].className='offhover';
    }

    this.adbox.childNodes[this.stnow].style.display='list-item';
    this.st.childNodes[this.stnow].className='onhover';
}

