function initialize()
{
  //document.forms[0].reset();
  col1Select();
  
  // for hktrade
  setAYears2();
}

function showPart(partName){
  var frm = document.getElementById(partName).style;
  frm.display='block';
  frm.visibility='visible';
}

function hidePart(partName){
  var frm = document.getElementById(partName).style;
  //frm.visibility='hidden';
  frm.display='none';
}

function col1Select(){
	var oCol1 = document.getElementsByName("general_TradeType")[0];
	
	if(oCol1.value=="TT"){
		showPart("col2_TT");
		hidePart("col2_TX");
		hidePart("col2_DX");
		hidePart("col2_RX");
		hidePart("col2_TIM");
	}
	
	else if(oCol1.value=="TX"){
		hidePart("col2_TT");
		showPart("col2_TX");
		hidePart("col2_DX");
		hidePart("col2_RX");
		hidePart("col2_TIM");
	}
	
	else if(oCol1.value=="DX"){
		hidePart("col2_TT");
		hidePart("col2_TX");
		showPart("col2_DX");
		hidePart("col2_RX");
		hidePart("col2_TIM");
	}
	
	else if(oCol1.value=="RX"){
		hidePart("col2_TT");
		hidePart("col2_TX");
		hidePart("col2_DX");
		showPart("col2_RX");
		hidePart("col2_TIM");
	}
	
	else if(oCol1.value=="TIM"){
		hidePart("col2_TT");
		hidePart("col2_TX");
		hidePart("col2_DX");
		hidePart("col2_RX");
		showPart("col2_TIM");
	}
	
	col2Select();

};

function col2Select(){
	var oCol1 = document.getElementsByName("general_TradeType")[0];
	var oCol2 = document.getElementsByName("general_" + oCol1.value)[0];
	// alert(oCol2.value);
	// if(oCol2.value=="PARTNERS" || oCol2.value=="MARKETS" || oCol2.value=="SUPPLIERS"){
	if(oCol2.value=="PARTNERS" ){
		showPart("col3");
		setAYears1(oCol2.value);
		return;
	}
	hidePart("col3");
	
	setAYears1(oCol2.value);
};


function setAYears1(ttype)
{
  var syear=1994;
  
  fillInYears(0);
  //alert(ttype);
  if (ttype == "PARTNERS")
    syear=1996;
  else if (ttype == "MARKETS" || ttype=="SUPPLIERS")
    syear=1996;
  else if (ttype == "REGIONS" || ttype == "COUNTRY")
    syear=1998;
  else if (ttype == "ORIGINS")
    syear=1996;
  else if (ttype == "ORIGDES" || ttype == "DESORIG")
    syear=1996;
  
  removeYears(0,syear);
}

/* ptable */
function ptable_selectReportTrade()
{
  var otradeType=document.getElementsByName("ptable_TradeType")[0];
  var oreportType=document.getElementsByName("ptable_type")[0];
  
  if (otradeType.selectedIndex == 3) // imports
  {
    oreportType.options[1].text="Suppliers";
  }
  else
  {
    oreportType.options[1].text="Markets";
  }
}

/* end ptable */


/* hktrade */
function hktradeSelect(){
	var oCol1 = document.getElementsByName("hktrade_with")[0];
	
	if(oCol1.value=="WORLD"){
		hidePart("hktrade_Area");
		hidePart("hktrade_Region");
		hidePart("hktrade_Country");
	}
	
	else if(oCol1.value=="AREA"){
		showPart("hktrade_Area");
		hidePart("hktrade_Region");
		hidePart("hktrade_Country");
	}
	
	else if(oCol1.value=="REGION"){
		hidePart("hktrade_Area");
		showPart("hktrade_Region");
		hidePart("hktrade_Country");
	}
	
	else if(oCol1.value=="COUNTRY"){
		hidePart("hktrade_Area");
		hidePart("hktrade_Region");
		showPart("hktrade_Country");
	}
	
};


function setAYears2()
{
  var syear=1998;
  
  fillInYears(1);
  //alert(ttype);
  
  removeYears(1,syear);
}
/* end hktrade */