function CHN_total_search()
{
	var keyword = document.CHN_searchForm.CHN_searchText.value ;

	if (keyword == "" )
	{
		alert("Input more than 2 characters");
		document.CHN_searchForm.CHN_searchText.focus();
		return;
	}
	
	//var chr_flag = korean_check(keyword)
	var sOption = document.CHN_searchForm.CHN_searchOption.value ;

	if (sOption =='ALL' )
	{
		//if (chr_flag == true)
		//{
			//document.CHN_searchForm.action = "http://www.icbank.com/CHN/default.asp?file=search_result.asp"
			//document.CHN_searchForm.submit();
		//}
		//else
		//{
			document.CHN_searchForm.action = "http://www.icbank.com/CHN/default.asp?file=search_result_stock.asp"
			document.CHN_searchForm.submit();
		//}
	}
	else if (sOption == 'stock')
	{	
		document.CHN_searchForm.action= "http://www.icbank.com/CHN/buysell/default.asp?file=stock_search_result.asp&sch=1&keyword="+keyword;
		document.CHN_searchForm.submit();
	}
	//else if (sOption == 'comm')
	//{	
	//		document.CHN_searchForm.action = "http://www.icbank.com/home/default.asp?file=search_result_comm.asp"
	//		document.CHN_searchForm.submit();
	//}	
	//else if (sOption == 'news')
	//{	
	//		document.CHN_searchForm.action = "http://www.icbank.com/home/default.asp?file=search_result_news.asp"
	//		document.CHN_searchForm.submit();
	//}	
	//else if (sOption == 'tech')
	//{	
	//		document.CHN_searchForm.action = "http://www.icbank.com/home/default.asp?file=search_result_tech.asp"
	//		document.CHN_searchForm.submit();
	//}		
	else if (sOption == 'datasheet')
	{	
		document.CHN_searchForm.action = "http://www.icbank.com/CHN/semi/default.asp?file=data_search_result.asp&field=pn&option=1&search_val="+keyword;
		document.CHN_searchForm.submit();
	}	
	//else if (sOption == 'site')
	//{	
	//	document.CHN_searchForm.action= "http://www.icbank.com/semi/default.asp?file=elecSite_search.asp&keyword="+keyword;
	//	document.CHN_searchForm.submit();
	//}		
	//else if (sOption == 'shop')
	//{	
	//	document.CHN_searchForm.action = "http://www.icbank.com/buysell/nshop/default.asp?file=prod_search.asp&search_text="+keyword;
	//	document.CHN_searchForm.submit();
	//}		
	else if (sOption == 'mfg')
	{	
		document.CHN_searchForm.action = "http://www.icbank.com/CHN/semi/default.asp?file=company_search_result.asp&field=mfg&option=1&search_val="+keyword;
		document.CHN_searchForm.submit();
	}		
	else if (sOption == 'agency')
	{
		document.CHN_searchForm.action = "http://www.icbank.com/CHN/semi/default.asp?file=disty_search_result.asp&Field=disty&option=2&search_val="+keyword;
		//document.CHN_searchForm.action = "http://www.icbank.com/semi/default.asp?file=disty_search_result_1.asp&Field=disty&option=2&search_val="+keyword;
		document.CHN_searchForm.submit();
	}	
	//else if (sOption == 'dic')
	//{	
	//	document.CHN_searchForm.action = "http://www.icbank.com/semi/ElecInfo/default.asp?file=elecDic_view.asp&search_val="+keyword;
	//	document.CHN_searchForm.submit();
	//}			
}

function korean_check(str)
{
    var i;
    var ch;
    
    for (i=0;i<str.lCHNth;i++)
    {
        ch = escape(str.charAt(i));        //ISO-Latin-1 ¹®ÀÚ¼ÂÀ¸·Î º¯°æ
        //°¡ ==> %uAC00
        //Èþ ==> %uD79D
            //ÆR ==> %uD7A3
                if (strCharByte(ch) != 1)
                {
                        return true; //ÇÑ±Û
                }
    }
    if (changenum(str) == 1)
    {
    			return false; //¼ýÀÚ Æ÷ÇÔ
    }
    else
    {
	    	return true; //¼ýÀÚ ¹ÌÆ÷ÇÔ
    }
   // return false; //ÇÑ±Û ¾Æ´Ô
    
}


function changenum(instring)
                {
      var pnumresult="";
       for (ic=0; ic<instring.lCHNth; ic++)
       {
          charpnum = instring.substr(ic,1);
          if (charpnum.charCodeAt(0) > 47 && charpnum.charCodeAt(0) < 58)
          {

                     return 1; //¼ýÀÚÀÓ
				 break;
          }
		
       }
	return 2; // ¼ýÀÚ¾Æ´Ô
        //return pnumresult;
     } 
			 
function strCharByte(chStr)
{
        if (chStr.substring(0, 2) == '%u')
        {
                if (chStr.substring(2,4) == '00')
                        return 1;
                else
                        return 2;        //ÇÑ±Û
        }
        else if (chStr.substring(0,1) == '%')
        {
                //alert (parseInt(chStr.substring(1,3), 16));
                if (parseInt(chStr.substring(1,3), 16) > 127)
                        return 2;        //ÇÑ±Û
                else
                        return 1;
        }
        else
        {
                return 1;
        }
}

function check_key()
{
	if (window.event.keyCode == 13)
	{
		CHN_total_search();
	}
}