var ajax=new Object();


//alert(1)
/*--- content loader object for cross-browser requests ---*/
ajax.ContentLoader=function(){


}
var _cols=new Array();

var favorite_div_click=new Array();
var favorite_div_no;
var favorite_page_total;
var favorite_page_num;
var favorite_page_this;
var favorite_div=new Array();



EPSN.favorite={
	
	submit:function(url,method,param,f,page,type){
	
		var d;
		$.ajax({
			type: method,
			url: url,
			data: param ,
			timeout: 10000,
			dataType: type ,
			beforeSend:function(){

				$("#leftpanel").block('<b><img src="img/loading.gif"> Loading... </b>');
			},
			complete: function(){
				//$("#findResult").animate({opacity: "show" }, { duration: "slow" })
				//alert(d)
				if (d==true){
					
				}else{
					
					$("#leftpanel").unblock();
				
				}

			},
			error: function(msg){
				$("#leftpanel").block('<b>Network Error</b><br><img src=img/close_button.gif onclick=$("#leftpanel").unblock() style=cursor:pointer; align=absmiddle>', { border: '1px solid #E0E0E0',width:'300px' },{a:setTimeout('$("#leftpanel").unblock()',"3000")});

			},
			success: function(aa){
				d=eval("EPSN.favorite." + f)(aa);
			}



		})
	
	}
	,submit_basic:function(url,method,param,f,page,type){
	
		var d;
		$.ajax({
			type: method,
			url: url,
			data: param ,
			timeout: 10000,
			dataType: type ,
			beforeSend:function(){

				$("#contents_basic").block('<b><img src="img/loading.gif"> Loading... </b>');
			},
			complete: function(){
				//$("#findResult").animate({opacity: "show" }, { duration: "slow" })
				//alert(d)
				if (d==true){
					
				}else{
					
					$("#contents_basic").unblock();
				
				}

			},
			error: function(msg){
				$("#contents_basic").block('<b>Network Error</b><br><button onclick=$("#contents_basic").unblock()>close</button>', { border: '1px solid #E0E0E0',width:'300px' },{a:setTimeout('$("#contents_basic").unblock()',"3000")});

			},
			success: function(aa){
				d=eval("EPSN.contents." + f)(aa);
			}



		})
	
	}
	,submit_contents:function(url,method,param,f,page,type){
	
		var d;
		$.ajax({
			type: method,
			url: url,
			data: param ,
			timeout: 10000,
			dataType: type ,
			beforeSend:function(){

				$("#contents").block('<b><img src="img/loading.gif"> Loading... </b>');
			},
			complete: function(){
				//$("#findResult").animate({opacity: "show" }, { duration: "slow" })
				//alert(d)
				if (d==true){
					
				}else{
					
					$("#contents").unblock();
				
				}

			},
			error: function(msg){
				$("#contents").block('<b>Network Error</b><br><button onclick=$("#contents").unblock()>close</button>', { border: '1px solid #E0E0E0',width:'300px' },{a:setTimeout('$("#contents").unblock()',"3000")});

			},
			success: function(aa){
				d=eval("EPSN.favorite." + f)(aa);
			}



		})
	
	}
	,submit1:function(url,method,param,f,page,type){
	
		var d;
		$.ajax({
			type: method,
			url: url,
			data: param ,
			timeout: 10000,
			dataType: type ,
			beforeSend:function(){

				$("#mappanel").block('<b><img src="img/loading.gif"> Loading... </b>');
			},
			complete: function(){
				//$("#findResult").animate({opacity: "show" }, { duration: "slow" })
				//alert(d)
				if (d==true){
					
				}else{
					$("#mappanel").unblock();
				}
			},
			error: function(msg){
				$("#mappanel").block('<b>Network Error</b><br><button onclick=$("#mappanel").unblock()>close</button>', { border: '1px solid #E0E0E0',width:'300px' },{a:setTimeout('$("#mappanel").unblock()',"3000")});

			},
			success: function(aa){
				d=eval("EPSN.favorite." + f)(aa);
			}

		})
	
	}
	,favorite_list:function(json){
	
		var a=eval(json)

		favorite_div=_gel('favorite_div1');

		favorite_div.innerHTML="";
		for (var i=0; i<a.length; i++)
		{
				if (!a[i].nno) continue;
				favorite_div[i]=document.createElement("div");
				favorite_div[i].setAttribute('id',"favorite_div1_"+i);
				favorite_div[i].setAttribute('nno',a[i].nno);
				favorite_div[i].setAttribute('sno',a[i].sno);
				favorite_div[i].setAttribute('cate',decodeURIComponent(a[i].cate));
				favorite_div[i].setAttribute('fno',a[i].fno);
				favorite_div[i].setAttribute('name',a[i].fno);
				favorite_div[i].setAttribute('inhtml',"<table width=100% height='16px' border=0 cellpadding=0 cellspacing=0 onclick=EPSN.favorite.favorite_eplist('favorite_div1_"+i+"',"+a[i].nno+",1)><tr><td id=favorite_div1_"+i+"_h><span id=favorite_div1_"+i+"_t ><img src='img/favorite/folder_icon.gif' align=absmiddle id=favorite_img_"+i+">&nbsp;"+decodeURIComponent(a[i].cate)+"</span> ("+a[i].fno+")</td></tr></table>");

				favorite_div[i].style.cursor="hand";
				if (i<6) {
					favorite_div.appendChild(favorite_div[i]);
				}
				
				favorite_div[i].innerHTML="<table width=100% height='16px' border=0 cellpadding=0 cellspacing=0 onclick=EPSN.favorite.favorite_eplist('favorite_div1_"+i+"',"+a[i].nno+",1)><tr><td id=favorite_div1_"+i+"_h><span id=favorite_div1_"+i+"_t ><img src='img/favorite/folder_icon.gif' align=absmiddle  id=favorite_img_"+i+">&nbsp;"+decodeURIComponent(a[i].cate)+"</span> ("+a[i].fno+")</td></tr></table>";
		}


		favorite_page_total=i;
		favorite_page_this=1
		favorite_page_num=Math.ceil(favorite_page_total/6)
		_gel('favorite_menu_cnt').innerHTML="<b style='color:#474747'>1/"+favorite_page_num+"</b>";
	
	}
	,favorite_list_edit:function(json){
	
		var a=eval(json)
		var favorite_div=_gel('favorite_div1');

		favorite_div.innerHTML="";
		for (var i=0; i<a.length; i++)
		{
				if (!a[i].nno) continue;

				favorite_div[i]=document.createElement("div");
				favorite_div[i].setAttribute('id',"favorite_div1_"+i);
				favorite_div[i].setAttribute('nno',a[i].nno);
				favorite_div[i].setAttribute('sno',a[i].sno);
				favorite_div[i].setAttribute('cate',decodeURIComponent(a[i].cate));
				favorite_div[i].setAttribute('fno',a[i].fno);
				favorite_div.appendChild(favorite_div[i]);
				favorite_div[i].innerHTML="<table width=100% height='16px' border=0 cellpadding=0 cellspacing=0><tr><td id=favorite_div1_"+i+"_h><span id=favorite_div1_"+i+"_t><img src='img/favorite/folder_icon.gif' align=absmiddle>&nbsp;"+decodeURIComponent(a[i].cate)+"</span> ("+a[i].fno+")</td></tr></table>";

				if (!favorite_div_no)
				{
					favorite_div_no=a[i].nno;
				
				}else{
					favorite_div_no=parseInt(favorite_div_no)<parseInt(a[i].nno)?parseInt(a[i].nno):parseInt(favorite_div_no);
			
				}

				//a!=""?":":"";
		}
		dim=document.createElement("div");
		dim.setAttribute('id',"dim");

		favorite_div.appendChild(dim);
		ax=false;
		_cols=[favorite_div];
		aH(_cols);

	
	}
	,savediv:function(){
		var divname=_gel('favorite_div1');
		var a="";
		divname_count=divname.childNodes.length;

		for(i=0;i<divname_count-1;i++){

			a+=divname.childNodes[i].getAttribute('nno') +"||||"+divname.childNodes[i].getAttribute('sno')+"||||"+divname.childNodes[i].getAttribute('cate')+"\n"
			
		
		}
		a=encodeURIComponent(a)
		var param="q=" + a;


		//alert(params)
		var method="POST";
		var url="xml/favorite_update.php";
		var f="savediv_result";
		var page=1;
		EPSN.favorite.submit_contents(url,method,param,f,page,"json");

		//var favorite=new ajax.xhr.Request("EXEC/exec_favorite_update.php",params,ajax.ContentLoader.prototype.favorite_menu_list,"POST","");
	}
	,savediv_result:function(json){
		
		if (json.state=="true")
		{
			EPSN.LeftPanelResize('357','resize','favorite')
		}else{
		
			//$("#leftpanel").block('', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#POPUP").unblock()',"1000")});
	
			$("#leftpanel").block('<b>'+decodeURIComponent(json.msg)+'</b><br><img src=img/close_button.gif onclick=$("#leftpanel").unblock() style=cursor:pointer; align=absmiddle>', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#leftpanel").unblock()',"2000")});

		}
		return true
	}
	,favorite_clickno:{
		Ca:""
		,Cno:""
	
	}
	,favorite_eplist:function(a,q,p){
		EPSN.favorite.favorite_clickno.Ca=a;
		EPSN.favorite.favorite_clickno.Cno=q;

		if (a)
		{
			a=_gel(a);
			code_name=_gel('favorite_div1');

			code_count=code_name.childNodes.length;
			for(i=0;i<code_count;i++){
				
				if (a.id==code_name.childNodes[i].id)
				{
					code_name.childNodes[i].style.backgroundColor='#F5FFE9'

					$("#favorite_img_"+i).attr({ "src": "img/favorite/foldericonopen.gif"});

				}else{
					code_name.childNodes[i].style.backgroundColor='#FFFFFF'
					$("#favorite_img_"+i).attr({ "src": "img/favorite/folder_icon.gif"});

				}
				
			}
		}

	//var a=document.getElementById("div2_7");	
	//a.innerHTML=Loadings.list

		var param="q="+q+"&page="+p;
		q_cate=q;
		//var loader1=new ajax.xhr.Request("XML_PHP/favorite_xml_eplist.php",params,ajax.ContentLoader.prototype.favorite_xml_eplist,"GET","");
		var method="POST";
		var url="xml/favorite_eplist.php";
		var f="favorite_eplist_result";
		var page=1;
		//window.open(url+"?"+param)
		EPSN.favorite.submit_contents(url,method,param,f,page,"json");

	}
	,favorite_eplist_result:function(json){
		//alert(EPSN.favorite.favorite_clickno.Cno)
		if (json.count == 0)
		{
			inhtml="<div style='padding:2px'></div><img src='img/icon11.gif' align=absmiddle> <b style='color:#474747'>이포지션 즐겨찾기 결과</b><table cellpadding=0 cellspacing=0 width=325px style='table-layout:fixed;border-left:1px solid #C1DF9D;border-right:1px solid #C1DF9D;border-bottom:1px solid #C1DF9D;border-top:2px solid #9ED260;'>";
			inhtml+="<tr height=30px><td>이포지션이 없습니다</td></tr></table>";
		}else{
			/*
			inhtml="<table cellpadding=0 cellspacing=0 width=335px style='table-layout:fixed'  style='color:#8D8D8D'>";
			inhtml+="<col width=90px >";
			inhtml+="<col width=30px>";
			inhtml+="<col width=145px  >";
			inhtml+="<col width=70px  >";

			inhtml+="<tr height=1px><td colspan=4 bgcolor=#DBDBDB></td></tr>";
			inhtml+="<tr bgcolor=#F9F9F9 height=25px>";
			inhtml+="<td  style='color:#8D8D8D'>이포지션</td>";
			inhtml+="<td  style='color:#8D8D8D'>국가</td>";
			inhtml+="<td  style='color:#8D8D8D'>푯말명</td>";
			inhtml+="<td  style='color:#8D8D8D'>수정/삭제</td>";
			inhtml+="</tr>";
*/


			inhtml="<div style='padding:2px'></div><img src='img/icon11.gif' align=absmiddle> <b style='color:#474747'>이포지션 즐겨찾기 결과</b><table cellpadding=0 cellspacing=0 width=325px style='table-layout:fixed;border-left:1px solid #C1DF9D;border-right:1px solid #C1DF9D;border-bottom:1px solid #C1DF9D;border-top:2px solid #9ED260;'>";
			inhtml+="<col width=20px >";
			inhtml+="<col width=303px>";
			$.each(json.items, function(i,item){
				inhtml+="<tr height=23px>";
				inhtml+="<td><input type=checkbox value='"+item.no+"'  id=nochk"+i+"></td>";
				if (!isUndefined(item.ep_name))
				{
					if (item.name=="")
					{
						//viewpoint(x1,y1,name,T)

						inhtml+="<td><a href=javascript:document.getElementById('mapiframe').contentWindow.MAPS.Control.viewpoint('"+item.x+"','"+item.y+"','푯말없음"+item.memo+"','G')>푯말 없음</a>&nbsp;<img src='img/icon1.gif' align=absmiddle></td>";
					}else{
						inhtml+="<td><a href=javascript:document.getElementById('mapiframe').contentWindow.MAPS.Control.viewpoint('"+item.x+"','"+item.y+"','"+ encodeURIComponent( item.name + "<br>" + item.memo)+"','G')>"+decodeURIComponent(item.name)+"</a>&nbsp;<img src='img/icon1.gif' align=absmiddle></td>";
					}
				
				}else{
					//inhtml+="<td><a href='javascript:EPSN.contents.Contents_Basic1(\""+decodeURIComponent(item.ep_name)+"\",\""+decodeURIComponent(item.do_name)+"\")'>"+decodeURIComponent(item.ep_name)+"#"+decodeURIComponent(item.do_name)+"</a>&nbsp;<img src='img/egosio.gif' align=absmiddle></td>";

					
					if (decodeURIComponent(item.do_name)=="사이사이")
					{
						inhtml+="<td>&nbsp;<img src='img/icon7.gif' align=absmiddle>&nbsp;<a href=javascript:void(0) onclick='window.open(\"http://open.egosio.com/?q="+(item.ep_name)+"%23"+(item.do_name)+"\")'>"+decodeURIComponent(item.ep_name)+"#"+decodeURIComponent(item.do_name)+"</a></td>";
					}else{
						inhtml+="<td>&nbsp;<img src='img/icon7.gif' align=absmiddle>&nbsp;<a href='javascript:EPSN.contents.Contents_Basic1(\""+decodeURIComponent(item.ep_name)+"\",\""+decodeURIComponent(item.do_name)+"\")'>"+decodeURIComponent(item.ep_name)+"#"+decodeURIComponent(item.do_name)+"</a></td>";
					}

				}
								
				inhtml+="</tr>";
				inhtml+="<tr height=1px><td colspan=2><img src='img/favorite_table_bar.gif'></td></tr>";

				//inhtml+= decodeURIComponent(item.ep_id) + "<img src='http://open.egosio.com/img/COUNTRY/"+item.country+".png'>" + " (" + decodeURIComponent(item.ep_name) +") <br>";
			});

			inhtml+="<tr>";
			inhtml+="<td colspan=2>"+ EPSN.favorite.AllPage( json.total , json.page,"EPSN.favorite.favorite_eplist") +"</td>";
			inhtml+="</tr>";
		}
		
		inhtml+="</table><div id=contents_basic></div>";
		//alert(inhtml)
		$("#favoriteeplist").html(inhtml);
		
	}
	,add_save:function(){
		//alert($("#Favorite_Form1").serialize())


		if ($("#select_fav").val()=="")
		{			
			
			$("#mappanel").block('<b>카테고리를 선택하세요</b><br><img src=img/close_button.gif onclick=$("#mappanel").unblock() style=cursor:pointer; align=absmiddle>', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#mappanel").unblock()',"2000")});

			return false
		}


		var param=document.getElementById('mapiframe').contentWindow.$("#Favorite_Form").serialize();
		//var favorite_tempx=$("#favorite_tempx").val();
		//alert(favorite_tempx)
		var method="POST";
		var url="xml/favorite_add.php";
		var f="add_save_result";
		var page=1;
		//window.open(url + "?"+param)

		

		EPSN.favorite.submit1(url,method,param,f,page,"json");
	

	/*
		var cate_select=_gel('select_fav');

		if (epid=="" || epdomain=="" ||cate_select.value=="")
		{
			alert("이동할 카테고리를 선택 해주세요"); return false;
		}


		

		epid=encodeURIComponent(epid);
		epdomain=encodeURIComponent(epdomain);
		params="epid="+epid+"&epdomain="+epdomain+"&q_select="+cate_select.value;

		var option2=new ajax.xhr.Request("EXEC/exec_favorite_add.php",params,ajax.ContentLoader.prototype.favorite_xml_add,"GET","");
	
	*/
	}
	,add_save_result:function(json){
		if (json.state=="true")
		{
			//EPSN.LeftPanelResize('400','resize','favorite');
			$("#mappanel").block('<b>'+decodeURIComponent(json.msg)+'</b><br><img src=img/fmove.gif onclick=LeftPanelWidth=357;EPSN.LeftPanelResize(LeftPanelWidth,"resize","favorite"); style=cursor:hand align=absmiddle> <img src=img/close_button.gif onclick=$("#mappanel").unblock() style=cursor:pointer align=absmiddle>', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#mappanel").unblock()',"2000")});
//Map_remarker
			document.getElementById('mapiframe').contentWindow.Map_remarker()
		}else{
		
			//$("#leftpanel").block('', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#POPUP").unblock()',"1000")});
			$("#mappanel").block('<b>'+decodeURIComponent(json.msg)+'</b><br><img src=img/close_button.gif onclick=$("#mappanel").unblock() style=cursor:pointer; align=absmiddle>', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#mappanel").unblock()',"2000")});

		}
		
		return true
	}
	,favorite_add:function(epid,epdomain,x,y){

		
		if (!USERID.getid.uid)
		{
			OnBlind("",200,100,"loginchk","로그인");
			
		}else{
		
		
			if (_gel('fam_div'))
			{		
			//	_gel('fam_div').parentNode.removeChild(_gel('fam_div'))
			}

			option1="";

			var e=true;
			var a="";
			var s=""
			

			
			//fam=_gel('fam_div');
			//fam.style.left='260px';
			
			if (epid!="")
			{
				innerHTML="<table bgcolor='#FFFFFF' style='border: solid #8B8B8B 1px;'><tr style='padding:10px;' onMouseover=cl(true) onMouseout='cl(false)'><td><select onclick=option_loader() id=select_fav><option>카테고리</option></select></td><td><img src='img/favorite/favorite_bt_submit.gif' align=absmiddle onclick=add_save('"+epid+"','"+epdomain+"') style='cursor:pointer;width:54px;height:19px'><img src='img/favorite/favorite_bt_cancel.gif' align=absmiddle onclick=\"$('#fam_div').hide('slow')\"; style='cursor:pointer'></td></tr></table>";

			}else{
				innerHTML="<table bgcolor='#FFFFFF' style='border: solid #8B8B8B 1px;'>";
				innerHTML+="<tr>";
				innerHTML+="<td><select onclick=option_loader() id=select_fav><option>카테고리</option></select>";
				innerHTML+="<input type='text' id=favorite_tempname>";
				innerHTML+="<textarea style='width:150px;height:200px'></textarea>";
				
				innerHTML+="<br><img src='img/favorite/favorite_bt_submit.gif' align=absmiddle onclick=add_save('"+epid+"','"+epdomain+"') style='cursor:pointer;width:54px;height:19px'>";
				innerHTML+="<img src='img/favorite/favorite_bt_cancel.gif' align=absmiddle onclick=\"$('#fam_div').hide('slow')\"; style='cursor:pointer'></td></tr></table>";
			
			}
			
			//$("#fam_div").html(innerHTML)
		//	innerHTML="22"
			$("#fam_div").show('slow');
			//$("#fam_div").css({"left" : 0,"top":0});
			$("#fam_div").html(innerHTML);
			

			//alert(innerHTML)

			cl=function(bl){
				e=bl
				if (e==false && _gel('fam_div')){
					s=setTimeout("cremovel()","5000");
				}else{
					clearTimeout(s)
				}
			
			}
			cremovel=function(){
				if (e==false && _gel('fam_div')) {
					option1="";
					_gel('fam_div').parentNode.removeChild(_gel('fam_div'))
				}
			}

			add_save=function(){
			
				var cate_select=_gel('select_fav');

				if (epid=="" || epdomain=="" ||cate_select.value=="")
				{
					alert("이동할 카테고리를 선택 해주세요"); return false;
				}


				

				epid=encodeURIComponent(epid);
				epdomain=encodeURIComponent(epdomain);
				params="epid="+epid+"&epdomain="+epdomain+"&q_select="+cate_select.value;

				var option2=new ajax.xhr.Request("EXEC/exec_favorite_add.php",params,ajax.ContentLoader.prototype.favorite_xml_add,"GET","");
			
			}
			

		
		
		
		
		
		
		}
	
	//(epid,epdomain,clickdiv,detail){
	}
	,option_loader:function(){
		



			$.ajax({
					type: "POST",
					url: "xml/favorite_list.php",
					data: "" ,
					timeout: 10000,
					dataType: "json" ,
					beforeSend:function(){
					},
					complete: function(){


					},
					error: function(msg){
					},
					success: function(aa){
						
						option1=aa
						document.getElementById('mapiframe').contentWindow.document.getElementById('select_fav').options.length=0;
						document.getElementById('mapiframe').contentWindow.document.getElementById('select_fav').options[0]=new Option("카테고리","");
							

						for (var i=0; i<option1.length; i++)
						{
							
							newItem=new Option(decodeURIComponent(option1[i].cate));
							newItem.value = option1[i].nno;
							document.getElementById('mapiframe').contentWindow.document.getElementById('select_fav').options.add(newItem,i+1);

						}


					}



				});
	
	

	
	}
	,option_loader1:function(){

		$.ajax({
				type: "POST",
				url: "xml/favorite_list.php",
				data: "" ,
				timeout: 10000,
				dataType: "json" ,
				beforeSend:function(){
				},
				complete: function(){


				},
				error: function(msg){
				
				},
				success: function(aa){
					
					option1=aa
					document.getElementById('select_fav1').options.length=0;
					document.getElementById('select_fav1').options[0]=new Option("카테고리","");
						

					for (var i=0; i<option1.length; i++)
					{
						
						newItem=new Option(decodeURIComponent(option1[i].cate));
						newItem.value = option1[i].nno;
						document.getElementById('select_fav1').options.add(newItem,i+1);

					}


				}



			});
	}
	,option_list:function(json){
	
		option1=json
		document.getElementById('mapiframe').contentWindow.document.getElementById('select_fav').options.length=0;
		document.getElementById('mapiframe').contentWindow.document.getElementById('select_fav').options[0]=new Option("카테고리","");
			

		for (var i=0; i<option1.length; i++)
		{
			
			newItem=new Option(decodeURIComponent(json[i].cate));
			newItem.value = option1[i].nno;
			document.getElementById('mapiframe').contentWindow.document.getElementById('select_fav').options.add(newItem,i+1);

		}
	}
	,option_list1:function(json){
	
		option1=json
		document.getElementById('select_fav1').options.length=0;
		document.getElementById('select_fav1').options[0]=new Option("카테고리","");
		for (var i=0; i<option1.length; i++)
		{
			newItem=new Option(decodeURIComponent(json[i].cate));
			newItem.value = option1[i].nno;
			document.getElementById('select_fav1').options.add(newItem,i+1);

		}
	}
	,favorite_delete_confirm:function(){

		var a="";
		for (var i=0; i<10; i++)
		{

			if (!_gel('nochk'+i)) continue;
			if (_gel('nochk'+i).checked==true)
			{
				if (a=="") a+=_gel('nochk'+i).value;
				else a+=","+_gel('nochk'+i).value;
			}
		
		}

		if (a=="")
		{
			$("#leftpanel").block('<b>삭제할 이포지션을 선택해 주세요</b><br><img src=img/close_button.gif onclick=$("#leftpanel").unblock() style=cursor:pointer; align=absmiddle>', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#leftpanel").unblock()',"2000")});return false;

		}else{

			OnBlind(a,370,150,"favorite_delete","즐겨찾기 삭제");
			
		}
	}
	,favorite_delete:function(a){
		var param="q_array="+a;
		var method="POST";
		var url="xml/favorite_delete.php";
		var f="favorite_delete_result";
		var page=1;
		EPSN.favorite.submit_contents(url,method,param,f,page,"json");

	}
	,favorite_delete_result:function(json){

		//alert(json.state)
		if (json.state=="true")
		{

			$("#leftpanel").unblock()
			//EPSN.LeftPanelResize('400','resize','favorite');
			//$("#mappanel").block('<b>'+decodeURIComponent(json.msg)+'</b><br><button onclick=$("#mappanel").unblock()>close</button>', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#mappanel").unblock()',"2000")});
			
			
			var param="q="+EPSN.favorite.favorite_clickno.Cno+"&page=1";
			
			
			//var loader1=new ajax.xhr.Request("XML_PHP/favorite_xml_eplist.php",params,ajax.ContentLoader.prototype.favorite_xml_eplist,"GET","");
			var method="POST";
			var url="xml/favorite_eplist.php";
			var f="favorite_eplist_result";
			var page=1;
			//window.open(url+"?"+param)
			EPSN.favorite.submit_contents(url,method,param,f,page,"json");

			//Map_remarker()
		}else{
		
			//$("#leftpanel").block('', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#POPUP").unblock()',"1000")});
			$("#leftpanel").block('<b>'+decodeURIComponent(json.msg)+'</b><br><img src=img/close_button.gif onclick=$("#leftpanel").unblock() style=cursor:pointer; align=absmiddle>', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#leftpanel").unblock()',"2000")});

		}
		
		return true
	},AllPage:function(total,page,func){
		listunit=10;
		pageunit=10;
	/*
	var page=1;

	var listunit=10;
	var pageunit=10;

	totalcnt
	*/	
		
		var totpages = Math.ceil(total/listunit); //총페이지수
		var thisblock = Math.ceil(page/pageunit); //현재 페이징블럭
		var startpage, endpage;
		var ret_HTML = "";
		//ct=document.cform.hcate.value
		
		// 현재 페이지블럭의 시작페이지번호
		if(thisblock > 1){
			startpage = (thisblock-1)*pageunit+1;
		}else{
			startpage = 1;
		}
		
		// 현재 페이지블럭의 끝페이지번호
		if( (thisblock*pageunit) >= totpages ){
			endpage = totpages;
		}else{
			endpage = thisblock*pageunit;
		}
		
		ret_HTML = "<table width=100%><TR>";
		ret_HTML += "  <TD align='center' colspan='5' class='paging_td' >";
		
		if(page > 1){
			ret_HTML += "  <A href=javascript:"+func+"('"+EPSN.favorite.favorite_clickno.Ca+"','"+EPSN.favorite.favorite_clickno.Cno+"',1);><img src='img/left_arrow1.gif' align=absmiddle></A>"; 
			
			if (startpage!=1)
			{
				ret_HTML += "  <A href=javascript:"+func+"('"+EPSN.favorite.favorite_clickno.Ca+"','"+EPSN.favorite.favorite_clickno.Cno+"',"+(startpage-1)+");><img src='img/left_arrow.gif' align=absmiddle></A>"; 

			}


		}



		for(i=startpage; i<=endpage; i++){
			if(i!=page){
				ret_HTML += " <A href=javascript:"+func+"('"+EPSN.favorite.favorite_clickno.Ca+"','"+EPSN.favorite.favorite_clickno.Cno+"',"+i+");>"+i+"</A>";
			}else{
				ret_HTML += " <B>"+i+"</B>";
			}
		}
		


		if(page != totpages){
			if (i < totpages)
			{
				ret_HTML += "  <A href=javascript:"+func+"('"+EPSN.favorite.favorite_clickno.Ca+"','"+EPSN.favorite.favorite_clickno.Cno+"',"+(i)+");><img src='img/right_arrow.gif' align=absmiddle></A>"; 

			}
			
			ret_HTML += "  <A href=javascript:"+func+"('"+EPSN.favorite.favorite_clickno.Ca+"','"+EPSN.favorite.favorite_clickno.Cno+"',"+totpages+");><img src='img/right_arrow1.gif' align=absmiddle></A>"; 
		}

		ret_HTML += "  </TD>";
		ret_HTML += "</TR></table>";
		
		return ret_HTML;

	
	}
	,favorite_move:function(){

		option1="";
	//var list_size = document.nochk.elements.length; 
		var e=true;
		var a="";
		var s=""
		
		for (var i=0; i<10; i++)
		{

			if (!_gel('nochk'+i)) continue;

			if (_gel('nochk'+i).checked==true)
			{
				if (a=="") a+=_gel('nochk'+i).value;
				else a+=","+_gel('nochk'+i).value;
			}
			
		}

		for (var i=0; i<10; i++)
		{
			if (!_gel('nochk'+i)) continue;

			if (_gel('nochk'+i).checked==true)
			{
				if (a=="") a+=_gel('nochk'+i).value;
				else a+=","+_gel('nochk'+i).value;
			}
		}

		if (a!=""){

			var innerHTML="<table style='border: solid #8B8B8B 1px;' bgcolor='#E3E3E3' width=170px height=40px><tr style='padding:10px;' onMouseover=c(true) onMouseout='c(false)'><td><select onclick=EPSN.favorite.option_loader1() id=select_fav1><option>카테고리</option></select></td><td><img src='img/favorite/favorite_bt_submit.gif' align=absmiddle  onclick=move_save() style='cursor:pointer'><img src='img/favorite/favorite_bt_cancel.gif' align=absmiddle  onclick=\"$('#fam_div').hide('slow')\"; style='cursor:pointer'></td></tr></table>";

			//b.appendChild(fam);
			//option_loader();

		}else{
			//alert("이동할 이포지션을 선택해 주세요.");return false;
			$("#leftpanel").block('<b>이동할 이포지션을 선택해 주세요</b><br><img src=img/close_button.gif onclick=$("#leftpanel").unblock() style=cursor:pointer; align=absmiddle>', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#leftpanel").unblock()',"2000")});return false;

		}
		
		//var ani_left= $("#thema_img1").offset().left
		//var ani_top= $("#thema_img1").offset().top

		
		$("#fam_div").show('slow');
		
		$("#fam_div").css({"left" : 132,"top":143});
		
		$("#fam_div").html(innerHTML);


		
		c=function(bl){
			e=bl
			if (e==false && _gel('fam_div')){
				s=setTimeout("cremove()","2000");
			}else{
				clearTimeout(s)
			}
		
		}
		cremove=function(){
		//	var b=_gel('favorite_table_div')
			if (e==false && _gel('fam_div')) {
				option1="";
				$("#fam_div").hide('slow');
			}
		}

		move_save=function(){
			//alert(1)
			a="";
			for (var i=0; i<10; i++)
			{

				if (!_gel('nochk'+i)) continue;

				if (_gel('nochk'+i).checked==true)
				{
					if (a=="") a+=_gel('nochk'+i).value;
					else a+=","+_gel('nochk'+i).value;
				}
				
			}
			var cate_select=_gel('select_fav1');

			if (a=="" || cate_select.value=="")
			{
				//alert("이동할 카테고리를 선택 해주세요"); 
				$("#leftpanel").block('<b>이동할 카테고리를 선택해 주세요</b><br><img src=img/close_button.gif onclick=$("#leftpanel").unblock() style=cursor:pointer; align=absmiddle>', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#leftpanel").unblock()',"2000")});return false;

			}
			
			a=encodeURIComponent(a);
			var param="q_array="+a+"&q_select="+cate_select.value;
			var method="POST";
			var url="xml/favorite_moveall.php";
			var f="favorite_move_result";
			var page=1;
			EPSN.favorite.submit_contents(url,method,param,f,page,"json");
		}
		
	}
	,favorite_move_result:function(json){
		if (json.state=="true")
		{

			$("#leftpanel").unblock()
			//EPSN.LeftPanelResize('400','resize','favorite');
			//$("#mappanel").block('<b>'+decodeURIComponent(json.msg)+'</b><br><button onclick=$("#mappanel").unblock()>close</button>', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#mappanel").unblock()',"2000")});
			
			
			var param="q="+EPSN.favorite.favorite_clickno.Cno+"&page=1";
			
			
			//var loader1=new ajax.xhr.Request("XML_PHP/favorite_xml_eplist.php",params,ajax.ContentLoader.prototype.favorite_xml_eplist,"GET","");
			var method="POST";
			var url="xml/favorite_eplist.php";
			var f="favorite_eplist_result";
			var page=1;
			//window.open(url+"?"+param)
			EPSN.favorite.submit_contents(url,method,param,f,page,"json");

			//Map_remarker()
		}else{
		
			//$("#leftpanel").block('', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#POPUP").unblock()',"1000")});
			$("#leftpanel").block('<b>'+decodeURIComponent(json.msg)+'</b><br><img src=img/close_button.gif onclick=$("#leftpanel").unblock() style=cursor:pointer; align=absmiddle>', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#leftpanel").unblock()',"2000")});

		}
	}
	,favorite_list_open:function(json){
		
		
		var fhtml="";
		fhtml1="";
		var vhtml="";
		
		
		fhtml+="<table cellpadding=0 cellspacing=0>";
		fhtml+="<tr><td><img src='img/left_menuboxtop.gif'></td></tr>";

		fhtml+="<tr height=><td></td></tr>";

		$.each(json.lists, function(i,item){
			fhtml1+="<a href=javascript:EPSN.favorite.favorite_eplist_open("+item.nno+",1)>"+decodeURIComponent(item.cate) +"</a> ("+item.fno+") |";
//EPSN.favorite.favorite_eplist('favorite_div1_"+i+"',"+a[i].nno+",1)
		});


		var temp_box="";
		temp_box+="<table cellpadding=0 cellspacing=0>";
		temp_box+="<tr height=52px><td background='img/left_menuboxbg.gif' style='padding-left:55px'><font color=#28598A><b>이포지션광장</b>은 이슈가 되는 카테고리에 마이이포지션을 광장으로 보낼수 있는 누구나 참여할수 있는 공간입니다</font></td></tr>";
		temp_box+="<tr><td><img src='img/left_menuboxbar.gif'></td></tr>";
		temp_box+="<tr><td style='padding:5px'>"+fhtml1+"</td></tr>";
		temp_box+="</table>";

		fhtml+="<tr><td background='img/left_menuboxlinebg.gif' style='padding:5px'>"+temp_box+"</td></tr>"
		fhtml+="<tr><td><img src='img/left_menuboxbottom.gif'></td></tr>";
		fhtml+="</table>";



		vhtml="<div style='padding:5px'></div><img src='img/icon5.gif' align=absmiddle><b style='color:#474747'>이포지션 광장 검색결과</b>";
		vhtml+="<table cellpadding=0 cellspacing=0 width=325px style='table-layout:fixed;border-left:1px solid #ACE2F2;border-right:1px solid #ACE2F2;border-bottom:1px solid #ACE2F2;border-top:1px solid #2EA5C9'  style='color:#8D8D8D'>";


		$.each(json.values, function(j,items){
			
			if (j!=0) vhtml+="<tr height=1px><td align=center><img src='img/open_tablebar.gif'></td></tr>";

			vhtml+="<tr height=23px>";

			if (!isUndefined(items.ep_name))
			{
				

				if (items.name=="")
				{
					//viewpoint(x1,y1,name,T)

					vhtml+="<td>&nbsp;<img src='img/icon6.gif' align=absmiddle>&nbsp;<a href=javascript:document.getElementById('mapiframe').contentWindow.MAPS.Control.viewpoint('"+items.x+"','"+items.y+"','푯말없음"+items.memo+"','G')>푯말 없음</a></td>";
				}else{
					vhtml+="<td>&nbsp;<img src='img/icon6.gif' align=absmiddle>&nbsp;<a href=javascript:document.getElementById('mapiframe').contentWindow.MAPS.Control.viewpoint('"+items.x+"','"+items.y+"','"+ encodeURIComponent( items.name + "<br>" + items.memo)+"','G')>"+decodeURIComponent(items.name)+"</a></td>";
				}
			
			}else{


				if (decodeURIComponent(items.do_name)=="사이사이")
				{
					vhtml+="<td>&nbsp;<img src='img/icon7.gif' align=absmiddle>&nbsp;<a href=javascript:void(0) onclick='window.open(\"http://open.egosio.com/?q="+(items.ep_name)+"%23"+(items.do_name)+"\")'>"+decodeURIComponent(items.ep_name)+"#"+decodeURIComponent(items.do_name)+"</a></td>";
				}else{
					vhtml+="<td>&nbsp;<img src='img/icon7.gif' align=absmiddle>&nbsp;<a href='javascript:EPSN.contents.Contents_Basic1(\""+decodeURIComponent(items.ep_name)+"\",\""+decodeURIComponent(items.do_name)+"\")'>"+decodeURIComponent(items.ep_name)+"#"+decodeURIComponent(items.do_name)+"</a></td>";
				}


			}

			vhtml+="</tr>";


		});
		vhtml+="</table><div style='padding:5px'></div><div id=contents_basic></div>";

		$("#favorite_table_div").html(fhtml);
		$("#favorite_open_list").html(vhtml);

		//favorite_page_total=i;
		//favorite_page_this=1
		//favorite_page_num=Math.ceil(favorite_page_total/6)
		//_gel('favorite_menu_cnt').innerHTML="<font color='#F26522'>1/"+favorite_page_num+"</font>";

	
	}
	,favorite_eplist_open:function(no,p){

	//var a=document.getElementById("div2_7");	
	//a.innerHTML=Loadings.list

		var param="no="+no+"&page="+p;

		var method="POST";
		var url="xml/favorite_eplist_open.php";
		var f="favorite_eplist_open_result";
		var page=1;
		//window.open(url+"?"+param)
		EPSN.favorite.submit_contents(url,method,param,f,page,"json");
	}
	,favorite_eplist_open_result:function(json){
	
		var inhtml="";
		var inhtml1="";
		
		//alert(json.count)
		if (json.count == 0)
		{
			inhtml="<div style='padding:5px'></div><img src='img/icon5.gif' align=absmiddle><b style='color:#474747'>이포지션 광장 검색결과</b>";
			inhtml+="<table cellpadding=0 cellspacing=0 width=325px style='table-layout:fixed;border-left:1px solid #ACE2F2;border-right:1px solid #ACE2F2;border-bottom:1px solid #ACE2F2;border-top:1px solid #2EA5C9'  style='color:#8D8D8D'>";
			inhtml+="<tr><td>이포지션이 없습니다</td></tr></table>";

		}else{
			
			inhtml="<div style='padding:5px'></div><img src='img/icon5.gif' align=absmiddle><b style='color:#474747'>이포지션 광장 검색결과</b>";
			inhtml+="<table cellpadding=0 cellspacing=0 width=325px style='table-layout:fixed;border-left:1px solid #ACE2F2;border-right:1px solid #ACE2F2;border-bottom:1px solid #ACE2F2;border-top:1px solid #2EA5C9'  style='color:#8D8D8D'>";

			
			$.each(json.items, function(i,item){
				
				//alert(1)
//alert(item.nno)
				inhtml+="<tr height=23px>";
				itemno=item.nno
				if (!isUndefined(item.ep_name))
				{
					
					
					
					if (item.name=="")
					{
						//viewpoint(x1,y1,name,T)

						inhtml+="<td>&nbsp;<img src='img/icon6.gif' align=absmiddle>&nbsp;<a href=javascript:document.getElementById('mapiframe').contentWindow.MAPS.Control.viewpoint('"+item.x+"','"+item.y+"','푯말없음"+item.memo+"','G')>푯말 없음</a></td>";
					}else{
						inhtml+="<td>&nbsp;<img src='img/icon6.gif' align=absmiddle>&nbsp;<a href=javascript:document.getElementById('mapiframe').contentWindow.MAPS.Control.viewpoint('"+item.x+"','"+item.y+"','"+ encodeURIComponent( item.name + "<br>" + item.memo)+"','G')>"+decodeURIComponent(item.name)+"</a></td>";
					}
				
				}else{
					if (decodeURIComponent(item.do_name)=="사이사이")
					{
						inhtml+="<td>&nbsp;<img src='img/icon7.gif' align=absmiddle>&nbsp;<a href=javascript:void(0) onclick='window.open(\"http://open.egosio.com/?q="+(item.ep_name)+"%23"+(item.do_name)+"\")'>"+decodeURIComponent(item.ep_name)+"#"+decodeURIComponent(item.do_name)+"</a></td>";
					}else{
						inhtml+="<td>&nbsp;<img src='img/icon7.gif' align=absmiddle>&nbsp;<a href='javascript:EPSN.contents.Contents_Basic1(\""+decodeURIComponent(item.ep_name)+"\",\""+decodeURIComponent(item.do_name)+"\")'>"+decodeURIComponent(item.ep_name)+"#"+decodeURIComponent(item.do_name)+"</a></td>";
					}
					
					
				}
								
				inhtml+="</tr>";
				inhtml+="<tr height=1px><td align=center><img src='img/open_tablebar.gif'></td></tr>";
				//inhtml+= decodeURIComponent(item.ep_id) + "<img src='http://open.egosio.com/img/COUNTRY/"+item.country+".png'>" + " (" + decodeURIComponent(item.ep_name) +") <br>";
			});
			
			//alert(itemno)

			inhtml+="<tr>";
			inhtml+="<td >"+ EPSN.favorite.openpage( json.total , json.page,"EPSN.favorite.favorite_eplist_open",itemno) +"</td>";
			inhtml+="</tr>";

		}
		
		inhtml+="</table><div id=contents_basic></div>";
		//alert(inhtml)
		$("#favorite_open_list").html(inhtml);
		//alert(1)

	}
	,openpage:function(total,page,func,no){
		listunit=10;
		pageunit=10;
	/*
	var page=1;

	var listunit=10;
	var pageunit=10;

	totalcnt
	*/	
		
		var totpages = Math.ceil(total/listunit); //총페이지수
		var thisblock = Math.ceil(page/pageunit); //현재 페이징블럭
		var startpage, endpage;
		var ret_HTML = "";
		//ct=document.cform.hcate.value
		
		// 현재 페이지블럭의 시작페이지번호
		if(thisblock > 1){
			startpage = (thisblock-1)*pageunit+1;
		}else{
			startpage = 1;
		}
		
		// 현재 페이지블럭의 끝페이지번호
		if( (thisblock*pageunit) >= totpages ){
			endpage = totpages;
		}else{
			endpage = thisblock*pageunit;
		}
		
		ret_HTML = "<table width=100%><TR>";
		ret_HTML += "  <TD align='center' colspan='5' class='paging_td' >";
		
		if(page > 1){
			ret_HTML += "  <A href=javascript:"+func+"('"+no+"',1);><img src='img/left_arrow1.gif' align=absmiddle></A>"; 
			
			if (startpage!=1)
			{
				ret_HTML += "  <A href=javascript:"+func+"('"+no+"',"+(startpage-1)+");><img src='img/left_arrow.gif' align=absmiddle></A>"; 

			}


		}


		for(i=startpage; i<=endpage; i++){
			if(i!=page){
				ret_HTML += " <A href=javascript:"+func+"('"+no+"',"+i+");>"+i+"</A>";
			}else{
				ret_HTML += " <B>"+i+"</B>";
			}
		}
		


		if(page != totpages){
			if (i < totpages)
			{
				ret_HTML += "  <A href=javascript:"+func+"('"+no+"',"+(i)+");><img src='img/right_arrow.gif' align=absmiddle></A>"; 

			}
			
			ret_HTML += "  <A href=javascript:"+func+"('"+no+"',"+totpages+");><img src='img/right_arrow1.gif' align=absmiddle></A>"; 
		}

		ret_HTML += "  </TD>";
		ret_HTML += "</TR></table>";
		
		return ret_HTML;

	
	}
}



function favorite_menu_arrow(a){
	
	var favorite_div1=_gel('favorite_div1');

	if (a=="left")
	{
		if (favorite_page_this > 1)
		{	
			favorite_page_this=favorite_page_this-1

			j=(favorite_page_this * 6)-6

			favorite_div1.innerHTML=''
			for (var i=j; i<j+6; i++){
				if (!favorite_div[i]) continue;
				favorite_div[i].innerHTML=favorite_div[i].getAttribute('inhtml')
				favorite_div1.appendChild(favorite_div[i]);
			}
			_gel('favorite_menu_cnt').innerHTML="<font color='#F26522'>"+favorite_page_this +"/"+ favorite_page_num+"</font>";
		}	
		

	}else{
		if (favorite_page_this < favorite_page_num)
		{
			j=favorite_page_this * 6
			favorite_page_this=favorite_page_this+1

			favorite_div1.innerHTML=''
			for (var i=j; i<j+6; i++){
				
				if (!favorite_div[i]) continue;
				favorite_div[i].innerHTML=favorite_div[i].getAttribute('inhtml')
				favorite_div1.appendChild(favorite_div[i]);
			}
			_gel('favorite_menu_cnt').innerHTML="<font color='#F26522'>"+favorite_page_this +"/"+ favorite_page_num+"</font>";
		}	
	}


}
var q_cate;





function _gel(vl){
	return document.getElementById?document.getElementById(vl):null
}

function _gelstn(a){
	return document.getElementsByTagName?document.getElementsByTagName(a):new Array()

}

function _uc(a){
	return a.toUpperCase()
}

function _trim(a){
	return a.replace(/^\s*|\s*$/g,"")
}

function _esc(a){
	return window.encodeURIComponent?encodeURIComponent(a):escape(a)
}

var aO=function(a){ 
	
	return window.decodeURIComponent?decodeURIComponent(a):unescape(a)

};

var _unesc=aO;

function _hesc(a){
	return a.replace(/</g,"&lt;").replace(/>/g,"&gt;")
}

var aN=0;

function _uid(){
	return"obj"+aN++
}




var aI=navigator.userAgent.indexOf("Safari")>=0;

function _sendx(a,aa){
	var ab=aP();
	
	if(!ab||aI&&!aa){
		(new Image()).src=a
	}else{
		ab.open("GET",a,true);
		
		if(aa){
			ab.onreadystatechange=function(){
				if(ab.readyState==4){
					aa(ab.responseText)
				}
			}
		}
		ab.send(null)
	}
}



function aP(){
	var a=null;
	if(window.ActiveXObject){
		a=new ActiveXObject("Msxml2.XMLHTTP");
		if(!a){
			a=new ActiveXObject("Microsoft.XMLHTTP")
		}
	}else 

		if(window.XMLHttpRequest){
			a=new XMLHttpRequest()
		}
return a

}


var _et="";
var _pid="";
var as="/ig/setp";

function an(a,aa,ab){
	var ac=document.createElement("input");
	ac.type="hidden";
	ac.name=aa;
	ac.value=ab;
	a.appendChild(ac)
}


function aF(){
	var a=new Object();
	var aa=document.location.search.substring(1);
	var ab=aa.split("&");
	
	for(var i=0;i<ab.length;i++){
		var ad=ab[i].indexOf("=");
		
		if(ad==-1)continue;
		
		var ae=ab[i].substring(0,ad);
		var af=ab[i].substring(ad+1);
		af=af.replace(/\+/g," ");
		a[ae]=_unesc(af)
	}
return a

}

function ar(){
	var a={pid:1,host:1,hl:1};
	var aa=aF();
	var ab="?";
	for(var ac in aa){
		if(a[ac]){	ab+=ac+"="+_esc(aa[ac])+"&"}
	}
	return ab

}

function _fsetp(a,aa,ab){
	a.action=as;
	a.method="get";
	an(a,"url",document.location);
	an(a,"et",_et);
	an(a,"pid",_pid);
	an(a,"m_"+aa+"_t",ab);
return true

}

function _xsetp(a){
	_sendx(as+ar()+"et="+_et+"&pid="+_pid+"&"+a,null)
}

function _dlsetp(a,aa){
	if(!aa){
		aa=_esc(document.location)
	}
	document.location=as+ar()+"et="+_et+"&pid="+_pid+"&url="+aa+"&"+a
}

function _ssbc(a,aa,ab){
	
	var ac=_gelstn("*");
	
	for(var i=0;i<ac.length;i++){
		if(ac[i].className==a){
			ac[i].style[aa]=ab

		}
	}
}


var aE="";

function _enableGS(a,aa){
	a.action=aE+"/CheckCookie";
	
	a.method="get";
	an(a,"service",aa);
	an(a,"continue",document.location);
	an(a,"skipvpage",true);
	return true
}

function aM(a){
	_xsetp("pnlo="+(a?1:0))
}

var _uli;
var _pnlo;
var _pl;
var _mod;
var az=false;


function _upc(){

	_ssbc("medit","display",_pnlo||_uli?"":"none");
	if(_pl&&(_uli||_pnlo)){
		if(!az){
			aH(_cols);
			az=true
		}
		_ssbc("mttl","cursor","move")
	}
}

var aq=0;
function _tp(a){

	//alert("카테고리 목록을 드래그 해서 순서를 바꾸세요");
	//if(aq>0)clearInterval(ap);
	_pnlo=a;
	_mod=a;
	aM(a);
	//aH(a);
	_upc();

	return false

}


function _tp_(a){

location.reload();

return false
}


function _add_m(a){
	_dlsetp(a)
}

function _add_m_confirm(a,b){
	if(confirm(b)){
		_add_m(a)
	}
}

function _add_f(a){
	_dlsetp("n_25="+_esc("url="+_esc(a)))
}

var aw=/^_add_m(_confirm)?\(\"[^"]+\"(, *\"[^"]+\")?\)$/;



function aD(a){
	var aa=_gel("ffresults");
	if(a.length>0&&a.charAt(0)=="<"){
		aa.innerHTML=a
	}else if(a.match(aw)!=null){
		eval(a)
	}
}


function aB(a){
	var aa=/^alert\(\"[^"]+\"\)$/;
	if(a.match(aw)!=null||a.match(aa)!=null){
		eval(a)
	}
}

var aj=[];
var ap=0;
var am=null;

function ag(){
	
	if(!am){
		am=document.createElement("DIV");
		am.style.display="none";
		am.style.position="absolute";
		am.style.cursor="move";
		am.style.backgroundColor="#ffffff";
		am.style.paddingBottom="0px";

		document.body.appendChild(am)
	}
	return am
}

var al={obj:null,init:function(a){
		a.onmousedown=al.start;
		if(isNaN(parseInt(ag().style.left)))ag().style.left="0px";
		if(isNaN(parseInt(ag().style.top)))ag().style.top="0px";
		a.onDragStart=new Function();
		a.onDragEnd=new Function();
		a.onDrag=new Function();
		a.onclick=new Function();
		
	},start:function(a){
		
		var aa=al.obj=this;
		a=al.fixE(a);
		ag().style.backgroundColor='#F5FFE9'

		var ab=parseInt(ag().style.top);
		var ac=parseInt(ag().style.left);

		aa.onDragStart(ac,ab,a.clientX,a.clientY);
		aa.lastMouseX=a.clientX;
		aa.lastMouseY=a.clientY;
		document.onmousemove=al.drag;
		document.onmouseup=al.end;
		
		return false
	},drag:function(a){
		a=al.fixE(a);
		var aa=al.obj;
		var ab=a.clientY;
		var ac=a.clientX;
		var ad=parseInt(ag().style.top);
		var ae=parseInt(ag().style.left);
		var af,ah;
		af=ae+ac-aa.lastMouseX;
		ah=ad+ab-aa.lastMouseY;
		ag().style.left=af+"px";
		ag().style.top=ah+"px";
		aa.lastMouseX=ac;
		aa.lastMouseY=ab;
		aa.onDrag(af,ah,a.clientX,a.clientY);
		return false
	},click:function(a){
		aa.onclick(1,2);
	},end:function(){
		document.onmousemove=null;
		document.onmouseup=null;
		al.obj.onDragEnd(parseInt(ag().style.left),parseInt(ag().style.top));
		al.obj=null

	},fixE:function(a){
		if(typeof a=="undefined")a=window.event;
		if(typeof a.layerX=="undefined")a.layerX=a.offsetX;
		if(typeof a.layerY=="undefined")a.layerY=a.offsetY;
		return a
	}
};
var ax=false;

function aH(a){
	if(ax)return;
	

	ax=true;
	aj=a;
	for(var i=0;i<aj.length;i++){
		for(var j=0;j<aj[i].childNodes.length;j++){
			
			var ac=aj[i].childNodes[j];
			var ad=_gel(ac.id+"_h");

			if(!ad)continue;
			ad.module=ac;
			al.init(ad);
			var ae=_gel(ac.id+"_url");
			if(ae){
				ae.h=ad;
				ae.onmousedown=function(){
					this.h.href=this.href;
					this.h.target=this.target
				}
			}

			ad.onDragStart=function(af,ah){

				clearInterval(ap);
				
				var ai=this.module
				aC(ai);

				ai.origNextSibling=ai.nextSibling;
				var ak=ag();
				ak.style.left=ao(ai,true);
				ak.style.top=ao(ai,false);

				ak.style.height=ai.offsetHeight;
				ak.style.width=ai.offsetWidth;
				ak.style.display="block";
				ak.style.opacity=0.8;
				ak.style.filter="alpha(opacity=80)";
				ak.innerHTML=ai.innerHTML;
				
				ak.className='div_favorite';
				this.onclick(af,ah);
				this.dragged=false
				
			};
			
			ad.onDrag=function(af,ah){
				aJ(this.module,af,ah);
				this.dragged=true
			};
			
			ad.onclick=function(af,ah){

				code_name=_gel('favorite_div1');
		
				code_count=code_name.childNodes.length;


				for(i=0;i<code_count;i++){
					
					if (this.module.id==code_name.childNodes[i].id)
					{
						favorite_div_click['this']=this.module
						
						code_name.childNodes[i].style.backgroundColor='#F5FFE9'

					}else{
						code_name.childNodes[i].style.backgroundColor='#FFFFFF'
					}
					
				}
				
				_gel('favorite_q').value=this.module.getAttribute('cate')
				

				


			};
			
			ad.onDragEnd=function(af,ah){
				if(this.dragged){
					ap=aG(this.module,150,15)
				}else{
					ay();
					if(this.href){
						if(this.target){
							window.open(this.href,this.target)
						}else{
							document.location=this.href
						}
					}
				}

				this.target=null;
				this.href=null;
				if(this.module.nextSibling!=this.module.origNextSibling){
					aL()
				}

			}
		}
	}
}

function savediv(){

	var divname=_gel('favorite_div1');
	var a="";
	divname_count=divname.childNodes.length;

	for(i=0;i<divname_count-1;i++){

		a+=divname.childNodes[i].getAttribute('nno') +"||||"+divname.childNodes[i].getAttribute('sno')+"||||"+divname.childNodes[i].getAttribute('cate')+"\n"
		
	
	}
	a=encodeURIComponent(a)

	var params="q=" + a;
	var favorite=new ajax.xhr.Request("EXEC/exec_favorite_update.php",params,ajax.ContentLoader.prototype.favorite_menu_list,"POST","");

}

function deldiv(){
	
	
	if (!favorite_div_click['this'])return false;
	var favorite_div=_gel('favorite_div1');
	var del_div=favorite_div_click['this'];
	
	if (del_div.getAttribute('fno')>0)
	{
		//alert('\n※ 삭제 하실 수 없습니다\n------------------------------         \n관련 자료가 존재합니다\n\n먼저 해당 자료를 삭제하셔야 합니다');return false;
	
	$("#contents").block('<b>※ 삭제 하실 수 없습니다<br>관련 자료가 존재합니다\n\n먼저 해당 자료를 삭제하셔야 합니다</b><br><img src=img/close_button.gif onclick=$("#contents").unblock() style=cursor:pointer; align=absmiddle>', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#contents").unblock()',"3000")});return false;

	}else{
	
	favorite_div.removeChild(del_div);
	favorite_div_click['this']=null;
	}
	ax=false;
	_cols=[favorite_div];
	aH(_cols);
}

function  adddiv(){


	favorite_div_no=parseInt(favorite_div_no+1);

	var favorite_div=_gel('favorite_div1');

	var a=document.createElement("div");
	a.setAttribute("id","favorite_div1_"+favorite_div_no)
	a.setAttribute('nno',favorite_div_no);
	a.setAttribute('sno',0);
	a.setAttribute('cate',"미분류추가");
	a.setAttribute('fno',0);
	dim=_gel("dim");
	
	
	a.innerHTML="<table border=0 height='16px' cellpadding=0 cellspacing=0><tr><td id=favorite_div1_"+favorite_div_no+"_h><span id=favorite_div1_"+favorite_div_no+"_t><img src='img/favorite/folder_icon.gif' align=absmiddle>&nbsp;"+a.getAttribute('cate')+"</span> (0)</td></tr></table>";
	favorite_div.insertBefore(a,dim);

	ax=false;
	_cols=[favorite_div];
	aH(_cols);

}

function applyMenu(){
	if (!favorite_div_click['this'])return false;
	
	var a=document.getElementById('favorite_q');

	if (a.value.indexOf("|")!="-1"){
		a.value=a.value.replace("|","",a.value)
		a.focus();
		//alert(" '|'  문자는 사용할수 없습니다 ");
		$("#leftpanel").block('<b>|  문자는 사용할수 없습니다</b><br><img src=img/close_button.gif onclick=$("#leftpanel").unblock() style=cursor:pointer; align=absmiddle>', { border: '1px solid #E0E0E0',width:'200px' },{a:setTimeout('$("#leftpanel").unblock()',"3000")});

		return false;
	}


	favorite_div_click['this'].setAttribute('cate',a.value);
	var b=_gel(favorite_div_click['this'].id+"_t");
	
	b.innerHTML=a.value

}

div_upanddown=function(a){
				
	if (!favorite_div_click['this']) return false;
	
	code_name=_gel('favorite_div1');

	code_count=code_name.childNodes.length;
	//alert(code_count)
	


	for(i=0;i<code_count;i++){
		
		if (favorite_div_click['this'].id==code_name.childNodes[i].id)
		{
			favorite_div_click['this']=favorite_div_click['this']

			if (i==0){
				favorite_div_click['prev']=favorite_div_click['this']
				favorite_div_click['next']=code_name.childNodes[(i+1)]
			}else	if (i==code_count-1){
				favorite_div_click['prev']=code_name.childNodes[(i-1)]
				favorite_div_click['next']=favorite_div_click['this']
			}else{
				favorite_div_click['prev']=code_name.childNodes[(i-1)]
				favorite_div_click['next']=code_name.childNodes[(i+1)]
			}
		}
	}

	favorite_div_click['prev_top']=ao(code_name.childNodes[0],false);
	favorite_div_click['prev_bottom']=ao(code_name.childNodes[(code_count-1)],false);
		
		
	if (a==1){
		if (favorite_div_click['this'].id!=favorite_div_click['prev'].id)	aJ(favorite_div_click['this'],249,favorite_div_click['prev_top']);
	}else if (a==2)	{
		if (favorite_div_click['this'].id!=favorite_div_click['prev'].id)	aJ(favorite_div_click['this'],249,parseInt(ao(favorite_div_click['this'],false)-16));
	}else if (a==3)	{
		if (favorite_div_click['this'].id!=favorite_div_click['next'].id)	aJ(favorite_div_click['this'],249,parseInt(ao(favorite_div_click['this'],false)+16));
	}else if (a==4)	{
		aJ(favorite_div_click['this'],249,favorite_div_click['prev_bottom']);
	}

}


function ay(){
	ag().style.display="none"
}
/*
function clearInterval(){
	[native code]
}
*/
function aG(a,aa,ab){
	//alert(a.id + " " + aa +" - "+ ab)
	var ac=parseInt(ag().style.left);
	var ad=parseInt(ag().style.top);
	var ae=(ac-ao(a,true))/ab;
	var af=(ad-ao(a,false))/ab;
	return setInterval(function(){
		if(ab<1){
			clearInterval(ap);
			ay();
			return
		}
		ab--;
		ac-=ae;
		ad-=af;
		ag().style.left=parseInt(ac)+"px";
		ag().style.top=parseInt(ad)+"px"
	},aa/ab)
}

function aC(a){
	for(var i=0;i<aj.length;i++){
		var ab=0;
		for(var ac=0;ac<aj[i].childNodes.length;ac++){
			var ad=aj[i].childNodes[ac];
			if(ad==a)ab=ad.offsetHeight;
			ad.pagePosLeft=ao(ad,true);
			ad.pagePosTop=ao(ad,false)-ab
		}
	}
}

function ao(a,aa){
	var ab=0;
	while(a!=null){
		ab+=a["offset"+(aa?"Left":"Top")];
		a=a.offsetParent
	}
	return ab
}

function aJ(a,aa,ab){
	var ac=null;
	var ad=100000000;
	for(var i=0;i<aj.length;i++){
		for(var af=0;af<aj[i].childNodes.length;af++){
			var ah=aj[i].childNodes[af];
			if(ah==a)continue;
			var ai=Math.sqrt(Math.pow(aa-ah.pagePosLeft,2)+Math.pow(ab-ah.pagePosTop,2));
			if(isNaN(ai))continue;
			if(ai<ad){ad=ai;ac=ah}
		}
	}
	if(ac!=null&&a.nextSibling!=ac){
		
		ac.parentNode.insertBefore(a,ac);
		aK(a)
	}
}

function aK(a){
	a.parentNode.style.display="none";
	a.parentNode.style.display=""
}

function aL(){
	var a="";
	for(var i=0;i<aj.length;i++){
		for(var ab=0;ab<aj[i].childNodes.length;ab++){
			var ac=aj[i].childNodes[ab];
			a+=a!=""?":":"";
			a+=ac.id.substring(2)+"_"+ac.parentNode.id.substring(2)
		}
	}
	_xsetp("&mp="+_esc(a))
}