/* 	G calendar v0.5
 *	(°øÈÞÀÏ ¹× ±¹°æÀÏ Ã¼Å©±â´É¾øÀ½)
 *
 *¡¡By Çàº¹ÇÑ°í´Ï(gonom9@empal.com)
 *  ¾ÆÀÌ¿þµù µðÀÚÀÎÆÀ 20070705 customized : ´ÙÁßÀÔ·Â, À§Ä¡fix, ´Ý±â¹öÆ°, ¹ÌÁ¤ÀÔ·Â°¡´ÉÃ³¸® */
<!-- calendar.
var action_global = ""; //actionÀÇ Àü¿ªº¯¼ö

function cal(year, month, day, action){
    var i, j, day_num=1;
    var last_week, month_link="";
    var calDate = new Date(year, month-1, day_num);
    var checkDate = new Date();
    var date_array = new Array(6);

    for(i=0;i<6;i++) date_array[i] = new Array("","","","","","","");

    //½ºÅ©¸³Æ® ÃßÃâ ¹× º¯È¯, ³»¿ëÀÌ ¾øÀ¸¸é ¸¶Áö¸· action »ç¿ë
    if(action == ""){
	script = action_global;
    }else{
	var script = action;
	var action_mode = action.substring(0,3);
	if(action_mode.toLowerCase()=="url") script = "document.location.href='"+action.substring(4,action.length)+"'";
	action_global = script;
    }

    for(j=0;j<6;j++){
	for(i=0;i<7;i++){
	    if(j==0 && i==0)i = calDate.getDay();
	    date_array[j][i]=day_num+"";
	    day_num++;

	    //ÇØ´ç ³¯Â¥°ª¿¡ ´ëÇÑ À¯È¿¼º °Ë»ç
	    checkDate.setFullYear(year, month-1, day_num);
	    if(checkDate.getDate() != day_num) break;
	}
	if(checkDate.getDate() != day_num) break;
    }
    last_week = (date_array[5][0])?6:5;

    outStr = "<table bgcolor=#CCCCCC width=160 border=0 cellpadding=0 cellspacing=0 style='border:1 solid black'><tr><td>\n";
    outStr += "<table width=100% border=0 cellpadding=0 cellspacing=1 style='border:1 solid black'>\n";
    outStr += "<col width=20 align=center></col><col width=20 align=center></col><col width=20 align=center></col><col width=20 align=center></col><col width=20 align=center></col><col width=20 align=center></col><col width=20 align=center></col>\n";
    outStr += "<tr><td class=calendar style='color:#D5420E'>S<td class=calendar>M<td class=calendar>T<td class=calendar>W<td class=calendar>T<td class=calendar>F<td class=calendar style='color:#2B55A7'>S</tr>\n";
    for(j=0;j<last_week;j++){
	outStr += "<tr>";
	for(i=0;i<7;i++){
	    //½ºÅ©¸³Æ® ÀÚ·áº¯È¯
	    if(date_array[j][i]!=""){
		date_array[j][i]=(date_array[j][i] < 10)?  "0"+date_array[j][i] : date_array[j][i];
		t_month=(month < 10)?  "0"+month : month;
		action_script = script.replace("{year}", year);
		action_script = action_script.replace("{year}", year);
		action_script = action_script.replace("{year}", year);
		action_script = action_script.replace("{month}",t_month);
		action_script = action_script.replace("{month}",t_month);
		action_script = action_script.replace("{month}",t_month);
		action_script = action_script.replace("{day}", date_array[j][i]);
		action_script = action_script.replace("{day}", date_array[j][i]);
		action_script = action_script.replace("{day}", date_array[j][i]);
	    }
	    else action_script = "";


	    //³¯Â¥º°·Î ½ºÅ©¸³Æ® Ãâ·Â
	    if(i==0){ outStr += "<td class=calendar style='color:#D5420E;cursor:hand' onMouseover=this.style.backgroundColor='#FFEEEE' onMouseout=this.style.backgroundColor='' onClick=\""+action_script+"\">"+date_array[j][i]+"</td>"; continue; }
	    if(i==6){ outStr += "<td class=calendar style='color:#2B55A7;cursor:hand' onMouseover=this.style.backgroundColor='#EEEEFF' onMouseout=this.style.backgroundColor='' onClick=\""+action_script+"\">"+date_array[j][i]+"</td>"; continue; }
	    outStr += "<td class=calendar style='cursor:hand' onMouseover=this.style.backgroundColor='#EEEEEE' onMouseout=this.style.backgroundColor='' onClick=\""+action_script+"\">"+date_array[j][i]+"</td>";
	}
	outStr += "</tr>\n";
    }
    outStr += "</table></td></tr></table>";

	action_script = set_00(year,t_month,'day',script);
    month_link = (month > 1)? "<a onClick=\"cal("+year+","+(month-1)+","+day+",'')\" style='text-decoration:none; color:#909090; cursor:hand'>¢·</a> <font color=black>"+"<a onClick=\""+action_script+"\" style='text-decoration:none; color:#909090; cursor:hand'>"+month+"</a>":"<a onClick=\"cal("+(year-1)+","+(month+11)+","+day+",'')\" style='text-decoration:none; color:#909090; cursor:hand'>¢·</a> <font color=black>"+"<a onClick=\""+action_script+"\" style='text-decoration:none; color:#909090; cursor:hand'>"+month+"</a>";
    month_link += (month < 12)? "</font> <a onClick=\"cal("+year+","+(month+1)+","+day+",'')\" style='text-decoration:none; color:#909090; cursor:hand'>¢¹</a>":"</font> <a onClick=\"cal("+(year+1)+","+(month-11)+","+day+",'')\" style='text-decoration:none; color:#909090; cursor:hand'>¢¹</a>";

    //HTML ´ëÀÔ
    document.all.G_cal_body.innerHTML = outStr;
	action_script2 = set_00('0000','00','year',script);
    document.all.G_cal_year.innerHTML = "<a onClick=\""+action_script2+"\" style='text-decoration:none; color:#909090; cursor:hand'><font color=black>¹ÌÁ¤</font></a>";

	action_script = set_00(year,'00','month',script);
    document.all.G_cal_year.innerHTML += "<a onClick=\"cal("+(year-1)+","+month+","+day+",'')\" style='text-decoration:none; color:#909090; cursor:hand'>¢·</a><a onClick=\""+action_script+"\" style='text-decoration:none; color:#909090; cursor:hand'><font color=black>"+year+"</font></a><a onClick=\"cal("+(year+1)+","+month+","+day+",'')\" style='text-decoration:none; color:#909090; cursor:hand'>¢¹</a>";
    document.all.G_cal_month.innerHTML = month_link;
}
function onoff_Gcal(){
    var Gs=document.all.G_cal.style;
	var top_mod = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;

    Gs.top = top_mod + window.event.clientY + 0;
    Gs.left = document.body.scrollLeft + window.event.clientX - 0;
	if(Gs.visibility=="hidden"){
	  Gs.visibility = '';
      Gs.top = top_mod + window.event.clientY + 0;
      Gs.left = document.body.scrollLeft + window.event.clientX - 0;
	}else{
	  Gs.visibility = 'hidden';
	  Gs.top = 0;
	  Gs.left = 0;
	}
}
document.writeln("<style>td.calendar{font-size:7pt; font-family:tahoma;color:black; background-color:white}</style>");
document.writeln(""
+"<div id=G_cal style='width=160;position:absolute;visibility:hidden'>"
+"<table bgcolor=#EEEEEE width=160 height=25 border=0 cellpadding=3 cellspacing=0 style='border:1 solid black'>"
+"	<tr><td align=center style='font-size:8pt; font-family:tahoma'>"
+"		<span id=G_cal_year></span>&nbsp;&nbsp;<span id=G_cal_month></span>"
+"	</td><td style='font-size:8pt; font-family:tahoma; font-weight:bold; color:black; cursor:hand' width=18 onClick='onoff_Gcal();'>"
+"		[x]"
+"	</td></tr>"
+"</table>"
+"<div id=G_cal_body style='width:160'>"
+"</div></div>");


function set_00(year,month,mode,script){
		if(mode == 'day' || mode == 'month' || mode == 'year'){date = '00';}
		if(mode == 'month' || mode == 'year'){month = '00';}
		if(mode == 'year'){year = '0000';}
		action_script = script.replace("{year}", year);
		action_script = action_script.replace("{year}", year);
		action_script = action_script.replace("{year}", year);
		action_script = action_script.replace("{month}",month);
		action_script = action_script.replace("{month}",month);
		action_script = action_script.replace("{month}",month);
		action_script = action_script.replace("{day}", date);
		action_script = action_script.replace("{day}", date);
		action_script = action_script.replace("{day}", date);
		return action_script;
}

/* ±Ý¾× ÄÞ¸¶ Âï´Â ½ºÅ©¸³Æ® µÎ°³ÀÔ´Ï´Ù... 
onClickÀÌº¥Æ®½Ã¿Í onKeyPressÀÌº¥Æ® µÎ°³°¡ Æ²¸³´Ï´Ù. --;;;
»ç¿ë¿¹.. ¾Æ·¡ÀÇ 3°³ÀÇ ÀÌº¥Æ®¸¦ ÀÔ·ÂÇØ ÁÖ½Ã¸é µË´Ï´Ù.
ÀÔ·ÂÀ» ¾ÈÇÏ°í ºüÁ®³ª°¥½Ã¿¡´Â ÄÞ¸¶°¡ ÀÚµ¿ÀûÀ¸·Î ¾ø¾îÁö°Ô Ã³¸®µË´Ï´Ù.
onFocusOut="this.value=this.value.replace(/,/g,'');" 
onKeyPress="this.value=account_cal(this.value);" 
onClick="this.value=setComma(this.value);"
*/
function account_cal(soli) //¼öÄ¡ ÀÔ·Â½Ã ÄÞ¸¶ Âï¾îÁÖ±â : ÃâÃ³ phpschool »ìÂ¦ ¼öÁ¤ÇÔ
{ 
	var moneyorg = soli; /* ÀÔ·ÂµÈ °ª ºÒ·¯¿À±â */ 
	var moneyorglen = moneyorg.length; /* ÀÔ·ÂµÈ °ªÀÇ ±æÀÌ °è»ê */ 
	var money = ""; 
	var y = 0; 
	for (var x=moneyorglen; x>=0; x--)  /* ÄÄ¸¶ Á¦°Å¸¦ À§ÇØ ±æÀÌ ¸¸Å­ ·çÇÁ¸¦ °Å²Ù·Î µ¹¸°´Ù. */ 
	{ 
		var moyo = moneyorg.charAt(x); 
		if (moyo != ",")  /* ÄÄ¸¶°¡ ¾ø´Â °æ¿ì¿¡¸¸ ¼ýÀÚ¸¦ ºÙÀÎ´Ù */ 
		{ 
			if (y%3 == 0 && y != 0) /* ¼¼ÀÚ¸® ¸¶´Ù ÄÄ¸¶¸¦ ºÙÀÎ´Ù. */ 
			{ 
				money = moyo + "," + money 
				y++; 
			} 
			else 
			{ 
				money = moyo + money; 
				y++; 
			} 
		} 
	} 
	return money; 
}  

function setComma(str) // account_cal°ú °°Àº°ÍÀÌ³ª... onClickÀÌº¥Æ®½Ã¿¡¸¸ ¾²ÀÓ
{
	str = str.replace(/,/g,'');
	str = ""+str+"";
	var retValue = "";
	for(i=0; i<str.length; i++)
	{
		if(i > 0 && (i%3)==0) {
		retValue = str.charAt(str.length - i -1) + "," + retValue;
		} else {
		retValue = str.charAt(str.length - i -1) + retValue;
		}
	}
	return retValue;
}


function goToViewDoc(rg_cat_num,BlogNum,rg_doc_num){ //plaza¿ë ÇØ´ç ÆäÀÌÁö³»¿¡¼­ ÄÁÅÙÃ÷ ¿­¶÷ ½ºÅ©¸³Æ®
	document.getElementById("BodyFrame").src = '/blog/board/view.php?&ss[fc]='+rg_cat_num+'&bbs_id=gamiblog&S_BlogNum='+BlogNum+'&page=&doc_num='+rg_doc_num;
	document.getElementById("BodyFrame").style.display = "";
}

function open_print(val, mode){
  window.open('/info/_x/page_print.php?'+mode+'='+val, 'printscreen', 'width=670, height=540, scrollbars=yes');
}
function open_mail(val, mode){
  window.open('/info/_x/detail_sendmail.iwd?'+mode+'='+val, 'sendscreen', 'width=670, height=540, scrollbars=yes');
}

function openRequest(code,cop_ent_id){//????
  window.open('/collection/popup/request.php?cop_ent_id='+cop_ent_id+'&code='+code,'request','status=yes,scrollbars=yes,width=500,height=435');
}

function openVisit(code,cop_ent_id){//????
  window.open('/collection/popup/visit.php?cop_ent_id='+cop_ent_id+'&code='+code,'request','status=yes,scrollbars=yes,width=500,height=435');
}

function openRequestHalls(code,cop_ent_id){//????
  window.open('/collection/popup/request.php?cop_ent_id='+cop_ent_id+'&code='+code,'request','status=yes,scrollbars=yes,width=500,height=435');
}



function getParams (picnum) {

  if (picnum!=0) { // bar Å¬¸¯½Ã 0
    bar.style.top = 32 * (picnum + 1) - 6; // y ÁÂÇ¥Á¤ÇÔ
    maskd.style.top = 32 * (picnum + 1) - 10;
    var acoord = picnum;
    // [acoord] Áö¿ª°ª, ¼­¿ï °­µ¿=1 ·Î ½ÃÀÛ, Çà¸¶´Ù 1¾¿ Áõ°¡
  }

  var xcoord =  event.clientX - (anctable.offsetLeft + 110);
  // ±×¸²ÀÇ 0¿ø ÁöÁ¡¿¡ ´ëÇÑ »ó´ë x ÁÂÇ¥. anctableÀº ÀüÃ¼ table
  xcoord = "" + xcoord;
  var pcoord = "" + Math.round(xcoord / 40) * 5000;
  if (pcoord < 5000 ){pcoord=5000;}
  if (pcoord > 50000 ){pcoord=50000;}
  // [pcoord] °ª ÀüÈÄ 5000¿øÀ¸·Î °Ë»ö, 5000ÀÌ¸é 45000ÀÌ»óÀ¸·Î °Ë»ö

  var xsnap = 110 + pcoord/125 - 40 + 1;
  bar.style.left = xsnap;
  masko.style.left = xsnap;

  out.style.visibility='hidden';
  bar.style.visibility = "visible";
  masko.style.visibility = "visible";
  maskd.style.width = "3px";
  maskd.style.visibility = "visible";

//Æû¿¡ Ã¼Å©
  document.hall.acoord.value = acoord;
  document.hall.pcoord.value = pcoord;
//window.status = anctable.offsetLeft + ':' + anctable.offsetTop + ':' + maskd.style.left + ':' + pcoord + ':' + acoord + ':' + ycoord; //µð¹ö±×¿ë
}

function getParams2 (picnum) { // Áö¿ª Á¦¸ñÀ» Å¬¸¯ÇÒ ½Ã¿¡ Àü°¡°Ý´ë °Ë»ö

  var acoord = picnum;
  var pcoord = "all" // ¸ðµç °¡°Ý´ë¸¦ °Ë»öÇÔ.

  bar.style.top = 32 * (picnum + 1) - 6; // y ÁÂÇ¥Á¤ÇÔ
  maskd.style.top = 32 * (picnum + 1) - 10;

  out.style.visibility='hidden';
  bar.style.visibility = "hidden";
  masko.style.visibility = "hidden";
  maskd.style.width = "456px";
  maskd.style.visibility = "visible";

//Æû¿¡ Ã¼Å©
  document.hall.acoord.value = acoord;
  document.hall.pcoord.value = pcoord;
}