//ÃÊ±â°ª
var authorcounter = 0;
var arrTitle = new Array('Dr.','Prof.','Mr.','Ms.','Student.');
var arrTech = new Array();
//±â¼úºÐ¾ß
arrTech[0] ='Control Theory and Applications|Linear/Nonlinear Control|Adaptive/Robust Control|Identification and Estimation'
arrTech[1] ='Process Systems|Process Control and Monitoring|Process Design and Optimization|Process Automation'
arrTech[2] ='Control Devices and Instruments|Power Electronics|Hydraulic/Pneumatic Systems|Mems and Nano Technology'
arrTech[3] ='Industrial Applications|Automotive Systems|Power Systems|Communication Systems'
arrTech[4] ='Sensors and Signal Processing|Sensors and Instumentation|Signal Processing|Fault Diagnosis'
arrTech[5] ='Navigation, Guidance and Control|Navigation Algorithms|Guidance Technologies|GPS'
arrTech[6] ='Intelligent Systems|Artificial Neural Networks|Fuzzy Systems|Intelligent Control'
arrTech[7] ='Multimedia Systems|Database|Data Fusion|Computer Animation'
arrTech[8] ='Information and Networking|Real-Time Systems|Embedded Systems|Network-based Control Systems'
arrTech[9] ='Robotics and Applications|Robotic Systems and Control|Robot Vision|Virtual Reality'
arrTech[10] ='Manufacturing Systems and Automaiton|Modeling and Simulations|Factory Automation and CIM|Atutomation Network'
arrTech[11] ='Biomedical Engineering Systems|Biomedical Instrumentation|Biomedical Singnal Processing|Bio-Systems and Control'
arrTech[12] ='Others|Others'
arrTech[13] ='Special Session'

//±¹°¡
var country ='Korea|Afghanistan|Albania|Algeria|Andorra|Angola|Antigua and Barbuda|Argentina|Armenia|Australia|Austria|Azerbaijan|Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Belgium|Belize|Benin|Bhutan|Bolivia|Bosnia and Herzegovina|Botswana|Brazil|British Indian Ocean Territory|Brunei Darussalam|Bulgaria|Burkina Faso|Burundi|Cambodia|Cameroon|Canada|Cape Verde|Central African Republic|Chad|Chile|China|Colombia|Comoros|Congo|Costa Rica|Cote d`Ivoire|Croatia (Hrvatska)|Cuba|Cyprus|Czech Republic|Denmark|Djibouti|Dominica|Dominican Republic|Ecuador|Egypt|El Salvador|Equatorial Guinea|Eritrea|Estonia|Ethiopia|Fiji|Finland|France|French Polynesia|Gabon|Gambia|Georgia|Germany|Ghana|Greece|Grenada|Guatemala|Guinea|Guinea-Bissau|Guyana|Haiti|Honduras|Hong Kong|Hungary|Iceland|India|Indonesia|Iran|Iraq|Ireland|Israel|Italy|Jamaica|Japan|Jordan|Kazakhstan|Kenya|Kiribati|Korea|Kuwait|Kyrgyzstan|Laos|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luxembourg|Macedonia|Madagascar|Malawi|Malaysia|Maldives|Mali|Malta|Marshall Islands|Mauritania|Mauritius|Mexico|Micronesia|Moldova|Monaco|Mongolia|Morocco|Mozambique|Namibia|Nauru|Nepal|Netherlands|New Zealand|Nicaragua|Niger|Nigeria|Norway|Oman|Pakistan|Palau|Panama|Papua New Guinea|Paraguay|Peru|Philippines|Poland|Portugal|Puerto Rico|Qatar|Romania|Russian Federation|Rwanda|Saint Kitts and Nevis|Saint Lucia|Saint Vincent and the Grenadines|Samoa|San Marino|Sao Tome and Principe|Saudi Arabia|Senegal|Seychelles|Sierra Leone|Singapore|Slovak Republic|Slovenia|Solomon Islands|Somalia|South Africa|Spain|Sri Lanka|Sudan|Suriname|Swaziland|Sweden|Switzerland|Syria|Taiwan|Tajikistan|Tanzania|Thailand|Togo|Tonga|Trinidad and Tobago|Tunisia|Turkey|Turkmenistan|Tuvalu|Uganda|Ukraine|United Arab Emirates|United Kingdom|United States|Uruguay|Uzbekistan|Vanuatu|Venezuela|Viet Nam|Western Sahara|Yemen|Yugoslavia|Zaire|Zambia|Zimbabwe'
var arrCountry = new Array();
arrCountry = country.split('|');

function chkLogin(){
  var f = document.FORM1;

  if (!(chkInput(f.MEMB_IDEN,'please fill in ID.'))) return;
  if (!(chkInput(f.MEMB_PASS,'enter password.'))) return;

  f.submit();
}

function AddAuthor(last)
{
  var html = '';
  var f = document.FORM1;

  authorcounter = parseInt(f.AUTH_CONT.value);
  if (!last) last = authorcounter +1;

	for (i = authorcounter+1; i <= last; i++)
	{
	  html +='<TABLE ID="T'+ i + '" WIDTH="596" BORDER="0" CELLPADDING="1" CELLSPACING="0" STYLE="border: 1px solid #E1E1E1; border-top: 0px solid white;"><TR>';
	  html +='<TD BGCOLOR="#FFFFFF" STYLE="width:70px; border-right: 1px solid #E1E1E1;">';
	  html +='<SELECT NAME="AUTH_TITL'+ i +'" STYLE="width:70px">';
	  for (var j = 0; j < arrTitle.length; j++) html +='<OPTION VALUE="'+ arrTitle[j] +'">'+ arrTitle[j] +'</OPTION>';

	  html +='</SELECT></TD>';
	  html +='<TD BGCOLOR="#FFFFFF" STYLE="width:110px; border-right: 1px solid #E1E1E1;">';
	  html +='<INPUT NAME="AUTH_NAMF'+ i +'" TYPE="TEXT" STYLE="width:110px" MAXLENGTH="20">';
	  html +='</TD>';
	  html +='<TD BGCOLOR="#FFFFFF" STYLE="width:80px; border-right: 1px solid #E1E1E1;">';
	  html +='<INPUT NAME="AUTH_NAMG'+ i +'" TYPE="TEXT" STYLE="width:90px" MAXLENGTH="30">';
	  html +='</TD>';
	  html +='<TD BGCOLOR="#FFFFFF" STYLE="width:100px; border-right: 1px solid #E1E1E1;">';
	  html +='<INPUT NAME="AUTH_MAIL'+ i +'" TYPE="TEXT" STYLE="width:110px" MAXLENGTH="100">';
	  html +='</TD>';
	  html +='<TD BGCOLOR="#FFFFFF" STYLE="width:100px; border-right: 1px solid #E1E1E1;" ALIGN="CENTER">';
	  html +='<INPUT NAME="AUTH_TYP1'+ i +'" TYPE="CHECKBOX" VALUE="1" OnClick="chkAuthor(this)">';
	  html +='</TD>';
	  html +='<TD BGCOLOR="#FFFFFF" STYLE="width:100px;" ALIGN="CENTER">';
	  html +='<INPUT NAME="AUTH_TYP2'+ i +'" TYPE="CHECKBOX" VALUE="2" OnClick="chkAuthor(this)">';
	  html +='</TD>';
	  html +='</TR>';
	  html +='<TR BGCOLOR="#FFFFFF">';
	  html +='<TD COLSPAN="2" STYLE="border-top: 1px solid #E1E1E1;border-right: 1px solid #E1E1E1;">';
	  html +='<INPUT NAME="AUTH_ORGA'+ i +'" TYPE="TEXT" STYLE="width:183px" MAXLENGTH="200">';
	  html +='</TD>';
	  html +='<TD COLSPAN="3" STYLE="border-top: 1px solid #E1E1E1;border-right: 1px solid #E1E1E1;">';
	  html +='<INPUT NAME="AUTH_ADDR'+ i +'" TYPE="TEXT" STYLE="width:296px" MAXLENGTH="500">';
	  html +='</TD>';
	  html +='<TD STYLE="border-top: 1px solid #E1E1E1;">';
	  html +='<SELECT NAME="CUNT_CODE'+ i +'" STYLE="width:90px">';
	  for (var k = 0; k < arrCountry.length; k++) html +='<OPTION VALUE="'+ [k+1] +'">'+ arrCountry[k] +'</OPTION>';

	  html +='</SELECT></TD>';
	  html +='</TR></TABLE>';
	  authorcounter++;
	}
	
  document.all['lstAuthor'].innerHTML += html;
  document.FORM1.AUTH_CONT.value = authorcounter;
}

function AddAuthor2(last)
{
  var html = '';
  var f = document.FORM1;

  authorcounter = parseInt(f.AUTH_CONT.value);
  if (!last) last = authorcounter +1;

	for (i = authorcounter+1; i <= last; i++)
	{
	  html +='<TABLE ID="T'+ i + '" WIDTH="610" BORDER="0" CELLPADDING="1" CELLSPACING="0" STYLE="border: 1px solid #E1E1E1; border-top: 0px solid white;"><TR>';
	  html +='<TD BGCOLOR="#FFFFFF" STYLE="width:70px; border-right: 1px solid #E1E1E1;">';
	  html +='<SELECT NAME="AUTH_TITL'+ i +'" STYLE="width:70px">';
	  for (var j = 0; j < arrTitle.length; j++) html +='<OPTION VALUE="'+ arrTitle[j] +'">'+ arrTitle[j] +'</OPTION>';

	  html +='</SELECT></TD>';
	  html +='<TD BGCOLOR="#FFFFFF" STYLE="width:100px; border-right: 1px solid #E1E1E1;">';
	  html +='<INPUT NAME="AUTH_NAMF'+ i +'" TYPE="TEXT" STYLE="width:100px" MAXLENGTH="20">';
	  html +='</TD>';
	  html +='<TD BGCOLOR="#FFFFFF" STYLE="width:80px; border-right: 1px solid #E1E1E1;">';
	  html +='<INPUT NAME="AUTH_NAMG'+ i +'" TYPE="TEXT" STYLE="width:80px" MAXLENGTH="30">';
	  html +='</TD>';
	  html +='<TD BGCOLOR="#FFFFFF" STYLE="width:90px; border-right: 1px solid #E1E1E1;">';
	  html +='<INPUT NAME="AUTH_MAIL'+ i +'" TYPE="TEXT" STYLE="width:90px" MAXLENGTH="100">';
	  html +='</TD>';
	  html +='<TD BGCOLOR="#FFFFFF" STYLE="width:95px; border-right: 1px solid #E1E1E1;" ALIGN="CENTER">';
	  html +='<INPUT NAME="AUTH_TYP1'+ i +'" TYPE="CHECKBOX" VALUE="1" OnClick="chkAuthor(this)">';
	  html +='</TD>';
	  html +='<TD BGCOLOR="#FFFFFF" STYLE="width:90px; border-right: 1px solid #E1E1E1;" ALIGN="CENTER">';
	  html +='<INPUT NAME="AUTH_TYP2'+ i +'" TYPE="CHECKBOX" VALUE="2" OnClick="chkAuthor(this)">';
	  html +='</TD>';	  
	  html +='<TD BGCOLOR="#FFFFFF" STYLE="width:85px;" ALIGN="CENTER">';
	  html +='<INPUT NAME="AUTH_CHAI'+ i +'" TYPE="CHECKBOX" VALUE="1" OnClick="chkChai(this)">';
	  html +='</TD>';
	  html +='</TR>';
	  html +='<TR BGCOLOR="#FFFFFF">';
	  html +='<TD COLSPAN="2" STYLE="border-top: 1px solid #E1E1E1;border-right: 1px solid #E1E1E1;">';
	  html +='<INPUT NAME="AUTH_ORGA'+ i +'" TYPE="TEXT" STYLE="width:170px" MAXLENGTH="200">';
	  html +='</TD>';
	  html +='<TD COLSPAN="4" STYLE="border-top: 1px solid #E1E1E1;border-right: 1px solid #E1E1E1;">';
	  html +='<INPUT NAME="AUTH_ADDR'+ i +'" TYPE="TEXT" STYLE="width:355px" MAXLENGTH="500">';
	  html +='</TD>';
	  html +='<TD STYLE="border-top: 1px solid #E1E1E1;">';
	  html +='<SELECT NAME="CUNT_CODE'+ i +'" STYLE="width:85px">';
	  for (var k = 0; k < arrCountry.length; k++) html +='<OPTION VALUE="'+ [k+1] +'">'+ arrCountry[k] +'</OPTION>';

	  html +='</SELECT></TD>';
	  html +='</TR></TABLE>';
	  authorcounter++;
	}
	
  document.all['lstAuthor'].innerHTML += html;
  document.FORM1.AUTH_CONT.value = authorcounter;
}

function cboPresentation(arg1)
{
  var f = document.FORM1;
  for (var i = 0; i < f.ABST_TYPE.length; i++) {
    if (arg1 == f.ABST_TYPE.options[i].value) f.ABST_TYPE.options[i].selected = true;
  }
}

function cboTech1(arg1) {
  var str = new Array();
  var f = document.FORM1;
  for (var i = 0; i < arrTech.length; i++)
  {
    str = arrTech[i].split('|');
    f.TECH_CODE.options[i+1] = new Option(str[0],i+1);
    if (arg1 == f.TECH_CODE.options[i+1].value) f.TECH_CODE.options[i+1].selected = true;
  }
}

function cboTech2(arg1) {
  var str = new Array();
  var f = document.FORM1;

  for (var i = 0; i < f.TSEC_CODE.length; i++) f.TSEC_CODE.remove(i);
  f.TSEC_CODE.options[0] = new Option('Sub Category','');
  if (f.TECH_CODE.options[0].value == '') f.TSEC_CODE.options[0].selected = true;


  
  if (f.TECH_CODE.selectedIndex == 14) {
		
	//	alert(f.TECH_CODE.selectedIndex);
		
		f.TSEC_CODE.disabled = true;
		f.TSEC_CODS.disabled = false;
		f.TSEC_CODS.focus();
  }
  
  else if (f.TECH_CODE.selectedIndex > 0) {
	if (f.TECH_CODE.selectedIndex != 14){
			f.TSEC_CODE.disabled = false;
			f.TSEC_CODS.disabled = true;
	}
    str = arrTech[f.TECH_CODE.selectedIndex-1].split('|');
    for (var i = 1; i < str.length; i++)
    {
      f.TSEC_CODE.options[i-1] = new Option(str[i],i);
      if (arg1 == f.TSEC_CODE.options[i-1].value) f.TSEC_CODE.options[i-1].selected = true;
    }
  }
}

function cboCountry(arg1)
{
  var f = document.FORM1;
  for (var i = 0; i < arrCountry.length; i++)
  {
    f.CUNT_CODE.options[i] = new Option(arrCountry[i],i+1);
    if (arg1 == f.CUNT_CODE.options[i].value) f.CUNT_CODE.options[i].selected = true;
  }
}

function srchCountry(arg1)
{
  var f = document.FORM1;
  for (var i = 0; i < arrCountry.length; i++)
  {
    f.SRCH_CUNT.options[i] = new Option(arrCountry[i],i+1);
    if (arg1 == f.SRCH_CUNT.options[i].value) f.SRCH_CUNT.options[i].selected = true;
  }
}

function cboTitle(arg1)
{
  var f = document.FORM1;
  for (var i = 0; i < arrTitle.length; i++)
  {
    f.MEMB_TITL.options[i] = new Option(arrTitle[i],arrTitle[i]);
    if (arg1 == f.MEMB_TITL.options[i].value) f.MEMB_TITL.options[i].selected = true;
  }
}

function chkAuthor(arg1)
{
  var f = document.FORM1;
  var name = arg1.name.substring(0,9)
  for (var i = 1; i <= f.AUTH_CONT.value; i++)
  {
    if (name+i != arg1.name) f.elements[name+i].checked = false;
  }
}

function chkChai(arg1)
{
  var f = document.FORM1;
  var name = arg1.name.substring(0,9)

  for (var i = 1; i <= f.AUTH_CONT.value; i++)
  {
    if (name+i != arg1.name) f.elements[name+i].checked = false;
  }
}

function checkid()
{
var f = document.FORM1;
if (!(chkInput(f.MEMB_IDEN,'please fill in ID.',null,6,10))) return;
}  

/*
function checkpass()
{
var f = document.FORM1;
if (!(chkInput(f.MEMB_PASS,'please fill in PASSWORD.',null,5,10))) return;
}  

function checkpass1()
{
var f = document.FORM1;
if (!(chkInput(f.MEMB_REPA,'please fill in REPASSWORD.',null,5,10))) return;
} 
*/   

function AddContributor()
{
  var author1 = author2 = 0;
  var f = document.FORM1;

  if (!(chkInput(f.MEMB_IDEN,'please fill in ID.',null,6,10))) return;
  if (!(chkInputIden(f.MEMB_IDEN))) return;
  if (!(chkInput(f.MEMB_PASS,'enter password.',null,5,10))) return;
  if (!(chkInputComp(f.MEMB_REPA,f.MEMB_PASS,'invalid confirm password'))) return;

  if (!(chkInput(f.MEMB_NAMF,'please fill in family name.'))) return;
  if (!(chkInput(f.MEMB_NAMG,'please fill in given name.'))) return;
  if (!(chkInput(f.MEMB_TELE,'please fill in telephone number.'))) return;
  if (!(chkInput(f.MEMB_MAIL,'please fill in e-mail.'))) return;
  if (!(chkInputMail(f.MEMB_MAIL, 'invalid e-mail.'))) return;
  if (f.CUNT_CODE.value == 'Korea' && f.MEMB_MOBI.value == ''){
    if (!(chkInputMail(f.MEMB_MOBI, 'please fill in cellular phone number.'))) return;
  }

   if (!(chkInput(f.TECH_CODE,'please select a technical area.'))) return;
// if (!(chkInput(f.TSEC_CODE,'please select a technical area.'))) return;
   if (!(chkInput(f.ABST_TITL,'please fill in paper title.'))) return;
// if (!(chkInput(f.ABST_MEMO,'please fill in abstract.',null,5,3000))) return;
// if (!(chkInput(f.ABST_PASS,'enter password of abstract management.'))) return;
// if (!(chkInputComp(f.ABST_REPA,f.ABST_PASS,'invalid confirm password'))) return;

  for (var i = 1; i <= f.AUTH_CONT.value; i++)
  {
    if (f.elements['AUTH_TYP1'+i].checked == true) author1 = 1;
    if (f.elements['AUTH_TYP2'+i].checked == true) author2 = 2;
//ÀúÀÚÁ¤º¸ ÀÔ·ÂÈ®ÀÎ
    if (!(chkInput(f.elements['AUTH_NAMF'+i],'please fill in family name.'))) return;
    if (!(chkInput(f.elements['AUTH_NAMG'+i],'please fill in given name.'))) return;
    if (!(chkInput(f.elements['AUTH_MAIL'+i],'please fill in e-mail.'))) return;
    if (!(chkInputMail(f.elements['AUTH_MAIL'+i], 'invalid e-mail.'))) return;
    if (!(chkInput(f.elements['AUTH_ORGA'+i],'please fill in affiliation.'))) return;
    if (!(chkInput(f.elements['AUTH_ADDR'+i],'please fill in address.'))) return;
  } 

  if (author1 == 0) {
    alert('check corresponding author');
    return;
  }

  if (author2 == 0) {
    alert('check presentation author');
    return;
  }
  
  f.submit();
}

function ModifyAbstract()
{
  var author1 = author2 = 0;
  var f = document.FORM1;

  if (!(chkInput(f.TECH_CODE,'please select a technical area.'))) return;
//  if (!(chkInput(f.TSEC_CODE,'please select a technical area.'))) return;
  if (!(chkInput(f.ABST_TITL,'please fill in paper title.'))) return;
//	if (!(chkInput(f.ABST_MEMO,'please fill in abstract.',null,5,3000))) return;
//  if (!(chkInput(f.ABST_PASS,'enter password of abstract management.'))) return;
//  if (!(chkInputComp(f.ABST_REPA,f.ABST_PASS,'invalid confirm password'))) return;

  for (var i = 1; i <= f.AUTH_CONT.value; i++)
  {
    if (f.elements['AUTH_TYP1'+i].checked == true) author1 = 1;
    if (f.elements['AUTH_TYP2'+i].checked == true) author2 = 2;
//ÀúÀÚÁ¤º¸ ÀÔ·ÂÈ®ÀÎ
    if (!(chkInput(f.elements['AUTH_NAMF'+i],'please fill in family name.'))) return;
    if (!(chkInput(f.elements['AUTH_NAMG'+i],'please fill in given name.'))) return;
    if (!(chkInput(f.elements['AUTH_MAIL'+i],'please fill in e-mail.'))) return;
    if (!(chkInputMail(f.elements['AUTH_MAIL'+i], 'invalid e-mail.'))) return;
    if (!(chkInput(f.elements['AUTH_ORGA'+i],'please fill in affiliation.'))) return;
    if (!(chkInput(f.elements['AUTH_ADDR'+i],'please fill in address.'))) return;
  } 

  if (author1 == 0) {
    alert('check corresponding author');
    return;
  }

  if (author2 == 0) {
    alert('check presentation author');
    return;
  }
  
  f.submit();
}

function ModifyAbstract2()
{
  var author1 = author2 = chai = 0;
  var f = document.FORM1;

 // if (!(chkInput(f.TECH_CODE,'please select a technical area.'))) return;
//  if (!(chkInput(f.TSEC_CODE,'please select a technical area.'))) return;
  if (!(chkInput(f.ABST_TITL,'please fill in paper title.'))) return;
//	if (!(chkInput(f.ABST_MEMO,'please fill in abstract.',null,5,3000))) return;
//  if (!(chkInput(f.ABST_PASS,'enter password of abstract management.'))) return;
//  if (!(chkInputComp(f.ABST_REPA,f.ABST_PASS,'invalid confirm password'))) return;

  for (var i = 1; i <= f.AUTH_CONT.value; i++)
  {
    if (f.elements['AUTH_TYP1'+i].checked == true) author1 = 1;
    if (f.elements['AUTH_TYP2'+i].checked == true) author2 = 2;
//ÀúÀÚÁ¤º¸ ÀÔ·ÂÈ®ÀÎ
    if (!(chkInput(f.elements['AUTH_NAMF'+i],'please fill in family name.'))) return;
    if (!(chkInput(f.elements['AUTH_NAMG'+i],'please fill in given name.'))) return;
    if (!(chkInput(f.elements['AUTH_MAIL'+i],'please fill in e-mail.'))) return;
    if (!(chkInputMail(f.elements['AUTH_MAIL'+i], 'invalid e-mail.'))) return;
    if (!(chkInput(f.elements['AUTH_ORGA'+i],'please fill in affiliation.'))) return;
    if (!(chkInput(f.elements['AUTH_ADDR'+i],'please fill in address.'))) return;
  } 

  if (author1 == 0) {
    alert('check corresponding author');
    return;
  }

  if (author2 == 0) {
    alert('check presentation author');
    return;
  }
  
  f.submit();
}

function checkDelete()
{
  var f = document.FORM1;
  var result = confirm('Are you sure?')
  //dalete
  if (result) f.submit();
}

function checkSearch(page)
{
  var f = document.FORM1;
  var checkinput = 0;

  if (page) f.action = '?MODE_NAME=AbstractSearch1&PAGE_NUMB='+ page;
  if (!(chkSearch(f.SRCH_TITL,5))) return;
  if (!(chkSearch(f.SRCH_IDEN,5))) return;
//  if (!(chkSearch(f.SRCH_MAIL,5))) return;
//  if (!(chkSearch(f.SRCH_NAMF,5))) return;
//	if (!(chkSearch(f.SRCH_NAMG,5))) return;

  for (var i=0; i < f.elements.length; i++)
  {
    if (f.elements[i].value != '') checkinput = 1;
  }
  if (checkinput == 0) return;

  f.submit();
}

//ÀÔ·Â À¯È¿¼º
function chkSearch(inputname, min) {
  var formname = inputname.form.name;
  var inputvalue = inputname.value.toLowerCase();
  if (inputvalue.length > 1 && inputvalue.length < min) {
    //setMsgbox(min +'ÀÚÀÌ»ó '+ max +'ÀÚÀÌÇÏ ¿µ¹®,¼ýÀÚÈ¥ÇÕ¸¸ °¡´ÉÇÕ´Ï´Ù.',null,null,null,formname,inputname.name);
    setMsgbox('must be '+ min +' characters or more',null,null,null,formname,inputname.name);
    return false;
  }

  return true;
}