var RptP=1;
var ChlP=1;
var ThkP=1;
var YaoP=1;
var TedP=1;
var ListRP=1;
//----------------------------------------
var RptSort="Time";
var ChlSort="Time";
var ThkSort="Time";
var YaoSort="Time";
var TedSort="Time";
var SortListR="Click";
var TagSet="";
//----------------------------------------
var kindSub="";
//----------------------------------------
var xmlHttp;
var myElementId;
var myUrl;

function SetColContent() {
	//--隱藏上一頁
	if(document.getElementById("pgBtn_reportPrev") && RptP<=1)
		document.getElementById("pgBtn_reportPrev").style.visibility="hidden"; 
	if(document.getElementById("pgBtn_channelPrev") && ChlP<=1)
		document.getElementById("pgBtn_channelPrev").style.visibility="hidden"; 
	if(document.getElementById("pgBtn_thinkPrev") && ThkP<=1)
		document.getElementById("pgBtn_thinkPrev").style.visibility="hidden"; 
	if(document.getElementById("pgBtn_introPrev") && YaoP<=1)
		document.getElementById("pgBtn_introPrev").style.visibility="hidden"; 
	if(document.getElementById("pgBtn_tedPrev") && TedP<=1)
		document.getElementById("pgBtn_tedPrev").style.visibility="hidden"; 
	if(document.getElementById("pgBtnListRPrev") && ListRP<=1)
		document.getElementById("pgBtnListRPrev").style.visibility="hidden"; 
		//pgBtnListR
	//--顯示上一頁
	if(document.getElementById("pgBtn_reportPrev") && RptP>1)
		document.getElementById("pgBtn_reportPrev").style.visibility="visible"; 
	if(document.getElementById("pgBtn_channelPrev") && ChlP>1)
		document.getElementById("pgBtn_channelPrev").style.visibility="visible"; 
	if(document.getElementById("pgBtn_thinkPrev") && ThkP>1)
		document.getElementById("pgBtn_thinkPrev").style.visibility="visible"; 
	if(document.getElementById("pgBtn_introPrev") && YaoP>1)
		document.getElementById("pgBtn_introPrev").style.visibility="visible"; 
	if(document.getElementById("pgBtn_tedPrev") && TedP>1)
		document.getElementById("pgBtn_tedPrev").style.visibility="visible"; 
	if(document.getElementById("pgBtnListRPrev") && ListRP>1)
		document.getElementById("pgBtnListRPrev").style.visibility="visible"; 
	//--確定沒有下一頁
	if(xmlHttp.responseText!="-1"){
		document.getElementById(myElementId).innerHTML=xmlHttp.responseText;
		//重新整理 LyteBox 功能
		resetLytebox();  
	}
}

function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}
    
function SetColContentChange(TargetPage,ElementId) {
    createXMLHttpRequest();
	myElementId = ElementId ;
	myUrl=TargetPage;
	xmlHttp.open("POST", TargetPage + "&ObjKindSub=" + kindSub , true);
	xmlHttp.onreadystatechange = handleStateChange;
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");    
	xmlHttp.send("");
}
    
function handleStateChange() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
           SetColContent();
        } else {
           alert("網路連線有誤，請稍後再試");
		}
    }
}
function handleStateChangeTc() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
           //alert("寫入成功");
		   //成功寫入追蹤記錄;
        } else {
           //alert("tc err");
          //alert("網路連線有誤，請稍後再試");
		}
    }
}

function handleStateChangeLogin() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
		   //成功寫入追蹤記錄;
			if(xmlHttp.responseText.substring(0,2)=="1@"){
				alert("您好：" + xmlHttp.responseText.substring(2) + "，登入成功，歡迎您的來訪");
				document.getElementById("mbmberStatus1").style.display="none";
				document.getElementById("mbmberStatus2").style.display="block";
				document.getElementById("memberNameShow").innerHTML=xmlHttp.responseText.substring(2);
				//-----------------------------
				//重新整理 LyteBox 功能
				resetLytebox();
				
			} else {
			  alert(xmlHttp.responseText);
			}
        } else {
           //alert("tc err");
          alert("網路連線有誤，請稍後再試");
		}
    }
}

function SetObjTrace(TargetPage,tc_x,tc_y,tc_objid,tc_tag,tc_url) {
    createXMLHttpRequest();
    //alert(TargetPage + "?" + "x=" + tc_x + "&y=" + tc_y + "&objId=" + tc_objid + "&tag=" + tc_tag + "&url=" + tc_url );
	xmlHttp.open("GET", TargetPage + "?" + "x=" + tc_x + "&y=" + tc_y + "&objId=" + tc_objid + "&tag=" + tc_tag + "&url=" + tc_url , true);
	xmlHttp.onreadystatechange = handleStateChangeTc;
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");    
	xmlHttp.send("");
}

function SetMemberLogin() {
    createXMLHttpRequest();
	xmlHttp.open("POST", "/html/V10/ChkLogin.aspx?" + "id=" + encodeURIComponent(document.getElementById("mbrLoginID").value) + "&pd=" + encodeURIComponent(document.getElementById("mbrLoginPwd").value) , true);
	xmlHttp.onreadystatechange = handleStateChangeLogin;
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");    
	xmlHttp.send("");
}


