//////////// TIDE GET /////////////////////////////////////////////////////////////


function tideStart(){
	
	var f = document.main;
	f.ha.value = "9999";
	f.target = "_self";
	f.action = site + "main";	
	f.submit();
	
}

////////////////////////////////////////////////////////////////////////////////////
function mainLoad(){
	
	document.getElementById("tideIcon").style.backgroundImage = 'url(common/gif/menu_tide_select.gif)';
}


//////////////////////////////////////////////////////////////////////////////////// TIDE SHOW
var id    		= null;
var tmpNm 		= null;
var html  		= null;
var whtml  		= null;
var tideNm 		= null;
var moonAge		= null;
var year    	= null;
var month   	= null;
var day     	= null;
var zo			= null;
var maxRatio	= null;
var minRatio	= null;
var prefecture  = null;
var city		= null;

////////////////////////////////////////////////////////////////////// Map操作
function showTide(inId, inNm, inZo, inMaxRatio, inMinRatio, inPrefecture, inCity){
	
	$("#bottomContent").show();
	
	id    		= null;
	tmpNm 		= null;
	html  		= null;
	tideNm 		= null;
	moonAge 	= null;
	year    	= null;
	month   	= null;
	day     	= null;
	zo			= null;
	maxRatio	= null;
	minRatio	= null;
	prefecture  = null;
	city		= null;	
	
	id 			= inId;
	tmpNm 		= inNm;
	zo			= Number(inZo) * 100;
	maxRatio	= Number(inMaxRatio) + 5;
	minRatio	= Number(inMinRatio) - 5;
	prefecture  = inPrefecture;
	city		= inCity;	
	
	//alert(zo);
	
	dd = new Date();
	
	year    = dd.getFullYear();
	month   = (dd.getMonth()+1);
	day     = dd.getDate();
	
	

	
	//drawGraph();

	TideDwr.getTideInfo(id, year , to00(month), to00(day), callbackTideInfo);
}

function callbackTideInfo(data){
	
	tideNm 	= data.tideName;
	moonAge = data.moonAge;
	
	document.getElementById("tide").innerHTML = "";
	
	html = "";
	html = html + "<div class=\'tmar20 fleft mar30 width200\'>";
	html = html + "<img id=\"imgCalendar\" src=\'common/gif/tide_detail_frame_calendar.gif\'/><br />";
	html = html + "<div id='calendar'></div><br />";
	html = html + "</div>";
	html = html + "<div id=\"tideInfo\" class=\'width200 mar20 fleft tmar20\'>";
	newTideInfo(data);
	html = html + "</div>";
	html = html + "<div id=\"tideName\" class=\"width200 mar20 fleft tmar50\">";
	html = html + 	buildTideNmIcon(data.tideName);
	html = html + "</div>";
	
	TideDwr.getTideDetail(id, year , to00(month), to00(day), callbackTideDetail);
	
	//MakeGraphDwr.makeGraph(id, tmpNm, year , to00(month), to00(day),callbackShowTide);
	
}

function callbackTideDetail(data){
	var htm = "";
	htm = htm + "<div id=\"tideTitle\"><span name=\"tideDetail\" id=\"tideDetailTitle\">" + tmpNm + "</span></div><br/><br />";
	htm = htm + "<div id=\"tideDetailRight\">";
	htm = htm + "<img id=\"imgGraph\" src=\'common/gif/tide_detail_frame_graph.gif\'/><br /><br />";
	htm = htm   + "<div id=\"legend\"></div>";
	htm = htm   + "<div id=\"placeholder\"></div>";
	htm = htm   + "<div id=\"tideCopyright\">";
	htm = htm   + "<span class=\"tideCopyrightName\">水面高:海上保安庁海洋情報部「潮汐推算」&#60;http://www1.kaiho.mlit.go.jp/KANKYO/TIDE/tide_pred/index.htm&#62;</span><br />";
	htm = htm   + "<span class=\"tideCopyrightName\">平均水面(Zo):海上保安庁、平成２０年「潮汐表」、2007年、378-398頁</span><br />";
	htm = htm   + "</div>";
	htm = htm + "</div>";
	htm = htm + "<br class=\"clear\"/>";
	
	
//	html = html + "<div id=\"pr2\">";
//	html = html + "<script type=\"text/javascript\"><!--";
//	html = html + "google_ad_client = \"pub-8578814845543622\";";
//	html = html + "google_ad_slot = \"7414617470\";";
//	html = html + "google_ad_width = 120;";
//	html = html + "google_ad_height = 600;";
//	html = html + "//-->";
//	html = html + "</script>";
//	html = html + "<script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></script>";
//	html = html + "</div>";
	
	html = htm + html;

	//document.getElementById("tide").innerHTML = html;
	document.getElementById("tide").innerHTML = html;
	writeCal(year,month,day);
	
	drawTideGraph(data);
	
	WeatherDwr.getWeatherInfo(prefecture, city, callbackWeather );
	
	
}

function callbackWeather(data){
	whtml = "";
	whtml = whtml + "<div id=\"weatherContent\">";
	whtml = whtml + "<img src=\'common/gif/tide_detail_frame_weather.gif\'/><br />"
	whtml = whtml + "<div id=\"tideWeather\">";
	if ( data == null ){
		whtml = whtml + "<span class=\'weatherMessage\'>天気情報はありません。</span>";
	} else {
		
		var day = new Date();
		for (var i=0; i<data.length; i++){
			whtml = whtml + "<div class=\'weatherDetail\'>";
			
			if (i==0){
				whtml = whtml + "<span class=\'wdDay\'>今日 - " + (day.getMonth()+1) + "月" + day.getDate() + "日(" + getWeekDay(day.getDay()) + ")</span><br />";
			} else if (i==1){
				computeDate(day , 1);
				whtml = whtml + "<span class=\'wdDay\'>明日 - " + (day.getMonth()+1) + "月" + day.getDate() + "日(" + getWeekDay(day.getDay()) + ")</span><br />";
			} else if (i==2){
				computeDate(day , 1);
				whtml = whtml + "<span class=\'wdDay\'>明後日 - " + (day.getMonth()+1) + "月" + day.getDate() + "日(" + getWeekDay(day.getDay()) + ")</span><br />";
			}
			
			whtml = whtml + "<br />";
			whtml = whtml + "<img src=\'" + data[i].iconUrl + "\'/><br /><br />";
			whtml = whtml + "<span class=\'wdWeather\'>" + data[i].weather + "</span><br /><br />";
			whtml = whtml + "<span class=\'wdTempTitle\'>最高気温&nbsp;：&nbsp;</span>";
			whtml = whtml + "<span class=\'wdTemp\'>" + data[i].maxTemp + "℃</span><br />";
			whtml = whtml + "<span class=\'wdTempTitle\'>最低気温&nbsp;：&nbsp;</span>";
			whtml = whtml + "<span class=\'wdTemp\'>" + data[i].minTemp + "℃</span><br /><br />";
			whtml = whtml + "</div>";
			
			if (i!=2){
				whtml = whtml + "<img class=\'weatherV\' src=\'common/gif/tide_detail_frame_weather_v.gif\'/>";
			}
		}
	}	
	whtml = whtml + "</div></div>";
	
	
	
	if ( data == null ){
		callbackWarn(null);
	} else {
		WeatherDwr.getWeatherWarn(data[0].areaId, data[0].id, callbackWarn);
	}
}

function callbackWarn(data){
	whtml = whtml + "<div id=\"tideWeatherWarnContent\">";
	whtml = whtml + "<img src=\'common/gif/tide_detail_frame_weather_warn.gif\'/><br />"
	whtml = whtml + "<div id=\"tideWeatherWarn\">";
	
	if ( data == null ){
		whtml = whtml + "<span class=\'weatherMessage\'>警報・注意報情報はありません。</span>";
	} else {
		whtml = whtml + "<table class\'weatherWarnTable\'>";
		
		for (var i=0; i<data.length; i++){
			whtml = whtml + "<tr>";
			whtml = whtml + "<td>";
			whtml = whtml + "<a target=\"_blank\" href=\'http://weather.livedoor.com" + data[i].linkUrl + "'\>" + data[i].localNm + "</a>";
			whtml = whtml + "</td>";
			whtml = whtml + "<td>";
			if (data[i].warn == "1"){
				whtml = whtml + "<img src=\'common/gif/weather_keihou.gif\'>";
			} else if (data[i].caution == "1"){
				whtml = whtml + "<img src=\'common/gif/weather_cyuihou.gif\'>";
			} else {
				whtml = whtml + "<span class=\'weatherMessageTd\'>無</span>";
			}
			whtml = whtml + "</td>";
			whtml = whtml + "</tr>";
		}
		whtml = whtml + "</table>";
	}
	
	whtml = whtml + "</div></div>";
	
	// PR2
//	whtml = whtml + "<div id=\"pr2\">";
//	whtml = whtml + "&nbsp;<script type=\"text/javascript\" defer=\"defer\">";
//	whtml = whtml + "google_ad_client = \"pub-8578814845543622\";";
//	whtml = whtml + "google_ad_slot = \"7414617470\";";
//	whtml = whtml + "google_ad_width = 120;";
//	whtml = whtml + "google_ad_height = 600;";
//	whtml = whtml + "</script>";
//	whtml = whtml + "<script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\" defer=\"defer\"></script>";
//	whtml = whtml + "</div>";
	
	document.getElementById("weather").innerHTML = whtml;
	$(".hr").show();
	$("#pr2").show();
	
	var chtml = "<br />";
	chtml = chtml + "<img src=\'common/gif/tide_detail_frame_control.gif\'/><br />";
	chtml = chtml + "<br />";
	chtml = chtml + "<p class=\"tab\">『" + tmpNm + "』の潮汐（＋天気）情報を毎日好きな時間にメールで受け取る事が出来ます。無料です。</p>";
	chtml = chtml + "<br />";
	chtml = chtml + "<br />";
	chtml = chtml + "<form name=\"add\" method=\"post\" action=\"\">";
	chtml = chtml + "<input type=\"button\" id=\"tideMailAdd\" value=\"\" onclick=\"userTideAdd();\" />";
	chtml = chtml + "</form>";
	//chtml = chtml + "<a class=\"pagetop\" href=\"javascript:pagemap();\">▲地図に戻る</a><br />";
	chtml = chtml + "<div id=\"mail\"></div>";
	
	chtml = chtml + "<br /><br /><br />";
	
	
	chtml = chtml + "<div id=\"banner\">";
	chtml = chtml + "<img src=\'common/gif/tide_detail_frame_banner.gif\'/><br />";
	chtml = chtml + "<div id=\"banner\">";
	chtml = chtml + "<br />";
	chtml = chtml + "<p class=\"tab\">あなたが運営するサイトやブログに『" + tmpNm + "』の潮汐情報へのリンクを設置する事ができます。</p>";
	chtml = chtml + "<p class=\"tab\">次のコードをあなたのサイト（or ブログ）に貼り付けると、下のような画像を表示させることができます。</p>";
	chtml = chtml + "<p class=\"tab\">また、画像をクリックするとこのページにジャンプします。</p>";
	chtml = chtml + "<p class=\"tab\">※別画面でこのページにジャンプしたい場合は、aタグの中に  [ target=\"_blank\" ]を挿入します。</p>";
	chtml = chtml + "<br class=\"clear\"/>";
	chtml = chtml + "<p class=\"tab\">二種類用意しました。お好きな方をお使いください。</p>";
	chtml = chtml + "<br class=\"clear\"/>";
	
	chtml = chtml + "<div id=\"bannerDetail\">";
	chtml = chtml + "<br />";
	chtml = chtml + "<div id=\"bannerDetailImg\">";
	chtml = chtml + "<p class=\"bannerTitle\">＜表示される画像＞</p>";
	chtml = chtml + "<img id=\"bannerImg\" class=\"mar40\" src=\"tide/banner2/banner-" + id +".gif\">";
	chtml = chtml + "</div>";
	
	chtml = chtml + "<div id=\"bannerDetailCode\">";
	chtml = chtml + "<p class=\"bannerTitle\">＜貼り付けるHTMLコード＞</p>";
	chtml = chtml + "<TEXTAREA id=\"codeTag\" >";
	chtml = chtml + "<a href=\"http://www.seatrustaim.jp/seahacker/tide?action=2001&id=" + id +"\" title=\"シーハッカー " +  tmpNm + " 潮汐 潮位 潮見\"><img src=\"http://www.seatrustaim.jp/seahacker/tide/banner2/banner-" + id +".gif\" alt=\"" + tmpNm + "のバーナー\"></a>";
	chtml = chtml + "</TEXTAREA>";
	chtml = chtml + "</div>";

	chtml = chtml + "<br />";
	chtml = chtml + "<div id=\"bannerDetailImg\">";
	chtml = chtml + "<p class=\"bannerTitle\">＜表示される画像＞</p>";
	chtml = chtml + "<img id=\"bannerImg\" class=\"mar40\" src=\"tide/banner/banner-" + id +".jpg\">";
	chtml = chtml + "</div>";
	
	chtml = chtml + "<div id=\"bannerDetailCode\">";
	chtml = chtml + "<p class=\"bannerTitle\">＜貼り付けるHTMLコード＞</p>";
	chtml = chtml + "<TEXTAREA id=\"codeTag\" >";
	chtml = chtml + "<a href=\"http://www.seatrustaim.jp/seahacker/tide?action=2001&id=" + id +"\" title=\"シーハッカー " +  tmpNm + " 潮汐 潮位 潮見\"><img src=\"http://www.seatrustaim.jp/seahacker/tide/banner/banner-" + id +".jpg\" alt=\"" + tmpNm + "のバーナー\"></a>";
	chtml = chtml + "</TEXTAREA>";
	chtml = chtml + "</div>";
	
	chtml = chtml + "<br class=\"clear\"/>";
	chtml = chtml + "</div>";
	
	
	//chtml = chtml + "<a class=\"pagetop\" href=\"javascript:pagetop();\">▲ページの先頭に戻る</a>";
	chtml = chtml + "</div>";
	document.onerror = function() { 
		alert('画像を読み込めない！');
	};
	
	document.getElementById("control").innerHTML = chtml;
	
	if (tidekind == 1 ){
		var targetOffset = $('#tide').offset().top;
		$('html,body').animate({ scrollTop: targetOffset }, 1000);
	}
}



function newTideInfo(data){
	
	html = html + "<div>";
	html = html + 	"<img id=\'imgInfo\' src=\'common/gif/tide_detail_frame_info.gif\'/><br />";
	html = html + 	"<table id=\"tideInfoTable\">"; 
	buildTideInfo(data);
	html = html + 	"</table>";
	html = html + "</div>";
	
}

function buildTideInfo(data){
	
	html = html + "<br /><br />";
	if (data.highTime1 < data.lowTime1){
		if (data.highTime1 != null) {
			html = html + "<tr class=\"tideHigh\">";
			html = html + 	"<td class=\"width50\">満潮</td>";
			html = html + 	"<td class=\"width50\">" + data.highTime1 + "</td>";
			html = html + 	"<td class=\"width50\">" + data.highCm1 + "cm</td>";
			html = html + "</tr>";
		} else {
			html = html + "<tr>";
			html = html + 	"<td class=\"height150 width150\">潮汐情報がありません。</td>";
			html = html + "</tr>";
		}
		
		if (data.lowTime1 != null) {
			html = html + "<tr class=\"tideLow\">";
			html = html + "<td class=\"width50\">干潮</td>";
			html = html + "<td class=\"width50\">" + data.lowTime1 + "</td>";
			html = html + "<td class=\"width50\">" + data.lowCm1 + "cm</td>";
			html = html + "</tr>";
		}
		
		if (data.highTime2 != null) {
			html = html + "<tr class=\"tideHigh\">";
			html = html + "<td class=\"width50\">満潮</td>";
			html = html + "<td class=\"width50\">" + data.highTime2 + "</td>";
			html = html + "<td class=\"width50\">" + data.highCm2 + "cm</td>";
			html = html + "</tr>";
		}
		
		if (data.lowTime2 != null) {
			html = html + "<tr class=\"tideLow\">";
			html = html + "<td class=\"width50\">干潮</td>";
			html = html + "<td class=\"width50\">" + data.lowTime2 + "</td>";
			html = html + "<td class=\"width50\">" + data.lowCm2 + "cm</td>";
			html = html + "</tr>";
		}
		
		if (data.highTime3 != null) {
			html = html + "<tr class=\"tideHigh\">";
			html = html + "<td class=\"width50\">満潮</td>";
			html = html + "<td class=\"width50\">" + data.highTime3 + "</td>";
			html = html + "<td class=\"width50\">" + data.highCm3 + "cm</td>";
			html = html + "</tr>";
		}
		
		if (data.lowTime3 != null) {
			html = html + "<tr class=\"tideLow\">";
			html = html + "<td class=\"width50\">干潮</td>";
			html = html + "<td class=\"width50\">" + data.lowTime3 + "</td>";
			html = html + "<td class=\"width50\">" + data.lowCm3 + "cm</td>";
			html = html + "</tr>";
		}
		
	} else {
		if (data.lowTime1 != null) {
			html = html + "<tr class=\"tideLow\">";
			html = html + "<td class=\"width50\">干潮</td>";
			html = html + "<td class=\"width50\">" + data.lowTime1 + "</td>";
			html = html + "<td class=\"width50\">" + data.lowCm1 + "cm</td>";
			html = html + "</tr>";
		} else {
			html = html + "<tr>";
			html = html + "<td class=\"height160 width150\">潮汐情報がありません。</td>";
			html = html + "</tr>";			
		}
		
		if (data.highTime1 != null) {
			html = html + "<tr class=\"tideHigh\">";
			html = html + "<td class=\"width50\">満潮</td>";
			html = html + "<td class=\"width50\">" + data.highTime1 + "</td>";
			html = html + "<td class=\"width50\">" + data.highCm1 + "cm</td>";
			html = html + "</tr>";
		}
		
		if (data.lowTime2 != null) {
			html = html + "<tr class=\"tideLow\">";
			html = html + "<td class=\"width50\">干潮</td>";
			html = html + "<td class=\"width50\">" + data.lowTime2 + "</td>";
			html = html + "<td class=\"width50\">" + data.lowCm2 + "cm</td>";
			html = html + "</tr>";
		}
		
		if (data.highTime2 != null) {
			html = html + "<tr class=\"tideHigh\">";
			html = html + "<td class=\"width50\">満潮</td>";
			html = html + "<td class=\"width50\">" + data.highTime2 + "</td>";
			html = html + "<td class=\"width50\">" + data.highCm2 + "cm</td>";
			html = html + "</tr>";
		}
		
		if (data.lowTime3 != null) {
			html = html + "<tr class=\"tideLow\">";
			html = html + "<td class=\"width50\">干潮</td>";
			html = html + "<td class=\"width50\">" + data.lowTime3 + "</td>";
			html = html + "<td class=\"width50\">" + data.lowCm3 + "cm</td>";
			html = html + "</tr>";
		}
		
		if (data.highTime3 != null) {
			html = html + "<tr class=\"tideHigh\">";
			html = html + "<td class=\"width50\">満潮</td>";
			html = html + "<td class=\"width50\">" + data.highTime3 + "</td>";
			html = html + "<td class=\"width50\">" + data.highCm3 + "cm</td>";
			html = html + "</tr>";
		}
	}
			
}


//////////////////////////////////////////////////////////////////////カレンダー操作
function showTideFromCal(inYear, inMonth, inDay){
	
	html  	= null;
	tideNm 	= null;
	moonAge = null;
	year    = null;
	month   = null;
	day     = null;
	//zo		= null;	//初期化しない
	//maxRatio	= null;	//初期化しない
	//minRatio	= null;	//初期化しない
	
	year    = inYear;
	month   = inMonth;
	day     = inDay;
	TideDwr.getTideInfo(id, year , to00(month), to00(day), callbackTideInfo4Cal);
}

function callbackTideInfo4Cal(data){
	
	tideNm 	= data.tideName;
	moonAge = data.moonAge;
	
	updateTideInfo(data);
	TideDwr.getTideDetail(id, year , to00(month), to00(day), callbackTideDetail4Cal);
	
}

function updateTideInfo(data){
	
//	html = "";
//	html = html + "<img id=\"imgInfo\" src=\'common/gif/tide_detail_frame_info.gif\'/><br />";
//	html = html + "<div class=\"imgTideName\">";
//	html = html + buildTideNmIcon(data.tideName);
//	html = html + "</div>";
//	html = html + "<table id=\"tideInfoTable\">";
//	buildTideInfo(data);
//	html = html + "</table>";
	
	html = "";
	document.getElementById("tideInfo").innerHTML = "";
	newTideInfo(data);
	document.getElementById("tideInfo").innerHTML = html;
	
	html = "";
	document.getElementById("tideName").innerHTML = "";
	html = html + 	buildTideNmIcon(data.tideName);
	document.getElementById("tideName").innerHTML = html;
	
}


function callbackTideDetail4Cal(data){
	
	html = "";
	document.getElementById("tideDetailRight").innerHTML = "";
	
	html = html + "<img id=\"imgGraph\" src=\'common/gif/tide_detail_frame_graph.gif\'/><br /><br />";
	html = html   + "<div id=\"legend\"></div>";
	html = html   + "<div id=\"placeholder\"></div>";
	html = html   + "<div id=\"tideCopyright\">";
	html = html   + "<span class=\"tideCopyrightName\">水面高:海上保安庁海洋情報部「潮汐推算」&#60;http://www1.kaiho.mlit.go.jp/KANKYO/TIDE/tide_pred/index.htm&#62;</span><br />";
	html = html   + "<span class=\"tideCopyrightName\">平均水面(Zo):海上保安庁、平成２０年「潮汐表」、2007年、378-398頁</span><br />";
	html = html   + "</div>";
	document.getElementById("tideDetailRight").innerHTML = html;
	
	writeCal(year,month,day);
	
	drawTideGraph(data);
}

function buildTideNmIcon(data){
	
	if (data == "大潮"){
		return "<img src=\"common/gif/tide_big.gif\" />";
	} else if (data == "中潮"){
		return "<img src=\"common/gif/tide_mid.gif\" />";
	} else if (data == "小潮"){
		return "<img src=\"common/gif/tide_small.gif\" />";
	} else if (data == "若潮"){
		return "<img src=\"common/gif/tide_waka.gif\" />";
	} else if (data == "長潮"){
		return "<img src=\"common/gif/tide_naga.gif\" />";
	}
	return "";
}



//////////////////////////////////////////////////////////////メール登録
/**
 * 潮汐情報登録-START
 * @return
 */
function userTideAdd(){
	//alert("a");
	UserDwr.getUserNm(callbackUserTideAdd);
}

/**
 * 潮汐情報登録-1
 * @param data
 * @return
 */
function callbackUserTideAdd(data){
	
	if ( data == null ){
		html = "<div class=\"boxMsgDiv\"><br />" +
				"<ul>" +
				"<li>ログインしてからもう一度、潮汐情報を選択してください。<br />" +
				"&nbsp;→<a href=\"javascript:showLoginForm();\">ログイン</a></li>" + 
		        "<li>ユーザ登録をしていない方は、こちらからユーザ登録を行ってください。<br />" +
		        "&nbsp;→<a href=\"./createUser\">ユーザ登録</a></li>" +
		        "</ul>" +
		        "</div>";
		infoBlock("ログインしてください",
				  html,
				  "※ユーザ登録、登録後の使用などすべて無料です。",null, "このメッセージを閉じる");
	} else {
		showMailSetting();
	}
	
}

/**
 * メール設定画面表示
 * @return
 */
function showMailSetting(){
	UserDwr.checkMaxTide(callbackCheckMaxTide);
}

function callbackCheckMaxTide(data){
	
	if (data){
		$("#placeNm").html( $("#tideDetailTitle").html() );
		
		$.blockUI({ message:$('#mailSetting'), 
			css:{ 	backgroundColor:'#ffffff',
					color:'#565656',
					cursor:'default'}
		});
	} else {
		alertBlock( "潮汐登録数がオーバーします。", "潮汐登録数がオーバーする為、登録する事が出来ませんでした。<br />登録最大数が増えた後、登録して頂くようお願いします。", "", null);
	}

}

/**
 * 潮汐メール設定
 * @return
 */
function setUserTide(){
	
	UserDwr.setUserTide(id, $("input[@name=\'weatherFlag\']:checked").val() ,callbackSetUserTide );
	
	showWait('更新中...');
}

function callbackSetUserTide( data ) {
	
	if (data == -1){
		abortMsg();
	} else if ( data == -2 ) {
		alertBlock( "潮汐登録数がオーバーします。", "潮汐登録数がオーバーする為、登録する事が出来ませんでした。<br />登録最大数が増えた後、登録して頂くようお願いします。", "", null);
	} else if ( data == -3 ) {
		alertBlock( "すでに登録されています。", "", "", null);
	} else if ( data == 1 ) {
		reloadUserTideListNoUnblock();
		$.blockUI({ message:$('#sendTimeSetting'), 
			css:{ 	backgroundColor:'#ffffff',
					color:'#565656',
					cursor:'default'}
		});
	} else {
		showMsg( "登録完了。" );
		reloadUserTideListNoUnblock();
		
		
	}
}

/**
 * 送信時刻設定
 * @return
 */
function setSendTime(){
	UserDwr.setSendTime($("#sendtime").val(), callbackSetSendTime);
	showWait('更新中...');
}

function callbackSetSendTime(data){
	
	if (data == -1 ){
		abortMsg();
	} else if ( data != 0 ) {
		alertBlock( "入力値に間違えがあります。", "入力値に間違えがあった為登録できませんでした。<br />ユーザ情報編集画面より再度登録してください。", "", null);
	} else {
		showMsg( "登録完了。" );
	}
	
}



/**
 * 地図に戻る
 * @return
 */
function pagemap(){
	var targetOffset = $('#map').offset().top;
	$('html,body').animate({ scrollTop: targetOffset }, 1000);
};