	/* keyEvent중 enter 일때만 true 반환
	   */
  function onlyEnterChk(e) {
  	if(window.event){
  		if (event.keyCode == 13) {
  			return true;
  		}
  	}else{
  		if(e != null){
	  		if (e.which == 13) {
	  			return true;
	  		}
  		}
  	}
  	return false;
  }
  
  /* 이메일 보내기
   */
  function sendMailPop(url) 
  { 
	  cmm_popup_windowOpenResize_title(url, 675, 480, "sendMail");
  }
  
  
  /* 화면 가운데 팝업띄우기
   */
  function cmm_popup_windowOpenResize_title(url, popupwidth, popupheight, popup_title)
  {
  	Top = (window.screen.height - popupheight) / 3;
  	Left = (window.screen.width - popupwidth) / 2;
  	if (Top < 0) Top = 0;
  	if (Left < 0) Left = 0;
  	Future = "fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=" + Left + ",top=" + Top + ",width=" + popupwidth + ",height=" + popupheight;
  	PopUpWindow = window.open(url, popup_title, Future);
  	PopUpWindow.focus();
  }

var btnUtilScript = true;  //메일보내기, 스크랩, 프린트 버튼 중복 출력을 막기위한 변수
function printContents(vtitle, sgrp){
	var ww = "710";
	var hh = "550";
	var param = "";
	if(sgrp == "S02"){ //english
		param += "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
	    param += "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
	    param += "<head>\n";
		param += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
		param += "<title>" + vtitle + "</title>\n";	
		param += "<script type=\"text/javascript\">\n";
		param += "window.onload= function() {\n";
		param += "\tdocument.getElementById(\"util_btns_p\").innerHTML = \"&nbsp;\";\n";
		param += "\tif(document.getElementById(\"util_contents_4th\")){\n";
		param += "\t\tdocument.getElementById(\"util_contents_4th\").innerHTML = \"&nbsp;\";\n";	
		param += "\t}\n";
		param += "\tfor(var i = 0; i < document.getElementsByTagName(\"A\").length; i++){\n";
		param += "\t\tvar obj = document.getElementsByTagName(\"A\")[i];\n";
		param += "\t\tif(obj.id != \"print_popup\" && obj.id != \"print_close\") {\n"; 	
		param += "\t\t\tobj.disabled = true;\n";
		param += "\t\t\tobj.onclick = \"\";\n";
		param += "\t\t\tobj.onkeypress = \"\";\n";
		param += "\t\t}\n"; 
		param += "\t}\n";
		param += "}\n";
		
		param += "function enterChk(e) {\n";
		param += "\tif(window.event){\n";
		param += "\t\tif (event.keyCode == 13) {\n";
		param += "\t\t\treturn true;\n";
		param += "\t\t}else{\n";
		param += "\t\t\tif(e != null){\n";
		param += "\t\t\t\tif (e.which == 13) \n";
		param += "\t\t\t\treturn true;\n";
		param += "\t\t\t}\n";
		param += "\t\t}\n";
		param += "\t}\n";
		param += "\treturn false;\n";
		param += "}\n";
		param += "</script>\n";
		param += "<link rel=\"stylesheet\" type=\"text/css\" href=\"/_css/eng/common.css\" />\n";
		param += "<link rel=\"stylesheet\" type=\"text/css\" href=\"/_css/eng/sub.css\" />\n";
		param += "<link rel=\"stylesheet\" type=\"text/css\" href=\"/_css/eng/pop.css\" />\n";
		param += "</head>\n";
		param += "<body>\n";
		param += "\t<div id=\"wrap_print\">\n";
		param += "<p class=\"print_btn\">";
		param += "<a id=\"print_popup\" href=\"#popupPrint\" onclick=\"window.print();return false;\" onkeypress=\"if(enterChk(event))  {window.print(); return false;}\">";
		param += "<img src=\"/images/eng/common/btn_print.gif\" alt=\"print\" /></a>\n";
		param += "<a id=\"print_close\" href=\"#popupClose\" onclick=\"self.close();\" onkeypress=\"if(enterChk(event)) self.close();\">";
		param += "<img src=\"/images/eng/common/eng_btn_close.gif\" alt=\"close\" /></a>\n";
		param += "</p>";
		param += "\t\t<h1><img src=\"/images/eng/common/eng_tex08.jpg\" alt=\"pring contents\" /></h1>\n";
		param += "\t\t<div class=\"contents_print\" onclick=\"return false;\">\n";
		
		
		if(document.getElementById("contents"))
		{	
			param += document.getElementById("contents").innerHTML;
		} 
	    else if(document.getElementById("contents3"))
		{
			param += document.getElementById("contents3").innerHTML;
		}
		
		param += "\t\t</div>\n";
		param += "\t</div>";
		param += "</body></html>";
	}else if(sgrp == "S01"){
		param += "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
	    param += "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
	    param += "<head>\n";
		param += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
		param += "<title>" + vtitle + "</title>\n";	
		param += "<script type=\"text/javascript\">\n";
		param += "window.onload= function() {\n";
		param += "\tdocument.getElementById(\"util_btns_p\").innerHTML = \"&nbsp;\";\n";
		param += "\tif(document.getElementById(\"util_contents_4th\")){\n";
		param += "\t\tdocument.getElementById(\"util_contents_4th\").innerHTML = \"&nbsp;\";\n";	
		param += "\t}\n";
		param += "\tfor(var i = 0; i < document.getElementsByTagName(\"A\").length; i++){\n";
		param += "\t\tvar obj = document.getElementsByTagName(\"A\")[i];\n";
		param += "\t\tif(obj.id != \"print_popup\" && obj.id != \"print_close\") {\n"; 	
		param += "\t\t\tobj.disabled = true;\n";	
		param += "\t\t\tobj.onclick = \"\";\n";
		param += "\t\t\tobj.onkeypress = \"\";\n";
		param += "\t\t}\n"; 
		param += "\t}\n";
		param += "}\n";
		
		param += "function enterChk(e) {\n";
		param += "\tif(window.event){\n";
		param += "\t\tif (event.keyCode == 13) {\n";
		param += "\t\t\treturn true;\n";
		param += "\t\t}else{\n";
		param += "\t\t\tif(e != null){\n";
		param += "\t\t\t\tif (e.which == 13) \n";
		param += "\t\t\t\treturn true;\n";
		param += "\t\t\t}\n";
		param += "\t\t}\n";
		param += "\t}\n";
		param += "\treturn false;\n";
		param += "}\n";
		param += "</script>\n";
		param += "<link rel=\"stylesheet\" type=\"text/css\" href=\"/_css/kor/common.css\" />\n";
		param += "<link rel=\"stylesheet\" type=\"text/css\" href=\"/_css/kor/sub.css\" />\n";
		param += "<link rel=\"stylesheet\" type=\"text/css\" href=\"/_css/kor/pop.css\" />\n";
		param += "</head>\n";
		param += "<body>\n";
		param += "\t<div id=\"wrap_print\">\n";
		param += "<p class=\"print_btn\">";
		param += "<a id=\"print_popup\" href=\"#popupPrint\" onclick=\"window.print();return false;\" onkeypress=\"if(enterChk(event))  {window.print(); return false;}\">";
		param += "<img src=\"/images/kor/popup/btn_print.gif\" alt=\"프린트\" /></a>\n";
		param += "<a id=\"print_close\" href=\"#popupClose\" onclick=\"self.close();\" onkeypress=\"if(enterChk(event)) self.close();\">";
		param += "<img src=\"/images/kor/popup/btn_close.gif\" alt=\"창닫기\" /></a>\n";
		param += "</p>";
		param += "\t\t<h1><img src=\"/images/kor/popup/tex08.jpg\" alt=\"콘텐츠 인쇄하기\" /></h1>\n";
		param += "\t\t<div class=\"contents_print\" onclick=\"return false;\">\n";
		
		
		if(document.getElementById("contents"))
		{	
			param += document.getElementById("contents").innerHTML;
		} 
	    else if(document.getElementById("contents3"))
		{
			param += document.getElementById("contents3").innerHTML;
		}
		
		param += "\t\t</div>\n";
		param += "\t</div>";
		param += "</body></html>";
	}else if(sgrp == "rulebook"){
		param += "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
	    param += "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
	    param += "<head>\n";
		param += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
		param += "<title>" + vtitle + "</title>\n";
		
		param += "<link rel=\"stylesheet\" type=\"text/css\" href=\"/_css/kor/rulebook/common.css\" />\n";
		param += "<link rel=\"stylesheet\" type=\"text/css\" href=\"/_css/kor/rulebook/pop.css\" />\n";
		param += "<script type=\"text/javascript\">\n";
		param += "window.onload= function() {\n";
		param += "\tdocument.getElementById(\"util_btns_p\").innerHTML = \"&nbsp;\";\n";
		param += "\tif(document.getElementById(\"util_contents_4th\")){\n";
		param += "\t\tdocument.getElementById(\"util_contents_4th\").innerHTML = \"&nbsp;\";\n";	
		param += "\t}\n";
		param += "\tfor(var i = 0; i < document.getElementsByTagName(\"A\").length; i++){\n";
		param += "\t\tvar obj = document.getElementsByTagName(\"A\")[i];\n";
		param += "\t\tif(obj.id != \"print_popup\" && obj.id != \"print_close\") {\n"; 	
		param += "\t\t\tobj.disabled = true;\n";	
		param += "\t\t\tobj.onclick = \"\";\n";
		param += "\t\t\tobj.onkeypress = \"\";\n";
		param += "\t\t}\n"; 
		param += "\t}\n";
		param += "}\n";
		
		param += "function enterChk(e) {\n";
		param += "\tif(window.event){\n";
		param += "\t\tif (event.keyCode == 13) {\n";
		param += "\t\t\treturn true;\n";
		param += "\t\t}else{\n";
		param += "\t\t\tif(e != null){\n";
		param += "\t\t\t\tif (e.which == 13) \n";
		param += "\t\t\t\treturn true;\n";
		param += "\t\t\t}\n";
		param += "\t\t}\n";
		param += "\t}\n";
		param += "\treturn false;\n";
		param += "}\n";
		param += "</script>\n";
		param += "</head>\n";
		param += "<body onload=\"print();close();\">\n";
		param += "\t<div id=\"wrap_print\">\n";
		param += "\t\t<h1><img src=\"/images/kor/popup/tex08.jpg\" alt=\"콘텐츠 인쇄하기\" /></h1>\n";
		param += "\t\t<div class=\"contents_print\">\n";
		param += "<p class=\"print_c\">";
		
		
		if(document.getElementById("contents"))
		{	
			param += document.getElementById("contents").innerHTML;
		} 
	    else if(document.getElementById("contents3"))
		{
			param += document.getElementById("contents3").innerHTML;
		}
		
		param += "</p>";
		param += "\t\t</div>\n";
		param += "\t</div>";
		param += "</body></html>";
	}
		
	var win = window.open("","printContentsWindow","top=0,left=0,width="+ww+",height="+hh+",menubar=0,scrollbars=1");
	win.document.write("" + param);
	
	win.document.close();
	win.focus();
}
		var newSize = 3;

function changeFontSizeInit() {	
	var className = "f_size03";	
	document.getElementById("contents_body").className = className;
	newSize = 3;
}

function changeFontSize( updown ) {
	var preSize = newSize;
	if(updown == 1) newSize = newSize + 1;
	else if(updown == -1) newSize = newSize - 1;
		
	if ( newSize < 3 ) {
		alert("가장 작은 글꼴입니다.");
		newSize = 3;
		return;
	} else if ( newSize > 6 ) {
		alert("가장 큰 글꼴입니다.");
		newSize = 6;
		return;
	}
	
	var className = "f_size0" + newSize;
	if(document.getElementById("contents_body")) {
		document.getElementById("contents_body").className = className;
		fontFind(document.getElementById("contents_body"), updown);
	}	
}	


function fontFind(obj, updown)
{
	var addMinuse = "";
	if(updown == 1)  addMinuse = "+";
	else if(updown == -1) addMinuse = "-";
	
	if(obj.tagName) {
		if(obj.childNodes.length > 0) {
			if(obj.tagName == "FONT"){
				if(obj.getAttribute("SIZE")){				
					var temp = eval(obj.getAttribute("SIZE") + addMinuse + "1");
					temp = temp + "";
					obj.setAttribute("size",temp);
				}
			}
			if(obj.tagName == "P"){
				if(obj.style.fontSize){
					var fontSize = obj.style.fontSize;				
					fontSize = fontSize.replace("pt","");				
					obj.style.fontSize = eval(fontSize + addMinuse +"3+\"pt\"");
				}
			}		
			
			for(var nodeIdx = 0; nodeIdx < obj.childNodes.length ; nodeIdx++){
				fontFind(obj.childNodes[nodeIdx], updown);
			}
		}
		else
		{			
			if(obj.tagName == "FONT"){
				if(obj.getAttribute("SIZE")){				
					var temp = eval(obj.getAttribute("SIZE") + addMinuse + "1");
					temp = temp + "";
					obj.setAttribute("size",temp);
				}
			}
			if(obj.tagName == "P"){
				if(obj.style.fontSize){
					var fontSize = obj.style.fontSize;				
					fontSize = fontSize.replace("pt","");				
					obj.style.fontSize = eval(fontSize + addMinuse +"3+\"pt\"");
				}
			}		
		}
	}
}
