//»çÀü°ü·Ã

function yp_dic(home)
{
	var isIE = (document.all)? true:false;
	var f = document.getElementById("idsunet");
	if(isIE)
	{
		var doc = document.selection.createRange().text
		if(!doc)
		{
			if(document.frames['idsu'])doc = document.frames['idsu'].document.selection.createRange().text
		}
	}
	else
	{
		var doc = window.getSelection()
	}
	
	if(!doc || doc==false)
	{
		yp_dic_forms(home);
	}
	else
	{
		dicXML(home,doc)
	}
}
function dic_submit_check(home)
{
	var f = document.dic;
	if(!f.dic_key.value)
	{
		alert('»çÀü °Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä');f.dic_key.focus();return false;
	}
	dicXML(home,f.dic_key.value);
	return false;
}
function yp_dic_forms(home)
{
	var f = document.getElementById("yp_tmp");

		f.style.display = "block";
		f.style.width = "300px";
		f.style.height="500px";

		f.style.top = (screen.height+document.body.scrollTop)/2-150;
		f.style.left = (screen.width+document.body.scrollLeft)/2-250;
		t = "<form name=\"dic\" method=\"post\" action=\""+home+"bbs/dic.php\" style=\"display:inline;\" onsubmit=\"return dic_submit_check('"+home+"');\">";
		t += "<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\" bgcolor=\"#8F8F8F\">";
		t += "<tr align=\"center\"><td><a href=\"javascript://\" onclick=\"yp_dic_none()\"><font color=\"#FFFFFF\">»çÀü°Ë»ö</font></a></td></tr>";
		t += "<tr bgcolor=\"#FFFFFF\" align=\"center\"><td>";
		t += "<input type=\"text\" name=\"dic_key\" value=\"\"> <input type=\"submit\" value=\"°Ë»ö\">";
		t += "</td></tr>";
		t += "</table></form>";

		f.innerHTML = t;
		document.dic.dic_key.focus();
}

	var dic_key = new Array(), dic_explan = new Array();

	function dicXML(home,dic_key) 
	{
		if (document.implementation && document.implementation.createDocument) {

			var xmldoc = document.implementation.createDocument("", "", null);
			xmldoc.onload = function(  ) { dicRSS(home,xmldoc); }
			xmldoc.load(home+"bbs/dic.php?dic_key="+dic_key);

		}
		else if (window.ActiveXObject) { 

			var xmldoc = new ActiveXObject("Microsoft.XMLDOM");   
			xmldoc.onreadystatechange = function(  ) {            
				if (xmldoc.readyState == 4) dicRSS(home,xmldoc);
		}
			 xmldoc.load(home+"bbs/dic.php?dic_key="+dic_key);                                  
		}
	}
	 

	function dicRSS(home,xmldoc) {

		var items = xmldoc.getElementsByTagName("item");
		if(items[0])
		{
			var e = items[0];
			yp_dic_layer(home,e.getElementsByTagName("dic_key")[0].firstChild.data,e.getElementsByTagName("dic_explan")[0].firstChild.data);
		}
		else
		{
			alert("Ã£À¸½Ã´Â ´Ü¾î°¡ »çÀü¿¡ µî·ÏµÇ¾î ÀÖÁö ¾Ê½À´Ï´Ù.");
		}

	}

function yp_dic_layer(home,dic_key,dic_explan)
{

	dic_explan = dic_explan.replace(/\r/ig,"<br>");
	dic_explan = dic_explan.replace(/\n/ig,"<br>");
	dic_explan = dic_explan.replace(/\<\?/ig,"&lt?");
	dic_explan = dic_explan.replace(/\?\>/ig,"?&gt");

	var f = document.getElementById("yp_tmp");
	f.style.display = "block";
	f.style.width = "300px";
	f.style.height="500px";
	f.style.top = (screen.height+document.body.scrollTop)/2-150;
	f.style.left = (screen.width+document.body.scrollLeft)/2-250;


	t = "<form name=\"dic\" method=\"post\" action=\""+home+"bbs/dic.php\" style=\"display:inline;\" onsubmit=\"return dic_submit_check('"+home+"');\">";
	t += "<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\" bgcolor=\"#8F8F8F\">";
	t += "<tr align=\"center\"><td><a href=\"javascript://\" onclick=\"yp_dic_none()\"><font color=\"#FFFFFF\">»çÀü°Ë»ö</font></a></td></tr>";
	t += "<tr bgcolor=\"#FFFFFF\" align=\"center\"><td>";
	t += "<input type=\"text\" name=\"dic_key\" value=\""+dic_key+"\"> <input type=\"submit\" value=\"°Ë»ö\">";
	t += "</td></tr>";
	t += "<tr bgcolor=\"#FFFFFF\"><td>";
	t += dic_explan;
	t += "</td></tr>";
	t += "</table></form>";
	f.innerHTML = t;
	document.dic.dic_key.focus();
}

function yp_dic_none()
{
	var f = document.getElementById("yp_tmp");
	f.style.display = "none";
}

document.write("<div style=\"display:none;position:absolute;overflow:auto;z-index:100;\" id=\"yp_tmp\"></div>");