<!--// 플래너를 위해 아래 부분 추가 --- -->
<?php
$GLOBALS['pYear'] = Context::get('pYear');	// XE변수 넘겨받기 위해서.
$pYear=$GLOBALS['pYear']; 					// XE변수 넘겨받기 위해서.
$GLOBALS['pMonth'] = Context::get('pMonth');	// XE변수 넘겨받기 위해서.
$pMonth=$GLOBALS['pMonth']; 					// XE변수 넘겨받기 위해서.

$GLOBALS['extra_vars1'] = Context::get('extra_vars1');	  // XE변수 넘겨받기 위해서.
$in_extra_vars1=$GLOBALS['extra_vars1'];				
$in_extra_vars1_temp = str_replace("-", "", $in_extra_vars1);  // "-" 제거
$__Context->in_extra_vars1_temp = $in_extra_vars1_temp;			  // XE변수로 변환

if ($pYear == null){
    $pYear = date("Y");
    $pMonth = date("n");
    $pDay = date("d");
	}
$tmparr=explode("-", $in_extra_vars1);	//클릭한 날자
	if ($tmparr[2] != null){
	$pDay =$tmparr[2];
	}
?>
<!--// 플래너를 위해 윗부분 추가 --- -->

<!--#include("_header.html")-->

<!--// 플래너를 위해 아래 부분 추가 --- -->
<style> 
.calendar_container { margin:0 0 20px 0; width:100%; height:auto; vertical-align:top; clear:both; *zoom:1; } 
.calendar_container:after { calendar_box:""; clear:both; display:block; } 
.calendar_box { float:left; width:185px; height:auto; text-align:center;border:1px solid #dddddd; margin-right:10px; padding:5px; } 
.calendar_box ul { width:100%; display:block; list-style-type:none; margin:0; padding:0; } 
.calendar_box li { width:25px; display:block; float:left; } 
.stoday { font-weight:bold; background-color:yellow; color:black;} 
.calendar_text { text-align:center; font-size:12px; } 
.ssunday { color:red; } 
.snday { color:blue; } 
.calendar_title { margin:0px; text-align:center; font-size:12px; background-color:#999999; color:#ffffff; } 
.clear { clear:both; } 
.time_table { width:640px; display:block; float:left; margin:0; padding:0; font-size:8pt;} 

.error { border:1px solid red; }
</style> 

<?php 
function fn_smallcalendar_ymd($pYear, $pMonth, $pDay){ 
    $year = date("Y",mktime(0,0,0,$pMonth,1,$pYear)); 
    $month = date("n",mktime(0,0,0,$pMonth,1,$pYear)); 
    if ($pDay != 0){ 
    $day = date("d",mktime(0,0,0,$pMonth,$pDay,$pYear)); 
    } 
 
    $day_max = date("t",mktime(0,0,0,$month,1,$year)); 
    $week_start = date("w",mktime(0,0,0,$month,1,$year)); 
    $i = 0; 
    $j = 0; 
    $html = "<div class='calendar_box'>\n<div class='calendar_title stoday'>".sprintf("%d-%02d-%02d",$year,$month,$day)."</div>\n<ul>"; 
    while ($j<$day_max){ 
        if ($i<$week_start) { 
            $html .= "<li class='calendar_text'>*</li>"; 
        } else { 
            if ($i%7==0){ 
                $html .= "</ul><ul>\n"; 
                $font_color = " ssunday"; 
            } 
            else if ($i%7==6) $font_color = ""; 
            else $font_color = ""; 
            if ($month==$pMonth and $day == ($j+1)) $font_weight = " stoday"; 
            else $font_weight = ""; 
            $html .= "<li class='calendar_text$font_color$font_weight'>" . ($j+1) . "</li>"; 
            $j ++; 
        } 
        $i ++; 
    } 
    while ($i%7!==0){ 
        $html .= "<li class='calendar_text'>*</li>"; 
        $i ++; 
    } 
     $html .= "</ul>\n</div>\n"; 
    return $html; 
} 
?> 

<?php 
$year = date("Y"); 
$month = date("n"); 
$day = date("d"); 
?> 

<div class="calendar_container"> 
    <?php echo fn_smallcalendar_ymd($pYear,$pMonth-1, 0);?> 
    <?php echo fn_smallcalendar_ymd($pYear,$pMonth, $pDay);?> 
    <?php echo fn_smallcalendar_ymd($pYear,$pMonth+1, 0);?> 
</div> 
<div class="clear">&nbsp;</div> 
<!--// 플래너를 위해 윗부분 추가 {print_r(get_defined_vars())}--- -->

<form action="./" method="post" onsubmit="jQuery(this).find('input').each(function(){if(this.title==this.value)this.value='';});return procFilter(this, window.insert)" id="fo_write" class="boardWrite">
<input type="hidden" name="mid" value="{$mid}" />
<!--@if($oDocument->getContentText() == null && $module_info->auto_text != null)-->
<input type="hidden" name="content" value="{$module_info->auto_text}" />
<!--@else-->
<input type="hidden" name="content" value="{$oDocument->getContentText()}" />
<!--@endif-->
<input type="hidden" name="document_srl" value="{$document_srl}" />


	<div class="boardWriteHeader">
	
		<!--@if($module_info->use_category=="Y")-->
		<select name="category_srl" class="category">
			<option value="">{$lang->category}</option>
			<!--@foreach($category_list as $val)-->
			<option <!--@if(!$val->grant)-->disabled="disabled"<!--@endif--> value="{$val->category_srl}" <!--@if($val->grant&&$val->selected||$val->category_srl==$oDocument->get('category_srl'))-->selected="selected"<!--@endif-->>
				{str_repeat("&nbsp;&nbsp;",$val->depth)} {$val->title} ({$val->document_count})
			</option>
			<!--@endforeach-->
		</select>
		<!--@endif-->
		
		<!--@if($oDocument->getTitleText())-->
		<input type="text" name="title" id="postTitle" class="inputText" value="{htmlspecialchars($oDocument->getTitleText())}" />
		<!--@else-->
		<input type="text" name="title" id="postTitle" class="inputText" value="{$lang->title}" title="{$lang->title}" onfocus="if(this.value==this.title) this.value='';" />
		<!--@endif-->
	
        <!--@if($is_logged)-->
        <span class="buttonOfficial"><button type="button" onclick="doDocumentLoad(this); return false;">{$lang->cmd_load}</button></span>
        <!--@endif-->
		
	</div>

    <!--@if(count($extra_keys))-->
    <table border="1" cellspacing="0" summary="Extra Form" class="extraVarsList">
	<caption><em>*</em> : {$lang->is_required}</caption>
    <!--@foreach($extra_keys as $key => $val)-->
 	  <!--@if($val->idx != 7)-->  <!--// 시간이 아닐때 -->
      <tr>
        <th scope="row">{$val->name} <!--@if($val->is_required=='Y')--><em>*</em><!--@end--></th>
		<!--@if($val->idx == 1)-->  <!--// 일정시작 -->
			<!--@if($in_extra_vars1_temp != null && $val->value == null)-->  <!--// 일정시작일자 없으면-->
				{@ $val->value = $in_extra_vars1_temp}
			<!--@endif-->
        <td>
		  <div>{$val->getFormHTML()}</div>
          <!--@if(count($extra_keys) >= 7 )-->  <!--// 시간표 (0.2대 호환을 위해)-->
            {@$ev_arr=explode("|@|",$extra_keys[7]->value)}
  			<p><br/>시작시간:&nbsp;<input type="text" name="extra_vars7" id="time1" size="5" value="{$ev_arr[0]}" />&nbsp;&nbsp;&nbsp;종료시간:&nbsp;<input type="text" name="extra_vars7" id="time2" size="5" value="{$ev_arr[1]}" /></p>
			{$extra_keys[7]->desc}
          <!--@endif-->
		</td>
		<!--@elseif($val->idx == 3 and $val->type != "color")-->  <!--// 배경색상 -->
        <td>
            <?php Context::loadJavascriptPlugin('ui.colorpicker'); ?>
            <input type="text" name="extra_vars3" value="{$val->value}" class="color-indicator inputTypeText" />
            <br/>{$val->desc}
        </td>
        <!--@elseif($val->idx == 4)-->  <!--// 일정확인 -->
        <td>
			<!--@if($extra_keys[4]->type == "radio" || $extra_keys[4]->type == "checkbox")-->
				{@$ev_type=$extra_keys[4]->type}
			<!--@else-->
				{@$ev_type="radio"}
			<!--@endif-->
			{@$v=explode("||",$extra_keys[4]->default)}  <!--// 사용자용, 매니저용 아이콘 구분자 "||"-->
			{@$v_user=explode(",",$v[0])}
			{@$v_mgr=explode(",",$v[1])}

			{@$ev_arr=explode("|@|",$extra_keys[4]->value)}  <!--// 선택된 아이콘-->

			<!--@foreach($v_user as $valf)-->  <!--// 사용자용 일정확인 아이콘 출력-->
            {@$valf_id = str_replace(".", "_", $valf)}
			<input type="{$ev_type}" id="{$valf_id}" name="extra_vars4" value="{$valf}" 
				<!--@if(in_array($valf, $ev_arr))-->checked="checked"<!--@endif--> 
			/> 
			<label for="{$valf_id}" onclick="if(navigator.appVersion.indexOf('MSIE') != -1){$valf_id}.click()"><img src="./images/icon/{$valf}" style="cursor:pointer;" /></label>
			<!--@endforeach-->

			<!--@if($grant->manager && $v_mgr[0] !=null )-->  <!--// 매니저용 일정확인 아이콘 출력-->
			<br />
			<!--@foreach($v_mgr as $valf)-->
            {@$valf_id = str_replace(".", "_", $valf)}
			<input type="{$ev_type}" id="{$valf_id}" name="extra_vars4" value="{$valf}" 
				<!--@if(in_array($valf, $ev_arr))-->checked="checked"<!--@endif--> 
			/> 
			<label for="{$valf_id}" onclick="if(navigator.appVersion.indexOf('MSIE') != -1){$valf_id}.click()"><img src="./images/icon/{$valf}" style="cursor:pointer;" /></label>
			<!--@endforeach-->
			<!--@endif-->

            <br/>{$val->desc}
        </td>
        <!--@elseif($val->idx == 8)-->  <!--// 공개그룹 -->
            <!--@if($logged_info->member_srl != null && $module_info->display_opengroup != "N")-->
            <!--@if($grant->manager)-->
                {@$oMemberModel = &getModel('member'); $group_list = $oMemberModel->getGroups($module_info->site_srl);}
                <!--@foreach($group_list as $key => $group)-->
                    {@$group_list_temp .= ','.$group->title}
                <!--@end-->
                {@$group_list_temp=substr($group_list_temp,1)}   <!--// 전체 user그룹목록 -->
            <!--@else-->
                {@$group_list = $logged_info->group_list}
                <!--@foreach($group_list as $key => $group)-->
                    {@$group_list_temp .= ','.$group}
                <!--@end-->
                {@$group_list_temp=substr($group_list_temp,1)}  <!--// login user가 소속된 user그룹목록 -->
            <!--@endif-->
            {@$group_list_arr = explode(",",$group_list_temp)}
            {@$open_group_arr=explode("|@|",$extra_keys[8]->value)}  <!--// 선택된 공개그룹-->
            <!--@endif-->
        <td>
            <!--@if($logged_info->member_srl != null)-->
                <!--@foreach($group_list_arr as $key => $group)-->
               <input type="checkbox" name="extra_vars8" value="{$group}" id="open_group_{$group}"<!--@if(in_array($group, $open_group_arr))--> checked="checked"<!--@end--> />
                <label for="open_group_{$group}">{$group}</label>
                <!--@end-->
            <!--@endif-->
            <br/>{$val->desc}
        </td>

		<!--@elseif($val->type == "radio")-->  <!--// 라디오타입 한줄로 출력위해-->
        <td>
            {@$temp_getFormHTML = $val->getFormHTML()}
            {@$temp_getFormHTML = str_replace("<ul>", "", $temp_getFormHTML)}
            {@$temp_getFormHTML = str_replace("</ul>", "", $temp_getFormHTML)}
            {$temp_getFormHTML}
		</td>
		<!--@else-->
        <td>{$val->getFormHTML()}</td>
		<!--@endif-->
      </tr>
 	  <!--@endif-->  <!--// 시간(7)이 아닐때 -->
   <!--@endforeach-->
    </table>
    <!--@endif-->

	<div class="editorOption">
		<!--@if(!$is_logged)-->
		   <input type="text" name="nick_name" class="inputText userName" value="{$lang->writer}" title="{$lang->writer}" onfocus="if(this.value==this.title)this.value='';return false;" />
		   <input type="password" name="password" class="inputText userPw" value="{$lang->password}" title="{$lang->password}"  onfocus="if(this.value==this.title)this.value='';return false;" />
		   <input type="text" name="email_address" class="inputText emailAddress" value="{$lang->email_address}" title="{$lang->email_address}"  onfocus="if(this.value==this.title)this.value='';return false;" />
		   <input type="text" name="homepage" class="inputText homePage" value="{$lang->homepage}" title="{$lang->homepage}"  onfocus="if(this.value==this.title)this.value='';return false;" />
		<!--@end-->
		
        <!--@if($grant->manager)-->
        {@ $_color = array('555555','222288','226622','2266EE','8866CC','88AA66','EE2222','EE6622','EEAA22','EEEE22') }
        <select name="title_color" id="title_color" <!--@if($oDocument->get('title_color'))-->style="color:#{$oDocument->get('title_color')};"<!--@end--> onchange="this.style.color=this.options[this.selectedIndex].style.color;">
                <option value="" style="color:#CCCCCC;">{$lang->title_color}</option>
                <!--@foreach($_color as $_col)-->
                <option value="{$_col}" style="color:#{$_col}" <!--@if($oDocument->get('title_color')==$_col)-->selected="selected"<!--@end-->>{$lang->title_color}</option>
                <!--@endforeach-->
            </select>
            <input type="checkbox" name="title_bold" id="title_bold" value="Y" <!--@if($oDocument->get('title_bold')=='Y')-->checked="checked"<!--@end--> />
            <label for="title_bold">{$lang->title_bold}</label>
            <input type="checkbox" name="is_notice" value="Y" <!--@if($oDocument->isNotice())-->checked="checked"<!--@end--> id="is_notice" />
            <label for="is_notice">{$lang->notice}</label>
            <input type="checkbox" name="lock_comment" value="Y" <!--@if($oDocument->isLocked())-->checked="checked"<!--@end--> id="lock_comment" />
            <label for="lock_comment">{$lang->lock_comment}</label>
        <!--@endif-->
        <!--@if($module_info->secret=="Y")-->
            <input type="checkbox" name="is_secret" value="Y" <!--@if($oDocument->isSecret())-->checked="checked"<!--@end--> id="is_secret" />
            <label for="is_secret">{$lang->secret}</label>
        <!--@end-->
            <input type="checkbox" name="allow_comment" value="Y" <!--@if($oDocument->allowComment())-->checked="checked"<!--@end--> id="allow_comment" />
            <label for="allow_comment">{$lang->allow_comment}</label>
            <input type="checkbox" name="allow_trackback" value="Y" <!--@if($oDocument->allowTrackback())-->checked="checked"<!--@end--> id="allow_trackback" />
            <label for="allow_trackback">{$lang->allow_trackback}</label>
        <!--@if($is_logged)-->
            <input type="checkbox" name="notify_message" value="Y" <!--@if($oDocument->useNotify())-->checked="checked"<!--@end--> id="notify_message" />
            <label for="notify_message">{$lang->notify}</label>
        <!--@end-->
    </div>

    <div class="editor">{$oDocument->getEditor()}</div>

    <div class="tag">
        <input type="text" name="tags" value="{htmlspecialchars($oDocument->get('tags'))}" class="inputText" title="Tag" />
		<p>{$lang->about_tag}</p>
    </div>

	<div class="boardNavigation">
		<span class="buttonOfficial"><input type="submit" value="{$lang->cmd_registration}" accesskey="s" /></span>
		<span class="buttonOfficial"><button type="button" onclick="doDocumentSave(this);">{$lang->cmd_temp_save}</button></span>
		<span class="buttonOfficial"><button type="button" onclick="doDocumentLoad(this);">{$lang->cmd_load}</button></span>
	</div>

    </form>
<!--#include("_footer.html")-->

<!--// Time Picker -->
<style type="text/css" media="all"><!--%import("timepicker/timePicker.css")--></style>
<script type="text/javascript" src="{$tpl_path}timepicker/jquery.timePicker.js"></script>
<script type="text/javascript">//<![CDATA[
var $j = jQuery.noConflict();
$j(document).ready(function()
{
    // 시작시간 08:00  - 20:30, 15 minutes steps.
    $j('#time1').timePicker({
       startTime: "08:00",  // Using string. Can take string or Date object.
       endTime: "20:30",  // Using Date object here.
       show24Hours: true,
       separator:':',
       step: 15});
    //  종료시간 08:00  - 20:30, 15 minutes steps.
    $j('#time2').timePicker({
       startTime: "08:00",  // Using string. Can take string or Date object.
       endTime: new Date(0, 0, 0, 20, 30, 0),  // Using Date object here.
       show24Hours: true,
       separator:':',
       step: 15});

    // Store time used by duration.
    var oldTime = $j.timePicker("#time1").getTime();
    
    // Keep the duration between the two inputs.
    $j("#time1").change(function() {
      if ($j("#time2").val()) { // Only update when second input has a value.
        // Calculate duration.
        var duration = ($j.timePicker("#time2").getTime() - oldTime);
        var time = $j.timePicker("#time1").getTime();
        // Calculate and update the time in the second input.
        $j.timePicker("#time2").setTime(new Date(new Date(time.getTime() + duration)));
        oldTime = time;
      }
    });
    // Validate.
    $j("#time2").change(function() {
      if($j.timePicker("#time1").getTime() > $j.timePicker(this).getTime()) {
        $j(this).addClass("error");
      }
      else {
        $j(this).removeClass("error");
      }
    });

  });
  //]]></script>
