//    IE Script
var NS4;
var IE4;
var mouse_top;
var mouse_left;
var scroll_top;
var scroll_left;
var event_id = "none";
var status_over = false;    
var parent_menu_name = "";
var parent_menu_name_org = "menu_parent";//idÅ¬·°¿ë ui
var child_menu_array = ["menu_child1"];
//    var child_menu_array = ["menu_child1", "menu_child2", "menu_child3"];
var submenu_left_indent = 70;
var column_height = 18;
var submenu_top_indent = 0;
var mainmenu_top_indent = 0;    
var menuover_bgcolor = "#FFC000";
var menuover_fgcolor = "#FFFFFF";
var default_menuover_bgcolor = "#FFFFFF";
var default_menuover_fgcolor = "#000000";
var event_check;

var jsv_logNo = "";
var jsv_openYn = "";
var jsv_valid = "";
var jsv_site = "";
var jsv_bt = "";
var jsv_num = "";
var jsv_ctgno = "";
var jsv_scrapopen = 1;

function ui_scrap(type,site,bt,num) 
{
	jsv_bt	= bt;	//º¸µå¸í
    jsv_num = num;	
    jsv_site = site;
    jsv_scrapopen = type;

    parent_menu_name = "";
}

function win_open(url, name, option)
{
    var popup = window.open(url, name, option);
    popup.focus();
}

function articleCopy(tsite,jsv_bt,jsv_num){
	
	var urls ="http://hac.educamp.org/adm/site/SiteBoardCopy.php?site="+jsv_site+"&id="+jsv_bt+"&no="+jsv_num+"&target="+tsite;
	var msg = "Á¤¸» º¹»çÇÏ½Ã°Ú½À´Ï±î?";
	if(confirm(msg)){
		//alert(urls);return;
		alert('º»¹®ÀÌ º¹»çµÇ¾ú½À´Ï´Ù.');		
		win_open(urls, "hiddenframe");
		
	}
	

}


function exec_menuitem_scrap(key) 
{
    switch(key) 
    {
        case "EVENT1" ://ÇÐ´çº¹»ç
            articleCopy(1,jsv_bt,jsv_num);
            break;
        case "EVENT2" ://¸¶ÄÉÆÃº¹»ç
            articleCopy(2,jsv_bt,jsv_num);
            break;
        case "EVENT3" ://¿¬±¸¼Òº¹»ç
            articleCopy(3,jsv_bt,jsv_num);
            break;    
        case "EVENT4" ://ÇÁ¸°Æ®ÇÏ±â
            boardPrint(jsv_num);
            break;
        case "EVENT5" ://½Å°íÇÏ±â
            badArticleReport(jsv_num);
            break;
    }
	hideAll();
}


if (document.all)
{
    NS4 = false;
    IE4 = true;
}
else
{
    NS4 = true;
    IE4 = false;
}
isWin = (navigator.appVersion.indexOf("Win") != -1)

if (NS4) 
{
    document.captureEvents(Event.CLICK)
    document.onclick = MouseDownScrap;
} 
else if (IE4) 
{
    document.onclick = MouseDownScrap;
}

function startIt() {}
    
function menuOver(ar_obj, ar_id) 
{
    status_over = true;
    changeOnColor(ar_obj);
    hideChild(event_id);
}
    
function menuOut(ar_obj) 
{
    status_over = false;
	changeOutColor(ar_obj);
}

function SubmenuOver(ar_obj) 
{
    status_over = true;
    changeColor(ar_obj);
}

function MouseDownScrap(e) 
{
	//½ºÅ©·¦±â´É »ç¿ëÇÏÁö ¾Ê°í CF°Ô½ÃÆÇ ½ºÅ©¸³Æ® ¿À·ù·Î returnÇÔ.2010-09-08
	//return;


    parent_menu_name="";

    if (!e) e = window.event;
    event_target = (NS4) ? e.target : e.srcElement;
    event_target = event_target.toString();
    event_check = event_target.indexOf("javascript:ui_scrap(");        
	
    if (parent_menu_name=="")
    {
        if (event_target.indexOf("javascript:ui_scrap(0"))     //scrap hidden
        {
            parent_menu_name = "menu_parent_scrap";            
        } 
        else if (!event_target.indexOf("javascript:ui_scrap(0"))     
        {
            parent_menu_name = "menu_parent_scrap2";
        }
    }
    
    if (!status_over) hideAll();
    
    
    if (!event_check) 
    {
        viewMenuScrap(e, parent_menu_name);
    }
    else 
    {
    	
        if (!event_target.indexOf("javascript:ui("))
        {
            viewMenu(e, parent_menu_name_org);
        } 
        else 
        {
        	
            if (!status_over) hideAll();
            return;
        }
    }
}

function hideChild(ar_id) 
{
    if (event_id == "none") 
        return;
    for (i=0; i<child_menu_array.length; i++) 
        eval(child_menu_array[i] + ".style.display = \"none\"");
}
    
function hideAll() 
{
    document.getElementById("menu_parent_scrap").style.display = "none";
    document.getElementById("menu_parent_scrap2").style.display = "none";
    try{
        eval("document.getElementById('" + parent_menu_name_org + "').style.display = \"none\"");        
    }
    catch(e){}
        
        
    if (event_id == "none") 
        return;
    for (i=0; i<child_menu_array.length; i++) 
        eval(child_menu_array[i] + ".style.display = \"none\"");
}

function viewMenuScrap(e, ar_id) 
{
    if (ar_id == "none") 
        return;
    
    menuLocBod = window.document.body;
    xPos = menuLocBod.scrollLeft + e.clientX;
    yPos = e.clientY + menuLocBod.scrollTop;
    screen_height = window.document.body.offsetHeight;
    screen_width = window.document.body.offsetWidth;
    mouse_top = e.y;
    mouse_left = e.x;
    mainmenu_top_indent = eval("document.getElementById('" + parent_menu_name + "').childNodes[0].childNodes[0].childNodes.length");
    mainmenu_top_indent = mainmenu_top_indent * column_height;

    if (screen_height > mouse_top + mainmenu_top_indent) 
	    yPos = e.clientY + menuLocBod.scrollTop;
    else
        yPos = (e.clientY + menuLocBod.scrollTop) - mainmenu_top_indent;

	if (mouse_top - mainmenu_top_indent < 0) 
        yPos = e.clientY + menuLocBod.scrollTop;

	
	if (event_target.indexOf("javascript:ui("))
    {
		yPos = yPos - 55;
        xPos = xPos - 105;
	}
    if (!event_target.indexOf("javascript:ui_scrap(0"))
	{
        yPos = yPos + 20;
    }

	var objMenu = eval("document.getElementById('" + ar_id + "')");
	objMenu.style.top = yPos;
	objMenu.style.left = xPos;
	objMenu.style.display = "";
}
    
function changeOnColor(obj)
{
    obj.style.backgroundColor = menuover_bgcolor;
}
function changeOutColor(obj)
{
    obj.style.backgroundColor = default_menuover_bgcolor;
}        

document.write("<div id=\"menu_parent_scrap\" style=\"position:absolute;display:none;top:0;left:0\">");
document.write("<table width=\"115\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"#B6B6B6\">");
document.write("<tr><td> ");
document.write("<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"#FFFFFF\">");
document.write("<tr> ");
document.write("<td style=\"padding: 3 0 0 10\" height=\"23\" onmouseout=\"menuOut(this);\" onmouseover=\"menuOver(this, 'none');\" onclick=\"exec_menuitem_scrap('EVENT1');\" style=\"cursor:hand\"><span class=\"n_id\"><font color=#404040>ÇÐ´ç ¼ö°­»ý°ÇÀÇ</font></span></td>");
document.write("</tr><tr> ");
document.write("<td background=\"http://blogimgs.naver.com/imgs/bg_dot.gif\" height=\"1\"></td>");
document.write("</tr><tr> ");
document.write("<td style=\"padding: 2 0 0 10\" height=\"22\" onmouseout=\"menuOut(this);\" onmouseover=\"menuOver(this, 'none');\" onclick=\"exec_menuitem_scrap('EVENT2');\" style=\"cursor:hand\"><span class=\"n_id\"><font color=#404040>¸¶ÄÉÆÃ À¯Àú°ÇÀÇ</font></span></td>");
document.write("</tr><tr> ");
document.write("<td background=\"http://blogimgs.naver.com/imgs/bg_dot.gif\" height=\"1\"></td>");
document.write("</tr><tr> ");
document.write("<td style=\"padding: 2 0 0 10\" height=\"22\" onmouseout=\"menuOut(this);\" onmouseover=\"menuOver(this, 'none');\" onclick=\"exec_menuitem_scrap('EVENT3');\" style=\"cursor:hand\"><span class=\"n_id\"><font color=#404040>¿¬±¸¼Ò À¯Àú°ÇÀÇ</font></span></td>");
document.write("</tr><tr> ");
document.write("</tr></table></td></tr></table>");
document.write("</div>");


document.write("<div id=\"menu_parent_scrap2\" style=\"position:absolute;display:none;top:0;left:0\">");
document.write("<table width=\"115\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"#B6B6B6\"><tr><td>");
document.write("<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"#FFFFFF\">");
document.write("<tr><td style=\"padding: 2 0 0 10\" height=\"22\" onmouseout=\"menuOut(this);\" onmouseover=\"menuOver(this, 'none');\" onclick=\"exec_menuitem_scrap('EVENT3');\" style=\"cursor:hand\"><span class=\"n_id\"><font color=#404040>ÇÁ¸°Æ® ÇÏ±â</font></span></td></tr>");
document.write("<tr><td background=\"http://blogimgs.naver.com/imgs/bg_dot.gif\" height=\"1\"></td></tr>");
document.write("<tr><td style=\"padding: 2 0 0 10\" height=\"22\" onmouseout=\"menuOut(this);\" onmouseover=\"menuOver(this, 'none');\" onclick=\"exec_menuitem_scrap('EVENT4');\" style=\"cursor:hand\"><span class=\"n_id\"><font color=#404040>½Å°í ÇÏ±â</font></span></td></tr>");
document.write("</table>");
document.write("</td></tr></table>");
document.write("</div>");
