﻿var Mapi_Scupio_Id = "2892";
//var Mapi_Scupio_Flag = false;
var Mapi_Scupio_Flag = true;

function wait_load(look_for,callback) {
    var interval = setInterval(function() {
        if (eval("typeof " + look_for) != "undefined") {
            clearInterval(interval);
            callback();
        }
    }, 50);
}

function callscupio1(mid,pid,ch,cat,iid,kw) {
if(Mapi_Scupio_Flag ){
    wait_load("window.scupioec", function() {
        window.scupioec.call({"mid":mid,"pid":pid,"ch":ch,"cat":cat,"iid":iid,"kw":kw});
    });
	window.focus();
}
}

function mapi_scupio(id,_cat,_kw){
	var cat="";
	var kw="";
	if(_cat&&_cat!=""){
		cat=_cat;
	}
	if(_kw&&_kw!=""){
		kw=_kw;
	}
	switch (id){
		case "detection" ://進入導引頁
			callscupio1(Mapi_Scupio_Id,"event0","ch1","cat0","iid0","");
		break;
		case "SkylineGlobeSetupTC" ://下載skyline
			callscupio1(Mapi_Scupio_Id,"event0","ch1","cat1","iid0","");
			location.href = "SkylineGlobeSetupTC.zip";
		break;
		case "right_AD_1" ://進入首頁/右下角AD
		case "right_AD_2" ://進入首頁/右下角AD
		case "right_AD_3" ://進入首頁/右下角AD
			callscupio1(Mapi_Scupio_Id,"event1","ch2","cat1","iid"+cat,kw);
		break;
		case "bottom_AD_1" ://進入首頁/資訊區下方AD
			callscupio1(Mapi_Scupio_Id,"event1","ch2","cat2","iid"+cat,kw);
		break;
		case "bottom_AD_2_1" ://進入首頁/廣告交換AD
		case "bottom_AD_2_2" ://進入首頁/廣告交換AD
		case "bottom_AD_2_3" ://進入首頁/廣告交換AD
		case "bottom_AD_2_4" ://進入首頁/廣告交換AD
			callscupio1(Mapi_Scupio_Id,"event1","ch2","cat3","iid"+cat,kw);
		break;
		case "menu6" ://愛找查-找什麼
			callscupio1(Mapi_Scupio_Id,"event0","ch3","cat0","iid0","");
			subMenuChange(id);
			SelectgroupcontrolFunctionIndex('愛找查','open');
		break;
		case "submenu6_findWhat" ://愛找查-找什麼
			callscupio1(Mapi_Scupio_Id,"event0","ch3","cat0","iid0","");
			IframeChangeCallAnalytics('GoogleAnalytics/FindWhat.html');
			cleanJTreeViewSpan();
			SelectgroupcontrolFunctionIndex('找什麼','open');
		break;
		case "funTF" ://愛找查-找什麼-查詢
			if(event.keyCode==13){
				if ($('funTF').value!=""){
					document.getElementById("left_searchResult_1").innerHTML="";
					var value = document.getElementById("FunSelect").value;
					var str = escape(document.getElementById("funTF").value);
					callscupio1(Mapi_Scupio_Id,"event0","ch3","cat"+value,"iid0",str);
					myButtonbyid("FunBtn");
					MapiCreateLocation();
					onSearchFunB();
				}
			}
		break;
		case "FunBtn" ://愛找查-找什麼-查詢
			document.getElementById("left_searchResult_1").innerHTML="";
			var value = document.getElementById("FunSelect").value;
			var str = escape(document.getElementById("funTF").value);
			callscupio1(Mapi_Scupio_Id,"event0","ch3","cat"+value,"iid0",str);
			myButtonbyid(id);
			MapiCreateLocation();
			onSearchFunB();
		break;
		case "submenu6_findLoc" ://愛找查-找地標
			callscupio1(Mapi_Scupio_Id,"event0","ch4","cat0","iid0","");
			IframeChangeCallAnalytics('GoogleAnalytics/Findwhere.html');
			cleanJTreeViewSpan();
			SelectgroupcontrolFunctionIndex('找地標','open');
		break;
		case "locTF" ://愛找查-找地標-查詢
			if(event.keyCode==13){
				if ($('locTF').value!=""){
					document.getElementById("left_searchResult_1").innerHTML="";
					var str = escape(document.getElementById("locTF").value);
					callscupio1(Mapi_Scupio_Id,"event0","ch4","cat1","iid0",str);
					myButtonbyid("LocBtn");
					MapiCreateLocation();
					onSearchLOCA();
				}
			}
		break;
		case "LocBtn" ://愛找查-找地標-查詢
			document.getElementById("left_searchResult_1").innerHTML="";
			var str = escape(document.getElementById("locTF").value);
			callscupio1(Mapi_Scupio_Id,"event0","ch4","cat1","iid0",str);
			myButtonbyid(id);
			MapiCreateLocation();
			onSearchLOCA();
		break;
		case "submenu6_findAdd" ://愛找查-找地址
			callscupio1(Mapi_Scupio_Id,"event0","ch5","cat0","iid0","");
			IframeChangeCallAnalytics('GoogleAnalytics/FindAddress.html');
			cleanJTreeViewSpan();
			SelectgroupcontrolFunctionIndex('找地址','open');
		break;
		case "addrTF" ://愛找查-找地址-查詢
			if(event.keyCode==13){
				if ($('addrTF').value!=""){
					document.getElementById("left_searchResult_1").innerHTML="";
					var str = escape(document.getElementById("addrTF").value);
					callscupio1(Mapi_Scupio_Id,"event0","ch5","cat1","iid0",str);
					myButtonbyid("AddrBtn");
					MapiCreateLocation();
					stringcheckaddrTF();
					onSearchaAddr();
				}
			}
		break;
		case "AddrBtn" ://愛找查-找地址-查詢
			document.getElementById("left_searchResult_1").innerHTML="";
			var str = escape(document.getElementById("addrTF").value);
			callscupio1(Mapi_Scupio_Id,"event0","ch5","cat1","iid0",str);
			myButtonbyid(id);
			MapiCreateLocation();
			stringcheckaddrTF();
			onSearchaAddr();
		break;
		case "submenu6_findWho" ://愛找查-找朋友
			IframeChangeCallAnalytics('GoogleAnalytics/FindWho.html');
			cleanJTreeViewSpan();
			SelectgroupcontrolFunctionIndex('找朋友','open');
		break;
		case "fdTF" ://愛找查-找朋友-查詢
			if(event.keyCode==13){
				if ($('fdTF').value!=""){
					document.getElementById("left_searchResult_1").innerHTML="";
					var str = document.getElementById("fdTF").value;
					var str2 = document.getElementById("DropDownList51").value;//性別
					var str3_1 = document.getElementById("TextBox1").value;//年齡1
					var str3_2 = document.getElementById("TextBox2").value;//年齡2
					var str4 = document.getElementById("DropDownList21").value;//星座
					var str5 = document.getElementById("DropDownList31").value;//血型
					var escapestr = escape(str+","+str2+","+str3_1+"~"+str3_2+","+str4+","+str5);
					callscupio1(Mapi_Scupio_Id,"event0","ch6","cat1","iid0",escapestr );
					myButtonbyid("FdBtn");
					MapiCreateLocation();
					onSearchUserC();
				}
			}
		break;
		case "FdBtn" ://愛找查-找朋友-查詢
			document.getElementById("left_searchResult_1").innerHTML="";
			var str = document.getElementById("fdTF").value;
			var str2 = document.getElementById("DropDownList51").value;//性別
			var str3_1 = document.getElementById("TextBox1").value;//年齡1
			var str3_2 = document.getElementById("TextBox2").value;//年齡2
			var str4 = document.getElementById("DropDownList21").value;//星座
			var str5 = document.getElementById("DropDownList31").value;//血型
			var escapestr = escape(str+","+str2+","+str3_1+"~"+str3_2+","+str4+","+str5);
			callscupio1(Mapi_Scupio_Id,"event0","ch6","cat1","iid0",escapestr );
			myButtonbyid(id);
			MapiCreateLocation();
			onSearchUserC();
		break;
		case "menu7" ://搜主意
			callscupio1(Mapi_Scupio_Id,"event0","ch7","cat0","iid0","");
			subMenuChange(id);
			onSearchideaV2();
			SelectgroupcontrolFunctionIndex('搜主意','open');
		break;
		case "menu7_Searchidea" ://搜主意-主題
			callscupio1(Mapi_Scupio_Id,"event0","ch7","cat"+cat,"iid0","");
		break;
		case "Searchidea_POI" ://搜主意-POI
			callscupio1(Mapi_Scupio_Id,"event0","ch7","cat"+cat,"iid"+kw,"");
		break;
		case "Searchidea_POI_AD" ://搜主意-POI-AD
			callscupio1(Mapi_Scupio_Id,"event1","ch7","cat"+cat,"iid"+kw,"");
			newwindow = window.open ("http://ezhungry.com/ezhungry.php?id=13", "search");
			newwindow.focus();
		break;
		case "menu8" ://報Ma仔
			callscupio1(Mapi_Scupio_Id,"event0","ch8","cat0","iid0","");
			subMenuChange(id);
			SelectgroupcontrolFunctionIndex('報Ma仔','open');
		break;
		case "menu8_NewPoMa" ://報Ma仔-最新報馬
			callscupio1(Mapi_Scupio_Id,"event0","ch8","cat0","iid1","");
			SelectgroupcontrolFunctionIndex('NEW報Ma仔','open');
		break;
		case "menu8_NewPoMa_search" ://報Ma仔-最新報馬-搜尋
			callscupio1(Mapi_Scupio_Id,"event0","ch8","cat"+cat,"iid0","");
		break;
		case "menu8_MyPoMa" ://報Ma仔-我的報馬
			callscupio1(Mapi_Scupio_Id,"event0","ch8","cat0","iid2","");
			SelectgroupcontrolFunctionIndex('My報Ma仔','open');
		break;
		case "menu8_MyPoMa_search" ://報Ma仔-搜尋
			callscupio1(Mapi_Scupio_Id,"event0","ch8","cat"+cat,"iid0","");
		break;
		case "POMA_POI" ://報Ma仔-POI
			callscupio1(Mapi_Scupio_Id,"event0","ch8","cat"+cat,"iid"+kw,"");
		break;
		case "POMA_POI_AD" ://報Ma仔-POI-AD
			callscupio1(Mapi_Scupio_Id,"event1","ch8","cat"+cat,"iid"+kw,"");
			newwindow = window.open ("http://ezhungry.com/ezhungry.php?id=13", "search");
			newwindow.focus();
		break;
		case "menu1" ://特約地圖
			callscupio1(Mapi_Scupio_Id,"event0","ch9","cat0","iid0","");
			subMenuChange(id);
			SelectgroupcontrolFunctionIndex('特約地圖','open');
		break;
		case "subMenu1_YP" ://特約地圖/YP
			callscupio1(Mapi_Scupio_Id,"event0","ch9","cat1","iid0","");
			YPChangeHidelayer();
			SelectgroupcontrolFunctionIndex('YP','open');
			FindObjPlay('Spacial_Point\\YPstart');
		break;
		case "YPTF" ://特約地圖/YP-查詢
			if(event.keyCode==13){
				if ($('YPTF').value!=""){
					var str = escape(document.getElementById("YPTF").value);
					callscupio1(Mapi_Scupio_Id,"event0","ch9","cat1","iid0",str);
					taiwanyellowpage();
				}
			}
		break;
		case "YPBtn" ://特約地圖/YP-查詢
			var str = escape(document.getElementById("YPTF").value);
			callscupio1(Mapi_Scupio_Id,"event0","ch9","cat1","iid0",str);
			taiwanyellowpage();
		break;
		case "YPPOI" ://特約地圖/YP-查詢-POI
			callscupio1(Mapi_Scupio_Id,"event0","ch9","cat1","iid"+cat,"");
		break;
		case "subMenu1_EZTable" ://特約地圖/EZTable
			callscupio1(Mapi_Scupio_Id,"event0","ch9","cat2","iid0","");
			EZTableChangeHidelayer();
			SelectgroupcontrolFunctionIndex('EZTable','open');
			FindObjPlay('Spacial_Point\\EZTablestart');
		break;
		case "EZTF" ://特約地圖/YP-查詢
			if(event.keyCode==13){
				if ($('EZTF').value!=""){
					var str = escape(document.getElementById("EZTF").value);
					callscupio1(Mapi_Scupio_Id,"event0","ch9","cat2","iid0",str);
					EZTabiepage();
				}
			}
		break;
		case "EZBtn" ://特約地圖/EZTable-查詢
			var str = escape(document.getElementById("EZTF").value);
			callscupio1(Mapi_Scupio_Id,"event0","ch9","cat2","iid0",str);
			EZTabiepage();
		break;
		case "EZTablePOI" ://特約地圖/EZTable-查詢-POI
			callscupio1(Mapi_Scupio_Id,"event0","ch9","cat2","iid"+cat,"");
		break;
		case "EZTablePOI_AD" ://特約地圖/EZTable-查詢-POI-AD
			callscupio1(Mapi_Scupio_Id,"event1","ch9","cat2","iid"+cat,"");
			newwindow = window.open ("http://ezhungry.com/ezhungry.php?id=13", "search");
			newwindow.focus();
		break;
		case "menu2" ://主題地圖
			callscupio1(Mapi_Scupio_Id,"event0","ch10","cat0","iid0","");
			subMenuChange(id);
			SelectgroupcontrolFunctionIndex('主題地圖','open');
		break;
		case "subMenu2_north" ://主題地圖/北部
			callscupio1(Mapi_Scupio_Id,"event0","ch10","cat1","iid0","");
			openTopicMap(id);
		break;
		case "subMenu2_north_Item1" ://主題地圖/北部/商圈百貨
			callscupio1(Mapi_Scupio_Id,"event0","ch10","cat1","iid1","");
		break;
		case "subMenu2_north_Item2" ://主題地圖/北部/娛樂消費
			callscupio1(Mapi_Scupio_Id,"event0","ch10","cat1","iid2","");
		break;
		case "subMenu2_center" ://主題地圖/中部
			callscupio1(Mapi_Scupio_Id,"event0","ch10","cat2","iid0","");
			openTopicMap(id);
		break;
		case "subMenu2_center_Item1" ://主題地圖/中部/媽祖遶境
			callscupio1(Mapi_Scupio_Id,"event0","ch10","cat2","iid1","");
		break;
		case "subMenu2_south" ://主題地圖/南部
			callscupio1(Mapi_Scupio_Id,"event0","ch10","cat3","iid0","");
			openTopicMap(id);
		break;
		case "subMenu2_south_Item1" ://主題地圖/南部/海角七號
			callscupio1(Mapi_Scupio_Id,"event0","ch10","cat3","iid1","");
		break;
		case "subMenu2_south_Item2" ://主題地圖/南部/商圈百貨
			callscupio1(Mapi_Scupio_Id,"event0","ch10","cat3","iid2","");
		break;
		case "subMenu2_south_Item3" ://主題地圖/南部/捷運車站
			callscupio1(Mapi_Scupio_Id,"event0","ch10","cat3","iid3","");
		break;
		case "subMenu2_east" ://主題地圖/東部
			callscupio1(Mapi_Scupio_Id,"event0","ch10","cat4","iid0","");
			openTopicMap(id);
		break;
		case "menu5" ://立體世界
			callscupio1(Mapi_Scupio_Id,"event0","ch11","cat0","iid0","");
			subMenuChange(id);
			SelectgroupcontrolFunctionIndex('立體世界','open');
		break;
		case "menu5_Item1" ://立體世界/台北市景點導覽
			callscupio1(Mapi_Scupio_Id,"event0","ch11","cat1","iid0","");
			showhide2(menu7outline);
		break;
		case "menu5_Item2" ://立體世界/台南市景點導覽
			callscupio1(Mapi_Scupio_Id,"event0","ch11","cat2","iid0","");
			showhide2(menu8outline);
		break;
		case "menu5_Item3" ://立體世界/高雄市景點導覽
			callscupio1(Mapi_Scupio_Id,"event0","ch11","cat3","iid0","");
			showhide2(menu90outline);
		break;
		case "menu5_Item4" ://立體世界/海角七號景點導覽
			callscupio1(Mapi_Scupio_Id,"event0","ch11","cat4","iid0","");
			showhide2(menu91outline);
		break;
		case "menu5_Item5" ://立體世界/媽祖繞境景點導覽
			callscupio1(Mapi_Scupio_Id,"event0","ch11","cat5","iid0","");
			showhide2(menu92outline);
		break;
		case "menu5_Item6" ://立體世界/內部導覽
			callscupio1(Mapi_Scupio_Id,"event0","ch11","cat6","iid0","");
			showhide2(menu93outline);
		break;
		case "menu3" ://粉絲團
			callscupio1(Mapi_Scupio_Id,"event0","ch12","cat0","iid0","");
			window.open ('http://www.facebook.com/group.php?v=wall&amp;ref=search&amp;gid=122818456902'); 
		break;
		case "menu9" ://艋舺
			callscupio1(Mapi_Scupio_Id,"event0","ch13","cat0","iid0","");
			subMenuChange(id);
			SelectgroupcontrolFunctionIndex('MonGa','open');
			FindObjPlay('MonGa\\start');
		break;
		case "Keyword_1" ://關鍵字
			callscupio1(Mapi_Scupio_Id,"event0","ch14","cat0","iid0","電影艋舺");
		break;
		case "Keyword_2" ://關鍵字
			callscupio1(Mapi_Scupio_Id,"event0","ch14","cat0","iid0","特色牛肉麵");
		break;
		case "Keyword_3" ://關鍵字
			callscupio1(Mapi_Scupio_Id,"event0","ch14","cat0","iid0","正妹店員");
		break;
		case "Keyword_4" ://關鍵字
			callscupio1(Mapi_Scupio_Id,"event0","ch14","cat0","iid0","單車聚點");
		break;
		case "Keyword_5" ://關鍵字
			callscupio1(Mapi_Scupio_Id,"event0","ch14","cat0","iid0","收集心心");
		break;
		case "Keyword_6" ://關鍵字
			callscupio1(Mapi_Scupio_Id,"event0","ch14","cat0","iid0","夢時代");
			OpenAll3DBuilding('PagePlusC');
			FindObjPlay('PagePlusC\\夢時代廣場');
		break;
		case "Keyword_7" ://關鍵字
			callscupio1(Mapi_Scupio_Id,"event0","ch14","cat0","iid0","便捷高雄");
			OpenAll3DBuilding('PagePlusC');
			FindObjPlay('PagePlusC\\美麗島站');
		break;
		case "Keyword_8" ://關鍵字
			callscupio1(Mapi_Scupio_Id,"event0","ch14","cat0","iid0","餐廳訂位");
		break;
		case "Keyword_9" ://關鍵字
			callscupio1(Mapi_Scupio_Id,"event0","ch14","cat0","iid0","生活黃頁");
			//特約地圖
			subMenuChange("menu1");
			SelectgroupcontrolFunctionIndex('特約地圖','open');
			//特約地圖/YP
			YPChangeHidelayer();
			SelectgroupcontrolFunctionIndex('YP','open');
			FindObjPlay('Spacial_Point\\YPstart');
		break;
		case "Keyword_10" ://關鍵字
			callscupio1(Mapi_Scupio_Id,"event0","ch14","cat0","iid0","免費簡訊");
		break;
		case "Keyword_11" ://關鍵字
			callscupio1(Mapi_Scupio_Id,"event0","ch14","cat0","iid0","募集房東");
		break;
		case "tab_link_1" ://關鍵字
		case "tab_link_1_1" ://關鍵字
			callscupio1(Mapi_Scupio_Id,"event0","ch15","cat0","iid0","艋舺-我們一起走進大人的世界並且一去不回");
		break;
		case "mapSticker_link" ://地圖貼紙
			callscupio1(Mapi_Scupio_Id,"event0","ch16","cat0","iid0","");
			openStickerMain();
		break;
	} 
}
