function setCountryDome(dc){	
	var dest = dc;
	var cnt =0;
	var p_countrySet;
	for(i=0;i<document.sForm.elements.length;i++){
		if(document.sForm.elements[i].type == 'select-one' && document.sForm.elements[i].name == 'p_country'){
				var p_countrySet = document.sForm.elements[i];
		}
	}
	p_countrySet.options.length = 1;
	if(dest != ""){
		for( i=0; i < countryList.length; i++){
			if (countryList[i].dest == dest){
				cnt = cnt +1;
				p_countrySet.options[cnt] = new Option(countryList[i].name,countryList[i].name);
			}
		}
		if(dest == 13){
			dest = 14;
			for( i=0; i < countryList.length; i++){
				if (countryList[i].dest == dest){
					cnt = cnt +1;
					p_countrySet.options[cnt] = new Option(countryList[i].name,countryList[i].name);
				}
			}
		}
		if(dest == 14){
			dest = 15;
			for( i=0; i < countryList.length; i++){
				if (countryList[i].dest == dest){
					cnt = cnt +1;
					p_countrySet.options[cnt] = new Option(countryList[i].name,countryList[i].name);
				}
			}
		}
   	}
	   	
	p_countrySet.options.length = cnt+1;
	p_countrySet.selectedIndex = 0;

}


function setCountry(dc){	
	var dest = dc;
	var cnt =0;
	var p_countrySet;
	for(i=0;i<document.sForm.elements.length;i++){
		if(document.sForm.elements[i].type == 'select-one' && document.sForm.elements[i].name == 'p_country'){
				var p_countrySet = document.sForm.elements[i];
		}
	}
	p_countrySet.options.length = 1;
	if(dest != ""){
		for( i=0; i < countryList.length; i++){
			if (countryList[i].dest == dest){
				cnt = cnt +1;
				p_countrySet.options[cnt] = new Option(countryList[i].name,countryList[i].name);
			}
		}
		if(dest == 13){
			dest = 14;
			for( i=0; i < countryList.length; i++){
				if (countryList[i].dest == dest){
					cnt = cnt +1;
					p_countrySet.options[cnt] = new Option(countryList[i].name,countryList[i].name);
				}
			}
		}
		if(dest == 14){
			dest = 15;
			for( i=0; i < countryList.length; i++){
				if (countryList[i].dest == dest){
					cnt = cnt +1;
					p_countrySet.options[cnt] = new Option(countryList[i].name,countryList[i].name);
				}
			}
		}
   	}
	   	
	p_countrySet.options.length = cnt+1;
	p_countrySet.selectedIndex = 0;

}

function setCity(cc ){
	var country = cc;
	var cnt =0;
	
	this.document.sForm.p_city.options.length = 1;
	if(country != ""){
		for(i=0; i< cityList.length; i++){
			if (cityList[i].country == country ){
				cnt = cnt +1;
				this.document.sForm.p_city.options[cnt]=new Option(cityList[i].name, cityList[i].code);
			}
		}
	}
	this.document.sForm.p_city.options.length = cnt+1;
	this.document.sForm.p_city.selectedIndex = 0;
}

function setCityV(){
	var num = document.sForm.p_city.selectedIndex;
	var city = document.sForm.p_city.options[num].value;
}

function setGroup(gc){	
	var group = gc;
	var cnt =0;
	
	this.document.sForm.p_country.options.length = 1;
	if(group != ""){
		for( i=0; i < countryList.length; i++){
			if (countryList[i].group == group){
				cnt = cnt +1;
				this.document.sForm.p_country.options[cnt] = new Option(countryList[i].name, countryList[i].code);
			}
		}
   	}
	   	
	this.document.sForm.p_country.options.length = cnt+1;
	this.document.sForm.p_country.selectedIndex = 0;
	this.document.sForm.p_city.options.length = 1;
	this.document.sForm.p_city.selectedIndex = 0;

}


//list
function destRec(naigai, code, name){
	this.naigai = naigai;
	this.code = code;
	this.name = name;
	return
}

function makeArray(n){
	this.length=n;
	for(var i=1; i<=n; i++)
	this[i]=null;
	return this;
}

function countryRec(dest, code, name, group){
	this.dest = dest;
	this.code = code;
	this.name = name;
	this.group = group;
}

function cityRec(country, code, name){
	this.country = country;
	this.code = code;
	this.name = name;
}

function hatsuRec(dest, code, name, group){
	this.dest = dest;
	this.code = code;
	this.name = name;
	this.group = group;
}

function setRes(){
	document.sForm.reset();
}

var i ;

var hatsuList=new makeArray();
i = 0;
hatsuList[i++] =new hatsuRec('J','104','関東','01');
hatsuList[i++] =new hatsuRec('J','106','関西','02');
hatsuList[i++] =new hatsuRec('J','105','中部・北陸','03');
hatsuList[i++] =new hatsuRec('J','103','中部・北陸','03');
hatsuList[i++] =new hatsuRec('J','111','中部・北陸','03');
hatsuList[i++] =new hatsuRec('J','109','九州','04');
hatsuList[i++] =new hatsuRec('J','101','北海道','05');
hatsuList[i++] =new hatsuRec('J','102','東北','06');
hatsuList[i++] =new hatsuRec('J','107','中国・四国','07');
hatsuList[i++] =new hatsuRec('J','108','中国・四国','07');
hatsuList.length =10;

var destList=new makeArray();
i = 0;
destList[i++] =new destRec('W','HWI','ハワイ');
destList[i++] =new destRec('W','MNA','ミクロネシア');
destList[i++] =new destRec('W','AAS','アジア');
destList[i++] =new destRec('W','BEU','ヨーロッパ');
destList[i++] =new destRec('W','DNU','北アメリカ');
destList[i++] =new destRec('W','ESU','南アメリカ');
destList[i++] =new destRec('W','FOC','オセアニア');
destList[i++] =new destRec('W','CAF','アフリカ');
destList[i++] =new destRec('W','CHT','中近東');
destList.length =9;

var countryList=new makeArray();
i = 0;
countryList[i++] =new countryRec('10','J','北海道');
countryList[i++] =new countryRec('11','J','青森県');
countryList[i++] =new countryRec('11','J','岩手県');
countryList[i++] =new countryRec('11','J','宮城県');
countryList[i++] =new countryRec('11','J','秋田県');
countryList[i++] =new countryRec('11','J','山形県');
countryList[i++] =new countryRec('11','J','福島県');
countryList[i++] =new countryRec('12','J','茨城県');
countryList[i++] =new countryRec('12','J','栃木県');
countryList[i++] =new countryRec('12','J','群馬県');
countryList[i++] =new countryRec('21','J','東京都');
countryList[i++] =new countryRec('12','J','埼玉県');
countryList[i++] =new countryRec('12','J','千葉県');
countryList[i++] =new countryRec('12','J','神奈川県');
countryList[i++] =new countryRec('12','J','静岡県');
countryList[i++] =new countryRec('13','J','山梨県');
countryList[i++] =new countryRec('13','J','新潟県');
countryList[i++] =new countryRec('13','J','富山県');
countryList[i++] =new countryRec('13','J','石川県');
countryList[i++] =new countryRec('13','J','福井県');
countryList[i++] =new countryRec('13','J','長野県');
countryList[i++] =new countryRec('13','J','岐阜県');
countryList[i++] =new countryRec('13','J','静岡県');
countryList[i++] =new countryRec('13','J','愛知県');
countryList[i++] =new countryRec('13','J','三重県');
countryList[i++] =new countryRec('16','J','滋賀県');
countryList[i++] =new countryRec('16','J','京都府');
countryList[i++] =new countryRec('16','J','大阪府');
countryList[i++] =new countryRec('16','J','奈良県');
countryList[i++] =new countryRec('16','J','兵庫県');
countryList[i++] =new countryRec('16','J','和歌山県');
countryList[i++] =new countryRec('17','J','鳥取県');
countryList[i++] =new countryRec('17','J','島根県');
countryList[i++] =new countryRec('17','J','岡山県');
countryList[i++] =new countryRec('17','J','広島県');
countryList[i++] =new countryRec('17','J','山口県');
countryList[i++] =new countryRec('18','J','徳島県');
countryList[i++] =new countryRec('18','J','香川県');
countryList[i++] =new countryRec('18','J','愛媛県');
countryList[i++] =new countryRec('18','J','高知県');
countryList[i++] =new countryRec('19','J','福岡県');
countryList[i++] =new countryRec('19','J','佐賀県');
countryList[i++] =new countryRec('19','J','長崎県');
countryList[i++] =new countryRec('19','J','熊本県');
countryList[i++] =new countryRec('19','J','大分県');
countryList[i++] =new countryRec('19','J','宮崎県');
countryList[i++] =new countryRec('19','J','鹿児島県');
countryList[i++] =new countryRec('20','J','沖縄県');


countryList.length = 48

var setArray = new Array();
var setHatsuArray = new Array();

function setHatsu(dc){
	var z = 0;
	for(i=0;i<document.sForm.elements.length;i++){
		if(document.sForm.elements[i].type == 'hidden' && document.sForm.elements[i].name == 'p_hatsu'){
				document.sForm.elements[i].value = "";
				setHatsuArray[z] = document.sForm.elements[i];
				z++;
		}
	}
	z = 0;
	for(i=0;i<hatsuList.length;i++){
		if(hatsuList[i].group == dc){
			setHatsuArray[z].value = hatsuList[i].code;
			z++;
		}
	}
}

function formSubmitDome(){
	
	var dfdest = document.domeForm.p_dest.options;

	thisDest = document.domeForm.p_dest.options[document.domeForm.p_dest.selectedIndex].value;
	var z = 0;
	var p_countrySet;

	for(i=0;i<countryList.length;i++){
		if(countryList[i].dest == thisDest){
			setArray[z] = countryList[i].name;
			z++;
		}
	}
	
	z = 0;
	for(i=0;i<document.domeForm.elements.length;i++){
		if(document.domeForm.elements[i].name == 'p_country' && document.domeForm.elements[i].type == 'hidden'){
			document.domeForm.elements[i].value = setArray[z];
			z++;
		}
	}

	document.domeForm.p_dest.options[document.domeForm.p_dest.selectedIndex].value = "";
	document.domeForm.submit();
}

function hatsusaubch(p) {
	switch (p.options[p.selectedIndex].text) {
		case "福岡" : document.sForm.p_hatsu_sub.value="091";break;
		case "鹿児島" : document.sForm.p_hatsu_sub.value="097";break;
		default : document.sForm.p_hatsu_sub.value="";break;
	}
}



