﻿/*
   客製化功能  AITS三期  
*/
var DivSet = '';
function LoginCheck() //帳密--確認
{	
	window.location.href='./index.aspx?LoginStatus=in';	//新版
    //舊版
    /*document.getElementById('CustomizeNode').style.width=screen.width;
		document.getElementById('CustomizeNode').style.height=screen.height;
		document.getElementById('CusLogin').style.left=screen.width/2-50;
		document.getElementById('CusLogin').style.top=80;
		CustomizeNode.style.display='';
		CusLogin.style.display='';    		*/
}
function LoginCheck1() //帳密--確認舊版
{	
    CustomizeNode.style.display='none';
		CusLogin.style.display='none';
    hl.SetLinkFinish = SetLinkCustomizeCheck;	
 	var SetPage='./ASPX/Custome_Login.aspx?LoginStatus=in&op=web&AccUserName='+encodeURI(document.getElementById('LoginAcc').value)+'&AccPasswd='+encodeURI(document.getElementById('LoginPwd').value);
 	hl.makeReques(SetPage,hl,'get',null);
}
function LoginReset() //帳密--確認舊版
{	
    document.getElementById('LoginAcc').value='';
    document.getElementById('LoginPwd').value='';
    CustomizeNode.style.display='none';
		CusLogin.style.display='none';
}
function LoginOut() // 帳密--登出
{  	
  	CusId='';
  	window.location.href='./index.aspx?LoginStatus=out'; 
}
function LoginCenter() //帳密--設定登入中心點
{		
	var lt = gMapBase.ToMapPoint(SEPoint.x, SEPoint.y-52);
    	var Center = new Array(2);
    	Center[0]=MapToRealPosX(lt.X);
    	Center[1]=MapToRealPosY(lt.Y); 
	var s = Center[0]+','+Center[1]+','+gMapBase.getMapLevel();	
	hl.SetLinkFinish = SetLinkCustomize02;			
 	var SetPage='./ASPX/Customize.aspx?op='+encodeURI('center')+'&center='+encodeURI(s);
	
 	hl.makeReques(SetPage,hl,'get',null);
    	SetMapCenter(MapToRealPosX(lt.X),MapToRealPosY(lt.Y),gMapBase.getMapLevel());     	 
    	DelRMenu();
}
function MyRoadEvent() // 收藏--設定即時路況
{
    var mmH = parseInt(document.body.clientHeight);
	mmH=(mmH-updo)/2;
	var mmW = parseInt(document.body.clientWidth);
	mmW = mmW/2;
	var lt = gMapBase.ToMapPoint(mmW, mmH);
    	var Center = new Array(2);
    	Center[0]=MapToRealPosX(lt.X);
    	Center[1]=MapToRealPosY(lt.Y); 
	
	CusPOI[0] = Center[0]+','+Center[1]+','+gMapBase.getMapLevel();	
	CusPOI[1] = 'Event';	
	Customize();	
}
function MyCollection() // 收藏--取得我的交通資訊
{
	hl.SetLinkFinish = SetLinkCustomize;	
 	var SetPage='./ASPX/GetCustomize.aspx';
 	hl.makeReques(SetPage,hl,'get',null);
}
function Customize(sv) // 收藏--訂定名稱
{	
	var svtp ;
	if(sv==null) svtp='AddCusPOI();';
	else if(sv!=null) svtp="AddCusGuidance('"+sv+"')";
	
	CustomizeDiv.innerHTML='<table style="background-color:#ffffff;" class="text"><tr><td align="center" >'+lag[146]+'</td></tr>'+
	'<tr><td ><input id="CustomizeInput" type="text"  class="text" size="20" /></td></tr>'+
	'<tr><td align="right" ><input type="submit" class="send" value="'+lag[36]+'"  onclick="'+ svtp +'" />　<input type="reset" class="send" value="'+lag[28]+'"  onclick="CustomizeDiv.style.display=\'none\';CustomizeNode.style.display=\'none\';" />'+
	'</td></tr></table>';
	
	if(CusId=='')
	{
		if( confirm(lag[150]))
		LoginCheck();
		//alert('網路市民登入功能尚未初開通．');
		//window.location.href='./index.aspx?LoginStatus=in';
	}
	else
	{
		document.getElementById('CustomizeInput').value='';
		document.getElementById('CustomizeNode').style.width=screen.width;
		document.getElementById('CustomizeNode').style.height=screen.height;
		document.getElementById('CustomizeDiv').style.left=screen.width/2-50;
		document.getElementById('CustomizeDiv').style.top=50;
		CustomizeNode.style.display='';
		CustomizeDiv.style.display='';	
	}

}
function EditCustomize(ssn,ttp) // 收藏--編輯名稱
{	
	CustomizeDiv.innerHTML='<table style="background-color:#ffffff;" class="text"><tr><td align="center" >'+lag[147]+'</td></tr>'+
	'<tr><td ><input id="CustomizeInput" type="text"  class="text" size="20" /></td></tr>'+
	'<tr><td align="right" ><input type="submit" class="send" value="'+lag[36]+'"  onclick="EditCusPOI(\''+ssn+'\',\''+ttp+'\');" />　<input type="reset" class="send" value="'+lag[28]+'"  onclick="CustomizeDiv.style.display=\'none\';CustomizeNode.style.display=\'none\';" />'+
	'</td></tr></table>';
	
	if(CusId=='')
	{
		if( confirm(lag[150]))
		LoginCheck();
		//alert('網路市民登入功能尚未開通．');
		//window.location.href='./index.aspx?LoginStatus=in';
	}
	else
	{
		document.getElementById('CustomizeInput').value='';
		document.getElementById('CustomizeNode').style.width=screen.width;
		document.getElementById('CustomizeNode').style.height=screen.height;
		document.getElementById('CustomizeDiv').style.left=screen.width/2-50;
		document.getElementById('CustomizeDiv').style.top=50;
		CustomizeNode.style.display='';
		CustomizeDiv.style.display='';	
	}
}
function EditCustomize_MyFavoriteStop(Gs1,Gs2,Gs3,Gs4,Gs5,Gs6,Gs7,Gs8,Gs9) //編輯預約到站提醒  //20091130新增Gs9
{	
// ID，路線名稱，站牌名稱，時，分，True為要寄信通知，去回程，True為要簡訊通知,提醒星期
	
var i=1;
var tarry=new Array();
  
tarry.push('<table style="cellSpacing="0" cellPadding="3" width="200" border="0">');
tarry.push('<tr><td bgColor="#ffffff"><table style="BORDER-RIGHT: #3fb1d8 1px solid; BORDER-TOP: #3fb1d8 1px solid; BORDER-LEFT: #3fb1d8 1px solid; BORDER-BOTTOM: #3fb1d8 1px solid" cellSpacing="2" cellPadding="5" bgColor="#FFFFFF" border="0" >');
tarry.push('<tr><td bgColor="#ffffff"><P align="center">路線:'+Gs2+'站牌:'+Gs3+'('+Gs7+')</P></td>');
tarry.push('<td align="right" bgColor="#ffffff" border="0" width="10px" style="width:10px;" >');
tarry.push('<img onclick="CustomizeDiv.style.display=\'none\';CustomizeNode.style.display=\'none\';" alt="關閉" src="./images/page/X.gif" width="10px" align="right" /></td></tr>');
//20091130以下新增
tarry.push('<tr><td>提醒日期:<select id="EditFavoriteStopS6"><option value="0">每天</option><option value="1">星期一</option><option value="2">星期二</option><option value="3">星期三</option><option value="4">星期四</option><option value="5">星期五</option><option value="6">星期六</option><option value="7">星期日</option>');
tarry.push('</select></td><td>&nbsp;</td></tr>');
//20091130以上新增
tarry.push('<tr><td>提醒時間:<select id="EditFavoriteStopS2"><option value="NO">時...</option>');
for (i = 1; i < 24; i++)
{
  tarry.push('<option value=' + i + '>' + i + '</option>');
}
tarry.push('</select> : <select id="EditFavoriteStopS3"><option value="NO">分...</option>');
for (i = 0; i < 60; i++)
{
  tarry.push('<option value=' + i + '>' + i + '</option>');
}          
tarry.push('</select></td><td>&nbsp;</td></tr>');
tarry.push('<tr><td><table style="width:100%" border="1"><tr><td colspan="2" align="center">寄信通知</td></tr><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" id="EditFavoriteStopS4" name="EditFavoriteStopS4" value="1" onclick="document.getElementById(\'EditFavoriteStopS4\').value=1;" '); 
if(Gs6=="True")
{
tarry.push('checked="checked"');
}
tarry.push('/>是&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" id="EditFavoriteStopS4" name="EditFavoriteStopS4" value="0" onclick="document.getElementById(\'EditFavoriteStopS4\').value=0;" '); 
if(Gs6!="True")
{
tarry.push('checked="checked"');
}  
tarry.push('/>否&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr></table></td></tr>');

/*
tarry.push('<tr><td><table style="width:100%" border="1"><tr><td colspan="2" align="center">簡訊通知</td></tr><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" id="EditFavoriteStopS5" name="EditFavoriteStopS5" value="1" onclick="document.getElementById(\'EditFavoriteStopS5\').value=1;" '); 
if(Gs8=="True")
{
tarry.push('checked="checked"');
}
tarry.push('/>是&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" id="EditFavoriteStopS5" name="EditFavoriteStopS5" value="0" onclick="document.getElementById(\'EditFavoriteStopS5\').value=0;" '); 
if(Gs8!="True")
{
tarry.push('checked="checked"');
}  
tarry.push('/>否&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr></table></td></tr>');
*/
tarry.push('<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="確定" onclick="EditFavoriteStop();" style="width:60px;" width="60px" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="取消" style="width:70px;" width="70px" onclick="CustomizeDiv.style.display=\'none\';CustomizeNode.style.display=\'none\';"/></td><td>&nbsp;</td></tr>');
tarry.push('</table></td></tr><tr><td style="width:0px; height:0px; display:\'none\'; visibility:\'hidden\'"><div id="EditFavoriteStopS1" style="width:0px; height:0px; display:\'none\'; visibility:\'hidden\'">'+Gs1+'</div></td></tr></table>');

	
	document.getElementById('CustomizeDiv').innerHTML=tarry.join('');
	
    for(i=0;i<document.getElementById('EditFavoriteStopS2').options.length;i++)
    {
       if(parseInt(document.getElementById('EditFavoriteStopS2').options[i].value)==parseInt(Gs4))
        {
           document.getElementById('EditFavoriteStopS2').options[i].selected=true;
        }
    }
    for(i=0;i<document.getElementById('EditFavoriteStopS3').options.length;i++)
    {
       if(parseInt(document.getElementById('EditFavoriteStopS3').options[i].value)==parseInt(Gs5))
        {
           document.getElementById('EditFavoriteStopS3').options[i].selected=true;
        }
    }
    if(Gs6=="True")
	{document.getElementById('EditFavoriteStopS4').value=1;}
	else
	{document.getElementById('EditFavoriteStopS4').value=0;}
    
    for(i=0;i<8;i++)  //20091130以下新增
    {
       if(parseInt(document.getElementById('EditFavoriteStopS6').options[i].value)==parseInt(Gs9))
        {
           document.getElementById('EditFavoriteStopS6').options[i].selected=true;
        }
    } //20091130以上新增
    /*
    if(Gs8=="True")
	{document.getElementById('EditFavoriteStopS5').value=1;}
	else
	{document.getElementById('EditFavoriteStopS5').value=0;}
	*/
	if(CusId=='')
	{
		if( confirm(lag[150]))
		LoginCheck();
	}
	else
	{
		document.getElementById('CustomizeNode').style.width=screen.width;
		document.getElementById('CustomizeNode').style.height=screen.height;
		document.getElementById('CustomizeDiv').style.left=screen.width/2-50;
		document.getElementById('CustomizeDiv').style.top=50;
		CustomizeNode.style.display='';
		CustomizeDiv.style.display='';	
	}
}
function EditCusPOI(ssn,ttp) //收藏--編輯
{
	if( confirm(lag[148]))
	{
		do{ssn = ssn.replace('&','~');}
		while(ssn.indexOf('&')>-1)
	
	hl.SetLinkFinish = SetLinkCustomize02;			
 	var SetPage='./ASPX/Customize.aspx?op=edit&POIsn='+ssn+'&CusName='+escape(document.getElementById('CustomizeInput').value)+'&TpCase='+encodeURI(ttp);
 	hl.makeReques(SetPage,hl,'get',null);	
	}
}
function DelCusPOI(ssn,ttp) //收藏--刪除
{
	if( confirm(lag[149]))
	{
		do{ssn = ssn.replace('&','~');}
		while(ssn.indexOf('&')>-1)
	
	hl.SetLinkFinish = SetLinkCustomize02;			
 	var SetPage='./ASPX/Customize.aspx?op=delete&POIsn='+ssn+'&TpCase='+encodeURI(ttp);
 	hl.makeReques(SetPage,hl,'get',null);	
	}
}
function AddCusPOI() // 收藏--加入
{
	if(document.getElementById('CustomizeInput').value=='') alert(((Lang=='CHT')?'請輸入自訂名稱':'Please input the name'));
	else
	{
		hl.SetLinkFinish = SetLinkCustomize02;			
 		var SetPage='./ASPX/Customize.aspx?op=cuspoi&CusName='+escape(document.getElementById('CustomizeInput').value)+'&Type='+encodeURI(CusPOI[1])+'&POIsn='+encodeURI(CusPOI[0]);
 		hl.makeReques(SetPage,hl,'get',null);
	}
}
function AddCusGuidance(sv) // 收藏--導航()城際(Inherit)加入
{	
	var svSE='';
	if(sv == 'Inherit')
		svSE = CusInherit;		
	else
		svSE = RoadGuideData[0][0]+',_'+RoadGuideData[0][1]+',_'+RoadGuideData[0][2]+',_'+RoadGuideData[1][0]+',_'+RoadGuideData[1][1]+',_'+RoadGuideData[1][2]+',_';
	hl.SetLinkFinish = SetLinkCustomize02;			
 	var SetPage='./ASPX/Customize.aspx?op=guidance&CusName='+escape(document.getElementById('CustomizeInput').value)+'&Type='+encodeURI(sv)+'&POIsn='+escape(svSE);
 	
 	hl.makeReques(SetPage,hl,'get',null);	
}
function SWCustom(e)
{		
	ActionArray[3]=true;
	hl.SetLinkFinish = SetLinkCustomize01;
 	var SetPage='./ASPX/GetAction.aspx?Lang='+Lang+'&Action=8';
 	hl.makeReques(SetPage,hl,'get',null);
	
}
function Myguidance(sn,sv)
{
	
	OpenUpRoute();mroll();
	var Custemp ;		
	Custemp = sn.split(',_');
		
	if(sv == 'Travel')
	{		
		AddTravel();
		SetSE(0,Custemp[0],Custemp[1],Custemp[2]);
		SetSE(1,Custemp[3],Custemp[4],Custemp[5]);
		RunTravel();
			
	}
	else
	{		
		SetSE(0,Custemp[0],Custemp[1],Custemp[2]);
		SetSE(1,Custemp[3],Custemp[4],Custemp[5]);
		RunRoute();
	}
	SetMapCenter((parseFloat(Custemp[0])+parseFloat(Custemp[3]))/2,(parseFloat(Custemp[1])+parseFloat(Custemp[4]))/2,gMapBase.getMapLevel());
	
}
function MyEventShow(sn,sv)
{
    ActionArray[2]==true;
    CreateAction(true);
    var Custemp ;		
	Custemp = sn.split(',');
	SetMapCenter(Custemp[0],Custemp[1],Custemp[2]);
	//SetMapCenter(301435,2773095,6);
	//gMapBase.putMapLevel(parseFloat(Custemp[2]));
	//gMapBase.RefreshMap(true, true);
}
function MyInherit(sn,sv)
{
	HtmlDiv.innerHTML='';
	document.getElementById("HtmlDiv").style.visibility='';	
	document.getElementById("LeftDiv").style.visibility='Hidden';
    	document.getElementById("TransitLeftDiv").style.visibility='Hidden';
    	document.getElementById("RouteLeftDiv").style.visibility='Hidden';
    	if(sn.indexOf('GetTrain') > -1)
    	{
		hl.SetLinkFinish = SetLinkFinish16;
    		hl.makeReques(sn,hl,'get',null);	
	}
	else
	{
		hl.SetLinkFinish = SetLinkFinish18;
    		hl.makeReques(sn,hl,'get',null);
	}
}
function MyBusRoute(sn,sv)
{
	AddTransit();mroll();
	document.getElementById("RouteInput").value=sn;
    	BusRouteSumit(sn);
}
function SetLinkCustomize() 
  {
  	if(hl.HpptRequest.responseText=='100')
  	{
  		alert(((Lang=='CHT')?'登入過時，請重新登入...':'login time out,Please record.'));
  		window.location.href='index.aspx'; 
  	}
	else
	{
  		var Custemp ;
  		var StopGoback;  //20091001韋銘
  		var CCTVtemp='',CMStemp='',Eventemp='',Speedtemp='',Parktemp='',Traveltemp='',Routetemp='',Inheritemp='',Bustemp='',MyFavoriteStop='',TRoadSpeedE2='',TRoadSpeedE3='';  	
  		Custemp = hl.HpptRequest.responseText.split('|_');  	
  	for (var i=0;i<Custemp.length-1;i++)
    	{	
    		Custemp[i]=Custemp[i].split('&_');
    		switch(Custemp[i][0])
    		{
    			case 'CCTV':
    				CCTVtemp+='<tr height="10px"><td>‧<a href="javascript:void(0);" onclick="GetSmallDiv(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');">'+Custemp[i][1]+'</a>  <img onclick="EditCustomize(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/common/editor_edit.gif" alt="編輯" style="width:14px;height:14px;cursor:pointer;" />  <img onclick="DelCusPOI(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/ITS/del.gif" alt="刪除" style="width:14px;height:14px;cursor:pointer;" /></td></tr>';
    			break;
    			case 'CMS':
    				CMStemp+='<tr><td>‧<a href="javascript:void(0);" onclick="GetSmallDiv(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');">'+Custemp[i][1]+'</a>  <img onclick="EditCustomize(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/common/editor_edit.gif" alt="編輯" style="width:14px;height:14px;cursor:pointer;" />  <img onclick="DelCusPOI(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/ITS/del.gif" alt="刪除" style="width:14px;height:14px;cursor:pointer;" /></td></tr>';
    			break;    			
    			case 'Speed':
    				Speedtemp+='<tr><td>‧<a href="javascript:void(0);" onclick="GetSmallDiv(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');">'+Custemp[i][1]+'</a>  <img onclick="EditCustomize(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/common/editor_edit.gif" alt="編輯" style="width:14px;height:14px;cursor:pointer;" />  <img onclick="DelCusPOI(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/ITS/del.gif" alt="刪除" style="width:14px;height:14px;cursor:pointer;" /></td></tr>';
    			break;
    			case 'Park':
    				Parktemp+='<tr><td>‧<a href="javascript:void(0);" onclick="GetSmallDiv(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');">'+Custemp[i][1]+'</a>  <img onclick="EditCustomize(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/common/editor_edit.gif" alt="編輯" style="width:14px;height:14px;cursor:pointer;" />  <img onclick="DelCusPOI(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/ITS/del.gif" alt="刪除" style="width:14px;height:14px;cursor:pointer;" /></td></tr>';
    			break;
    			case 'Event':
    				Eventemp+='<tr><td>‧<a href="javascript:void(0);" onclick="MyEventShow(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');">'+Custemp[i][1]+'</a>  <img onclick="EditCustomize(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/common/editor_edit.gif" alt="編輯" style="width:14px;height:14px;cursor:pointer;" />  <img onclick="DelCusPOI(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/ITS/del.gif" alt="刪除" style="width:14px;height:14px;cursor:pointer;" /></td></tr>';
    			break;
    			case 'Travel':
    				Traveltemp+='<tr><td>‧<a href="javascript:void(0);" onclick="Myguidance(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');">'+Custemp[i][1]+'</a>  <img onclick="EditCustomize(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/common/editor_edit.gif" alt="編輯" style="width:14px;height:14px;cursor:pointer;" />  <img onclick="DelCusPOI(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/ITS/del.gif" alt="刪除" style="width:14px;height:14px;cursor:pointer;" /></td></tr>';
    			break;
    			case 'Route':
    				Routetemp+='<tr><td>‧<a href="javascript:void(0);" onclick="Myguidance(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');">'+Custemp[i][1]+'</a>  <img onclick="EditCustomize(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/common/editor_edit.gif" alt="編輯" style="width:14px;height:14px;cursor:pointer;" />  <img onclick="DelCusPOI(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/ITS/del.gif" alt="刪除" style="width:14px;height:14px;cursor:pointer;" /></td></tr>';
    			break;
    			case 'Inherit':
    				Inheritemp+='<tr><td>‧<a href="javascript:void(0);" onclick="MyInherit(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');">'+Custemp[i][1]+'</a>  <img onclick="EditCustomize(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/common/editor_edit.gif" alt="編輯" style="width:14px;height:14px;cursor:pointer;" />  <img onclick="DelCusPOI(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/ITS/del.gif" alt="刪除" style="width:14px;height:14px;cursor:pointer;" /></td></tr>';
    			break;
    			case 'Bus':
    				Bustemp+='<tr><td>‧<a href="javascript:void(0);" onclick="MyBusRoute(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');">'+Custemp[i][1]+'</a>  <img onclick="EditCustomize(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/common/editor_edit.gif" alt="編輯" style="width:14px;height:14px;cursor:pointer;" />  <img onclick="DelCusPOI(\''+Custemp[i][2]+'\',\''+Custemp[i][0]+'\');" src="./images/ITS/del.gif" alt="刪除" style="width:14px;height:14px;cursor:pointer;" /></td></tr>';
    			break;
    			case 'MyFavoriteStop':
    			    Custemp[i][7]=="1"?StopGoback="去程":StopGoback="回程";
    				MyFavoriteStop+='<tr><td>‧<span>路線:'+Custemp[i][2]+' 站牌:'+Custemp[i][3]+'('+StopGoback+')</span>  <img onclick="EditCustomize_MyFavoriteStop(\''+Custemp[i][1]+'\',\''+Custemp[i][2]+'\',\''+Custemp[i][3]+'\',\''+Custemp[i][4]+'\',\''+Custemp[i][5]+'\',\''+Custemp[i][8]+'\',\''+StopGoback+'\',\''+Custemp[i][9]+'\',\''+Custemp[i][10]+'\');" src="./images/common/editor_edit.gif" alt="編輯" style="width:14px;height:14px;cursor:pointer;" />  <img onclick="DelCusPOI(\''+Custemp[i][1]+'\',\''+Custemp[i][0]+'\');" src="./images/ITS/del.gif" alt="刪除" style="width:14px;height:14px;cursor:pointer;" /></td></tr>';    		//20091130新增Gs9	
    			break;   
    			case 'MyFavoriteSpeed':
    				TRoadSpeedE2+='<tr><td>‧<span>'+Custemp[i][2]+'(從'+Custemp[i][3]+'至'+Custemp[i][4]+')</span>  <img onclick="EditMyFavoriteSpeed(\''+Custemp[i][1]+'\',\''+Custemp[i][2]+'\',\''+Custemp[i][3]+'\',\''+Custemp[i][4]+'\',\''+Custemp[i][5]+'\',\''+Custemp[i][6]+'\',\''+Custemp[i][7]+'\',\''+Custemp[i][8]+'\',\''+Custemp[i][9]+'\');" src="./images/common/editor_edit.gif" alt="編輯" style="width:14px;height:14px;cursor:pointer;" />  <img onclick="DelCusPOI(\''+Custemp[i][1]+'\',\''+Custemp[i][0]+'\');" src="./images/ITS/del.gif" alt="刪除" style="width:14px;height:14px;cursor:pointer;" /></td></tr>';    			
    			break;  
    			case 'MyFavoriteEven':
    				TRoadSpeedE3+='<tr><td>‧<span>'+Custemp[i][2]+'</span>  <img onclick="EditMyFavoriteEven(\''+Custemp[i][1]+'\',\''+Custemp[i][2]+'\',\''+Custemp[i][3]+'\',\''+Custemp[i][4]+'\',\''+Custemp[i][5]+'\',\''+Custemp[i][6]+'\',\''+Custemp[i][7]+'\');" src="./images/common/editor_edit.gif" alt="編輯" style="width:14px;height:14px;cursor:pointer;" />  <img onclick="DelCusPOI(\''+Custemp[i][1]+'\',\''+Custemp[i][0]+'\');" src="./images/ITS/del.gif" alt="刪除" style="width:14px;height:14px;cursor:pointer;" /></td></tr>';    			
    			break;      			
    		}	
    	} 
    	 var n='無自訂資訊';
    	 if(Lang!='CHT') n='NO Set Information'
    	 if(CCTVtemp=='') CCTVtemp = n;
    	 if(CMStemp=='') CMStemp = n; 
    	 if(Speedtemp=='') Speedtemp = n; 
    	 if(Parktemp=='') Parktemp = n; 
    	 if(Traveltemp=='') Traveltemp = n; 
    	 if(Routetemp=='') Routetemp = n; 
    	 if(Inheritemp=='') Inheritemp = n; 
    	 if(Bustemp=='') Bustemp = n; 
    	 if(Eventemp=='') Eventemp = n; 
    	 if(MyFavoriteStop=='') MyFavoriteStop = n;
    	 if(TRoadSpeedE2=='') TRoadSpeedE2 = n;
    	 if(TRoadSpeedE3=='') TRoadSpeedE3 = n;    	 

    	var TRoadSpeedE= '<tr id="RoadSpeedTR1"><td valign="top"><table border="0" cellspacing="0" cellpadding="0"><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick="GetSpeedData();">道路速率提醒</a>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>'+
    	'<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick="ShowSpeedRoadTR2();">道路速率編輯</a>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>'+
    	'<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick="GetEvenData(\'Even\');" >路況事件提醒</a>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>'+  		  		  		   
    	'<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick="ShowSpeedRoadTR3();">路況事件編輯</a>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr></table></td></tr>'+
    	'<tr id="RoadSpeedTR2" style="display:none;"><td valign="top"><table border="0" cellspacing="0" cellpadding="0">'+TRoadSpeedE2+'<tr><td aling=\"center\"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" '+
    	'style="width:125px;" onclick="ShowSpeedRoadTR1();" value="回到上一頁" /></td></tr></table></td></tr>'+
    	'<tr id="RoadSpeedTR3" style="display:none;"><td valign="top"><table border="0" cellspacing="0" cellpadding="0">'+TRoadSpeedE3+'<tr><td aling=\"center\"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" '+
    	'style="width:125px;" onclick="ShowSpeedRoadTR1();" value="回到上一頁" /></td></tr></table></td></tr>';
 	        	 
 	    document.getElementById("RelatedDiv").style.visibility=''; 	
	    document.getElementById("LeftDiv").style.visibility='Hidden';
    	document.getElementById("RouteLeftDiv").style.visibility='Hidden';
    	document.getElementById("TransitLeftDiv").style.visibility='Hidden';
    	document.getElementById("HtmlDiv").style.visibility='Hidden';
	    
	    RelatedDiv.innerHTML='<table width="244" border="0" cellspacing="0" cellpadding="0" style="border-right:1px solid #a6d8cc;">'+
        '<tr><td width="243" height="32" valign="top" ><table width="216" border="0" cellspacing="0" cellpadding="0"><tr><td width="14">&nbsp;</td><td width="28" align="left" valign="top"><img src="./images/common/sun.jpg" alt="" width="25" height="26" /></td><td class="guide_md"><font color="#ffffff">'+lag[144]+'</font></td><td width="42">&nbsp;</td></tr></table></td></tr>'+
        '<tr><td><a onclick="DivSetFun(\'cctvCusDiv\');" ><img id="clec_btn01" src="./images/'+Lang+'/my_e/clec_btn01.png" onmousedown="Clec(this.id);" /></a></td></tr><tr><td><div id="cctvCusDiv" class="collection" style="background-color:#FFFF66; display:none; height:80px; overflow:auto;"><table width="100%" border="0" cellspacing="0" cellpadding="3">'+ CCTVtemp + '</table></div></td></tr>'+        
        '<tr><td><a onclick="DivSetFun(\'cmsCusDiv\');" ><img id="clec_btn02" src="./images/'+Lang+'/my_e/clec_btn02.png" onmousedown="Clec(this.id);" /></a></td></tr><tr><td><div id="cmsCusDiv" class="collection" style="background-color:#FFFF66; display:none; height:80px; overflow:auto;"><table width="100%" border="0" cellspacing="0" cellpadding="3">'+  CMStemp + '</table></div></td></tr>'+       
        '<tr><td><a onclick="DivSetFun(\'speedCusDiv\');" ><img id="clec_btn03" src="./images/'+Lang+'/my_e/clec_btn03.png" onmousedown="Clec(this.id);" /></a></td></tr><tr><td><div id="speedCusDiv" class="collection" style="background-color:#FFFF66; display:none; height:80px; overflow:auto;"><table width="100%" border="0" cellspacing="0" cellpadding="3">' + Speedtemp + '</table></div></td></tr>'+
        '<tr><td><a onclick="DivSetFun(\'parkCusDiv\');" ><img id="clec_btn04" src="./images/'+Lang+'/my_e/clec_btn04.png" onmousedown="Clec(this.id);" /></a></td></tr><tr><td><div id="parkCusDiv" class="collection" style="background-color:#FFFF66; display:none; height:80px; overflow:auto;"><table width="100%" border="0" cellspacing="0" cellpadding="3">' + Parktemp + '</table></div></td></tr>'+
        '<tr><td><a onclick="DivSetFun(\'eventCusDiv\');" ><img id="clec_btn05" src="./images/'+Lang+'/my_e/clec_btn05.png" onmousedown="Clec(this.id);" /></a></td></tr><tr><td><div id="eventCusDiv" class="collection" style="background-color:#FFFF66; display:none; height:80px; overflow:auto;"><table width="100%" border="0" cellspacing="0" cellpadding="3">' + Eventemp + '</table></div></td></tr>'+
        '<tr><td><a onclick="DivSetFun(\'TravelCusDiv\');" ><img id="clec_btn06" src="./images/'+Lang+'/my_e/clec_btn06.png" onmousedown="Clec(this.id);" /></a></td></tr><tr><td><div id="TravelCusDiv" class="collection" style="background-color:#FFFF66; display:none; height:80px; overflow:auto;"><table width="100%" border="0" cellspacing="0" cellpadding="3">' + Traveltemp + '</table></div></td></tr>'+
        '<tr><td><a onclick="DivSetFun(\'RouteCusDiv\');" ><img id="clec_btn07" src="./images/'+Lang+'/my_e/clec_btn07.png" onmousedown="Clec(this.id);" /></a></td></tr><tr><td><div id="RouteCusDiv" class="collection" style="background-color:#FFFF66; display:none; height:80px; overflow:auto;"><table width="100%" border="0" cellspacing="0" cellpadding="3">' + Routetemp + '</table></div></td></tr>'+
        '<tr><td><a onclick="DivSetFun(\'InheritCusDiv\');" ><img id="clec_btn08" src="./images/'+Lang+'/my_e/clec_btn08.png" onmousedown="Clec(this.id);" /></a></td></tr><tr><td><div id="InheritCusDiv" class="collection" style="background-color:#FFFF66; display:none; height:80px; overflow:auto;"><table width="100%" border="0" cellspacing="0" cellpadding="3">' + Inheritemp + '</table></div></td></tr>';
        
        if(Lang=='CHT')
        {
           RelatedDiv.innerHTML +=
          '<tr><td><a onclick="DivSetFun(\'ShowMyFavoriteStopDiv\');" ><img id="clec_btn010" src="./images/'+Lang+'/my_e/clec_btn010.png" onmousedown="Clec(this.id);" /></a></td></tr><tr><td><div id="ShowMyFavoriteStopDiv" class="collection2" style="background-color:#FFFF66; display:none; height:80px; overflow:auto;"><table width="100%" border="0" cellspacing="0" cellpadding="0">' + MyFavoriteStop + '</table></div></td></tr><tr><td><a onclick="DivSetFun(\'TRoadSpeedE\');" ><img id="clec_btn011" src="./images/'+Lang+'/my_e/clec_btn011.png" onmousedown="Clec(this.id);" /></a></td></tr><tr><td><div id="TRoadSpeedE" class="collection2" style="background-color:#FFFF66; display:none; height:80px; overflow:auto;"><table width="100%" border="0" cellspacing="0" cellpadding="0">' + TRoadSpeedE + '</table></div></td></tr>';       
        }
        RelatedDiv.innerHTML +=
        '<tr><td><a onclick="DivSetFun(\'BusCusDiv\');" ><img id="clec_btn09" src="./images/'+Lang+'/my_e/clec_btn09.png" onmousedown="Clec(this.id);" /></a></td></tr><tr><td><div id="BusCusDiv" class="collection" style="background-color:#FFFF66; display:none; height:80px; overflow:auto;"><table width="100%" border="0" cellspacing="0" cellpadding="3">' + Bustemp + '</table></div></td></tr>'+
        '<tr><td><table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td></td></tr></table></td></tr><tr><td align="center"><font color="#336699">('+lag[145]+')</font></td></tr></table>';
	}
  }
function Clec(s)
{
MySpeedStopClose();
    var obj = document.getElementById(s);
    var objs ="";
    if(Lang=='CHT')
    {
      for(var i=1;i<12;i++)
      {
        objs = document.getElementById('clec_btn0'+i);
        objs.src = './images/'+Lang+'/my_e/clec_btn0'+i+'.png';    
      }
    }
    else
    {
      for(var i=1;i<10;i++)
      {
        objs = document.getElementById('clec_btn0'+i);
        objs.src = './images/'+Lang+'/my_e/clec_btn0'+i+'.png';    
      }
    }
    obj.src = './images/'+Lang+'/my_e/'+s+'_f2.png';    
    
}
function SetLinkCustomize01()
  {
  	
  	ActionPOI = hl.HpptRequest.responseText.split('|_');
  	for (var i=0;i<ActionPOI.length-1;i++)
    {
    	ActionPOI[i]=ActionPOI[i].split('&_');
    	for (var j=0;j<ActionPOI[i].length-1;j++)
    	{
    		ActionPOI[i][j]=ActionPOI[i][j].split(',_');
    	}
    }    
    CreateAction(true);
    GetSmallDiv(CusId[0],CusId[1]);    
  }
function SetLinkCustomize02()
{
	//alert(hl.HpptRequest.responseText);
  	if(hl.HpptRequest.responseText=='201') 
  		alert(((Lang=='CHT')?'設定完成，下次登入時套用設定':'OK,used the set when login next time'));
	else if(hl.HpptRequest.responseText=='202') 	
	    if(Lang=='CHT')
		    alert('已將['+document.getElementById('CustomizeInput').value+']收藏至[我的交通資訊]');	
		else
		    alert('Put ['+document.getElementById('CustomizeInput').value+'] in [My Traffic List]');	
	else if(hl.HpptRequest.responseText=='203') 
		MyCollection();		
	else if(hl.HpptRequest.responseText=='100')
		alert(((Lang=='CHT')?'重複收藏':'Repeat!'));
	else if(hl.HpptRequest.responseText=='400') 
		alert(((Lang=='CHT')?'失敗':'Loss'));
	CustomizeDiv.style.display='none';CustomizeNode.style.display='none';
}
function SetLinkCustomizeCheck()
  {
  	/*
       if (XmlHttp5.readyState == 4)
        {        	
          if (XmlHttp5.status == 200)
            {            	
            	var Center = new Array();            	
            	Center = XmlHttp5.responseText.split(',');             	
            	switch(parseInt(Center[0]))
            	{
            	    case 111: 
            	    	alert('登出成功，重新導入頁面...');
            	    	window.location.href='index.aspx'; 
            	    break;
            	    case 401: 
            	    	alert('未填入帳號'); 
            	    break;
            	    case 402: 
            	    	alert('帳號不存在'); 
            	    break;
            	    case 403: 
            	    	alert('未填入密碼'); 
            	    break;
            	    case 404: 
            	    	alert('帳號密碼不正確'); 
            	    break;
            	    case 200:
            	    	alert(Center[2]+' 您好，歡迎您登入本系統。將載入個人化設定...');  
            	    	CusId=Center[2];        	
            		SetMapCenter(Center[3],Center[4],gMapBase.getMapLevel());
            		window.location.href='index.aspx';            		    	
            	    break;            	    
            	}
            	document.getElementById("LoginAcc").value=''; 
            	document.getElementById("LoginPwd").value='';  
           }
       }*/
	   
	   var Center = new Array();            	
            	Center = hl.HpptRequest.responseText.split(',');            	
            	switch(parseInt(Center[0]))
            	{
            	    case 111: 
            	    	alert('登出成功，重新導入頁面...');
            	    	window.location.href='index.aspx'; 
            	    break;
            	    case 401: 
            	    	alert('未填入帳號'); 
            	    	CustomizeNode.style.display='';
		                CusLogin.style.display='';
            	    break;
            	    case 402: 
            	    	alert('帳號不存在'); 
            	    	CustomizeNode.style.display='';
		                CusLogin.style.display='';
            	    break;
            	    case 403: 
            	    	alert('未填入密碼'); 
            	    	CustomizeNode.style.display='';
		                CusLogin.style.display='';
            	    break;
            	    case 404: 
            	    	alert('帳號密碼不正確'); 
            	    	CustomizeNode.style.display='';
		                CusLogin.style.display='';
            	    break;					
            	    case 200:
            	    	alert(Center[2]+' 您好，歡迎您登入本系統。將載入個人化設定...');  
            	    	CusId=Center[2];        	
            		SetMapCenter(Center[3],Center[4],gMapBase.getMapLevel());
            		window.location.href='index.aspx';            		    	
            	    break;     
					default:
						alert('登入失敗．'); 
					break;
            	}
            	document.getElementById("LoginAcc").value=''; 
            	document.getElementById("LoginPwd").value='';
  }
  
  function DivSetFun(s)
  { 
        var obj = document.getElementById(s);
        if(DivSet=='') 
        {
            obj.style.display='';
            DivSet = s;
        }
        else
        {   
            var objs = document.getElementById(DivSet);
            objs.style.display='none';
            obj.style.display='';
            DivSet = s;              
        }
  }
  
  
