// ½ÎÀÌ¿ùµåÃ³·³ »ç¿ëÀÚ¸í Å¬¸¯ÇÏ¸é ·¹ÀÌ¾î·Î ÇØ´ç ¼­ºñ½º¸ñ·ÏÀÌ ÀÌ¸§¿·¿¡ ³ª¿À°Ô²û ÇÏ´Â ¸ðµâ
var NS4;
var IE4;
var mouse_top;
var mouse_left;
var parent_menu_name = "class_userinfo";
var status_over = false;	
var event_id = "none";
//var child_menu_array = ["menu_child1", "menu_child2", "menu_child3","menu_child4"];
var column_height = 18;
var mainmenu_top_indent = 0;	
var menuover_bgcolor = "#C9CDD1";
var menuover_fgcolor = "#ffffff";
var default_menuover_bgcolor = "#ffffff";
var default_menuover_fgcolor = "#000000";

NS4 = (document.layers);
IE4 = (document.all);
isWin = (navigator.appVersion.indexOf("Win") != -1)
if (NS4) {
  document.captureEvents(Event.CLICK)
  document.onclick = MouseDown;
}
else if (IE4) {
  document.onclick = MouseDown;
}

function MouseDown(e) {
  event_target = event.srcElement;
  event_target = event_target.toString();
  // HTML¹®¼­Áß¿¡ "javascript:UserMenu(" ºÎºÐÀÌ ÀÖ´ÂÁö Ã¼Å©
  event_check  = event_target.indexOf("javascript:UserMenuView(");		

  if (!status_over) hideAll();
  if (!event_check) {
    viewMenu(event, parent_menu_name);
  }
  else {
    /*event_check = event_target.indexOf("javascript:UserMenuView1(");
    if (!status_over) hideAll();
    if (!event_check) {
      viewMenu(event,parent_menu_name);
    } */
    hideAll();
  }
  /*else {
    event_check = event_target.indexOf("javascript:PZPopup_top(");
    if (!event_check) {
      viewMenu_top(event,  parent_menu_name);
    }
    else {
      if (!status_over) hideAll();
      return;
    }
    hideAll();
  }*/
}

function hideAll() {
  eval(parent_menu_name + ".style.display = \"none\"");
  if (event_id == "none") { return; }
  //var menu_len = child_menu_array.length;
  //for (i=0; i<menu_len; i++) eval(child_menu_array[i] + ".style.display = \"none\"");
}

function viewMenu (e, ar_id) {
  if (ar_id == "none") return;
  menuLocBod = window.document.body;
  xPos = menuLocBod.scrollLeft + event.clientX;
  yPos = event.clientY + menuLocBod.scrollTop;
  screen_height = window.document.body.offsetHeight;
  screen_width = window.document.body.offsetWidth;
  mouse_top = e.y;
  mouse_left = e.x;
  eval("mainmenu_top_indent = " + parent_menu_name + ".children[0].children[0].children.length");
  mainmenu_top_indent = mainmenu_top_indent * column_height;

  if (screen_height > mouse_top + mainmenu_top_indent) 
    yPos = event.clientY + menuLocBod.scrollTop;
  else
    yPos = (event.clientY + menuLocBod.scrollTop) - mainmenu_top_indent;

  if (mouse_top - mainmenu_top_indent < 0) 
  yPos = event.clientY + menuLocBod.scrollTop;

  eval(ar_id + ".style.pixelTop =" + yPos);
  eval(ar_id + ".style.pixelLeft =" + xPos);		
  eval(ar_id + ".style.display = \"\"");
}

function onMouseOver(ar_obj, ar_id) {
  status_over = true;
  changeColor(ar_obj);
}

function onMouseOut(ar_obj) {
  status_over = false;
  changeColor(ar_obj);
}

function changeColor(ar_obj) {
  if (ar_obj.children[0].style.color == menuover_fgcolor) {
    ar_obj.children[0].style.color = default_menuover_fgcolor;
    ar_obj.children[0].style.backgroundColor = default_menuover_bgcolor;
  }
  else {
    ar_obj.children[0].style.backgroundColor = menuover_bgcolor;
    ar_obj.children[0].style.color = menuover_fgcolor;
  }
}

// ¸ñ·Ï¿¡¼­ ½ÎÀÌ¿ùµå¿Í °°Àº ½ºÅ©¸³Æ®¸¦ Àû¿ëÇÒ °æ¿ì (º¹¼ö Àû¿ë °¡´É)
function UserMenuView(arg1,arg2)
{
  // alert(arg1 + " " +  arg2);
  // ¾ÆÀÌµð¿Í ÀÌ¸§À» º¯¼ö·Î ¹Þ´Â´Ù.
  i_area = arg1;
  i_area_no = arg2;
  
  document.getElementById("area_name").innerText = i_area;
}

function UserInfoView(arg1)
{
  var _x = document.body.clientWidth/2 - 400;
  var _y = document.body.clientHeight/4;

  // À§¿¡¼­ ¹ÞÀº º¯¼ö·Î Ã³¸®
  if (arg1 == 1) { // È¸¿øÁ¤º¸ º¸±â·Î ÀÌµ¿

    openWin = window.open("../area_view.php?gubun=1&no="+i_area_no+"","","status=yes,scrollbars=auto,width=800,height=500,left="+_x+",top="+_y);
    openWin.focus();
    // alert(user_id + "´ÔÀÇ È¸¿øÁ¤º¸ º¸±â");
  }
  else if (arg1 == 2) {
//    if(!confirm(user_id + "´ÔÀ» ¼±È£È¸¿øÀ¸·Î Ãß°¡ÇÏ½Ã°Ú½À´Ï±î?")) {
//      return false;
//    }
//    alert("³Ü~~Ãß°¡µÇ¾ú³×¿ä!!^^");

    openWin = window.open("../area_view.php?gubun=2&no="+i_area_no+"","","status=yesÌ,scrollbars=no,width=600,height=500,left="+_x+",top="+_y);
    openWin.focus();

  }
}
// ³ªÀÇ Áö½ÄºÎµ¿»ê¿¡¼­ »ç¿ë
//function My_UserInfoView(arg1)
//{
// À§¿¡¼­ ¹ÞÀº º¯¼ö·Î Ã³¸®
//  if (arg1 == 1) { // È¸¿øÁ¤º¸ º¸±â·Î ÀÌµ¿
//    var _x = document.body.clientWidth/2 - 300;
//    var _y = document.body.clientHeight/2 - 80;

//    openWin = window.open("http://www.drapt.com/","","status=yes,scrollbars=no,width=770,height=565,left="+_x+",top="+_y);
//   openWin.focus();
    // alert(user_id + "´ÔÀÇ È¸¿øÁ¤º¸ º¸±â");
//  }
//  else if (arg1 == 2) { // ¼±È£È¸¿ø Ãß°¡·Î ÀÌµ¿
//    if(!confirm(user_id + "´ÔÀ» ¼±È£È¸¿øÀ¸·Î Ãß°¡ÇÏ½Ã°Ú½À´Ï±î?")) {
//      return false;
//    }
//    alert("³Ü~~Ãß°¡µÇ¾ú³×¿ä!!^^");
//  }
//}
