﻿function SelectCountryType(drpTypeId,DrpFromCityId,UseType)
{ 
    var typeL;
    var cityL;
    var response;
    if(drpTypeId!=null)
        typeL=document.getElementById(drpTypeId);
    if(DrpFromCityId!=null)
        cityL=document.getElementById(DrpFromCityId); 
    if(typeL!=null)
    {
        type=typeL.value;
        response =Methods.GetCityByType(type,UseType);
        if(cityL!=null)
            flist(cityL,response,'地区お選びください');
    } 
    return;
} 


function FillCountryByType(AreaList,FillList,ClearList)
{   
    ClearDepartList(AreaList,FillList,ClearList);  
    var areaL=document.getElementById(AreaList);
    var fillL=document.getElementById(FillList); 
	var strAreaCode =areaL.value; 
    var response; 
    response=Methods.GetDrpCountryByType(strAreaCode,'CHN',true);
	if(fillL!=null)
	{
	    flist(fillL,response,'お選びください');
	}
	return;
}
function FillDrpCity(firstDrpID,SecondDrpID,UseType)
{   
    var countryCode =(document.getElementById(firstDrpID)).value;
    var response =Methods.GetCityByCountry(countryCode,UseType);
    var list = document.getElementById(SecondDrpID);
    flist(list,response,'お選びください');
}
 
function ClearDepartList(AreaList,FillList,ClearList)
{
    var areaL;
    var fillL;
    var clearL;
    var departL;
    areaL=document.getElementById(AreaList);
	if(areaL==null)
	    return;
	fillL=document.getElementById(FillList);
	if (fillL==null)
		return;
	if (ClearList!=null)
	{
		clearL=document.getElementById(ClearList);
		if (clearL!=null)
		{
			clearL.length=0;
			clearL.options.add(new  Option('お選びください',''));  
	    }
	}
}

function setAreaState(AreaList,FillList,ClearList)
{
    var areaL;
    var fillL;
    var clearL;
    var departL; 
	if(AreaList!=null)
	{
	    areaL=document.getElementById(AreaList);
	    if (areaL!=null)
	    {
			areaL.length=0;
	    }
	} 
	if(FillList!=null)
	{
	    fillL=document.getElementById(FillList);
	    if (fillL!=null)
	    {
			fillL.length=0;
	    }
	}  
	if (ClearList!=null)
	{
		clearL=document.getElementById(ClearList);
		if (clearL!=null)
		{
			clearL.length=0;  
	    }
	}
}

function SetState(drpCountryTyp,drpFromCity,drpToCity,txtToCity,Fyear,Fmonth,Fday,txtFreeWord,UseTypeF,UseTypeT)
{
    var response;
    var responseTo;
    CountryTyp=document.getElementById(drpCountryTyp);
    FromCity=document.getElementById(drpFromCity);
    ToCity=document.getElementById(drpToCity);
   
    FreeWord=document.getElementById(txtFreeWord); 
     
    LFyear=document.getElementById(Fyear);
    LFmonth=document.getElementById(Fmonth);
    LFday=document.getElementById(Fday);
     
    if(CountryTyp!=null)
    {   
        CountryTyp.selectedIndex =0;
        var type=CountryTyp.value;
        response =Methods.GetCityByType(type,UseTypeF);
        if(FromCity!=null)
            flist(FromCity,response,'地区お選びください');

    } 
    if(ToCity!=null)
    {
        response =Methods.GetCityByType("CHN",UseTypeT);
        flist(ToCity,response,'お選びください');
    }
     if(txtToCity.length>0)
    {
        tToCity=document.getElementById(txtToCity);
        if(tToCity!=null)
        {
            tToCity.value='漢字/アルファベットで入力';
	        tToCity.style.color='#B2B2B2';
        }
    }
    
  
    if(FreeWord!=null)
    { 
        FreeWord.value='漢字/アルファベット';
	    FreeWord.style.color='#B2B2B2';
    }  
     
    var toDay = new Date(); 
    if(LFyear!=null)
	    LFyear.value=toDay.getFullYear(); 
	var intMonth=toDay.getMonth()+1;
	var strMonth=intMonth.toString();
	strMonth='0'+strMonth;
	strMonth=strMonth.substring(strMonth.length-2,strMonth.length); 
	if(LFmonth!=null)
	    LFmonth.value=strMonth; 
	var intDay=toDay.getDate();
	var strDay=intDay.toString();
	strDay='0'+strDay;
	strDay=strDay.substring(strDay.length-2,strDay.length);
	if(LFday!=null)
	    LFday.value=strDay; 
}
 