						   
var newsoption1 = {
  firstname: "mynews",
  secondname: "showhere",
  thirdname:"news_display",
  fourthname:"news_button",
   playingtitle:"現在播放:",
      nexttitle:"下則活動：",
  prevtitle:"上則活動：" 
  //effectspeed:"1000"
  


}

var newsoption2 = {
  firstname: "mynews1",
  secondname: "showhere1",
  thirdname:"news_display1",
  fourthname:"news_button1",
  playingtitle:"現在播放:",
     nexttitle:"下則活動：",
  prevtitle:"上則活動："
//  effectspeed:"1000"

}

var newsoption3 = {
  firstname: "mynews2",
  secondname: "showhere2",
  thirdname:"news_display2",
  fourthname:"news_button2",
  playingtitle:"現在播放:",
   nexttitle:"下則揪團：",
  prevtitle:"上則揪團："
  
 // effectspeed:"1000"

}
var newsoption4 = {
  firstname: "mynews3",
  secondname: "showhere3",
  thirdname:"news_display3",
  fourthname:"news_button3",
   playingtitle:"現在播放:",
   nexttitle:"下則揪團：",
  prevtitle:"上則揪團："
}

var myoffset=$('#news_button').offset();
var myoffset1=$('#news_button1').offset();
var myoffset2=$('#news_button2').offset();
var myoffset3=$('#news_button3').offset();


var mytop=myoffset.top-1;
var mytop1=myoffset1.top-1;
var mytop2=myoffset2.top-1;
var mytop3=myoffset3.top-1;
$(document).ready(function(){
						   



				
				
		
						   

$.init_news(newsoption1);//最近期活動



$.init_news(newsoption2);//熱門活動



$.init_news(newsoption3);//最近期揪團



$.init_news(newsoption4);//熱門揪團



$('#news_button').css({top:mytop});
$('#news_button1').css({top:mytop1});
$('#news_button2').css({top:mytop2});
$('#news_button3').css({top:mytop3});



});

function formatItem(row) {
		return row[0] + " (<strong>id: " + row[1] + "</strong>)";
	}
	function formatResult(row) {
		return row[0].replace(/(<.+?>)/gi, '');
	}
	$("#name").autocomplete(
"../auto/name.php",{
		formatResult: formatResult}
);

	$("#place").autocomplete("../auto/place.php",
{
		formatResult: formatResult}
);
	$("#addr").autocomplete("../auto/add.php",
{
		formatResult: formatResult}
);
//MAP
$("#mapbutton").click(function() { 
var title = $("#mapbutton img").attr("src");


if(title=='../member/images/mapclose.png'){
	
			 $("#mapbutton img").attr({ 
          src: "../member/images/mapon.png"
          
        });
//    $("#cmap").text($("img").attr("src"));
	//$('img[src="../member/images/mapclose.png"]').attr({src:""});
	//<img src='../member/images/mapclose.png' alt='' border=0 name="close"/>
	//$('img[name="close"]').attr("name","opne");
}else {

	 $("#mapbutton img").attr({ 
          src: "../member/images/mapclose.png"
          
        });	
	//$('img[name="open"]').attr("name","close");
}
if ($.browser.mozilla ) {
   $("#map_index").slideToggle("fast");
}else {
$("#map_index").toggle("fold", { size: 30, horizFirst: true },  
    800);
}


	

});

$("#search #start_date").datepicker({ 
   beforeShow: customRange,
    dateFormat:"yy-mm-dd",
    minDate:"0",
	showOn: "both", 
    buttonImage: "../images/index_date.png", 
    buttonImageOnly: true 
});

$("#search #end_date").datepicker({ 
beforeShow: customRange,
    dateFormat:"yy-mm-dd",
  	 minDate:"0",
    showOn: "both", 
    buttonImage: "../images/index_date.png", 
    buttonImageOnly: true 
});
function customRange(input) { 
var tm=$("#start_date").datepicker("getDate");
var tm_2=$("#end_date").datepicker("getDate");
if(input.id == "end_date" && tm != null){
return {minDate: $("#start_date").datepicker("getDate") }
}

  if(input.id == "start_date" && tm_2 != null){
return { maxDate: $("#end_date").datepicker("getDate")  }
} 
	/*,maxDate: (input.id == "start_date" ? $("#end_date").datepicker("getDate") : null)}; */
} 






