if(mobile_user==null){
	var mobile_user=false;
}
var isPageReload=true;
function getXMLHttpRequest(){
	if(window.ActiveXObject){
	try{
		return new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try{
			return new ActiveXObject("Microsoft.XMLHTTP");
		}catch(e1) {
			return null;
		}
	}
	}else if(window.XMLHttpRequest){
		return new XMLHttpRequest();
	}else{
		return null;
	}
}
var ajaxLoader = new Array();
var httpRequest = null;
var httpRequests = new Array();
function sendRequest(url, params, callback, method, ida){
	if(ida==null){
		httpRequest = getXMLHttpRequest();
	}else{
		httpRequests[ida] = getXMLHttpRequest();
	}
	var httpMethod = method ? method : 'GET';
	if (httpMethod != 'GET' && httpMethod != 'POST') {
		httpMethod = 'GET';
	}
	var httpParams = (params == null || params == '') ? null : params;
	var httpUrl = url;
	if (httpMethod == 'GET' && httpParams != null) {
		httpUrl = httpUrl + "?" + httpParams;
	}
	if(ida==null){
		httpRequest.open(httpMethod, httpUrl, true);
		httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		httpRequest.onreadystatechange = callback;
		httpRequest.send(httpMethod == 'POST' ? httpParams : null);
	}else{
		httpRequests[ida].open(httpMethod, httpUrl, true);
		httpRequests[ida].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		httpRequests[ida].onreadystatechange = function(){callback(ida);};
		httpRequests[ida].send(httpMethod == 'POST' ? httpParams : null);
	}
}

function mOpen(url,name,attributes,txts,property){
	var a=window.open(url,name,attributes);
	if(a==null){
		mAlert('회원님께 키쉬닷컴 다른 회원에게서 쪽지가 도착하였으나 팝업차단이 걸려있어서 오픈하지 못하였습니다. 팝업차단을 해제하시고 나의정보의 받은 쪽지함을 통해 쪽지를 확인하시기 바랍니다.',property,'');
	}
}
function mAlertAjax(ida){
	if(httpRequests[ida].readyState == 4){
		if(httpRequests[ida].status == 200){
			txts=httpRequests[ida].responseText;
			mAlert(txts);
		}
	}
}
function mAlert(txts,property,page){
	if(txts==null || txts==''){
		if(page==null || page==''){ page="alerts"; }
		sendRequest("/K/LanguageLoader.php","page="+page+"&property="+property,mAlertAjax,"GET",httpRequests.length);
	}else{
		alert(txts);
	}
}

var listenerChecker='';
var nowUserObj='';
var evt=new Array();
var UID=new Array();
if(parent.document.getElementById('loginFrame')!=null){
	documents=parent.document;docum='y';
	parent.SVCMSGNUM=0;
	SVCMSGNUMS=parent.SVCMSGNUM;
}else{
	documents=document;docum='n';
	SVCMSGNUM=0;
	SVCMSGNUMS=SVCMSGNUM;
	if(window.addEventListener){
		window.addEventListener('load',makeMSGBOX,false); 
	}else if(window.attachEvent){
		window.attachEvent('onload',makeMSGBOX); 
	}
}


function makeMSGBOX(){
	if(documents.getElementById("SVCMSGBOX")==null){
		a=documents.createElement("div");
		a.id="SVCMSGBOX";
		a.style.cssText='position:absolute;z-index:10000;display:none;top:0;left:0;font-weight:bold;padding:3px;color:white;background-color:#aa0000;';
		documents.body.appendChild(a);
	}
}
function MSGPRINT(msg){
	try{
		SVCMSGNUMS=SVCMSGNUMS+1;
		documents.getElementById("SVCMSGBOX").style.top='0px';
		documents.getElementById("SVCMSGBOX").style.left='0px';
		documents.getElementById("SVCMSGBOX").innerHTML=msg;
		documents.getElementById("SVCMSGBOX").style.display='';
		documents.getElementById("SVCMSGBOX").style.top=(documents.documentElement.scrollTop||documents.body.scrollTop)+'px';
		documents.getElementById("SVCMSGBOX").style.left=((documents.documentElement.scrollWidth||documents.body.scrollWidth)-documents.getElementById("SVCMSGBOX").offsetWidth)+'px';
	}catch(e){ setTimeout('MSGPRINT("'+msg+'");',200); }
}
function MSGCLOSE(){
	if(SVCMSGNUMS>0){
		SVCMSGNUMS=SVCMSGNUMS-1;
	}
	try{
		if(SVCMSGNUMS==0){
			documents.getElementById("SVCMSGBOX").style.display='none';
		}
	}catch(e){ setTimeout('MSGCLOSE();',200); }
}


/*Profile Loader*/
function usr_profile(idx,e,ids){
	if(idx!='' && idx!=null && idx!='undefined'){
		nowUserObj=idx;
		evt['x']=e.clientX;evt['y']=e.clientY;
		if(docum=='y'){
			evt['x']=(e.pageX||e.x)+documents.getElementById('loginFrame').offsetLeft-parseInt(documents.documentElement.scrollLeft||documents.body.scrollLeft);
			evt['y']=(e.pageY||e.y)+documents.getElementById('loginFrame').offsetTop-parseInt(documents.documentElement.scrollTop||documents.body.scrollTop);
		}
	}
	if(function_exists('uPA')){
		uPA();
	}else{
		if(ajaxLoader['uPA']==null || ajaxLoader['uPA']=='undefined' || ajaxLoader['uPA']==''){
			MSGPRINT("U.S Loading...");
			scripts=document.createElement("script");
			scripts.type="text/javascript";
			scripts.src='/view/scripts/user_contextMenu.js';
			document.getElementsByTagName('head')[0].appendChild(scripts); 
			ajaxLoader['uPA']=true;
		}
		if(ajaxLoader['uPA']==true){
			setTimeout("usr_profile();",100);
		}
	}
}
/*Language Loader*/
var tmplang=new Array();
function languageObjInsert(page,idx,ids,values){
	if(page!='' && page!=null && page!='undefined'){
		tmplang['page']=page;
		tmplang['idx']=idx;
		tmplang['ids']=ids;
		tmplang['values']=values;
	}
	if(function_exists('lOIA')){lOIA();}else{
		if(ajaxLoader['lOIA']==null || ajaxLoader['lOIA']=='undefined' || ajaxLoader['lOIA']==''){
			MSGPRINT("L.S Loading...");
			scripts=document.createElement("script");
			scripts.type="text/javascript";
			scripts.src='/view/scripts/languageObject.js';
			document.getElementsByTagName('head')[0].appendChild(scripts); 
			ajaxLoader['lOIA']=true;
		}
		if(ajaxLoader['lOIA']==true){
			setTimeout("languageObjInsert();",100);
			MSGCLOSE();
		}
	}
}
/*Languages Loader*/
var tmplang_thing;
function languageObjsInsert(things){
	if(things!='' && things!=null && things!='undefined'){tmplang_things=things;}
	if(function_exists('lOsIA')){
		lOsIA();
	}else{
		if(ajaxLoader['lOIA']==null || ajaxLoader['lOIA']=='undefined' || ajaxLoader['lOIA']==''){
			MSGPRINT("L.S Loading...");
			scripts=document.createElement("script");
			scripts.type="text/javascript";
			scripts.src='/view/scripts/languageObject.js';
			document.getElementsByTagName('head')[0].appendChild(scripts); 
			ajaxLoader['lOIA']=true;
		}
		if(ajaxLoader['lOIA']==true){
			setTimeout("languageObjsInsert();",100);
			MSGCLOSE();
		}
	}
}

function function_exists(funcName){ 
   if(typeof window[funcName]=='function'){
	   return true;
   }else if(typeof window[funcName]=='' || typeof window[funcName]==null || typeof window[funcName]=='undefined'){
	   return false;
   }
} 

/*Session Checker*/
function sessionCHKER(){
	sendRequest("/common/user/sessionChker.xhtml","",sessionV,"GET",httpRequests.length);
	listenerChecker='sessionTC';
}
function sessionV(ida){
	if(httpRequests[ida].readyState == 4){
		if(httpRequests[ida].status == 200){
			t=httpRequests[ida].responseText.split("|zzazz|");
			for(i=0;i<t.length;i++){
				tx=t[i].split("|");
				if(tx[0]!=''){
					if(tx[0].indexOf('MSG')!=-1){
						mOpen("/common/message/readMessage.xhtml?idx="+tx[1],"MSG_"+tx[1],"width=400,height=430");
					}
				}
			}
		}
	}
}
sessionS=0;
function sessionTC(){
	if(sessionS%10==0){
		sessionCHKER();
	}
	MSGCLOSE();
	sessionS++;
	setTimeout("sessionTC();",1000);
}
if(docum=='n'){sessionTC();}

/*User Cache Clean*/
function showActive(){
	if(document.activeElement.nodeName!='INPUT' && document.activeElement.nodeName!='TEXTAREA' && document.activeElement.nodeName!='IFRAME'){
		if(isPageReload==true){
			location.reload();
		}
	}
	setTimeout("showActive()",600000);
}setTimeout("showActive()",600000);

function getCookie(name){
	var search = name + '=';
	if(document.cookie.length>0){
		var offset=document.cookie.indexOf(search);
		if(offset!=-1){
			offset+=search.length;
			var end=document.cookie.indexOf(';',offset);
			if(end==-1){end = document.cookie.length;}
			return unescape(document.cookie.substring(offset, end));
		}
	}
	return '';
}
function setCookies(name,value,expiredays){
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/;expires=" + todayDate.toGMTString() + ";";
}
function delCookies(name){
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() - 10 );
	document.cookie = name + "=" + "" + "; path=/;expires=" + todayDate.toGMTString() + ";";
}


function getRealOffsetTop(o){ 
	return o ? o.offsetTop + getRealOffsetTop(o.offsetParent) : 0; 
} 
function getRealOffsetLeft(o){ 
	return o ? o.offsetLeft + getRealOffsetLeft(o.offsetParent) : 0; 
} 
