$(function(){
	selectAll();
});

function selectAll(){
	//他ページ用
	$.postJSON("../PHP/json.php/Firstteam/selectAll", function(json) {
		var html = "";
		for(var i = 0; i < json.length; i++) {
			html += "<li><a href='../player/" + json[i].player_id + ".html'>" + json[i].player_namekana + "</a></li>";
		}
		$("#menuplayer").html(html);
	});

	$.postJSON("../PHP/json.php/Firstteam/selectStaff", function(json) {
		var html = "";
		for(var i = 0; i < json.length; i++) {
			html += "<li><a href='../staff/" + json[i].staff_id + ".html'>" + json[i].staff_namekana + "</a></li>";
		}
		$("#menustaff").html(html);
	});

/* 	//カテゴリー
	$.postJSON("../PHP/json.php/Index/selectCategory", function(json) {
		var html = "";
		for(var i = 0; i < json.length; i++) {
			html += "<li><a href='./news/wenger.html'>" + json[i].category_name + "</a></li>";
		}
		$("#categoryIndex").html(html);
	});
*/

	$.postJSON("../PHP/json.php/Firstteam/selectAll", function(json) {
		var html = "<option>- Select Player -</option>";
		for(var i = 0; i < json.length; i++) {
			html += "<option value='../player/" + json[i].player_id + ".html'>" + json[i].player_namekana + "</option>";
		}
		$("#plydropdown").html(html);
	});

	$.postJSON("../PHP/json.php/Firstteam/selectStaffAll", function(json) {
		var html = "<option>- Select Staff -</option>";
		for(var i = 0; i < json.length; i++) {
			html += "<option value='../staff/" + json[i].staff_id + ".html'>" + json[i].staff_namekana + "</option>";
		}
		$("#stfdropdown").html(html);
	});

	//リーグテーブルリンク
	//現在年取得
	var date 	= new Date();
	var nowY 	= date.getFullYear();
	var yyyytmp = date.getFullYear();
	var myYear4;
	var mm 	 	= date.getMonth() + 1;
	if(yyyytmp*100 + 8 > (yyyytmp*100 + mm)){
		myYear4 = date.getFullYear() - 1;
	}else{
		myYear4 = date.getFullYear();
	}	var html = "";
	html += "<a href='../match/rank_premier.html?year=" + myYear4 + "-" + (parseInt(myYear4)+1) + "'>プレミアリーグ順位表</a>";
	$("#leaguetablelink").html(html);
	$("#leaguetablelink2").html(html);
	$("#leaguetablelink3").html(html);
}