//=====================================================¼¼¼Ç À¯Áö ½Ã°£==============================================//
var xmlHttp;
function createXMLHttpRequest() {
	if(window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}else if(window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
}

function validate() {
	createXMLHttpRequest();
	var date = 0;
	var url = "/refresh.php?birthDate=" + escape(date.value);
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = callback;
	xmlHttp.send(null);
}

var KK=0;

function callback() {
	if(xmlHttp.readyState == 4) {
		if(xmlHttp.status == 200) {
			var userid = xmlHttp.responseXML.getElementsByTagName("userid")[0].firstChild.data;
			var passwd = xmlHttp.responseXML.getElementsByTagName("passwd")[0].firstChild.data;

			callServer_imecha();
			callServer_3dmecha();

			KK++;
		}
	}
}


//==============================¾ÆÀÌ¸ÞÄ«¿¡¼­ Á¤º¸ °¡Á®¿È START========================================//
function callServer_imecha(){
    headElement = document.getElementsByTagName("head").item(0);
    var url = "http://www.imecha.co.kr/blankPopup.html";
    var scriptTag = document.createElement("script");
    scriptTag.setAttribute("id", "JSONScript");
    scriptTag.setAttribute("type", "text/javascript");
    scriptTag.setAttribute("src", url);
    headElement.appendChild(scriptTag);//javascript¸¦ ºñµ¿±â·Î ´Ù¿î·ÎµåÇÏ¿© ÇÔ²² ½Ç·Á¿Â jsonÀÚ·á¸¦ jsonCallback ÇÔ¼ö¸¦ÅëÇØ È­¸é¿¡ Ç¥½ÃÇÒ ¼ö ÀÖµµ·ÏÇÑ´Ù.
}
function callFunction_imecha(receiveData) {
	//window.alert(receiveData.userid1+" && "+receiveData.passwd1);
	if(receiveData.userid1 && receiveData.passwd1) {
		headElement = document.getElementsByTagName("head").item(0);
		oFrame = document.createElement("iframe");
		oFrame.setAttribute("id","3d");
		oFrame.style.width = "0px";
		oFrame.style.height = "0px";
		oFrame.src = "/include/main_login_ps_pjd.php?userid1="+receiveData.userid1+"&passwd1="+receiveData.passwd1+"";
		headElement.appendChild(oFrame);//javascript¸¦ ºñµ¿±â·Î ´Ù¿î·ÎµåÇÏ¿© ÇÔ²² ½Ç·Á¿Â jsonÀÚ·á¸¦ jsonCallback ÇÔ¼ö¸¦ÅëÇØ È­¸é¿¡ Ç¥½ÃÇÒ ¼ö ÀÖµµ·ÏÇÑ´Ù.
		headElement.removeChild(oFrame);
	}
}
//==============================¾ÆÀÌ¸ÞÄ«¿¡¼­ Á¤º¸ °¡Á®¿È END========================================//

//==============================¸ÞÄ«ÇÇ¾Æ¿¡¼­ Á¤º¸ °¡Á®¿È START========================================//
function callServer_3dmecha(){
    headElement = document.getElementsByTagName("head").item(0);
    var url = "http://www.3dmecha.co.kr/blankPopup.html";
    var scriptTag = document.createElement("script");
    scriptTag.setAttribute("id", "JSONScript");
    scriptTag.setAttribute("type", "text/javascript");
    scriptTag.setAttribute("src", url);
    headElement.appendChild(scriptTag);//javascript¸¦ ºñµ¿±â·Î ´Ù¿î·ÎµåÇÏ¿© ÇÔ²² ½Ç·Á¿Â jsonÀÚ·á¸¦ jsonCallback ÇÔ¼ö¸¦ÅëÇØ È­¸é¿¡ Ç¥½ÃÇÒ ¼ö ÀÖµµ·ÏÇÑ´Ù.
}
function callFunction_3dmecha(receiveData) {
	//window.alert(receiveData.userid1+" && "+receiveData.passwd1);
	if(receiveData.userid1 && receiveData.passwd1) {
		headElement = document.getElementsByTagName("head").item(0);

/*		ÀÚ¹Ù½ºÅ©¸³Æ®·Î Ãâ·ÂÇÏ¸é ÁÖ¼ÒÃ¢ÀÇ ÁÖ¼Ò°¡ »õ·Î°íÄ§ µÇÁö ¾Ê´Â´Ù.
		var url = "/include/main_login_ps_pjd.php?userid1="+receiveData.userid1+"&passwd1="+receiveData.passwd1+"";
		var scriptTag = document.createElement("script");
		scriptTag.setAttribute("id", "JSONScript");
		scriptTag.setAttribute("type", "text/javascript");
		scriptTag.setAttribute("src", url);
		headElement.appendChild(scriptTag);
		headElement.removeChild(scriptTag);
*/
		oFrame = document.createElement("iframe");
		oFrame.setAttribute("id","3d");
		oFrame.style.width = "0px";
		oFrame.style.height = "0px";
		oFrame.src = "/include/main_login_ps_pjd.php?userid1="+receiveData.userid1+"&passwd1="+receiveData.passwd1+"";
		headElement.appendChild(oFrame);//javascript¸¦ ºñµ¿±â·Î ´Ù¿î·ÎµåÇÏ¿© ÇÔ²² ½Ç·Á¿Â jsonÀÚ·á¸¦ jsonCallback ÇÔ¼ö¸¦ÅëÇØ È­¸é¿¡ Ç¥½ÃÇÒ ¼ö ÀÖµµ·ÏÇÑ´Ù.
		headElement.removeChild(oFrame);
	}
}
//==============================¸ÞÄ«ÇÇ¾Æ¿¡¼­ Á¤º¸ °¡Á®¿È END========================================//

validate();
setInterval(validate,10000);			// 1000/1000
//=====================================================¼¼¼Ç À¯Áö ½Ã°£==============================================//
