<?php
    require('GoogleMapAPI.class.php');
    include("../db.php");
    $map = new GoogleMapAPI('map');
    // setup database for geocode caching
   // $map->setDSN('mysql://project:gp9806gun@140.117.71.186/project');
    // enter YOUR Google Map Key
    $map->setAPIKey('ABQIAAAA-fZzs3imoScYLbCOBKQlzRTYORkeNIKSncmJvlVfX-hxs_NibRRegT0ubbZJqL5v_tTrgBpOD_LZGQ');
     $map->setWidth('900px');
	 $map->setHeight('350px');
	  $map->disableSidebar(); 
	  $map->disableDirections();
	  $map->setZoomLevel(10);
	  $map->setControlSize = 'small';
	  putenv("NLS_LANG=TRADITIONAL CHINESE_TAIWAN.AL32UTF8");
    // create some map markers
	// $map->setMarkerIcon('http://140.117.192.176/project/toktok/map/Icons/iconb.png','http://140.117.192.176/project/toktok/map/Icons/shadow-iconb.png',0,0,10,10);
    //$map->addMarkerByAddress('高雄縣鳳山市二儀街','PJ Pizza','<b>PJ Pizza</b>');
    //$map->addMarkerByAddress('826 P St Lincoln NE 68502','Old Chicago','<b>Old Chicago</b>');
    //$map->addMarkerByAddress('3457 Holdrege St Lincoln NE 68502',"Valentino's","<b>Valentino's</b>");
    
	//$map->addMarkerIcon('http://140.117.192.176/project/toktok/map/Icons/icong.png','http://140.117.192.176/project/toktok/map/Icons/shadow-iconb.png',0,0,10,10);
    //$map->addMarkerByAddress('高雄市鼓山區蓮海路70號','xxxxx','<b>xxxxx/b>');
	//$map->addMarkerByCoords(120.348,22.7317,123132,5555,99999)
	//$map->setCenterCoords(120.265039,22.628032)
	
	//echo $lock_time = date("Y-m-d",mktime(date("H"),date("i"),date("s"),date("m"), date("d")+20,date("Y")));
	$now=date("Y-m-d");
	/*
	120.266151
	22.624735
	*/
	$in='';
	$pan='';
	$p_time=3000;
	
	if(!(isset($_POST['se']))){
	if(!(isset($_GET['type']))){
	
	  $map->setMarkerIcon('http://localhost/map/Icons/jume.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 $map->addMarkerIcon('http://localhost/map/Icons/jume.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10); 
		 $map->addMarkerByCoords(120.265039,22.628032,'>.^ 我是揪咪!?');
//		 $map->setCenterCoords(120.265039,22.628032);
	 }
	 $type=$_GET["type"];
	 if($type==1){
	 
	  $re = oci_parse($conn,"select LON,LAT from ACTIVITY NATURAL JOIN MAP where TID='$type' and END_DATE >='$now' and ROWNUM<20 group by LON,LAT ") or die('Insert error');
oci_execute($re);

	 if(oci_fetch_all($re,$result)!=0){oci_execute($re);
	 //$map->setMarkerIcon('http://140.117.71.186/map/Icons/shop.png','http://140.117.71.186/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 $map->addMarkerIcon('http://localhost/map/Icons/Shopping.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 while($res=oci_fetch_object($re)){
	   $LON=$res->LON;
	   $LAT=$res->LAT;
	   
	 if($res->LON!=''&&$res->LAT!=''){
	  $sql_ac="select * from ACTIVITY natural join MAP where TID='$type' and LON='$LON' and LAT='$LAT' and ROWNUM<20";}
	  else { $sql_ac="select * from ACTIVITY natural join MAP where TID='$type' and LON='' and LAT='' and ROWNUM<20";
	    $LON="120.265039";
	   $LAT="22.628032";
	  
	  }
	  
	  $re_2 = oci_parse($conn,$sql_ac) or die('Insert error');
oci_execute($re_2);
	  
	    if($res->LON!=''&&$res->LAT!=''){$pan.="panLL(".$LAT.",".$LON.",".$p_time.");";}else{
		$pan.="panLL(22.628032,120.265039,".$p_time.");";
		}
	 while($res_2=oci_fetch_object($re_2))
	 //echo $res->LON.$res->LAT.$res->content;
	 {
	 $aId_2=$res_2->AID;
	 
	 
	 $in.="<b>活動名稱:<a href=../ACTIVITY/activity_show_detail.php?aId=".$aId_2." target=_parent>".$res_2->ANAME."</b></a><br>活動時間:<br>".$res_2->ATIME."~".$res_2->END_DATE."<br>";

	 
	 
	 }
	  
	  $map->addMarkerByCoords($LON,$LAT,'$res->ACONTENT',$in);
	  $p_time=$p_time*2;
	  $in='';
	 }
	} else{
		 $map->setMarkerIcon('http://localhost/map/Icons/jume.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 $map->addMarkerIcon('http://localhost/map/Icons/jume.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10); 
		 $map->addMarkerByCoords(120.265039,22.628032,'>.^ 此類目前沒有活動喔!?');
		
		
		
		}
	 
	 
	 } if($type==2){
	 
	
	 $sql="select LON,LAT from ACTIVITY NATURAL JOIN MAP where TID='$type' and END_DATE >='$now' and ROWNUM<20 group by LON,LAT";
	  $re = oci_parse($conn,$sql) or die('Insert error');
oci_execute($re);
	
	  if(oci_fetch_all($re,$result)!=0){  oci_execute($re);
	  	//$map->setMarkerIcon('http://140.117.71.186/map/Icons/shop.png','http://140.117.71.186/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 $map->addMarkerIcon('http://localhost/map/Icons/Party.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 while($res=oci_fetch_object($re)){
	   $LON=$res->LON;
	   $LAT=$res->LAT;
	   
	 if($res->LON!=''&&$res->LAT!=''){
	  $sql_ac="select * from ACTIVITY natural join MAP where TID='$type' and LON='$LON' and LAT='$LAT' and ROWNUM<20";}
	  else { $sql_ac="select * from ACTIVITY natural join MAP where TID='$type' and LON='' and LAT='' and ROWNUM<20";
	    $LON="120.265039";
	   $LAT="22.628032";
	  
	  }
	   $re_2 = oci_parse($conn,$sql_ac) or die('Insert error');
oci_execute($re_2);
	
	    if($res->LON!=''&&$res->LAT!=''){$pan.="panLL(".$LAT.",".$LON.",".$p_time.");";}else{
		$pan.="panLL(22.628032,120.265039,".$p_time.");";
		}
	  
	 while($res_2=oci_fetch_object($re_2))
	 //echo $res->LON.$res->LAT.$res->content;
	 {
	 $aId_2=$res_2->AID;
	 
	 
	 $in.="<b>活動名稱:<a href=../ACTIVITY/activity_show_detail.php?aId=".$aId_2." target=_parent>".$res_2->ANAME."</b></a><br>活動時間:<br>".$res_2->ATIME."~".$res_2->END_DATE."<br>";

	 
	 
	 }
	  
	  $map->addMarkerByCoords($LON,$LAT,'$res->ACONTENT',$in);
	  $p_time=$p_time*2;
	  $in='';
	 }
	}else{
		 $map->setMarkerIcon('http://localhost/map/Icons/jume.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 $map->addMarkerIcon('http://localhost/map/Icons/jume.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10); 
		 $map->addMarkerByCoords(120.265039,22.628032,'>.^ 此類目前沒有活動喔!?');
		
		}
	 
	 } if($type==3){
	 
	 
	 $sql="select LON,LAT from ACTIVITY NATURAL JOIN MAP where TID='$type' and END_DATE >='$now' and ROWNUM<20 group by LON,LAT";
	  $re = oci_parse($conn,$sql) or die('Insert error');
oci_execute($re);

	   if(oci_fetch_all($re,$result)!=0){ oci_execute($re);
	  //$map->setMarkerIcon('http://140.117.71.186/map/Icons/shop.png','http://140.117.71.186/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 $map->addMarkerIcon('http://localhost/map/Icons/Food.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 while($res=oci_fetch_object($re)){
	   $LON=$res->LON;
	   $LAT=$res->LAT;
	 if($res->LON!=''&&$res->LAT!=''){
	  $sql_ac="select * from ACTIVITY natural join MAP where TID='$type' and LON='$LON' and LAT='$LAT' and ROWNUM<20";}
	  else { $sql_ac="select * from ACTIVITY natural join MAP where TID='$type' and LON='' and LAT='' and ROWNUM<20";
	    $LON="120.265039";
	   $LAT="22.628032";
	  
	  }
	    $re_2 = oci_parse($conn,$sql_ac) or die('Insert error');
oci_execute($re_2);
	  
	    if($res->LON!=''&&$res->LAT!=''){$pan.="panLL(".$LAT.",".$LON.",".$p_time.");";}else{
		$pan.="panLL(22.628032,120.265039,".$p_time.");";
		}
	  
	 while($res_2=oci_fetch_object($re_2))
	 //echo $res->LON.$res->LAT.$res->content;
	 {
	 $aId_2=$res_2->AID;
	 
	 
	 $in.="<b>活動名稱:<a href=../ACTIVITY/activity_show_detail.php?aId=".$aId_2." target=_parent>".$res_2->ANAME."</b></a><br>活動時間:<br>".$res_2->ATIME."~".$res_2->END_DATE."<br>";

	 
	 
	 }
	  
	  $map->addMarkerByCoords($LON,$LAT,'$res->ACONTENT',$in);
	   $p_time=$p_time*2;
	   $in='';
	 }
	}else {
		$map->setMarkerIcon('http://localhost/map/Icons/jume.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 $map->addMarkerIcon('http://localhost/map/Icons/jume.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10); 
		 $map->addMarkerByCoords(120.265039,22.628032,'>.^ 此類目前沒有活動喔!?');
		
		}
	 
	 } if($type==4){
	 
	 
	
 $sql="select LON,LAT from ACTIVITY NATURAL JOIN MAP where TID='$type' and END_DATE >='$now' and ROWNUM<20 group by LON,LAT";

	 $re = oci_parse($conn,$sql) or die('Insert error');
oci_execute($re);
	  if(oci_fetch_all($re,$result)!=0){ 
	  	oci_execute($re);
	  //$map->setMarkerIcon('http://140.117.71.186/map/Icons/shop.png','http://140.117.71.186/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 $map->addMarkerIcon('http://localhost/map/Icons/Travel.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 while($res=oci_fetch_object($re)){
	  $LON=$res->LON;
	   $LAT=$res->LAT;
	  
	 
	
	   if($res->LON!=''&&$res->LAT!=''){
	  $sql_ac="select * from ACTIVITY natural join MAP where TID='$type' and LON='$LON' and LAT='$LAT' and ROWNUM<20";}
	  else { $sql_ac="select * from ACTIVITY natural join MAP where TID='$type' and LON='' and LAT='' and ROWNUM<20";
	    $LON="120.265039";
	   $LAT="22.628032";
	  
	  }
	  	 $re_2 = oci_parse($conn,$sql_ac) or die('Insert error');
       oci_execute($re_2);

	    if($res->LON!=''&&$res->LAT!=''){$pan.="panLL(".$LAT.",".$LON.",".$p_time.");";}else{
		$pan.="panLL(22.628032,120.265039,".$p_time.");";
		}
	  
	 while($res_2=oci_fetch_object($re_2))
	 //echo $res->LON.$res->LAT.$res->content;
	 {
	 $aId_2=$res_2->AID;
	 
	 
	 $in.="<b>活動名稱:<a href=../ACTIVITY/activity_show_detail.php?aId=".$aId_2." target=_parent>".$res_2->ANAME."</b></a><br>活動時間:<br>".$res_2->ATIME."~".$res_2->END_DATE."<br>";

	 
	 
	 }
	  
	  $map->addMarkerByCoords($LON,$LAT,'$res->ACONTENT',$in);
	   $p_time=$p_time*2;
	   $in='';
	 }
	 }else{
	 			$map->setMarkerIcon('http://localhost/map/Icons/jume.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 $map->addMarkerIcon('http://localhost/map/Icons/jume.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10); 
		 $map->addMarkerByCoords(120.265039,22.628032,'>.^ 此類目前沒有活動喔!?');
	 	
	 	}
	 
	 
	 } if($type==5){
	 
	 
	  
	 $sql="select LON,LAT from ACTIVITY NATURAL JOIN MAP where TID='$type' and END_DATE >='$now' and ROWNUM<20 group by LON,LAT ";
	$re = oci_parse($conn,$sql) or die('Insert error');
       oci_execute($re);

	 
	 if(oci_fetch_all($re,$result)!=0){ oci_execute($re);
	 	//$map->setMarkerIcon('http://140.117.71.186/map/Icons/shop.png','http://140.117.71.186/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 $map->addMarkerIcon('http://localhost/map/Icons/sport.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 while($res=oci_fetch_object($re)){
	   $LON=$res->LON;
	   $LAT=$res->LAT;
	 if($res->LON!=''&&$res->LAT!=''){
	  $sql_ac="select * from ACTIVITY natural join MAP where TID='$type' and LON='$LON' and LAT='$LAT' and ROWNUM<20";}
	  else { $sql_ac="select * from ACTIVITY  natural join MAP where TID='$type' and LON='' and LAT='' and ROWNUM<20";
	    $LON="120.265039";
	   $LAT="22.628032";
	  
	  }
	  $re_2 = oci_parse($conn,$sql_ac) or die('Insert error');
       oci_execute($re_2);


	    if($res->LON!=''&&$res->LAT!=''){$pan.="panLL(".$LAT.",".$LON.",".$p_time.");";}else{
		$pan.="panLL(22.628032,120.265039,".$p_time.");";
		}
	  
	 while($res_2=oci_fetch_object($re_2))
	 //echo $res->LON.$res->LAT.$res->content;
	 {
	 $aId_2=$res_2->AID;
	 
	 
	 $in.="<b>活動名稱:<a href=../ACTIVITY/activity_show_detail.php?aId=".$aId_2." target=_parent>".$res_2->ANAME."</b></a><br>活動時間:<br>".$res_2->ATIME."~".$res_2->END_DATE."<br>";

	 
	 
	 }
	  
	  $map->addMarkerByCoords($LON,$LAT,'$res->ACONTENT',$in);
	    $p_time=$p_time*2;
	    $in='';
	 }
	 }else{
	 				//$map->setMarkerIcon('http://140.117.71.186/map/Icons/jume.png','http://140.117.71.186/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 $map->addMarkerIcon('http://localhost/map/Icons/jume.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10); 
		 $map->addMarkerByCoords(120.265039,22.628032,'>.^ 此類目前沒有活動喔!?');
	 	
	 	}
	 
	 } if($type==6){
	 
	
	 $sql="select LON,LAT from ACTIVITY NATURAL JOIN MAP where TID='$type' and END_DATE >='$now' and ROWNUM<20 group by LON,LAT ";
	   $re= oci_parse($conn,$sql) or die('Insert error');
       oci_execute($re);

	 if(oci_fetch_all($re,$result)!=0){ oci_execute($re);
	 	  //$map->setMarkerIcon('http://140.117.71.186/map/Icons/shop.png','http://140.117.71.186/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 $map->addMarkerIcon('http://localhost/map/Icons/Educate.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 while($res=oci_fetch_object($re)){
	    $LON=$res->LON;
	   $LAT=$res->LAT;
	 if($res->LON!=''&&$res->LAT!=''){
	  $sql_ac="select * from ACTIVITY natural join MAP where TID='$type' and LON='$LON' and LAT='$LAT' and ROWNUM<20 ";}
	  else { $sql_ac="select * from ACTIVITY natural join MAP where TID='$type' and LON='' and LAT='' and ROWNUM<20";
	    $LON="120.265039";
	   $LAT="22.628032";
	  
	  }

	   $re_2 = oci_parse($conn,$sql_ac) or die('Insert error');
       oci_execute($re_2);
	    if($res->LON!=''&&$res->LAT!=''){$pan.="panLL(".$LAT.",".$LON.",".$p_time.");";}else{
		$pan.="panLL(22.628032,120.265039,".$p_time.");";
		}
	  
	 while($res_2=oci_fetch_object($re_2))
	 //echo $res->LON.$res->LAT.$res->content;
	 {
	 $aId_2=$res_2->AID;
	 
	 
	 $in.="<b>活動名稱:<a href=../ACTIVITY/activity_show_detail.php?aId=".$aId_2." target=_parent>".$res_2->ANAME."</b></a><br>活動時間:<br>".$res_2->ATIME."~".$res_2->END_DATE."<br>";

	 
	 
	 }
	  
	  
	  $map->addMarkerByCoords($LON,$LAT,'$res->ACONTENTs',$in);
	    $p_time=$p_time*2;
	    $in='';
	 }
	 }else{
	 			$map->setMarkerIcon('http://localhost/map/Icons/jume.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 $map->addMarkerIcon('http://localhost/map/Icons/jume.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10); 
		 $map->addMarkerByCoords(120.265039,22.628032,'>.^ 此類目前沒有活動喔!?');
	 	
	 	}
	 }
	 
	}
	 
	 
	 /**************搜尋******************/
	 
	 if(isset($_POST['se'])){
	 
	 if(isset($_POST['aname'])){
	 $aname=$_POST['name'];
	 
	  $ser_str[]="ANAME like '%".$aname."%'";
	 
	 }
	 /*
	 if(isset($_POST['aplace'])){
	 $aplace=$_POST['place'];
	 $ser_str[]="aPlace like '%".$aplace."%'";
	 }
	 */
	 if(isset($_POST['adate'])){
	 $start_date=$_POST['start_date'];
	 $END_DATE=$_POST['end_date'];
	 $ser_str[]="ATIME>='".$start_date."' and END_DATE<='".$END_DATE."'";
	 
	 }
	 if(isset($_POST['aadd'])){
	 $aadd=$_POST['add'];
	 $ser_str[]="ADDRESS like '%".$aadd."%'";
	 }
	 if($ser_str!='')
	 $ser_out=implode(" and ",$ser_str);
	 
	 if(isset($_POST['type'])){
	 $stype=$_POST['aType'];
	 foreach($stype as $t){
	 	
	 	$se_ty[]=$t;
	 	
	 	}
	 	 //$ser_str[]=implode(" OR ",$se_ty);
	 	  foreach($se_ty as $t){
	
	 	if($ser_out!=''){
	 	$ser_sql="select LON,LAT  from ACTIVITY natural join MAP where TID='$t' and $ser_out and END_DATE >='$now' group by LON,LAT ";
	}else{
		 $ser_sql="select LON,LAT from ACTIVITY natural join MAP where TID='$t' and END_DATE >='$now' group by LON,LAT ";
		}
		$re= oci_parse($conn,$ser_sql) or die('Insert error');
       oci_execute($re);
	
	  if(oci_fetch_all($re,$result)!=0){ 
	 	//$map->setMarkerIcon('http://140.117.71.186/map/Icons/shop.png','http://140.117.71.186/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 if($t==1){
	 	 	$map->addMarkerIcon('http://localhost/map/Icons/Shopping.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 	$cname="Shopping";
	 	 	}else if($t==2){
	 	 	$map->addMarkerIcon('http://localhost/map/Icons/Party.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 	$cname="Party";
	 	 	}else if($t==3){
	 	 	$map->addMarkerIcon('http://localhost/map/Icons/Food.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 	$cname="Food";
	 	 	}else if($t==4){
	 	 	$map->addMarkerIcon('http://localhost/map/Icons/Travel.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 	$cname="Travel";
	 	 	}else if($t==5){
	 	 	$map->addMarkerIcon('http://localhost/map/Icons/sport.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 	$cname="Sports";
	 	 	}else if($t==6){
	 	 	$map->addMarkerIcon('http://localhost/map/Icons/Educate.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 	$cname="Educate";
	 	 	}else{ $map->addMarkerIcon('http://localhost/map/Icons/shop.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);}
	 	 
	 oci_execute($re);
	 while($res=oci_fetch_object($re)){
	   $LON=$res->LON;
	   $LAT=$res->LAT;
	  $sql_ac="select * from ACTIVITY natural join MAP where TID='$t' and LON='$LON' and LAT='$LAT' and END_DATE >='$now'";
	  $re_2= oci_parse($conn,$sql_ac) or die('Insert error');
       oci_execute($re_2);

	  $pan.="panLL(".$LAT.",".$LON.",".$p_time.");";
	  
	 while($res_2=oci_fetch_object($re_2))
	 //echo $res->LON.$res->LAT.$res->content;
	 {
	 $aId_2=$res_2->AID;
	 
	 
	 $in.="<b>活動名稱:<a href=../ACTIVITY/activity_show_detail.php?aId=".$aId_2." target=_parent>".$res_2->ANAME."</b></a><br>活動時間:<br>".$res_2->ATIME."~".$res_2->END_DATE."<br>";

	 
	 
	 }
	  
	  $map->addMarkerByCoords($LON,$LAT,'$res->ACONTENT',$in);
	    $p_time=$p_time*2;
	    $in='';
	 }
	 }else{
	 			//	$map->setMarkerIcon('http://140.117.71.186/map/Icons/jume.png','http://140.117.71.186/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 $map->addMarkerIcon('http://localhost/map/Icons/jume.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10); 
		 $map->addMarkerByCoords(120.265039,22.628032,'目前沒有活動喔 >.^ ');
	 	
	 	}
	 
	 
	 	
	 	}
	
	}else{
		
		 	  for($t=1;$t<=6;$t++){
	 	
	 	if($ser_out!=''){
	 	 $ser_sql="select LON,LAT from ACTIVITY natural join MAP where TID='$t' and $ser_out and END_DATE >='$now' group by LON,LAT ";
	}else{
		$ser_sql="select LON,LAT from ACTIVITY natural join MAP where TID='$t' group by LON,LAT ";
		}
		  $re= oci_parse($conn,$ser_sql) or die('Insert error');
       oci_execute($re);

	  if(oci_fetch_all($re,$result)!=0){ 
	 	//$map->setMarkerIcon('http://140.117.71.186/map/Icons/shop.png','http://140.117.71.186/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 if($t==1){
	 	 	$map->addMarkerIcon('http://localhost/map/Icons/Shopping.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 	
	 	 	}else if($t==2){
	 	 	$map->addMarkerIcon('http://localhost/map/Icons/Party.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 	
	 	 	}else if($t==3){
	 	 	$map->addMarkerIcon('http://localhost/map/Icons/Food.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 	
	 	 	}else if($t==4){
	 	 	$map->addMarkerIcon('http://localhost/map/Icons/Travel.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 	
	 	 	}else if($t==5){
	 	 	$map->addMarkerIcon('http://localhost/map/Icons/sport.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 	
	 	 	}else if($t==6){
	 	 	$map->addMarkerIcon('http://localhost/map/Icons/Educate.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 	
	 	 	}else{ $map->addMarkerIcon('http://localhost/map/Icons/shop.png','http://localhost/map/Icons/mm_20_shadow.png',0,0,10,10);}
	 	 
	 	oci_execute($re);
	 while($res=oci_fetch_object($re)){
	   $LON=$res->LON;
	   $LAT=$res->LAT;
	  $sql_ac="select * from ACTIVITY natural join MAP where TID='$t' and LON='$LON' and LAT='$LAT' and END_DATE >='$now'";

	   $re_2= oci_parse($conn,$sql_ac) or die('Insert error');
       oci_execute($re_2);
	  $pan.="panLL(".$LAT.",".$LON.",".$p_time.");";
	  
	 while($res_2=oci_fetch_object($re_2))
	 //echo $res->LON.$res->LAT.$res->content;
	 {
	 $aId_2=$res_2->AID;
	 
	 
	 $in.="<b>活動名稱:<a href=../ACTIVITY/activity_show_detail.php?aId=".$aId_2." target=_parent>".$res_2->ANAME."</b></a><br>活動時間:<br>".$res_2->ATIME."~".$res_2->END_DATE."<br>";

	 
	 
	 }
	  
	  $map->addMarkerByCoords($LON,$LAT,'$res->ACONTENT',$in);
	    $p_time=$p_time*2;
	    $in='';
	 }
	 }else{
	 				$map->setMarkerIcon('http://localhost/map/Icons/jume.png','http://140.117.71.186/map/Icons/mm_20_shadow.png',0,0,10,10);
	 	 $map->addMarkerIcon('http://localhost/map/Icons/jume.png','http://140.117.71.186/map/Icons/mm_20_shadow.png',0,0,10,10); 
		 $map->addMarkerByCoords(120.265039,22.628032,'>.^ 此類目前沒有活動喔!?');
	 	
	 	}
	 
	 
	 	
	 	}
		
		
		
		}
	 
	 
	
	 
	}
	 
	?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

   
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>
<?php $map->printHeaderJS(); ?>
    <?php $map->printMapJS(); ?>
	<script type="text/javascript">
	function panLL(x,y,time){
	window.setTimeout(function(){
	map.panTo(new GLatLng(x,y));},time);
	
	
	}
	var i=true;
	
	<? 
	
	echo $pan; 
	//echo $pan;
	
	?>
	/*window.setTimeout(function(){
                   ;},3000);
		*/			
					
					
					/*
					var overviewControl = new GOverviewMapControl(new GSize(100,100)); 

map.addControl(overviewControl);
*/ 
					</script>
				 

					<script >
					
					</script>
</head>

 <body onLoad="onLoad()">
	
   
    <?php 
	$map->printMap(); 
	
	
	// echo "中文";
    
     //$map->printSidebar(); 
	 ?>
	 
   <div id="map" style="width:860; height:310;"> </div> 
	
</body>
</html>
