

if(typeof(__embed_target_id)=='undefined'){
	var __embed_target_id = null;
}

/**
* embed ÆÐÄ¡¸¦ Àû¿ëÇÒ ÅÂ±×¸¦ ¼³Á¤ÇÕ´Ï´Ù
* ±âº»°ªÀº object,eembed,appelt ÅÂ±×ÀÔ´Ï´Ù
* false °ªÀÎ°æ¿ì ÆÐÄ¡¿¡¼­ Á¦¿ÜµË´Ï´Ù
*/
if(typeof(__embed_tags)=='undefined'){
	var __embed_tags = {object:true,embed:true,applet:false}
}

/**
* ÇÃ·¡½¬ÆÄÀÏÁß flashvars ¸¦ »ç¿ëÇÒ°æ¿ì ÇØ´ç ÇÃ·¡½¬ÀÇ ¿ÀºêÁ§Æ®¾ÆÀÌµð:true °ªÀ¸·Î object¸¦ µî·ÏÇØ ÁÖ¼¼¿ä
*/
var __flash_force_objs = {};

if(document.attachEvent){
	document.write('<style type="text/css">');
	document.write('object,embed{display:none;}');
	document.write('</style>');
	document.attachEvent('onreadystatechange',
		function (){
			
			if(__embed_target_id===null){
				var __target = document;
			}else{
				var __target = document.getElementById(__embed_target_id);
			}
			if (document.readyState == "complete"){
				function _replace(obj){
					var obj_re = document.createElement(obj.outerHTML);					
					obj_re.style.display='inline';
					obj.parentNode.replaceChild(obj_re,obj);
				}
				function _inner(obj){
					obj.style.display='inline';					
					var html = obj.outerHTML;
					var classid = obj.classid.toLowerCase();
					if(classid=='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' && typeof(__flash_force_objs[obj.id])=='undefined'){//flash ÀÎ°æ¿ì
						obj.insertAdjacentHTML('beforeBegin',html);
						obj.parentNode.removeChild(obj);
					}else{						
						//º¯°æÇÏ°íÀÚÇÏ´Â ActiveX classid ¸¦ Ãß°¡ÇÏ½Ã±â ¹Ù¶ø´Ï´Ù
						if(classid=='clsid:6bf52a52-394a-11d3-b153-00c04f79faa6' || //media 7
						classid=='clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95' || //6.4
						classid=='clsid:6bf52a52-394a-11d3-b153-00c04f79faa6' ||
						classid=='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'	
						){//media player 10
							embed_pos = html.indexOf('embed');
							if(embed_pos!=-1){//embed °¡ Á¸ÀçÇÏ´Â°æ¿ì
								var embed = '<'+html.substr(embed_pos);
								embed = embed.substr(0,embed.length-9);
								obj.insertAdjacentHTML('beforeBegin',embed);
								obj.parentNode.removeChild(obj);
							}else{
								//object·Î¸¸ µÇ¾î ÀÖ´Â°æ¿ì µ¿¿µ»ó ºÎºÐ¸¸ ÆÐÄ¡ÇÑ´Ù
								var embed = document.createElement('embed');
								var total = obj.childNodes.length;
								embed.setAttribute('autostart',0);
								if(obj.width){
									embed.setAttribute('width',obj.width);
								}
								if(obj.height){
									embed.setAttribute('height',obj.height);
								}
								for(var k=0;k<total;k++){
									n = obj.childNodes.item(k).getAttribute("name");
									v = obj.childNodes.item(k).getAttribute("value");
									if(n=='URL' || n=='url' || n=='FileName'){
										n = 'src';
									}
									embed.setAttribute(n,v);
								}
								if(embed.getAttribute('src')){
									embed.style.display = 'inline';
									obj.parentNode.replaceChild(embed,obj);
								}else{
									//ÆÄÀÏ¿¢¼¼½º object°¡ ¾Æ´Ñ°æ¿ì´Â À¯ÁöÇÑ´Ù								
								}
							}
						}
					}
				}

				if(__embed_tags.object===true){
					var objs = __target.getElementsByTagName('object');
					var i = objs.length;
					while(i-->0){
						_inner(objs[i]);
					}
				}
				if(__embed_tags.embed===true){
					var objs = __target.getElementsByTagName('embed');
					var i = objs.length;
					while(i-->0){
						_replace(objs[i])
					}
				}

				if(__embed_tags.applet===true){
					var objs = __target.getElementsByTagName('applet');
					var i = objs.length;
					while(i-->0){
						_replace(objs[i])
					}
				}
			}
		}
	);
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}


function toggle(LayerName,total) { 
	for (var i=1; i<=total; i++) {
		document.getElementById("special"+i).style.display = "none"
	}
	document.getElementById(LayerName).style.display = ""
}


/**********************************************************************************
	Quick Menu
***********************************************************************************/

var bNetscape4plus = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "4");
var bExplorer4plus = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");
function CheckUIElements(){
	var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;

	yMenuFrom = parseInt (document.getElementById("apDiv1").style.top, 10);
	var top = document.body.scrollTop; 
	if (top == 0) {
		top = document.documentElement.scrollTop;
	}
	yMenuTo = top + 295;
	timeoutNextCheck = 300;

	if ( Math.abs (yButtonFrom - (yMenuTo + 50)) < 6 && yButtonTo < yButtonFrom ) {
		setTimeout ("CheckUIElements()", timeoutNextCheck);
		return;
	}
	if ( yMenuFrom != yMenuTo ) {
		yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );
		if ( yMenuTo < yMenuFrom )
			yOffset = -yOffset;
		document.getElementById("apDiv1").style.top = parseInt (document.getElementById("apDiv1").style.top, 10) + yOffset;
		timeoutNextCheck = 10;
	}
	setTimeout ("CheckUIElements()", timeoutNextCheck);
}

function quickmenu() {
	var y;
	if ( top.frames.length )
		if ( bNetscape4plus ) {
		    document.getElementById("apDiv1").top = top.pageYOffset + 295;
			document.getElementById("apDiv1").visibility = "visible";
		} else if ( bExplorer4plus ) {
			document.getElementById("apDiv1").style.top = document.body.scrollTop + 295;
			document.getElementById("apDiv1").style.visibility = "visible";
		}
	CheckUIElements();
	return true;
}


/**********************************************************************************
	¿¹Àü comm_nsi_script.js ºÎºÐ
***********************************************************************************/

// ³ó½Ã¹Ì Å¸ÀÓÁî ºÎºÐ
function getYear() {
    return (new Date()).getYear();
}

function getMonth() {
    var month = (new Date()).getMonth()+1;
    if(month<10) month = "0"+month;
    return month;
}

function getDay() {
    var day = (new Date()).getDate();
    if(day<10) day = "0"+day;
    return day;
}

function getDate() {
    return getYear()+'-'+getMonth()+'-'+getDay();
}

function goLogin() {
	alert("·Î±×ÀÎ ÇØ ÁÖ¼¼¿ä.");
}

function onlyNumber(obj)
{
	key =obj.event.keyCode;
	if ( key == 13  || key == 9 )
	{   // ¿£ÅÍ,TAB
		return true;
	}
	if (key == 91 || key == 92 || key == 93 || key == 229 || key == 21 || key == 25 || key == 19) return true;

	if (key >= 112 && key <= 123) {       // function key
		obj.event.returnValue = true;
		return true;
	}

	if ((key == 40) || (key == 38 )) {    // À§, ¾Æ·¡ È­»ìÇ¥
		obj.event.returnValue = true;
		return true;
	}

	if (( key > 95) && ( key < 106 )) {   // ¿ìÃø Å°ÆÐµå ¼ýÀÚ key
		obj.event.returnValue = true;
		return true;
	}

	if (( key > 47) && ( key < 58 )) {    // Å°º¸µå »ó´Ü ¼ýÀÚ key
		obj.event.returnValue = true;
		return true;
	}
	if (( key == 37)||( key == 39 )||( key == 46)||( key == 8 )) {  // ÁÂ,¿ì È­»ìÇ¥,DEL,BACKS,-
		obj.event.returnValue = true;
		return true;
	}
	if (obj.event.altKey || obj.event.shiftKey || obj.event.ctrlKey)
	{
		obj.event.returnValue = true;
		return true;
	}
	if (( key > 36) && ( key < 41 ))
	{    // ÁÂ,»ó,¿ì,ÇÏ È­»ìÇ¥
		obj.event.returnValue = true;
		return true;
	}
	if (( key > 32) && ( key < 37 ))
	{    // Page-Up, Page-Down, End, Home
		obj.event.returnValue = true;
		return true;
	}
	if (( key == 45) || ( key == 46 ) || ( key == 144 ))
	{    // Insert,Delete,NumLock
		obj.event.returnValue = true;
		return true;
	}
	if (( key == 46)||( key == 8 )||( key == 17)||( key == 18 )||( key == 20)||( key == 27 ))
	{  // DEL,BACKS,Ctrl,Alt,CapsLock,Esc
		obj.event.returnValue = true;
		return true;
	}
	obj.event.returnValue=false;
	//alert('¼ýÀÚ¸¸ ÀÔ·Â °¡´ÉÇÕ´Ï´Ù.');
	return false;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


function win_open(url,x,y,scrollerbar){
    var hp;
    var vp;
    var windows;
    hp = ( screen.width - x ) / 2 + 1;
    vp = ( screen.height - y ) / 2 + 1;
    var winatt="width="+x+",height="+y+",toolbars=no,scrollbars="+scrollerbar+",esizable=no,status=no,left="+hp+",top="+vp;
    windows = window.open(url,"winpop",winatt);
}

function replace(str,regular_expression,replacement_string)
{
	var re = new RegExp(regular_expression,"ig");
	return str.replace(re,replacement_string);
 	return str;
}

function goPopup(val){
    if(val==""){
          alert("·Î±×ÀÎ ÇØ ÁÖ¼¼¿ä.");
    }else{        
        var url = "http://www.nongshimi.com/nsi/tim/wrt_deft_pro.jsp?mem_id="+val;
        win_open(url,400,213,"NO");
    }    
}



function goDetail(cat_code, cat_seq, data_seq){
    var strUrl = "./time_prev_viw.jsp?cat_code="+cat_code+"&cat_seq="+cat_seq+"&data_seq="+data_seq;
    win_open(strUrl,"600","540","yes");
}

function delete_Char(source,char)
{
	if (typeof(source) == "string")
	{
		return replace(source,char,'');
	}
	else if (typeof(source) == "object")
	{
		source.value = replace(source.value,char,'');
	}
	else
	{
		alert("Áö¿øÇÏÁö ¾Ê´Â ÇüÅÂÀÔ´Ï´Ù.");
	}

}

function display_Money(str)
{
	var div = str.length % 3;
	var s_str="";
	if (div == 0 ) {
		count = (str.length/3)-1;
	}else{
		count = (str.length-div) /3;
	}
	for (i=1;i<=count;i++){
		s_str =str.substr(str.length-3,3)+s_str;
		str = str.substr(0,str.length-3);
		if (str.length>0){
		s_str =","+s_str;
		}
	}
	s_str = str + s_str;
	if(s_str.substr(0,1) == "-"){
        s_str = delete_Char(s_str.substr(0,2),',')+s_str.substr(2);
	}
	return s_str;
}

function goMenu(cat_code){
    
    var catcode = cat_code.substring(0,2);
    switch(catcode){
        case '01': document.shMaster.action="news_deft_idx.jsp";
                break;
        case '02': document.shMaster.action="news_deft_idx.jsp?menu_code=02";
                break;
        case '03': document.shMaster.action="news_deft_idx.jsp?menu_code=03";
                break;
        case '04': document.shMaster.action="news_deft_idx.jsp?menu_code=04";
                break;
        case '05': document.shMaster.action="news_deft_idx.jsp?menu_code=05";
                break;
        case '06': document.shMaster.action="news_deft_idx.jsp?menu_code=06";
                break;
        case '07': document.shMaster.action="news_deft_idx.jsp?menu_code=07";
                break;
        case '08': document.shMaster.action="news_deft_idx.jsp?menu_code=08";
                break;
        case '09': document.shMaster.action="news_deft_idx.jsp?menu_code=09";
                break;
        case '10': document.shMaster.action="news_deft_idx.jsp?menu_code=10";
                break;
        case '11': document.shMaster.action="news_deft_lst.jsp?menu_code=11&cate_code=111";
                break;
    }

    document.shMaster.cat_code.value     = cat_code;
    document.shMaster.times_menu.value   = cat_code;
    document.shMaster.submit();
}

function goMenulst(cate_code, cate_seq){
    
    var catcode_tmp = cate_code.substring(0,2);
    switch(catcode_tmp){
        case '01': document.shMaster.action="news_deft_lst.jsp?menu_code=01&cate_code="+cate_code;
                break;
        case '02': document.shMaster.action="news_deft_lst.jsp?menu_code=02&cate_code="+cate_code;
                break;
        case '03': document.shMaster.action="news_deft_lst.jsp?menu_code=03&cate_code="+cate_code;
                break;
        case '04': document.shMaster.action="news_deft_lst.jsp?menu_code=04&cate_code="+cate_code;
                break;
        case '05': document.shMaster.action="news_deft_lst.jsp?menu_code=05&cate_code="+cate_code;
                break;
        case '06': document.shMaster.action="news_deft_lst.jsp?menu_code=06&cate_code="+cate_code;
                break;
        case '07': document.shMaster.action="news_deft_lst.jsp?menu_code=07&cate_code="+cate_code;
                break;
        case '08': document.shMaster.action="news_deft_lst.jsp?menu_code=08&cate_code="+cate_code;
                break;
        case '09': document.shMaster.action="news_deft_lst.jsp?menu_code=09&cate_code="+cate_code;
                break;
        case '10': document.shMaster.action="news_deft_lst.jsp?menu_code=10&cate_code="+cate_code;
                break;
        case '11': document.shMaster.action="news_deft_lst.jsp?menu_code=11&cate_code="+cate_code;
                break;

    }
    document.shMaster.cate_code.value	= cate_code;
    document.shMaster.cate_seq.value	= cate_seq;
    document.shMaster.submit();
}

function goPropose(){
    document.shMaster.action="/nsi/tim/jost_deft_int1.jsp";
    document.shMaster.submit();    
}

function goInfoWrite(){
    document.shMaster.action="/nsi/tim/jost_deft_int.jsp";
    document.shMaster.submit();    
}


//-------- ÀÌÇÏ ÇÏ´Ü±âÅ¸---------------------

//°ü¸®ÀÚ¿¡°Ô ¸ÞÀÏ
function down02_1(){
	SendMailMaster();
}
//ÀÌ¸ÞÀÏÁÖ¼Ò¹«´Ü¼öÁý°ÅºÎ
function down02_3(){
	comPop('/cmm/nMail.jsp','³ó½ÉÈ¨ÆäÀÌÁö','toolbar=no,top=1,left=1,width=488,height=187 scrollbars=no,resizable=no');
}
//°³ÀÎÁ¤º¸º¸È£Á¤Ã¥
function down02_2(){
	doAdd();
}

function doAdd() {
	document.form.action="<%=opAddUserPage%>";
	document.form.submit();
}

function  comPop(filename,title,cond){
	window.open(filename,title,cond);
}

function onepass_AddUser()
{
	path = "http://sso.nongshim.com/onepass/onepass_adduser.jsp?sid=NSIG&rtnurl=http://www.nongshimi.com/index.jsp";
	window.location.href=path;
}

function onepass_AddUser2()
{
	path = "http://sso.nongshim.com/onepass/onepass_adduser.jsp?sid=PLUS&rtnurl=http://www.nongshimi.com/nsi/eve/cnt/2009/09_plus/main.jsp";
	window.location.href=path;
}
/////////////////////////Main ¹ß¼Û /////////////////////////////
var vChildWin = new Array(1);

function OpenWindow(vGubn,vUrl,vWinInfo,vWinName) {
	if (vChildWin[vGubn] != null) vChildWin[vGubn].close();
	vChildWin[vGubn] = window.open(vUrl,vWinName,vWinInfo);
	if (vChildWin[vGubn].opener == null) vChildWin[vGubn].opener = window;
}    
    
// "All ¹ß¼Û" ¹öÆ°À» Å¬¸¯ÇÏ¿´À» °æ¿ì.....
function AllMail() {
	var vUrl,vWinInfo,vWinName;
  
	vWinInfo   = " toolbar=no,location=no  ,directories=no,status=no, ";
	vWinInfo  += " menubar=no,scrollbars=no,resizable=no  ,copyhistory=no,";	
	vWinInfo  += " width=500,height=420,left=370,top=200";
  
	vWinName   = "MailALL";
   
	if(document.liMaster.txtMCount.value == "0") {
		alert("¸ÞÀÏ ¹ß¼ÛÇÒ ´ë»óÀÌ ¾ø½À´Ï´Ù.");
		return false;
	}
  
	vUrl  = "/cmm/pMail.jsp?txtType=QUERY&txtTo=" + document.liMaster.txtMailSQL.value;
  
	OpenWindow(1,vUrl,vWinInfo,vWinName);
}

// Mail ¹ß¼Û ¹öÆ° Å¬¸¯½Ã...
function SendMail() {   
	var vUrl,vWinInfo,vWinName;

	vWinInfo   = " toolbar=no,location=no  ,directories=no,status=no, ";
	vWinInfo  += " menubar=no,scrollbars=no,resizable=no  ,copyhistory=no,";	
	vWinInfo  += " width=500,height=420,left=370,top=200";

	vWinName   = "MailOne";

	var vMailList = "";
	var vStr      = "";
	var vForm     = "";
	var vCnt      = Number(document.liMaster.txtMCount.value);    // ÇöÀç »ý¼ºµÈ °´Ã¼ÀÇ Count
	var vOkCnt    = 0;
                                              					// Ã¼Å© Count ÃÊ±âÈ­...
	for (var i = 1; i < vCnt ; i++) {                             // °´Ã¼ÀÇ °¹¼ö ¸¸Å­..
		vStr  = "document.liMaster.chkMail" + i;                    // °´Ã¼º¯¼ö »ý¼º...
		vForm = eval(vStr);                                         // °´Ã¼·Î ÀçÆò°¡..

		if (vForm.checked == true && vForm.value != "" ) {          // Click¿©ºÎ Check
			vOkCnt    += 1;                                           // Click °´¼ö Count
			vMailList += vForm.value + ";";                           // ¼±ÅÃµÈ Á¦Ç°ÄÚµå¸¦ ±¸ºÐÀÚ¸¦ µÎ¾î ÀúÀåÇÑ´Ù..
		}
	}

	if (vOkCnt == 0) {
		alert("¸ÞÀÏÀÌ ¾øÀ¸¸é ¹ß¼ÛÇÒ¼ö ¾ø½À´Ï´Ù.");
		return false;
	}
	
	vUrl = "/cmm/pMail.jsp?txtType=EMAIL&txtTo="+vMailList;

	OpenWindow(2,vUrl,vWinInfo,vWinName);
}

function SendMailMaster() {   
	var vUrl,vWinInfo,vWinName;

	vWinInfo   = " toolbar=no,location=no  ,directories=no,status=no, ";
	vWinInfo  += " menubar=no,scrollbars=no,resizable=no  ,copyhistory=no,";	
	vWinInfo  += " width=510,height=372,left=370,top=200";

	vWinName   = "MailOne";
	
	var vMailList = "";
	
	vUrl = "/cmm/pMail.jsp?txtType=ADMIN&txtTo="+vMailList;

	OpenWindow(2,vUrl,vWinInfo,vWinName);
}