


function getidname(kanyucodefield, field1, field2, type){
var kanyucode = $(kanyucodefield).value;
var url = 'https://jvamrs.jp/index.php?action_ajax_kanyucodetoidname=ture&kanyucode='+kanyucode+'&field1='+field1+'&field2='+field2+'&type='+type;
var http = new JKL.ParseXML( url );
http.async(showFiled);
var data = http.parse();
}

function showFiled(xml) {

	var field1 = xml.item.idfield;
	var field2 = xml.item.namefield;

	var return_id = xml.item.id;
	var return_name = xml.item.name;

	if(return_id == undefined){

		return_id = '';
	}


	if(return_name == undefined){

		return_name = '';
	}

	$(field1).value = return_id;
	$(field2).value = return_name;

}

function getJuusho(field, zip1, zip2){

var zipcode1 = $(zip1).value;

var zipcode2 = $(zip2).value;

var zipcode = zipcode1 + zipcode2

var url = 'https://jvamrs.jp/index.php?action_ajax_zipcode=true&zipcode=' + zipcode + '&field=' + field;

var http = new JKL.ParseXML( url );
http.async(showFiled2);
var data = http.parse();
}

function showFiled2(xml) {

	var value = xml.item.value;

	if(value == undefined){
		value = '';
	}

	$(xml.item.field).value = value;

}

function getJuusho2(site_url, no){

	var yuubinbangou1 = document.getElementById('yuubinbangou1' + no).value;
	var yuubinbangou2 = document.getElementById('yuubinbangou2' + no).value;

	var zipcode = yuubinbangou1 + yuubinbangou2

	var url = site_url + 'index.php?action_ajax_zipcode=true&zipcode=' + zipcode + '&field=juusho1_si' + no;

	var http = new JKL.ParseXML( url );
	http.async(showFiled2);
	var data = http.parse();
}

function getSekininshaJuusho(site_url, cnt, id){

	if(window.confirm('姓が入力されている行に、責任者と同じ郵便番号・住所が入力されます。\nよろしいですか？')){
		for(i=1; i<=cnt; i++) {
			var sizen = document.getElementById('sizen' + i).value;
			if(sizen != ""){
				for(j=1; j<=5; j++) {
					var url = site_url + 'index.php?action_ajax_sekininshazip=true&no=' + i + '&no2=' + j + '&id=' + id;
					var http = new JKL.ParseXML( url );
					http.async(showFiled2);
					var data = http.parse();
				}
			}
		}
	}
}

function search_taikai_meishou(){
	var taikaiid = $("jouitaikaiid").value;
	var url = 'https://jvamrs.jp/index.php?action_ajax_taikai_meishou=ture&taikaiid='+taikaiid;
	var http = new JKL.ParseXML( url );
	http.async(showFiled3);
	var data = http.parse();
}

function showFiled3(xml) {

	var meishou = xml.item.value;

	if(meishou == undefined){
		$("taikaimeishou").style.color = "#FF0000";
		meishou = 'そのような大会は存在しません。';
	} else {
		$("taikaimeishou").style.color = "#000000";
	}


	$("taikaimeishou").innerHTML = meishou;

}


function search_team_name_for_taikai(taikaiid){
	var teamid = $("suisen_teamid").value;
	var url = 'https://jvamrs.jp/index.php?action_ajax_taikai_team_name=ture&teamid='+teamid+'&taikaiid='+taikaiid;
	var http = new JKL.ParseXML( url );
	http.async(showFiled4);
	var data = http.parse();
}


function search_team_name(){
	var teamid = $("suisen_teamid").value;
	var url = 'https://jvamrs.jp/index.php?action_ajax_taikai_team_name=ture&teamid='+teamid;
	var http = new JKL.ParseXML( url );
	http.async(showFiled4);
	var data = http.parse();
}

function showFiled4(xml) {

	var team_name = xml.item.value;

	if(team_name == undefined){
		$("team_name").style.color = "#FF0000";
		team_name = 'そのようなチームは存在しません。';
	} else {
		$("team_name").style.color = "#000000";
	}


	$("team_name").innerHTML = team_name;

}

function getNameFromMemberID(field, memberid, password){

var memberid = $(memberid).value;
var password = $(password).value;

var url = 'https://jvamrs.jp/index.php?action_ajax_memberidtoname=true&password=' + password + '&memberid=' + memberid + '&field=' + field;

var http = new JKL.ParseXML( url );
http.async(showFiled5);
var data = http.parse();
}

function showFiled5(xml) {

	var value = xml.item.value;

	if(value == undefined){
		value = '';
	}

	$(xml.item.field).value = value;

}
