// declare new variables for each new div that you add, and link to the div by ID
// var region_div = document.getElementById("region_div");
var doc = null;

function ajax() {
	// Make a new XMLHttp object

    if (window.XMLHttpRequest) {
        try {
            doc = new XMLHttpRequest();
        } catch(e)  {}
    } else if (window.ActiveXObject) {
        try {
            doc = new ActiveXObject('Msxml2.XMLHTTP');
        } catch(e)  {
          try {
              doc = new ActiveXObject('Microsoft.XMLHTTP');
          } catch(e)  {}
        }
    }
}




function CheckAvail(argUserID){


		ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!
	    if (doc){
	       //destination.innerHTML = "Loading data...";
	       doc.open("GET", "../process/location.asp?section=valid_userid&userid="+argUserID, false);
	       doc.send(null);
	    	// Write the response to the div

			//document.getElementById('user_available').innerHTML = doc.responseText;
			//alert(arraylist[0]);

          //  alert(doc.responseText);

			if(doc.responseText==0) 	{
				document.getElementById('txt_userid_div').innerHTML = "<font color='red'>»ç¿ë°¡´ÉÇÑ ¾ÆÀÌµð ÀÔ´Ï´Ù.</font>";
				document.XForm.isUID.value = "Y"
				return false;
			}  else if(doc.responseText==1) {
				document.getElementById('txt_userid_div').innerHTML = "<font color='red'>±âÁ¸¿¡ Á¸ÀçÇÏ´Â ¾ÆÀÌµð ÀÔ´Ï´Ù.</font>";
				document.XForm.isUID.value = "N"
				return false;
            }  else if(doc.responseText==2) {
				document.getElementById('txt_userid_div').innerHTML = "<font color='red'>¶ç¾î ¾²±â¾ø´Â ¿µ¹®, ¼ýÀÚ·Î¸¸ 5ÀÚ~12ÀÚ ÀÌ³»·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä.</font>";
				document.XForm.isUID.value = "N"
				return false;
			}  else	{
				document.getElementById('txt_userid_div').innerHTML = "<font color='red'>ÀûÇÕÇÑ Á¤º¸°¡ ¾Æ´Õ´Ï´Ù.</font>";
				document.XForm.isUID.value = "N"
				return false;
			}


		}

	}



function ChoiceCourses(argObj){


		ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!


		var codeID = document.getElementById('codeID').value;


	    if (doc){
	       //destination.innerHTML = "Loading data...";
	        doc.open("GET", "../process/location.asp?section=choice_courses&codeID="+codeID, false);
	        doc.send(null);


			    var mainarraylist=doc.responseText.split("***");

				if (parseInt(mainarraylist[3]) <= parseInt(mainarraylist[4]) )  {
					  alert("¼ö°­ÀÎ¿øÀÌ ¸ðµÎ ¸ðÁýµÇ¾ú½À´Ï´Ù. °ü¸®ÀÚ¿¡°Ô ¹®ÀÇÇØÁÖ¼¼¿ä.");
				}

				document.getElementById('startDate').value       = mainarraylist[0];
				document.getElementById('crPriceFormat').value   = mainarraylist[2];
				document.getElementById('crPrice').value         = mainarraylist[1];
				document.getElementById('quotoCnt').value        = mainarraylist[3];
				document.getElementById('applyCnt').value        = mainarraylist[4];
                document.getElementById('eduDate').value         = mainarraylist[0] + " ~ " +  mainarraylist[5];


		}

}



function getPhotoTitle(argID){


		ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!



	    if (doc){
	       //destination.innerHTML = "Loading data...";
	        doc.open("GET", "../process/location.asp?section=photo_title&regID="+argID, false);
	        doc.send(null);

   		    document.getElementById('title_txt').innerHTML = doc.responseText;
		}
}



function sendConfirmMail(argID){



	  if (confirm("¼ö°­È®Á¤ ¸ÞÀÏÀ» º¸³»½Ã°Ú½À´Ï±î?") == false) {
			 return;
		}


	 if (window.XMLHttpRequest) {
        try {
            doc = new XMLHttpRequest();
        } catch(e)  {}
    } else if (window.ActiveXObject) {
        try {
            doc = new ActiveXObject('Msxml2.XMLHTTP');
        } catch(e)  {
          try {
              doc = new ActiveXObject('Microsoft.XMLHTTP');
          } catch(e)  {}
        }
    }
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!
	    if (doc){
	       doc.open("GET", "../process/location.asp?section=registered_mail&regID="+argID, false);
	       doc.send(null);
	    	// Write the response to the div

			if (doc.responseText=="N" )  {
					  alert("¿À·ù! ½Ã½ºÅÛ °ü¸®ÀÚ¿¡°Ô ¹®ÀÇÇØ ÁÖ¼¼¿ä.");
			} else {
	           document.getElementById('div_sendmail_'+argID).innerHTML = doc.responseText;
			}
	    }
}



function checkRealName(){


		ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!


	    var jumin1 = document.getElementById('jumin1').value;
		var jumin2 = document.getElementById('jumin2').value;
		var name = document.getElementById('name').value;
        var reqNum = document.getElementById('reqNum').value;
		//var name = document.getElementById('name').value;



	    if (doc){
	       //destination.innerHTML = "Loading data...";
	        doc.open("GET", "../process/location.asp?section=check_realname&name="+name+"&jumin1="+jumin1+"&jumin2="+jumin2+"&reqNum="+reqNum, false);
	        doc.send(null);

   		        var namelist=doc.responseText.split("***");

				    if (doc.responseText=="N" )  {
							  alert("½Ç¸íÀÎÁõÇÏ½Å ÁÖ¹Î¹øÈ£·Î ¿ì¸®¼ú¾Æ¸§ÅÍ¿¡ ±âÁ¸¿¡ È¸¿ø°¡ÀÔÀÌ µÇ¾î ÀÖ½À´Ï´Ù. È®ÀÎÇØ ÁÖ½Ê½Ã¿ä.");
					} else {

						document.getElementById('reqInfo').value       = namelist[0];
						document.getElementById('ok_url').value        = namelist[1];
					}

				//alert(namelist[0]);
		}
}

