 /**

 * itemMap Ã³¸® ºÎºÐ ½ÃÀÛ

 * /script/common/stringUtil.js/coMap ÇÔ¼ö º¯Çü

 * Åë°èÇ×¸ñ¿¡ ¸Â°Ô Ä¿½ºÅÍ¸¶ÀÌÂ¡

 *

 * @fileName	: item.js

 * @author		: Á¤Ã¢±³

 * @version		: 1.0

 * @since		: 2008-10-07

 */

 

var mainItemTitle = "";

var mainItemType = "";

var mainItemQuery = "";

var mainItemFullTitle = "";

var mainItemCode_th = "";

 

// Åë°èÇ×¸ñ Menu ÄÁÆ®·Ñ=================================================

var tab1 = true;	// ºÐ·ù/°Ë»ö Åë°è

var tab2 = false;	// Á¶°Ç°Ë»ö

var tab3 = false;	// ºÒ·¯¿À±â

var tab4 = false;	// ÃßÃµÇ×¸ñ

 

 

function itemMap() {

  // fields

  this.ids			= new Array();	// Åë°èÇ×¸ñ ¾ÆÀÌµð

  this.titles 		= new Array();	// Á¦¸ñ

  this.types 		= new Array();	// Å¸ÀÔ 0:ÀÏ¹ÝÅë°è, 1:°í±ÞÅë°è

  this.querys 		= new Array();  // ÀÏ¹ÝÅë°è ÄÃ·³¸í, °í±ÞÅë°è Äõ¸®

  this.fullTitles 	= new Array();	// ÅøÆÁÀ¸·Î º¸¿©Áö´Â ÀüÃ¼ Å¸ÀÌÆ²



  this.stat			= new Array();	// Åë°èÁ¤º¸

  this.gubun		= new Array();	// ±¸ºÐ	INGU, GAGU, COMP ±×·ìÇÎ ÄÚµå

  this.code_th		= new Array();  // »ê¾÷Ã¼ ±¸ºÐ

  this.densidty		= new Array();	// ¹Ðµµ

  this.filter		= new Array();	// Ä«Å×°í¸® => ÇÊÅÍ·Î ¼öÁ¤

  this.years		= new Array();	// ³âµµ ¹è¿­ 

  this.statEdit		= new Array();	// ¼öÁ¤ Åë°èÁ¤º¸(¼öÁ¤ÀÌ³ª ºÒ·¯¿À±â ÇÒ¶§ ÇÊ¿ä)  

    

  this.color 		= new Array(); 	// ¹ü·Ê»ö»ó

  this.legend		= new Array();	// ¹ü·Ê°ª

  this.count 		= 0;



  // methods

  this.put					= itemMap_put;

  this.getIdAt				= itemMap_getIdAt;  

  this.getTitleAt			= itemMap_getTitleAt;

  this.getTypeAt			= itemMap_getTypeAt;

  this.getQueryAt			= itemMap_getQueryAt;  

  this.getFullTitleAt		= itemMap_getFullTitleAt;  

  this.getStat				= itemMap_getStat;  

  this.getGubun				= itemMap_getGubun;

  this.getCode_th			= itemMap_getCode_th;

  this.getDensidty			= itemMap_getDensidty;  

  this.getFilter			= itemMap_getFilter;  

  this.getYearAt			= itemMap_getYearAt;

  this.getStatEdit			= itemMap_getStatEdit;  

  

  this.size					= itemMap_size;

  this.getMaxTitleLength	= itemMap_getMaxTitleLength;

  this.removeAt				= itemMap_removeAt;

  this.removeAll			= itemMap_removeAll;

  

  this.getLegendAt	= itemMap_getLegendAt;	// ¹ü·ÊÁ¤º¸ get

  this.setLegendAt	= itemMap_setLegendAt;	// ¹ü·ÊÁ¤º¸ set

  this.getColorAt	= itemMap_getColorAt;	// ¹ü·Ê»ö»ó get

  this.setColorAt	= itemMap_setColorAt;	// ¹ü·Ê»ö»ó set

}



/**

 * @type   : method

 * @access : public

 * @object : itemMap

 * @desc   : »õ·Î¿î mapÀ» Ãß°¡ÇÑ´Ù. °°Àº name°¡ Á¸ÀçÇÒ °æ¿ì overwriteÇÑ´Ù.

 * @sig    : title, type, query, fullTitle

 * @param  : title required mapÀÇ title·Î »ç¿ëÇÒ °ª

 * @param  : type required mapÀÇ type·Î »ç¿ëÇÒ °ª

 * @param  : query required mapÀÇ query·Î »ç¿ëÇÒ °ª

 * @param  : fullTitle required mapÀÇ fullTitle·Î »ç¿ëÇÒ °ª 

 * @return : ÆÄ¶ó¹ÌÅÍ°ª

 */

function itemMap_put(id, title, type, query, fullTitle, stat, gubun, densidty, filter, year,statEdit,code_th) 

{

 //alert(id + "\ntitle:"+title+"\ntype:"+type+"\nquery:"+query+"\nfullTitle:"+fullTitle+"\nstat:"+stat+"\ngubun:"+gubun+"\ndensidty:"+densidty+"\nfilter:"+filter+"\nyear:"+year)



  	for (var i = 0; i < this.count; i++) 

  	{

	    if (this.ids[i] == id) {

	    	this.titles[i]		= title;

	      this.types[i] 		= type;

	      this.querys[i] 		= query;

	      this.fullTitles[i] 	= fullTitle;

	      this.stat[i] 			= stat;

	      this.gubun[i] 		= gubun;

	      this.code_th[i]		= code_th;

	      this.densidty[i] 		= densidty;

	      this.filter[i] 		= filter;

	      this.years[i] 		= year;

	      this.statEdit[i] 		= statEdit;

	      return;

	    }

	}

	

	this.ids[this.count]		= id;

  	this.titles[this.count] 	= title;

  	this.types[this.count] 		= type;

  	this.querys[this.count] 	= query; 

  	this.fullTitles[this.count] = fullTitle; 

  	this.stat[this.count] 		= stat;

  	this.gubun[this.count] 		= gubun;

  	this.code_th[this.count]	= code_th;

  	this.densidty[this.count] 	= densidty; 

  	this.filter[this.count] 	= filter; 

  	this.statEdit[this.count] 		= statEdit;   	

  	this.years[this.count++]	= year;

}



// itemMap getter

function itemMap_getIdAt(index) {

  return this.ids[index];

}



function itemMap_getTitleAt(index) {

  return this.titles[index];

}



function itemMap_getTypeAt(index) {

  return this.types[index];

}



function itemMap_getQueryAt(index) {

  return this.querys[index];

}



function itemMap_getFullTitleAt(index) {

  return this.fullTitles[index];

}



function itemMap_getStat(index) {

  return this.stat[index];

}



function itemMap_getGubun(index) {

  return this.gubun[index];

}



function itemMap_getCode_th(index) {

  return this.code_th[index];

}



function itemMap_getDensidty(index) {

  return this.densidty[index];

}



function itemMap_getFilter(index) {

  return this.filter[index];

}



function itemMap_getYearAt(index) {

  return this.years[index];

}



function itemMap_getStatEdit(index) {

  return this.statEdit[index];

}



// ¹ü·Ê°ª getter

function itemMap_getLegendAt(index) {

  return this.legend[index];

}



// ¹ü·Ê°ª setter

function itemMap_setLegendAt(index, value) {

  this.legend[index] = value;

}



// ¹ü·Ê»ö»ó getter

function itemMap_getColorAt(index) {

  return this.color[index];

}



// ¹ü·Ê»ö»ó setter

function itemMap_setColorAt(index, value) {

  this.color[index] = value;

}



/**

 * @type   : method

 * @access : public

 * @object : itemMap

 * @desc   : mapÀÇ name-value ½ÖÀÇ °¹¼ö¸¦ ¾Ë·ÁÁØ´Ù.

 * @return : name-value ½ÖÀÇ °¹¼ö

 */

function itemMap_size() {

  return this.count;

}



/**

 * @type   : method

 * @access : public

 * @object : itemMap

 * @desc   : map ³»ÀÇ title °ªµéÀ» StringÀ¸·Î È¯»êÇÏ¿© ÃÖ´ë±æÀÌ¸¦ ¾Ë·ÁÁØ´Ù.

 * @return : max name length

 */

function itemMap_getMaxTitleLength() {

  var maxLength = 0;



  for (var i = 0; i < this.count; i++) {

    if (String(this.titles[i]).length > maxLength) {

      maxLength = String(this.titles[i]).length;

    }

  }



  return maxLength;

}



/**

 * @type   : method

 * @access : public

 * @object : itemMap

 * @desc   : map ³»ÀÇ idx °ª¿¡ ÇØ´çµÇ´Â µ¥ÀÌÅÍ¸¦ Áö¿î´Ù.

 * @return : ÇØ´çÇÏ´Â µ¥ÀÌÅÍ¸¦ Áö¿ì°í Áöµµ¿µ¿ª ¸®½ºÆ®¸¦ ´Ù½Ã ±×·ÁÁØ´Ù.

 */

function itemMap_removeAt(idx) {

	for(var i=idx; i < this.count; i++) {

		if(i == idx) {

		  this.ids[idx]			= null;

		  this.titles[idx] 		= null;

		  this.types[idx] 		= null;

		  this.querys[idx] 		= null;	 		

		  this.fullTitles[idx] 	= null;	 		

		  this.stat[idx]		= null;

		  this.statEdit[idx]	= null;		  

		  this.gubun[idx]		= null;

		  this.code_th[idx]		= null;

		  this.densidty[idx]	= null;

		  this.filter[idx]		= null;

		  this.years[idx]		= null;

	  	  this.legend[idx]		= null;

	  	  this.color[idx]		= null;

		} else {

		  this.ids[i-1] 		= this.ids[i];		

		  this.titles[i-1] 		= this.titles[i];

		  this.types[i-1] 		= this.types[i];

		  this.querys[i-1] 		= this.querys[i];			  

		  this.fullTitles[i-1] 	= this.fullTitles[i];	 			

		  this.stat[i-1] 		= this.stat[i];

		  this.statEdit[i-1]	= this.statEdit[i];		  

		  this.gubun[i-1] 		= this.gubun[i];

		  this.code_th[i-1]		= this.code_th[i];

		  this.densidty[i-1] 	= this.densidty[i];	 		

		  this.filter[i-1] 	= this.filter[i];

		  this.years[i-1] 		= this.years[i];

		  this.legend[i-1]		= this.legend[i];

	  	  this.color[i-1]		= this.color[i];

		}

	}

	this.count--;

	if(modeGubunValue !="easy"){
		//alert(mainAreaMap.getTitle(0));
		if (mainItemMap.size() == 0){
			
        	document.getElementById("selStatUnit").style.visibility = "hidden";
        	document.getElementById("selStatUnitClass").className = "dn";
        }else if(mainItemMap.size() == 1 && mainItemMap.getTitleAt(0).indexOf("ÃÑ")==0 && mainAreaMap.size() < 1  ){
        	//&& !mainAreaMap.getTitle(0).indexOf("ºÎ±Ù")== -1
        	//alert("shabeat8");
        	document.getElementById("selStatUnit").style.visibility = "visible";
        	document.getElementById("selStatUnitClass").className = "dn02";
        }   
		 
		itemListSetting();

	}

}



/**

 * @type   : method

 * @access : public

 * @object : coMap

 * @desc   : map ³»ÀÇ name °ª¿¡ ÇØ´çµÇ´Â µ¥ÀÌÅÍ¸¦ Áö¿î´Ù.

 * @return : result value (true/false)

 */

function itemMap_removeAll() 

{

	for(var i = 0; i < this.count; i++) 

	{

		this.ids[i]			= null;

	  	this.titles[i] 		= null;

	  	this.types[i] 		= null;

	  	this.querys[i] 		= null;	 		

	  	this.fullTitles[i] 	= null;	 		

	  	this.stat[i]		= null;

	  	this.gubun[i]		= null;

	  	this.code_th[i]		= null;

	  	this.densidty[i]	= null;

	  	this.filter[i]		= null;

	  	this.years[i]		= null;

	  	this.legend[i]		= null;

	  	this.color[i]		= null;

	  	this.statEdit[i]	= null;	  	

	}

  		

  	this.count = 0;

  	if(modeGubunValue !="easy"){

  		itemListSetting();

  	}

}



/**

 *  @Description	: ÃÊ±âÈ­ ÀÌº¥Æ®

 *  @Input			: type - 0 : ÀÏ¹Ý, 1: °í±Þ

 *  @Input			: mode - ¼öÁ¤ÀÏ °æ¿ì mode : edit

 *  @Input			: idx - ¼öÁ¤ÇÒ Åë°èÇ×¸ñÀÇ id

 *  @Output			: ¾øÀ½

 */

function init(type, mode, idx)

{

	if(type == "0" || type == "") {

		document.getElementById("itemFrame").src = '/statistics_new/flex/item/item.jsp?mode=' + mode + '&idx=' + idx;	

	} else if(type == "1") {

		alert("°í±ÞÅë°è ¼öÁ¤");

	}

	

	// Åë°èÁ¶È¸ ´ÜÀ§ ¹öÆ° ±ÇÇÑ

	//var groupCode = "";

	

	//if(parent.browserType == "msie") {

	//	groupCode = parent.userStat.userStatForm.groupCode.value;		

	//} else {

	//	groupCode = parent.getValueFromIFrame("userStat","groupCode");

	//}

	

	//if(groupCode == "inner_user" || groupCode == "admin_user")

	//{

		//parent.statItem.document.getElementById("selStatUnit").style.display = "block";

	//	parent.document.getElementById("selStatUnit").style.display = "block";

	//}else

	//{

		//parent.statItem.document.getElementById("selStatUnit").style.display = "none";

	//	parent.document.getElementById("selStatUnit").style.display = "none";

	//}

}



/**

 *  @Description	: ÅÇ ¸Þ´º ÀÌµ¿

 *  @Input			: src - ÀÌµ¿ ÇÒ page url

 *	@Input			: tab - tab ¹øÈ£

 *  @Output			: ¾øÀ½

 */

var tabNum = '';

function Fn_TabChange(src, tab)

{	

	// ¸ðµç ÅÇ enable = false

	tab1 = false;				

	tab2 = false;

	tab3 = false;

	tab4 = false;

		

	// ¼±ÅÃÇÑ ÅÇ enable = true

	if(tab == "1") tab1 = true;

	else if(tab == "2") tab2 = true;

	else if(tab == "3") tab3 = true;

	else if(tab == "4") tab4 = true;



	tapMenuControl();

	tabNum=tab;

	//document.getElementById("detailTr").style.display = "none";

	//parent.document.getElementById("statItem").style.height = 410;	

	//document.getElementById("itemFrame").style.height = 307;

	document.getElementById("itemFrame").src = src;	

}



/**

 *  @Description	: ÅÇ ¸Þ´º ÀÌ¹ÌÁö contrl

 *  @Input			: ¾øÀ½

 *  @Output			: ¾øÀ½

 */

function tapMenuControl()

{

	MM_swapImgRestore();

	MM_swapImage('imgTab1','','/statistics_new/images/i_menu01.gif',1);	

	MM_swapImage('imgTab2','','/statistics_new/images/i_menu03.gif',1);

	MM_swapImage('imgTab3','','/statistics_new/images/i_menu04.gif',1);

	MM_swapImage('imgTab4','','/statistics_new/images/i_menu02.gif',1);

	

	if (tab1) MM_swapImage('imgTab1','','/statistics_new/images/i_menu01_on.gif',1);			

	if (tab2) MM_swapImage('imgTab2','','/statistics_new/images/i_menu03_on.gif',1);	

	if (tab3) MM_swapImage('imgTab3','','/statistics_new/images/i_menu04_on.gif',1);	

	if (tab4) MM_swapImage('imgTab4','','/statistics_new/images/i_menu02_on.gif',1);	

}



/**

 *  @Description	: ÃÊ±âÈ­

 *  @Input			: pageNo - ÆäÀÌÁö ¹øÈ£

 *	@Input			: pageUrl - ÆäÀÌÁö ÁÖ¼Ò 

 *  @Output			: ¾øÀ½

 */

function Fn_Load(pageNo, pageUrl)

{

	Fn_Search_Url(pageNo, pageUrl);

}



/**

 *  @Description	: ÆäÀÌÁö ÀÌµ¿

 *  @Input			: pageNo - ÆäÀÌÁö ¹øÈ£

 *	@Input			: pageUrl - ÆäÀÌÁö ÁÖ¼Ò 

 *  @Output			: ¾øÀ½

 */

function Fn_GoPage(pageNo, pageUrl)

{

	Fn_Search_Url(pageNo, pageUrl);

}



/**

 *  @Description	: Á¶È¸

 *  @Input			: pageNo - ÆäÀÌÁö ¹øÈ£

 *	@Input			: pageUrl - ÆäÀÌÁö ÁÖ¼Ò

 *  @Output			: ¾øÀ½

 */

function Fn_Search_Url(pageNo, pageUrl)

{	

	if(cfIsNull(pageNo)) pageNo = "1";

	

	var loadRequest = sendHttpRequest("GET", "/statistics_new/item/" + pageUrl + "?pageNo="+pageNo);	

	var result = cfTrim(loadRequest.responseText);



	document.getElementById("srchList").innerHTML = result;

}



 //-------------------------------------------

 // FlashÀÇ °´Ã¼¸¦ ReturnÇØÁÜ

 //-------------------------------------------

function getMyApp(appName) 

{

  // Internet Explorer and Netscape refer to the Flash application 

  // object differently.

  // This function returns the appropriate syntax depending on the browser.

  // ÀÎÅÍ³Ý ÀÍ½ºÇÃ·Î·¯¿Í ³×½ºÄÉÀÌÇÁ´Â FlashÀÀ¿ë°´Ã¼¸¦ ´Ù¸£°Ô ÂüÁ¶ÇÕ´Ï´Ù.

  // ÀÌ ÇÔ¼ö´Â ºê¶ó¿ìÀú¿¡ ¸Â°Ô Àû´çÇÑ ÂüÁ¶°´Ã¼¸¦ ¸®ÅÏÇØÁÝ´Ï´Ù.(Áöµ¹½ºÅ¸)

	if (navigator.appName.indexOf ("Microsoft") !=-1) {

		return window[appName];

	} else {

		return document[appName];

	}

}

 

/**

 *  @Description	: Flex·Î µ¥ÀÌÅÍ¸¦ Àü¼ÛÇÏ´Â ÇÔ¼ö(ÀÏ¹ÝÅë°è)

 *  @Input			: ¾øÀ½

 *  @Output			: ¾øÀ½

 */ 

 function sendToFlexItemUserId()

 {

	var sgisMemberId = "";

	/*

	if(parent.parent.browserType == "msie") {

		sgisMemberId = parent.parent.document.frames['userStat'].userStatForm.sgisMemberId.value;		

	} else {

		sgisMemberId = parent.parent.getValueFromIFrame("userStat","sgisMemberId");

	}	

	*/

	if(sgisMemberId == "") {

		sgisMemberId = "Guest";	// Guest ±ÇÇÑ

	}

	

	//var msg =  setTimeout("getMyApp('SnaItem').sendItemUserid('Guest')",900);

	var msg =  getMyApp('SnaItem').sendItemUserid(sgisMemberId);

 } 



/**

 *  @Description	: Flex·ÎºÎÅÍ ¼±ÅÃÇÑ ÀÏ¹ÝÅë°è µ¥ÀÌÅÍ¸¦ ¹Þ´Â ÇÔ¼ö(ÀÏ¹ÝÅë°è)

 *  @Input			: s1 - m_Step1_SelectIdx

 *  @Input			: s2 - m_Step1_SelectData 

 *  @Input			: s3 - m_Step1_SelectLabel

 *  @Input			: s4 - m_Step2_SelectIdx

 *  @Input			: s5 - m_Step2_SelectData

 *  @Input			: s6 - m_Step2_SelectLabel

 *  @Input			: s7 - m_Step3_SelectIdx

 *  @Input			: s8 - m_Step3_SelectData

 *  @Input			: s9 - m_Step3_SelectLabel

 *  @Output			: ¾øÀ½

 */

function callbackFromItemValue(s1,s2,s3,s4,s5,s6,s7,s8,s9) {

	

	window.opener.mainItemTitle = replace_StringUtil(s9,",","");

	window.opener.mainItemType = "0"; // ÀÏ¹ÝÅë°è

	window.opener.mainItemQuery = s8;

	window.opener.mainItemFullTitle = s3 + " > " + s6 + " > " + window.opener.mainItemTitle;

	//alert(s8 +" "+s3 + " > " + s6 + " > " + window.opener.mainItemTitle);

	//alert("s9 ==> "+s9+"\ns8 ==> "+s8+"\ns3 ==> "+s3+"\ns6 ==> "+s6);

}







/**

 *  @Description	: Flex·ÎºÎÅÍ ¼±ÅÃÇÑ ÀÏ¹ÝÅë°è µ¥ÀÌÅÍ¸¦ ¹Þ´Â ÇÔ¼ö(ÀÏ¹ÝÅë°è)

 *  @Input			: s1 - m_Step1_SelectIdx

 *  @Input			: s2 - m_Step1_SelectData 

 *  @Input			: s3 - m_Step1_SelectLabel

 *  @Input			: s4 - m_Step2_SelectIdx

 *  @Input			: s5 - m_Step2_SelectData

 *  @Input			: s6 - m_Step2_SelectLabel

 *  @Input			: s7 - m_Step3_SelectIdx

 *  @Input			: s8 - m_Step3_SelectData

 *  @Input			: s9 - m_Step3_SelectLabel

 *  @Output			: ¾øÀ½

 */

function callbackFromItemValue(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) {

	window.opener.mainItemTitle = replace_StringUtil(s9,",","");

	window.opener.mainItemType = "0"; // ÀÏ¹ÝÅë°è

	window.opener.mainItemQuery = s8;

	window.opener.mainItemFullTitle = s3 + " > " + s6 + " > " + window.opener.mainItemTitle;

	if(cfIsNull(s10)){

		window.opener.mainItemCode_th = "8";

	}

	else{

		window.opener.mainItemCode_th = s10;

	}

	//alert(s8 +" "+s3 + " > " + s6 + " > " + window.opener.mainItemTitle);

	//alert("s9 ==> "+s9+"\ns8 ==> "+s8+"\ns3 ==> "+s3+"\ns6 ==> "+s6+"\ns1 ==> "+s1+"\ns10 ==> "+s10);

}



/**

 *  @Description	: ÀÏ¹ÝÅë°è ¸Þ´º ¼ÂÆÃ

 *  @Input			: ¾øÀ½

 *  @Output			: ¾øÀ½

 */

function setMainItemValue() {

/*

	if (opener.mainItemTitle == "")

	{

		alert("°Ë»öµÈ Åë°èÇ×¸ñÀ» ¼±ÅÃ ÇÏ½Ê½Ã¿À!");		

		return;

	}

*/

	//var idx = parent.frmEdit.sIdx.value;

	var idx = parent.document.getElementById('sIdx').value;

	

	window.opener.addUserItem(window.opener.mainItemTitle, window.opener.mainItemType, window.opener.mainItemQuery, window.opener.mainItemFullTitle, idx,window.opener.mainItemCode_th);	

}



/**

 *  @Description	: ÀÏ¹ÝÅë°è ¸Þ´º ¼ÂÆÃ

 *  @Input			: ¾øÀ½

 *  @Output			: ¾øÀ½

 */

function setContentsItemValue() {

/*

	if (opener.mainItemTitle == "")

	{

		alert("°Ë»öµÈ Åë°èÇ×¸ñÀ» ¼±ÅÃ ÇÏ½Ê½Ã¿À!");		

		return;

	}

*/

	//var idx = parent.frmEdit.sIdx.value;

	//window.opener.mainItemTitle = replace_StringUtil(s9,",","");

	//window.opener.mainItemType = "0"; // ÀÏ¹ÝÅë°è

	//window.opener.mainItemQuery = s8;

	//window.opener.mainItemFullTitle = s3 + " > " + s6 + " > " + window.opener.mainItemTitle;

	var idx = parent.document.getElementById('sIdx').value;

	var siDoSelectBoxValue = document.getElementById("siDoSelectBox");

	var guSelectBoxValue = document.getElementById("guSelectBox");

	var dongSelectBoxValue = document.getElementById("dongSelectBox");

	

	window.opener.mainItemTitle = replace_StringUtil(dongSelectBoxValue.options[dongSelectBoxValue.selectedIndex].text,",","");

	window.opener.mainItemType = "0"; // ÀÏ¹ÝÅë°è

	window.opener.mainItemQuery = dongSelectBoxValue.value;

	

	//alert(siDoSelectBoxValue.options[siDoSelectBoxValue.selectedIndex].text);

	//alert(guSelectBoxValue.options[guSelectBoxValue.selectedIndex].text);

	//alert(dongSelectBoxValue.options[dongSelectBoxValue.selectedIndex].text);

	window.opener.mainItemFullTitle = siDoSelectBoxValue.options[siDoSelectBoxValue.selectedIndex].text + " > " + guSelectBoxValue.options[guSelectBoxValue.selectedIndex].text + " > " + window.opener.mainItemTitle;

	

	var dongSelectBoxValue = document.getElementById("dongSelectBox").value;

	

	//alert("siDoSelectBoxValue ==> "+siDoSelectBoxValue +"\n dongSelectBoxValue ==> "+dongSelectBoxValue);

	window.opener.addUserItem(window.opener.mainItemTitle, window.opener.mainItemType, window.opener.mainItemQuery, window.opener.mainItemFullTitle, idx);	

}



/**

 * ÇÃ·º½º ¿¡·¯ ¶§¹®¿¡ ÀÓ½Ã·Î ±¸Çö »èÁ¦ ¿¹Á¤ 

 * Alex

 */

function imsiSetMainItemValue(mainItemTitle, mainItemType, mainItemQuery, mainItemFullTitle) {

	parent.parent.addUserItem(mainItemTitle, mainItemType, mainItemQuery, mainItemFullTitle);	

}



function statValueItemChange(idx, selYear) 

{	

	if(modeGubunValue != "easy"){

		setCheckedRadioValue(document.selectItem.rSelectItem, idx);

	}

	

	if(mainStatValueMap.size() == 0) return;

	

	// ÇØ´ç Ç×¸ñ¿¡ Àû¿ëµÈ ¹ü·Ê »ö»ó

	var color = mainItemMap.getColorAt(idx);

	if(cfIsNull(color)) color = userLegendColor;

	

	// ÇØ´ç Ç×¸ñ¿¡ Àû¿ëµÈ ¹ü·Ê °ª

	var legend = mainItemMap.getLegendAt(idx);

	

	if(cfIsNull(selYear)) {

		if(cfIsNull(legend)) drawLegend(idx, color);

		else drawLegendUser(idx, legend, color);

	} else {

		if(cfIsNull(legend)) drawLegend(idx, color, selYear);

		else drawLegendUser(idx, legend, color, selYear);		

	}

}



function modItem(idx, type, arrIdx) {

	if(type == "0") {

		

		//fn_openFrame('statItem', 'Åë°è Ç×¸ñ ¼³Á¤', 'single', '/statistics_new_web/item/menuItem.jsp?mode=edit&idx=' + idx + '&type=' + type, 'mapCenter', '576,410,,,,,10','max', '0', '', 'change', 'init');

		addItemPopUp('statItem','/statistics_new/flex/item/menuItem.jsp?mode=edit&idx=' + idx + '&type=' + type,576,410);

		//test_popUp('/statistics_new/item/menuItem.jsp?mode=edit&idx=' + idx + '&type=' + type,576,410);

	} else if(type == "1") {

		

		var src = '/statistics_new/item/modWeightItem.jsp?mode=edit&idx=' + idx + '&type=' + type + '&arrIdx=' + arrIdx;

		//fn_openFrame('modWeightItem', 'Åë°è Ç×¸ñ ¼³Á¤', 'single', src, 'mapCenter', '576,190 	,,,,,10','max', '0', '', 'change', 'init');

		//test_popUp(src,576,410);

		addItemPopUp('statItem',src,576,410);

	}

}



/**

 *  @Description	: Ç×¸ñÃß°¡ Ä«¿îÅÍ Ã³¸®

 *  @Input			: stat - °í±ÞÅë°èÇ×¸ñ stat

 *	@Input			: title - Åë°èÇ×¸ñ Å¸ÀÌÆ²¸í

 *  @Output			: "/statistics_new/item/mostNumerousCount.jsp?title="+title+"&stat="+stat;

 */

function setMostItemValue() {

	var type 				= "";	// ÀÏ¹ÝÅë°è 0, °í±ÞÅë°è 1

	var title		 		= "";	// Á¦¸ñ

	var item 				= "";	// ÀÏ¹ÝÅë°è ÄÃ·³¸í

	var statColumn 	= "";	// °í±ÞÅë°è ÄÃ·³¸í

	var statValue 	= "";	// °í±ÞÅë°è °ª



	for(var i=0; i<mainItemMap.size(); i++) {

	

		var typeValue = mainItemMap.getTypeAt(i);

		

		if(typeValue == "0") {	// ÀÏ¹ÝÅë°è

			if(i == mainItemMap.size()-1) {		// ¸¶Áö¸·ÀÏ °æ¿ì

				type += typeValue;

				title += mainItemMap.getTitleAt(i);

				item += mainItemMap.getQueryAt(i);

				statColumn += "NO";

				statValue += "NO";

			} else {

				type += typeValue + ":";

				title += mainItemMap.getTitleAt(i) + ":";

				item += mainItemMap.getQueryAt(i) + ":";

				statColumn += "NO:";

				statValue += "NO:";				

			}		

		} else if(typeValue == "1") { // °í±ÞÅë°è

			

			var weightItemArray = dataParser(mainItemMap.getStatEdit(i),"|");			

			

			//korean_age,1,20,1,4,25,¸¸³ªÀÌ,1|sex,5,2,,,,¼ºº°,1|marry_status,5,1,,,,È¥ÀÎ»óÅÂ,

			

			for(var j=0; j<weightItemArray.length; j++) {

				var weightStatArray = dataParser(weightItemArray[j],",");

				

				if(i == mainItemMap.size()-1 && j == weightItemArray.length-1) {		// ¸¶Áö¸·ÀÏ °æ¿ì

					type += typeValue;

					title += weightStatArray[6];

					item += "NO";

					statColumn += weightStatArray[0];

					statValue += weightStatArray[2];

				} else {

					type += typeValue + ":";

					title += weightStatArray[6] + ":";

					item += "NO:";

					statColumn += weightStatArray[0] + ":";

					statValue += weightStatArray[2] + ":";					

				}	// end of if else - ¸¶Áö¸· ±¸ºÐ

				

			}	// end of for - °í±ÞÅë°è ³»ºÎ¿¡¼­ ÄÃ·³¸íº°·Î

		}	// end of if else - ÀÏ¹Ý °í±Þ

	}	// end of for - ÀüÃ¼ µî·ÏµÈ Åë°èÇ×¸ñ¿¡ ´ëÇØ¼­

	

	var param = "?statType=" + type + "&statTitle=" + title + "&statItem=" + item;

	param += "&statColumn=" + statColumn + "&statValue=" + statValue;

	

	var loadRequest = sendHttpRequest("GET", "/statistics_new/item/mostNumerousCount.jsp"+param);	

	return;

	//var result = cfTrim(loadRequest.responseText);	

}



/**

 *  @Description	: ÀÏ¹ÝÅë°è Ç×¸ñ °Ë»ö

 *  @Input			: ¾øÀ½

 *  @Output			: ¾øÀ½

 */

function searchItem() {

	var searchValue = document.getElementById("searchValue");	

	var itemType = document.getElementById("itemType").value;

	

	if(searchValue.value == "") {

		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä!");

		searchValue.focus();

		return;

	}

	document.getElementById("content02").src = "/statistics_new/item/searchItemResult.jsp?itemType="+itemType+"&searchValue="+ searchValue.value;

}



/**

 *  @Description	: kosis Ç×¸ñ Ä«¿îÅÍ Ã³¸®

 *  @Input			: ¾øÀ½ 

 *  @Output			: ¾øÀ½

 */

function setMostKosisItemValue(title, orgId, tblId, orgNm)

{

	var param = "?title="+title			  

			  + "&orgId=" + orgId

			  + "&tblId=" + tblId

			  + "&orgNm=" + orgNm;

			  

	var loadRequest = sendHttpRequest("GET", "/statistics_new/item/mostNumerousCount.jsp"+param);	

	return;

	//var result = cfTrim(loadRequest.responseText);

}



/**

 *  @Description	: ÇØ´ç Åë°è Ç×¸ñÀÇ ±âÁØ³âµµ¸¦ °¡Á®¿À´Â ÇÔ¼ö

 *  @Input			: type - Å¸ÀÔ 0 - ÀÏ¹ÝÅë°è, 1 - °í±ÞÅë°è

 *  @Input			: gubun - ±¸ºÐ INGU - ÀÎ±¸, GAGU - °¡±¸, COMP - »ç¾÷Ã¼

 *  @Input			: itemIdentifier - ÀÏ¹ÝÅë°è Ç×¸ñ 

 *  @Output			: ¾øÀ½

 */

function setMaxBaseYearItemValue(type, gubun, itemIdentifier)

{

	var year = new Array();

	

	var lm_sURL = "/statistics_new/item/baseYearListItem.jsp?type=" + type + "&gubun=" + gubun + "&itemIdentifier=" + itemIdentifier;

	var loadRequest = sendHttpRequest("GET", lm_sURL);	

	var lm_oXML = parse(cfTrim(loadRequest.responseText));			

	var nodes = lm_oXML.getElementsByTagName('firstCode');	



 	for (var i = 0; i < nodes.length;i++)

 	{

 		year[i] = nodes[i].getAttribute('value');

 	}

	

	return stat_getMaxYear(year);

}



function setBaseYearItemValue(type, gubun, itemIdentifier)

{

	var year = new Array();

	

	var lm_sURL = "/statistics_new/item/baseYearListItem.jsp?type=" + type + "&gubun=" + gubun + "&itemIdentifier=" + itemIdentifier;

	var loadRequest = sendHttpRequest("GET", lm_sURL);	

	var lm_oXML = parse(cfTrim(loadRequest.responseText));			

	var nodes = lm_oXML.getElementsByTagName('firstCode');	



 	for (var i = 0; i < nodes.length;i++)

 	{

 		//alert(itemIdentifier.substr(0,2)+itemIdentifier.substr(0,3));

 		if(itemIdentifier.substr(0,2) == "cp"){

 			if(itemIdentifier.substr(0,3) == "cp9"){

 				year[year.length] = nodes[i].getAttribute('value');

 			}

 			else{

 				if(nodes[i].getAttribute('value') < 2007){

 					year[year.length] = nodes[i].getAttribute('value');

 				}

 			}

 		}

 		else{

 			year[year.length] = nodes[i].getAttribute('value');

 		}

 	}

	

	return year;

}



function stat_getMaxYear(year)

{

	var max = year[0];

	for (var i=0; i<year.length; i++)

	{

		if(year[i] > max)max=year[i];

	}

	return max;

}



/**

 *  @Description	: (ÀÏ¹ÝÅë°è) ´ëÃ¼ÄÁÅÙÃ÷ ¾ÆÀÌÅÛ ¼¼ÆÃ

 *  @Input			: document.getElementById("siDoSelectBox").text

 *  @Input			: document.getElementById("guSelectBox").text

 *  @Input			: document.getElementById("dongSelectBox").text

 *  @Input			: document.getElementById("siDoSelectBox").value

 *  @Input			: document.getElementById("guSelectBox").value

 *  @Input			: document.getElementById("dongSelectBox").value

 *  @Output			: ¾øÀ½

 *	Edit History 		: 2009.09.16 /±è°æÀç/ »õ·Î¿î Æã¼Ç Ãß°¡ÀÔ´Ï´Ù.

 */

function cfGetItemListSelect(){



	var stepOneText 	= document.getElementById("siDoSelectBox").options[document.getElementById("siDoSelectBox").selectedIndex].text;

	var stepTwoText 	= document.getElementById("guSelectBox").options[document.getElementById("siDoSelectBox").selectedIndex].text;

	var stepThreeText	= document.getElementById("dongSelectBox").text;

	

	var stepOneValue 	= document.getElementById("siDoSelectBox").value;

	var stepTwoValue 	= document.getElementById("guSelectBox").value;

	var stepThreeValue 	= document.getElementById("dongSelectBox").value;

	

	window.opener.mainItemTitle =stepOneText;

	window.opener.mainItemType = "0"; // ÀÏ¹ÝÅë°è

	window.opener.mainItemQuery = stepThreeValue;

	window.opener.mainItemFullTitle = stepOneText + " > " + stepTwoText + " > " + mainItemTitle;

	

	//alert(mainItemTitle+"\n"+mainItemQuery+"\n"+mainItemFullTitle+"\n"+idx);

}
