var Season = "2009";

function DateJump(kind) {
	var op1 = document.date.month.selectedIndex;
	var op2 = document.date.day.selectedIndex;
	var opValue1 = document.date.month.options[op1].value;
	var opValue2 = document.date.day.options[op2].value;
	if(kind == 1){
		head = "gm";
	}else if(kind == 11){
		head = "fgm";
	}else if(kind == 5){
		head = "opgm";
	}
	if(( op1 != 0 ) && ( op2 != 0 )){
		if(false != DATE_CHECK(opValue1,opValue2)){
			//location.href = "/eng/2008/games/fgm20080927.html";
			location.href = "/" + location.pathname.substring(1,9) + "/games/" + head + location.pathname.substring(5,9) + opValue1 + opValue2 + ".html";
		}
	}
}

function DATE_CHECK(Month,Day){
	//get day
	var Date = Month + Day;
	var Year = location.pathname.substring(1,5)
	//day judge
	//not leap year
	if(Year%400!=0 && Year%100==0 || Year%4!=0){
		if(Date=="0229" || Date=="0230" || Date=="0231" || Date=="0431" || Date=="0631" || Date=="0931" || Date=="1131"){
			return false;
		}
	//leap year
	}else{
		if(Date=="0230" || Date=="0231" || Date=="0431" || Date=="0631" || Date=="0931" || Date=="1131"){
			return false;
		}
	}
}

function StatsJump() {
	var op1 = document.stats.category.selectedIndex;
	var opValue1 = document.stats.category.options[op1].value;
	var opValue2;
	var i;
	if (document.stats.league.length) {
		for (i = 0; i < document.stats.league.length; i++) {
			if (document.stats.league[i].checked) {
				opValue2 = document.stats.league[i].value;
            		}
        	}
	}
	if( op1 != 0 ){
		location.href = opValue1 + "_" + opValue2 + ".html";
	}
}

function KojinJump(kind) {
	var op1 = document.kojin.team.selectedIndex;
	var opValue1 = document.kojin.team.options[op1].value;
	var opValue2;
	var i;
	if (document.kojin.borp.length) {
		for (i = 0; i < document.kojin.borp.length; i++) {
			if (document.kojin.borp[i].checked) {
				opValue2 = document.kojin.borp[i].value;
            		}
        	}
	}
	if( op1 != 0 ){
		location.href = "id" + opValue2 + kind + "_"+ opValue1 + ".html";
	}
}

function LeadersJump(menu) {
	var op1 = document.leaders.category.selectedIndex;
	var opValue1 = document.leaders.category.options[op1].value;
	var opValue2;
	var i;
	if(menu == 1){
		head = "lb_";
	}else if(menu == 2){
		head = "lp_";
	}else if(menu == 3){
		head = "lf_";
	}
	if (document.leaders.league.length) {
		for (i = 0; i < document.leaders.league.length; i++) {
			if (document.leaders.league[i].checked) {
				opValue2 = document.leaders.league[i].value;
            		}
        	}
	}
	if( op1 != 0 ){
		location.href = head + opValue1 + "_" + opValue2 + ".html";
	}
}

function LStatsJump(kind) {
	var op1 = document.stats.category.selectedIndex;
	var opValue1 = document.stats.category.options[op1].value;
	var opValue2 = document.stats.league.value;
	if( op1 != 0 ){
		location.href = "../" + Season + "/stats/" + opValue1 + "_" + opValue2 + ".html";
	}
}

function LKojinJump(kind) {
	var op1 = document.kojin.team.selectedIndex;
	var opValue1 = document.kojin.team.options[op1].value;
	var opValue2;
	var i;
	if (document.kojin.borp.length) {
		for (i = 0; i < document.kojin.borp.length; i++) {
			if (document.kojin.borp[i].checked) {
				opValue2 = document.kojin.borp[i].value;
            		}
        	}
	}
	if( op1 != 0 ){
		//location.href = "../../" + Season + "/stats/" + "id" + opValue2 + kind + "_"+ opValue1 + ".html";
		location.href = "../stats/" + "id" + opValue2 + kind + "_"+ opValue1 + ".html";
	}
}

function TeamsJump() {
	var op1 = document.index.team.selectedIndex;
	var opValue1 = document.index.team.options[op1].value;
	if( op1 != 0 ){
		location.href = "teams_index" + "_" + opValue1 + ".html";
	}
}
function TeamsJump2() {
	var op1 = document.index.team.selectedIndex;
	var opValue1 = document.index.team.options[op1].value;
	if( op1 != 0 ){
		location.href = "index" + "_" + opValue1 + ".html";
	}
}
function TStatsJump() {
	var op1 = document.stats.category.selectedIndex;
	var opValue1 = document.stats.category.options[op1].value;
	var opValue2;
	var i;
	if (document.stats.kind.length) {
		for (i = 0; i < document.stats.kind.length; i++) {
			if (document.stats.kind[i].checked) {
				opValue2 = document.stats.kind[i].value;
            		}
        	}
	}
	if( op1 != 0 ){
		location.href = "../" + Season + "/stats/" + opValue1 + "_" + opValue2 + ".html";
	}
}

function TKojinJump() {
	var op1 = document.stats.kojin.selectedIndex;
	var opValue1 = document.stats.kojin.options[op1].value;
	var opValue2;
	var opValue3 = document.stats.team.value;
	var i;
	if (document.stats.kind.length) {
		for (i = 0; i < document.stats.kind.length; i++) {
			if (document.stats.kind[i].checked) {
				opValue2 = document.stats.kind[i].value;
            		}
        	}
	}
	if(( opValue2 == "c" ) || ( opValue2 == "p" )){
		opValue2 = "1";
	}else if(( opValue2 == "e" ) || ( opValue2 == "w" )){
		opValue2 = "2";
	}
	if( op1 != 0 ){
		location.href = "../" + Season + "/stats/" +  opValue1 + opValue2 + "_" + opValue3 + ".html";
	}
}

function BHistoryJump() {
	var op1 = document.history.bat.selectedIndex;
	var opValue1 = document.history.bat.options[op1].value;
	var opValue2;
	var i;
	if (document.history.menu.length) {
		for (i = 0; i < document.history.menu.length; i++) {
			if (document.history.menu[i].checked) {
				opValue2 = document.history.menu[i].value;
            		}
        	}
	}
	if( op1 != 0 ){
		location.href = opValue2 + opValue1 + ".html";
	}
}

function PHistoryJump() {
	var op1 = document.history.pit.selectedIndex;
	var opValue1 = document.history.pit.options[op1].value;
	var opValue2;
	var i;
	if (document.history.menu.length) {
		for (i = 0; i < document.history.menu.length; i++) {
			if (document.history.menu[i].checked) {
				opValue2 = document.history.menu[i].value;
            		}
        	}
	}
	if( op1 != 0 ){
		location.href = opValue2 + opValue1 + ".html";
	}
}

function PlayerJump(menu) {
	var op1 = document.player.team.selectedIndex;
	var opValue1 = document.player.team.options[op1].value;
	if( op1 != 0 ){
		if( menu == 1 ){
			location.href = "../teams/" + "rst_" + opValue1 + ".html";
		}else if( menu == 2 ){
			location.href = "rst_" + opValue1 + ".html";
		}
	}
}

function RemmeiJump() {
	var op1 = document.yearly1.year.selectedIndex;
	var opValue1 = document.yearly1.year.options[op1].value;
	if( op1 != 0 ){
		location.href = "yakyuremmei_" + opValue1 + ".html";
	}
}

function YearlyJump() {
	var op1 = document.yearly2.season.length;
	var opValue1 = document.yearly2.season.value;
	var opValue2;
	var i;
	if (document.yearly2.league.length) {
		for (i = 0; i < document.yearly2.league.length; i++) {
			if (document.yearly2.league[i].checked) {
				if (document.yearly2.league[i].value == "c") {
					opValue2 = "centralleague";
				}else{
					opValue2 = "pacificleague";
				}
            		}
        	}
	}
	if( opValue1 >= 1950 && opValue1 <= 2007 ){
		location.href = opValue2 + "_" + opValue1 + ".html";
	}else{
		YearlyReset();
	}
}

function YearlyReset() {
	document.yearly2.season.value = "";
	document.yearly2.season.select();
}

function AllstarJump() {
	var opValue1 = document.allstar.season.value;
	var opValue2;
	opValue2 = "linescore";
	if( opValue1 >= 1951 && opValue1 <= 2008 ){
		location.href = opValue2 + opValue1 + ".html";
	}else{
		AllstarReset();
	}
}

function AllstarReset() {
	document.allstar.season.value = "";
	document.allstar.season.select();
}

function NipponseriesJump() {
	var opValue1 = document.nipponseries.season.value;
	var opValue2;
	opValue2 = "linescore";
	if( opValue1 >= 1950 && opValue1 <= 2008 ){
		location.href = opValue2 + opValue1 + ".html";
	}else{
		NipponseriesReset();
	}
}

function NipponseriesReset() {
	document.nipponseries.season.value = "";
	document.nipponseries.season.select();
}

function FreshJump() {
	var opValue1 = document.fresh.season.value;
	var opValue2;
	opValue2 = "boxscore";
	if( opValue1 >= 1999 && opValue1 <= 2009 ){
		location.href = opValue2 + opValue1 + ".html";
	}else{
		FreshReset();
	}
}

function FreshReset() {
	document.fresh.season.value = "";
	document.fresh.season.select();
}

function FarmNipponJump() {
	var opValue1 = document.farmnippon.season.value;
	var opValue2;
	opValue2 = "boxscore";
	if( opValue1 >= 1999 && opValue1 <= 2009 ){
		location.href = opValue2 + opValue1 + ".html";
	}else{
		FarmNipponReset();
	}
}

function FarmNipponReset() {
	document.farmnippon.season.value = "";
	document.farmnippon.season.select();
}
function History_bat_jump() {
	var op1 = document.history.bat.selectedIndex;
	var opValue1 = document.history.bat.options[op1].value;
	location.href = opValue1 + ".html";
}
function History_pit_jump() {
	var op1 = document.history.pit.selectedIndex;
	var opValue1 = document.history.pit.options[op1].value;
	location.href = opValue1 + ".html";
}


function CalendarJump(kind) {
	var op1 = document.month.month.selectedIndex;
	var opValue1 = document.month.month.options[op1].value;
	if(kind == 1){
		head = "index_";
	}else if(kind == 11){
		head = "index_farm_";
	}
	if(( op1 != 0 )){
		location.href = "/" + location.pathname.substring(1,9) + "/calendar/" + head + opValue1 + ".html";
	}
}
