// JavaScript Document
var AD_Count=1;
window.onload = function(){
//funAJAXGbig_cookiescheck('/GLOG3.1/api/Glog_Bigcheck.asp');  //蓋台用	
Index_flash_asp('/GLOG3.1/api/Index_flash.asp');
login_IndexAD_asp('/GLOG3.1/api/login_Per_IndexAD.asp');
Index_official_asp('/GLOG3.1/api/Index_official.asp');
News_noticetype();
New_IndexNotice_asp('/GLOG3.1/api/New_IndexNotice.asp');
Blog_Per_IndexAD_asp('/GLOG3.1/api/Blog_Per_IndexAD.asp');
Guide_Recommend_asp('/GLOG3.1/api/Guide_Recommend.asp');
GetHotClub_asp('/GLOG3.1/api/GIndex_GetHotClub.asp');
Index_HotPhoto_List_asp('/GLOG3.1/api/Index_HotPhoto.asp');
Great_photo_4_asp('/GLOG3.1/api/great_photo_4.asp');
Action_Per_IndexAD_asp('/GLOG3.1/api/Action_Per_IndexAD.asp');
Index_Action_List_asp('/GLOG3.1/api/Index_Action_List.asp');
Index_Login_User_asp('/GLOG3.1/api/Index_Login_User.asp');
Index_blog_a_asp('/GLOG3.1/api/Index_blog_a.asp');
GetNewCard_asp('/GLOG3.1/api/GetNewCard.asp');
EndCard_asp('/GLOG3.1/api/EndCard.asp');
Index_video_asp('/GLOG3.1/api/Index_video.asp');
Index_Bonus_asp('/GLOG3.1/api/Index_Bonus.asp');
funAJAXlivly_gamelist('/city/api/livly_serverlist.asp');
}

function Index_GetHotClub(){
	 if (myAjxa.GetHotClub.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var Iclub = myAjxa.GetHotClub.getRes();
	var club_data = Iclub.split ("!?!");
	//alert(myAjxa.GetHotClub.getRes());
	//alert (club_data[0]);
	if (club_data[0]==1){
		for (var n=1;n<club_data.length-1;n++){
			var club_data1 = club_data[n].split("!^!");
			//alert (club_data1[n]);
			document.getElementById("img_club"+n).src=club_data1[2];
			document.getElementById("club_name"+n).innerHTML=club_data1[1];
		    with(document.getElementById("club_link"+n)){href="/club/"+club_data1[0]; target="_top";}
		}
	}
	else{
		document.getElementById("club_a").innerHTML = Iclub;
	}
}

function Index_login_AD(){
	 if (myAjxa.LoginAD.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var IAD = myAjxa.LoginAD.getRes();
	var loginAD = IAD.split ("!?!");
	if (loginAD[0]==1){
			var loginAD1 = loginAD[1].split("!^!");
			//alert (loginAD1);
			document.getElementById("login_1").src=loginAD1[1];
		    with(document.getElementById("AD_link1")){href="/GLOG3.1/api/ad_url.asp?id="+loginAD1[0]; target="_blank";}
	}
	else{
		document.getElementById("AD_link1").innerHTML = IAD;
	}
}

function Index_Notice(){
	 if (myAjxa.IndexNotice.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var I_No = myAjxa.IndexNotice.getRes();
	var INotice = I_No.split("!?!");
	//	 結果值+!?!+id+!^!+NTitle (公告標題)+!^!+ NUrl (公告連結) !?!

	//alert (INotice);
	if (INotice[0]==1){
		for (var n=1;n<INotice.length-1;n++){
			var INotice1 = INotice[n].split("!^!");
			document.getElementById("Notice_li"+n).innerHTML=INotice1[1];
			if (INotice1[2] == ""){
				document.getElementById("Notice_li"+n).onclick = funAJAX; 		//onclick 綁定funAJAX
				document.getElementById("Notice_li"+n).name = INotice1[0];		//將name設定成文章aid
				document.getElementById("Notice_li"+n).style.cursor='pointer';
			}
			else {
				with(document.getElementById("Notice_li"+n)){href=INotice1[2]; target="_blank";}
			}
		}
	}
	else{
		document.getElementById("notice_a").innerHTML = I_No;
	}
		var codetype=new testaa();
		document.getElementById("News_more").onclick=codetype.funType;
}

function testaa(){
	this.funType=function(){showLightBox_notice2(this);	New_IndexNotice_List_asp('/GLOG3.1/api/New_IndexNotice_List.asp',"1","All");}
}


function Index_Guide_Recommend(){		//精選玩樂社群
	 if (myAjxa.G_Recommend.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var Guide = myAjxa.G_Recommend.getRes();
	var Index_Guide = Guide.split("!?!");
	//alert (Index_Guide);
	//1+ !?!G_AID (公會編號)!^!G_logo!^!G_Name (公會名稱)!^!G_Data (公會簡介)!?!最新文章1.F_Word!^!GF_AID (討論區流水編號)!^!G_Type(文章類別)!^!GF_Title (發表標題))!?!最新文章2!?!最新文章3
	if(Index_Guide[0]==1){
		//alert (Index_Guide[1]);
		var Index_Guide1=Index_Guide[1].split("!^!");
		document.getElementById("Index_club_img").src=Index_Guide1[1];
		document.getElementById("club_name").innerHTML=Index_Guide1[2];
		document.getElementById("club_data").innerHTML=Index_Guide1[3];
		for(var i=1;i<=3;i++){
			with(document.getElementById("Index_club_link"+i)){href="/club/index/index_com_a.asp?G="+Index_Guide1[0]; target="_top";}
		}
		if (Index_Guide[2]==""){
				document.getElementById("Club_New_list2").innerHTML="尚無文章";
		}
		else{
			for (var n=2;n<=4;n++){
				var list=Index_Guide[n].split("!^!");
				document.getElementById("Club_New_list"+n).innerHTML="【"+list[0]+"】"+list[3];
				with(document.getElementById("cb_link"+n)){href="/guide/discuss/discuss_con.asp?G="+Index_Guide1[0]+"&FID="+list[1]+"&L="+list[2]; target="_top";}
			}
		}
	}
	else{
		document.getElementById("Index_club_link2").innerHTML = Guide;
	}
}

function Index_EndCard(){
	 if (myAjxa.End_Card.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var ECard = myAjxa.End_Card.getRes();
	var Index_End_Card = ECard.split("!?!");
	//alert (Index_End_Card);
	//'1!?!Ai_AID (流水號)!^!BrowseItem2(0)(名稱)!^!Pic1(圖片路徑)!?!
	if(Index_End_Card[0]==1){		
		for (var n=1;n<Index_End_Card.length-1;n++){
			if(n >4) break;
			//alert (n);
			document.getElementById("end_con"+n).style.display="block";
			var Index_End_Card1=Index_End_Card[n].split("!^!");
			document.getElementById("endcard_img"+n).src=Index_End_Card1[2];
			document.getElementById("endcard_img"+n).title=Index_End_Card1[1];
			with(document.getElementById("endcard_link"+n)){href="/Auction/page/article_page.asp?ID="+Index_End_Card1[0];target="_top";}
		}
		for (var k=n;k<=4;k++){
			document.getElementById("end_con"+k).style.display="none";
		}
	}
	else{
		document.getElementById("Ecard").innerHTML=ECard;
	}
}

function Index_NewCard(){
	 if (myAjxa.New_Card.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var INew_Card = myAjxa.New_Card.getRes();
	var Index_New_Card = INew_Card.split("!?!");
	//1+ !?!NC_ID (流水號)!^!NCard_AID(卡片編號)!^!NCard_Name(卡片名稱)!^!NCard_Type(卡片類別)!^!NCard_URL(連結)!^!NCard_Date(說明)!?!
	//alert (Index_New_Card);
	//alert("aaa");
	if(Index_New_Card[0]==1){		
		var Index_New_Card1=Index_New_Card[1].split("!^!");
		document.getElementById("newcard_img").src="/card/images/coolcard_img/"+Index_New_Card1[3]+"/S_"+Index_New_Card1[1]+".jpg";
		document.getElementById("newcard_name").innerHTML=Index_New_Card1[2];
		document.getElementById("newcard_data").innerHTML=Index_New_Card1[5];
		for(var n=1;n<=3;n++){
			with(document.getElementById("newcard_link"+n)){href=Index_New_Card1[4];target="_top";}
		}
	}
	else{
		document.getElementById("ncard_a").innerHTML = 	INew_Card;
	}
}

function Index_blog_AD(){
	 if (myAjxa.Blog_AD.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var IblogAD = myAjxa.Blog_AD.getRes();
	var Index_blogAD = IblogAD.split("!?!");
	//結果值+ ! ? ! + AD_AID (廣告流水編號) [int 4] + ! ^ ! + AD_Data(廣告內文-反過濾編碼) [nvarcha 4000] + ! ^ !+AD_Url [nvarcha 200] (指定連結)  + ! ? !  
	//alert (Index_New_Card[1]);
	if(Index_blogAD[0]==1){	
		var Index_blogAD1=Index_blogAD[1].split("!^!");
		if (Index_blogAD1[2] != ""){
			var newElement = document.createElement('a');
			with(newElement){href="/GLOG3.1/api/ad_url.asp?id="+Index_blogAD1[0]; target="_blank";}
			newElement.innerHTML = Index_blogAD1[1];
			document.getElementById("blog_ad_data").appendChild(newElement);
		}
		else{
			document.getElementById("blog_ad_data").innerHTML=Index_blogAD1[1];
			}
	}	
	else{
		document.getElementById("blog_ad_data").innerHTML=IblogAD;
	}
}

function Index_Blog_List(){
	 if (myAjxa.Blog_list.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var blog = myAjxa.Blog_list.getRes();
	var blog_li = blog.split("!?!");
	//alert (blog_li);
	//結果值+!?!+0. U_ID[nvarnchar 20](玩家帳號)+!^!1.+ Daily_AID[int 4](日誌列表流水號)+!^!+2.D_title [nnvarnchar 40](文章標題) +!^!+3. D_data [text 30000](日誌本文) !^!4.D_Label_all[nvarnchar 10](全站分類)+!?!+
	if(blog_li[0]==1){
		for (var n=1;n<blog_li.length-1;n++){
			if(n >5) break;
			var blog_li1=blog_li[n].split("!^!");
			document.getElementById("bg_list"+n).innerHTML=blog_li1[2];
			document.getElementById("bg_class"+n).innerHTML="【"+blog_li1[4]+"】";
			with(document.getElementById("bg_list"+n)){href="/blog/blog_index.asp?id="+blog_li1[1]+"&U="+blog_li1[0];target="_top";}
			with(document.getElementById("bg_class"+n)){href="/blog_index/index.asp?DP_type=label&l_word="+escape(blog_li1[4])+"&l_type=article";target="_top";}
		}
	}
	else{
		document.getElementById("blog_a").innerHTML=blog;
	}
}

function Index_Notice_list(){
	 if (myAjxa.IndexNotice_list.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var INotice_list = myAjxa.IndexNotice_list.getRes().split("!?!");
	//alert (INotice_list);
    //結果值+ ! ? ! +總頁數+ ! ^ ! +現在頁數+ ! ^ ! +總筆數+ ! ? ! + 0.Notice_AID (公告流水編號) [int 4] + ! ^ ! + 1.N_Title (公告標題) [nvarchar 50] + ! ^ ! +2. N_Type (公告類別) [nvarchar 20] +! ^ ! +3. N_Url(公告連結) [nvarchar 200] + ! ^ ! +4. AddTime(新增時間) [smalldatetime 4] +!^!5.N_Type ! ? !
	document.getElementById("page_0").innerHTML="";
	if(INotice_list[0]==1){
		for (var n=2;n<INotice_list.length-1;n++){
			document.getElementById("News_con"+n).style.display="block";
			var INotice_list1=INotice_list[n].split("!^!");
			//alert (INotice_list[1]);
			var rs_page = INotice_list[1].split('!^!');
			
			switch(INotice_list1[2]){
				case "system":Nword = "系統"; break;
				case "bulletin":Nword = "公告"; break;
				case "space":Nword = "特報"; break;
				case "action":Nword = "活動"; break;
				case "other":Nword = "其他"; break;
			}
			document.getElementById("News_list"+n).innerHTML="";
			document.getElementById("News_list"+n).removeAttribute("href");
			document.getElementById("News_list"+n).removeAttribute("onclick");
			document.getElementById("News_list"+n).innerHTML="【"+Nword+"】"+INotice_list1[1];
			document.getElementById("News_time"+n).innerHTML=INotice_list1[4];
			//alert(INotice_list1[3]);
			if (INotice_list1[3]==""){
				document.getElementById("News_list"+n).onclick=funAJAX;	//onclick 綁定funAJAX
				document.getElementById("News_list"+n).name=INotice_list1[0];//將name設定成文章aid
				document.getElementById("News_list"+n).style.cursor='pointer';
			}else{
				with(document.getElementById("News_list"+n)){href=INotice_list1[3];target="_blank";onclick = "";}
			}
			
		}
		for(var k=n;k <=21 ;k++){
			document.getElementById("News_con"+k).style.display="none";
			document.getElementById("News_list"+k).href = "";
			document.getElementById("News_list"+k).innerHTML = "";
			document.getElementById("News_time"+k).innerHTML = "";
		}

	page("page_0",rs_page[1],rs_page[0],5,"page",New_IndexNotice_List_asp,'/GLOG3.1/api/New_IndexNotice_List.asp',INotice_list1[5])
	}
}


function News_noticetype() { 		 	   //公告列表Type
	 Kind  = new Array("","All","bulletin","system","action","space","other")
	 KindN = new Array("","全部","公告","系統","活動","特報","其他")
	 for (s=1; s < 7; s++){
 	    var N_kind = document.getElementById("News_type"+s);
		var newstype=new news(Kind[s]);
		N_kind.onclick=newstype.Ntype;
		N_kind.style.cursor='pointer';
		with(N_kind){innerHTML="<span>"+KindN[s]+"</span>"; } 
	 }
}

function news(type){
this.Ntype=function(){New_IndexNotice_List_asp('/GLOG3.1/api/New_IndexNotice_List.asp',"1",type);}
}

function Index_Notice_con(){
	//alert ("aa");
	document.getElementById("lay_bg").style.display="none";
	document.getElementById("lay_bg").style.visibility = "hidden";
	if (myAjxa.IndexNotice_con.State()== false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	}
	var noticecon = myAjxa.IndexNotice_con.getRes().split("!?!");
//結果值+!?!+ Notice_AID (公告流水編號) [int 4]  +!^!+ N_Title (公告標題) [nvarchar 60] +!^!+ N_Data (公告內容) [ntext 16] +!^!+N_Type (公告類別) [nvarchar 20] +!^!+ AddTime(新增時間) [datetime 8] +!^!+ N_Url(公告連結) [nvarchar 200] +!?!+LIST 1+!?!+LIST2+.............+!?!
	//alert (noticecon);
	if (noticecon[0] == 1) {
		var nc_x = noticecon[1].split('!^!');
		switch(nc_x[3]){
			case "system":Nword2 = "系統"; break;
			case "bulletin":Nword2 = "公告"; break;
			case "space":Nword2 = "特報"; break;
			case "action":Nword2 = "活動"; break;
			case "other":Nword2 = "其他"; break;
		}
		document.getElementById("news_con_title").innerHTML = "【"+Nword2+"】"+ nc_x[1];
		document.getElementById("news_con_data").innerHTML = nc_x[2];
		for(var n=2;n<=6;n++){
			noticecon1=noticecon[n].split('!^!');
			switch(noticecon1[2]){
				case "system":Nword3 = "系統"; break;
				case "bulletin":Nword3 = "公告"; break;
				case "space":Nword3 = "特報"; break;
				case "action":Nword3 = "活動"; break;
				case "other":Nword3 = "其他"; break;
			}
			document.getElementById("News_data_con"+n).innerHTML="【"+Nword3+"】"+noticecon1[1];
			document.getElementById("News_data_contime"+n).innerHTML=noticecon1[4];

			if (noticecon1[3]==""){
				document.getElementById("News_data_con"+n).onclick=funAJAX;	//onclick 綁定funAJAX
				document.getElementById("News_data_con"+n).name=noticecon1[0];//將name設定成文章aid
				document.getElementById("News_data_con"+n).style.cursor='pointer';
			}else{
				with(document.getElementById("News_data_con"+n)){href=noticecon1[3];target="_blank";}
			}
		}
	}
	showLightBox_notice3(this); //顯示公告內容 by old
}

function Index_HotPhoto_List(){  //熱門寫真推薦list
	 if (myAjxa.Index_Photo_li.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var IPhoto = myAjxa.Index_Photo_li.getRes();
	var Index_Photo_li = IPhoto.split("!?!");
	//alert (Index_Photo_li);
	if(Index_Photo_li[0]==1){
		var Index_Photo_li1=Index_Photo_li[1].split("!^!");
		for (var n=0;n<=2;n++){
			//alert(Index_Photo_li1[n]);
			Index_Photo_li2=Index_Photo_li1[n].split("_");
			//alert (Index_Photo_li2[1]);
			document.getElementById("Photo_li"+n).innerHTML=Index_Photo_li2[1];
			if(Index_Photo_li2[0]==1){
				with(document.getElementById("Photo_li"+n)){href="/album/list_con/game_category_con.asp?className="+escape(Index_Photo_li2[1]);target="_top";}
			}
			else{
				with(document.getElementById("Photo_li"+n)){href="/album/list_con/all_category_con.asp?className="+escape(Index_Photo_li2[1]);target="_top";}
			}
		}
	}
	else {
		document.getElementById("album_li").innerHTML=IPhoto;
	}
}

function Index_Photo_Data(){	//熱門寫真照片
	 if (myAjxa.Index_Photo_data.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var Iphoto = myAjxa.Index_Photo_data.getRes();
	var Index_photo = Iphoto.split("!?!");
	//結果值+ ! ? !0.Pic_Ctitle(精選標題)[nvarchar 40] !^!1.Pic_LF_pic(小圖左上位置)[nvarchar 200] ! ^ ! 2.Pic_LF_URL(小圖左上網址)[nvarchar 200]! ^ ! 3.Pic_RF_pic(小圖右上位置)[nvarchar 200] ! ^ ! 4.Pic_RF_url(小圖右上網址)[nvarchar 200] ! ? ! 
	if (Index_photo[0]==1){
		var Index_photo1=Index_photo[1].split("!^!");
		var Index_photo2=Index_photo[2].split("!^!");
		with(document.getElementById("Index_photo1")){src=Index_photo1[1];title=Index_photo1[0];}
		with(document.getElementById("Index_photo2")){src=Index_photo1[3];title=Index_photo1[0];}
		with(document.getElementById("Index_photo3")){src=Index_photo2[1];title=Index_photo2[0];}
		with(document.getElementById("Index_photo4")){src=Index_photo2[3];title=Index_photo2[0];}
		with(document.getElementById("Index_photo_data1")){href=Index_photo1[2];target="_top";}
		with(document.getElementById("Index_photo_data2")){href=Index_photo1[4];target="_top";}
		with(document.getElementById("Index_photo_data3")){href=Index_photo2[2];target="_top";}
		with(document.getElementById("Index_photo_data4")){href=Index_photo2[4];target="_top";}
	}
	else{
		document.getElementById("album_po").innerHTML = Iphoto;
	}
}

function Index_Hot_video(){	//影音分享
	 if (myAjxa.Index_video.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var Ivideo = myAjxa.Index_video.getRes();
	var Index_video = Ivideo.split("!?!");
	//1!?!0.MH_Vediotitle(影片標題)!^!1.video_url(影片連結)!^!2.vpic(影片圖所在)!?!
	if(Index_video[0]==1){
		var Index_video1=Index_video[1].split("!^!");
		with(document.getElementById("Index_video")){style.backgroundImage="url("+Index_video1[2]+")";title=Index_video1[0];}
		with(document.getElementById("video_link")){href=Index_video1[1];target="_top";}
		document.getElementById("video_name").innerHTML = Index_video1[0];
	}
	else{
		document.getElementById("video_a").innerHTML = 	Ivideo;
	}
}

function Action_Hot_IndexAD(){	//活動廣告
	 if (myAjxa.Action_IndexAD.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var IAction = myAjxa.Action_IndexAD.getRes();
	var Index_Action = IAction.split("!?!");
	//alert(Index_Auction[1]);
	//結果值+ ! ? ! +0. AD_AID (廣告流水編號) [int 4] + ! ^ ! 1.+ AD_Pic (圖片連結) [nvarchar(200)]+ ! ^ ! +2.AD_Url [nvarcha 200] (指定連結)  + ! ? ! 
	if(Index_Action[0]==1){
		var Index_Action1=Index_Action[1].split("!^!");
		document.getElementById("action_img").src=Index_Action1[1];
		with(document.getElementById("actoin_link")){href="/GLOG3.1/api/ad_url.asp?id="+Index_Action1[0]; target="_blank";}
	}
	else{
		document.getElementById("actoin_link").innerHTML = IAction;
		AD_Count=0;
	}
	
	if(AD_Count==1){
		setInterval("Action_Per_IndexAD_asp('/GLOG3.1/api/Action_Per_IndexAD.asp')",5000);	
		AD_Count+=1;
	}
}

function Acton_Hot_List(){	//活動List
	 if (myAjxa.Action_List.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var AList = myAjxa.Action_List.getRes();
	var Action_List = AList.split("!?!");
	//alert(Action_List[1]);
	//1+ ! ? ! 0.AC_ID (流水號)!^!1. AC_Name (活動名稱) !^! 2.說明!^! 3.連結!?!
	if(Action_List[0]==1){
		(Action_List.length-1 > 3) ? nn=4 : nn=Action_List.length-1;
		for (var n=1;n < nn;n++){
			var Action_List1=Action_List[n].split("!^!");
				with(document.getElementById("action_list"+n)){innerHTML=Action_List1[1];href=Action_List1[3]; target="_blank";title = Action_List1[2];}
		}
		for(var k=n;k <=3 ;k++){
			document.getElementById("ac_item"+k).style.display="none";
		}
	}
	else {
		document.getElementById("Action_con").innerHTML = AList;
	}
	var codetype=new testaa3();
	document.getElementById("action_more").onclick=codetype.funType3;
}

function testaa3(){
	this.funType3=function(){showLightBox_notice5(this);Action_list_asp('/GLOG3.1/api/Action_list.asp',"1");}
}


function Index_official_list(){		//官方部落
	 if (myAjxa.Index_official.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var Ioff = myAjxa.Index_official.getRes();
	var Index_off = Ioff.split("!?!");
	//結果值+ ! ? ! + 0.AD_AID (廣告流水編號) [int 4] + ! ^ ! + 1.AD_Title (廣告標題) [nvarchar 40] + ! ^ ! +2.AD_Url(指定連結)  [nvarcha 200] + ! ? ! 
	if (Index_off[0]==1){
		for(var n=1;n<Index_off.length-1;n++){
			var Index_off1=Index_off[n].split("!^!");
			document.getElementById("off_li"+n).innerHTML="<a href='/GLOG3.1/api/ad_url.asp?id="+Index_off1[0]+"' target='_blank'><font color='#FFFFFF'>"+Index_off1[1]+"</font></a>　|　";
		}
	}
	else{
		document.getElementById("off_a").innerHTML = Ioff;
	}
}

/*function Index_HItem(){		//最新版型
	 if (myAjxa.Index_Item.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var Hitem = myAjxa.Index_Item.getRes();
	var Hot_item = Hitem.split("!?!");
	//alert (Hot_item);
	//結果值+ ! ? !+link+ ! ? ! 
	if(Hot_item[0]==1){
		//alert (Hot_item[1]);
		var PictureScroller1 = new Scroller('PictureScroller1', 'PictureScroller2', '<div class="hot_temp_box">{0}</div>',[['<a href="http://www.google.com.tw"><img src="http://www.gemmyplanet.com/m2/images/g_03.gif" border="0"/></a>'],['<a href="http://www.glog.cc"><img src="http://www.gemmyplanet.com/m2/images/g_19.gif" border="0"/></a>'],['<a href="http://www.google.com.tw"><img src="http://www.gemmyplanet.com/m2/images/g_05.gif" border="0"/></a>'],['<a href="http://www.glog.cc"><img src="http://www.gemmyplanet.com/m2/images/g_01.gif" border="0"/></a>'],['<a href="http://www.glog.cc"><img src="http://www.gemmyplanet.com/m2/images/g_06.gif" border="0"/></a>'],['<a href="http://www.glog.cc"><img src="http://www.gemmyplanet.com/m2/images/g_05.gif" border="0"/></a>'],['<a href="http://www.wretch.cc"><img src="http://www.gemmyplanet.com/m2/images/g_04.gif" border="0"/></a>'],['<a href="http://www.wretch.cc"><img src="http://www.gemmyplanet.com/m2/images/g_02.gif" border="0"/></a>']],49,0.8,4);
		document.getElementById("left_run").onclick=function(){PictureScroller1.MovePreviousPage();}
		document.getElementById("right_run").onclick=function(){PictureScroller1.MoveNextPage();}
	}
	else{
		document.getElementById("PictureScroller2").innerHTML = Hitem;
	}
}*/

function Login_user(){
	 if (myAjxa.Index_login.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var on_user = myAjxa.Index_login.getRes();
	//alert (on_user);
	var user = on_user.split("!?!");
	if (user[0]==1){
		for (var n=1;n<user.length-1;n++){
			var user1=user[n].split("!^!");
			//alert (n+"::"+user1[1]);
			document.getElementById("login_user"+n).src=user1[1];
			with(document.getElementById("Login_link"+n)){href="/blog/blog_index.asp?U="+user1[0];target="_top";title = user1[2];}
		}
		for(var k=n;k <=9 ;k++){
			document.getElementById("login_user"+k).style.display="none";
		}
	}
	else{
		document.getElementById("online_id").innerHTML = on_user;
	}
		var codetype=new testaa2();
		document.getElementById("online_more").onclick=codetype.funType2;
}

function testaa2(){
	this.funType2=function(){showLightBox_notice4(this);Index_Login_List_asp('/GLOG3.1/api/Index_Login_List.asp');}
}

function Login_user_list(){
	 if (myAjxa.Index_login_list.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var t = myAjxa.Index_login_list.getRes().split("!?!");
	//alert (user[1]);
	if (t[0]==1){
		for (var n=1;n<t.length-1;n++){
			var user_list1=t[n].split("!^!");
			document.getElementById("online_li"+n).src=user_list1[1];
			with(document.getElementById("online_line"+n)){href="/blog/blog_index.asp?U="+user_list1[0];title = user_list1[2];target="_blank";}
		}
		for(var k=n;k <=66 ;k++){
			document.getElementById("online_li"+k).style.display="none";
		}

	}
}

function Index_bonus_item(){
	 if (myAjxa.Index_bonus.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var Iitems = myAjxa.Index_bonus.getRes();
	var items = Iitems.split("!?!");
	//1+ ! ? !  0.Bi_AID(流水號) !^!1. Bi_Title(商品名稱) !^!2. Bi_Data(資料) !^! 3.Bi_Pic(圖片)!?!
	if(items[0]==1){
		for (var n=1;n<items.length-1;n++){
			var items1=items[n].split("!^!");
			document.getElementById("bonus_img"+n).src=items1[3];
			with(document.getElementById("bonus_line"+n)){href="/Bonus/exchange/exchange.asp?ID="+items1[0];target="_top";}
			document.getElementById("bonus_title"+n).innerHTML=items1[1];
			with(document.getElementById("bonus_link"+n)){href="/Bonus/exchange/exchange.asp?ID="+items1[0];target="_top";}
			with(document.getElementById("bonus_data"+n)){innerHTML=items1[2];href="/Bonus/exchange/exchange.asp?ID="+items1[0];target="_top";}
		}
		for(var k=n;k <=3;k++){
		document.getElementById("bo_con"+k).style.display="none";
		}
	}
	else{
		document.getElementById("bonus_a").innerHTML = 	Iitems;
	}
}

function a_list_item(){
	 if (myAjxa.a_list.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var Iitems = myAjxa.a_list.getRes();
	var items = Iitems.split("!?!");
	// 1+ !?! +總頁數+ ! ^ ! +現在頁數+ ! ^ ! +總筆數+! ? ! 0.AC_ID (流水號)!^! 1.AC_Name (活動名稱) !^! 2.活動說明!^! 3.AC_URL (連結位置)!^!4.AC_Type!?!
	document.getElementById("page_2").innerHTML="";
	if (items[0]==1){
		var rs_page=items[1].split("!^!");
		for(var n=2; n < items.length-1;n++){
			var items1=items[n].split("!^!");
			//alert(items1[1]);
			document.getElementById("ac_con"+n).style.display="block";
			with(document.getElementById("ac_list"+n)){innerHTML=items1[1] ;title = items1[2];href=items1[3];target="_blank";}
			document.getElementById("ac_time"+n).setAttribute("color","");
			switch(items1[4]){
				case "進行中":
					document.getElementById("ac_time"+n).innerHTML=items1[4];
					document.getElementById("ac_time"+n).setAttribute("color","#709C11");
					break;
				case "未開放":
					document.getElementById("ac_con"+n).style.display="none";
					document.getElementById("ac_list"+n).innerHTML = "";
					document.getElementById("ac_time"+n).innerHTML = "";
					break;
				case "已結束":
					document.getElementById("ac_time"+n).innerHTML=items1[4];
					break;
			}
		}
		for(var k=n;k <=21 ;k++){
			document.getElementById("ac_con"+k).style.display="none";
			document.getElementById("ac_list"+k).innerHTML = "";
			document.getElementById("ac_time"+k).innerHTML = "";
		}
		
	page("page_2",rs_page[1],rs_page[0],5,"page",Action_list_asp,'/GLOG3.1/api/Action_list.asp',"")
	}
	else{
		document.getElementById("act_a").innerHTML = Iitems;
	}
}

function Index_Flash_Data(){
	 if (myAjxa.fash_data.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
		return;
	 }
 	var Iitems = myAjxa.fash_data.getRes();
	var Index_DiaAD = Iitems.split("!?!");
	//結果值+ ! ? ! + AD_AID (廣告流水編號) [int 4] + ! ^ ! + AD_Data(廣告內文-反過濾編碼) [nvarcha 4000] + ! ^ !+AD_Url [nvarcha 200] (指定連結)  + ! ? !  
	//alert (Index_New_Card[1]);
	if(Index_DiaAD[0]==1){	
		var DiaAD=Index_DiaAD[1].split("!^!");
		var AD = DiaAD[1].replace(/<p>/,"");
		var AD2 = AD.replace(/<\/p>/,"");
		var newElement = document.createElement("div");			
		newElement.innerHTML= AD2;
		if (DiaAD[2] != ""){
			var codetype=new myurl("/GLOG3.1/api/ad_url.asp?id="+DiaAD[0]);
			newElement.onclick=codetype.funType;
		}
		newElement.style.cursor='pointer';
		document.getElementById("dia_ad").appendChild(newElement);	
	}	
	else{
		document.getElementById("dia_ad").innerHTML=Iitems;
	}
}

//另開頁面
function myurl(url){
this.funType=function(){window.open(url);}
}


function livly_gamelist() { 		 	   //寵物島伺服器列表
	 if (myAjxa.livly_gamelist_link.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
	  	return;
	 }
	 var gameli = myAjxa.livly_gamelist_link.getRes().split('!?!');
	 if (gameli[0] == 'Y') {//有登入
		 if(gameli[1] == 1){
		 var ne_x = gameli[3].split('!^!');
		 //alert(gameli[2]);
				if(ne_x[0]=='0' && gameli[2]=='N'){//未認養
				showLivlyBox();
				document.getElementById("livly_serverlist2").style.cursor='pointer';
				document.getElementById("livly_serverlist2").onclick=function(){ 
						window.open(ne_x[2]);
						funAJAXlivly_writcookies('/city/api/livly_writcookes.asp','Y');
						}
				}
		 }
	 
	 
	 }
}

function livly_writcookies(){
	 if (myAjxa.livly_writcookies_link.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
	  	return;
	 }
	 MM_showHideLayers('Livly_block','','hide');
}

function livly_login_log(){
	 if (myAjxa.livly_login_log.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
	  	return;
	 }
}

function funGbig(){ //關閉
	 if (myAjxa.Gbig_writecookies_link.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
	  	return;
	 }
	MM_showHideLayers('GBig','','hide');
}

function funGbigcheck(){  //蓋台check
	 if (myAjxa.Gbig_cookiescheck_link.State() == false) {   //if (xmlHttp.readyState != 4(測試狀態是否請求完成) || xmlHttp.status != 200(如果伺服端回應OK) 
	  	return;
	 }
	  var gb = myAjxa.Gbig_cookiescheck_link.getRes().split('!?!');
	  if (gb == 'Y'){
		 MM_showHideLayers('GBig','','hide');
	  }else{
		  showbigBox();  
		  document.getElementById("Gbigclose").style.cursor='pointer';
		  document.getElementById("Gbigclose").onclick=function(){ 
				 funAJAXGbig_writecookies('/GLOG3.1/api/Glog_Big.asp','Y');
				}
		 
	  }
}

