//<![CDATA[


var IE  = (document.all) ? true : false;

function trim(st) {
  while(st) { if (st.indexOf(" ")==0) st = st.substring(1); else break; }
  while(st) { if (st.lastIndexOf(" ")==st.length-1) st = st.substring(0, st.length-1); else break; }
  return st;
}

function trim_all(form) {
  var i=0;
  while (i < form.length) {
    if (form.elements[i].type != 'file') {
      form.elements[i].value = trim(form.elements[i].value);
    }
    i++;
  }
  return true;
}

function submit_type1(act) {
  form.method = 'post';
  form.action = act;
  form.target = '_self';
  form.submit();
}

function submit_type2(act) {
  form.method = 'post';
  form.action = act;
  form.target = 'exe_frame';
  form.submit();
}

function submit_type3(act) {
  form.method = 'get';
  form.action = act;
  form.target = '_self';
  form.submit();
}

function str_innerHTML(str) {
  str = str.replace(/-\_t-t\_-/g, '\n');
  return str;
}

function isNull(field,message) {
  if (field.value.length==0) {
    alert(message + '\t');
    if (field.type != 'hidden') field.focus();
    return true;
  }
  return false;
}

function layer_toggle(obj) {
  if (obj.style.display == 'none') obj.style.display = 'block';
  else if (obj.style.display == 'block') obj.style.display = 'none';
}

function layer_toggle2(obj, obj2) {
  obj.style.display = 'block';
  obj2.style.display = 'none';
}

function has_leaves(d_ary, num) {
  for(i = 0; i < d_ary.length; i++) {
    if (num == d_ary[i][0] && d_ary[i][1] == '0') return false;
  }
  return true;
}

function onclick_setimp(obj, d_ary) {

  obj.style.color = c2;
  obj.style.backgroundColor = bc2;

  for(i = 0; i < d_ary.length; i++){
    var set_area = document.getElementById('imp'+d_ary[i]);
    set_area.style.color = c1;
    set_area.style.backgroundColor = bc1;
  }

  obj.style.color = c2;
  obj.style.backgroundColor = bc2;

}

function onclick_folder(sn, hc, ic, path) {

  hc = document.getElementById(hc);
  ic = document.getElementById(ic);

  if (hc == null) return false;

  sn_set = f_ary[sn].toString();
  sn_set = sn_set.split(',');

  var type = sn_set[0];
  var hl = sn_set[1];
  var il = sn_set[2];

  if (hc.style.display == 'none') {
    if (hl == '0') {
      if (il == '1') ic.src = path + 'tab' + type + '_opened6.gif';
      else ic.src = path + 'tab' + type + '_opened5.gif';
    } else {
      if (il == '1') ic.src = path + 'tab' + type + '_opened2.gif';
      else ic.src = path + 'tab' + type + '_opened1.gif';
    }
  } else {
    if (il == '1') {
      if (hl == '0') ic.src = path + 'tab' + type + '_opened6.gif';
      else ic.src = path + 'tab' + type + '_closed2.gif';
    } else {
      if (hl == '0') ic.src = path + 'tab' + type + '_opened5.gif';
      else ic.src = path + 'tab' + type + '_closed1.gif';
    }
  }

  layer_toggle(hc);

  return false;
}

function set_tree_status() {
  var ct_div, tree_status = '';
  for(i=0; i<d_ary.length; i++) { ct_div = document.getElementById('h_ct'+d_ary[i]); if (ct_div && ct_div.style.display == 'block') { tree_status += ',' + d_ary[i]; } }
  return tree_status;
}

function add_list(object, text, value) {
  loc=object.length;
  object.options[loc] = new Option(text,value);
  object.selectedIndex = loc;
}

function del_list(object) {
  var buffer = '';
  for (var i=0; i < object.options.length; i++) {
    if (object.options[i].selected == true) {
      buffer = buffer + '^' + i + '\|' + object.options[i].value;
    }
  }
  return buffer;
}

function onclick_insert_guest(form, mode, num, page, sort) {
  trim_all(form);
  if (isNull(form.guest_input_name, '이름을 입력해 주세요')) return false;
  if (isNull(form.guest_textarea_body, '본문을 입력해 주세요')) return false;
  if (form.guest_input_password.value == '') {
    if (!confirm('비밀번호를 입력하지 않으면 나중에 수정하실 수 없습니다.\t\n\n계속 진행하시겠습니까?')) return false;
  }
  form.md.value = 'guest_db';
  form.act.value = mode;
  form.num.value = num;
  form.page.value = page;
  form.sort.value = sort;
  form.submit();
}

function onclick_edit_guest(form, pnum, num, page, sort) {
  trim_all(form);
  if (isNull(form.guest_input_name, '이름을 입력해 주세요')) return false;
  if (isNull(form.guest_textarea_body, '본문을 입력해 주세요')) return false;
  form.md.value = 'guest_db';
  form.act.value = 'edit';
  form.pnum.value = pnum;
  form.num.value = num;
  form.page.value = page;
  form.sort.value = sort;
  form.submit();
}

function onclick_insert_comment(form, num){

  trim_all(form);

  if (isNull(eval('form.c_name_'+num), '이름을 입력해 주세요')) return false;
  // if (isNull(eval('form.c_password_'+num), '패스워드를 입력해 주세요')) return false;
  if (isNull(eval('form.c_body_'+num), '답글을 입력해 주세요')) return false;

  if (!confirm('답글을 올리시겠습니까?\t')) return false;

  form.target = 'exe_frame';
  form.action = 'add_exe.php';
  form.md.value = 'insert';
  form.num.value = num;

  form.c_name.value = eval('form.c_name_'+num).value;
  form.c_homepage.value = eval('form.c_homepage_'+num).value;
  form.c_password.value = eval('form.c_password_'+num).value;
  form.c_body.value = eval('form.c_body_'+num).value;
  form.d_target.value = 'post_'+num;
  form.submit();

  form.target = '_self';
  form.action = 'index.php';
  form.md.value = '';
  form.num.value = '';
}

function onclick_addexe(num, d_target, obj1, obj2, mode) {
  if (obj1.value == 0) {
    obj1.value = '1';
    obj2.value = '0';
    exe_frame.location.href='add_exe.php?md='+mode+'&num='+num+'&d_target='+d_target;
  } else {
    obj1.value = '0';
    var ele = eval(document.getElementById(d_target));
    ele.style.display = 'none';
    ele.innerHTML = '';
  }
  return true;
}

function onclick_delete(mode, pnum, num){
  window.open('del_exe.php?mode='+mode+'&pnum='+pnum+'&num='+num, 'del', 'width=350,height=200,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0');
}

function onclick_to_article_1l(obj1, obj2, msg) {
  if (obj1.selectedIndex == -1) { alert(msg); return false; }
  var buffer = '';
  temp = obj1.options[obj1.selectedIndex].value.split("|");
  buffer = '[##_1L|' + temp[2] + '|' + temp[1] + '|_##]';
  form.buffer.value = buffer;
  window.open('post_pop.php?view=1&mode=1L','post_pop','width=400, height=300, scrollbars=1, status=1');
  return true;
  set_tag_support(obj2, buffer, '');
  return true;
}

function onclick_to_article_1c(obj1, obj2, msg) {
  if (obj1.selectedIndex == -1) { alert(msg); return false; }
  var buffer = '';
  temp = obj1.options[obj1.selectedIndex].value.split("|");
  buffer = '[##_1C|' + temp[2] + '|' + temp[1] + '|_##]';
  form.buffer.value = buffer;
  window.open('post_pop.php?view=1&mode=1C','post_pop','width=400, height=300, scrollbars=1, status=1');
  return true;
  set_tag_support(obj2, buffer, '');
  return true;
}

function onclick_to_article_1r(obj1, obj2, msg) {
  if (obj1.selectedIndex == -1) { alert(msg); return false; }
  var buffer = '';
  temp = obj1.options[obj1.selectedIndex].value.split("|");
  buffer = '[##_1R|' + temp[2] + '|' + temp[1] + '|_##]';
  form.buffer.value = buffer;
  window.open('post_pop.php?view=1&mode=1R','post_pop','width=400, height=300, scrollbars=1, status=1');
  return true;
  set_tag_support(obj2, buffer, '');
  return true;
}

function onclick_to_article_2c(obj1, obj2, msg) {
  var count = 0;
  var buffer = '';

  for (var i=0; i < obj1.options.length; i++) {
    if (obj1.options[i].selected == true) {
      temp = obj1.options[i].value.split("|");
      buffer = buffer + '^' + temp[2] + '|' + temp[1] + '|';
      count++;
    }
  }

  if (count != 2) {
    alert(msg);
    return false;
  } else {
    var imageinfo;
    if (trim(buffer) != "") buffer = buffer.substr(1);
    imageinfo = buffer.split("^");
    buffer = '[##_2C|' + imageinfo[0] + ' |' + imageinfo[1] + ' _##]';
    form.buffer.value = buffer;
    window.open('post_pop.php?view=1&mode=2C','post_pop','width=400, height=300, scrollbars=1, status=1');
    return true;
    set_tag_support(obj2, buffer, '');
  }

  return true;
}

function onclick_to_article_3c(obj1, obj2, msg) {
  var count = 0;
  var buffer = '';
  for (var i=0; i < obj1.options.length; i++) {
    if (obj1.options[i].selected == true) {
      temp = obj1.options[i].value.split("|");
      buffer = buffer + '^' + temp[2] + '|' + temp[1] + '|';
      count++;
    }
  }
  if (count != 3) {
    alert(msg);
    return false;
  } else {
    var imageinfo;
    if (trim(buffer) != "") buffer = buffer.substr(1);
    imageinfo = buffer.split("^");
    buffer = '[##_3C|' + imageinfo[0] + '|' + imageinfo[1] + '|' + imageinfo[2] + '_##]';
    form.buffer.value = buffer;
    window.open('post_pop.php?view=1&mode=3C','post_pop','width=400, height=300, scrollbars=1, status=1');
    return true;
    set_tag_support(obj2, buffer, '');
    return false;
  }
}

function onclick_to_article_slide(obj1, obj2, msg) {
  var buffer = '';
  for (var i=0; i < obj1.options.length; i++) {
    if (obj1.options[i].selected == true) {
      temp = obj1.options[i].value.split("|");
      buffer = buffer + '^' + temp[2] + '|' + temp[1] + '|';
    }
  }
  var imageinfo;
  if (trim(buffer) != "") buffer = buffer.substr(1);
  imageinfo = buffer.split("^");

  buffer = '[##_S';
  for (i=0; i < imageinfo.length; i++) {
    buffer = buffer + '|' + imageinfo[i];
  }
  buffer = buffer + '_##]';
  form.buffer.value = buffer;
  window.open('post_pop.php?view=1&mode=s','post_pop','width=400, height=300, scrollbars=1, status=1');
  return true;
  set_tag_support(obj2, buffer, '');
  return false;
}

function onclick_to_article_free(obj1, obj2, path1, path2) {
  var buffer = '';
  for (var i=0; i < obj1.options.length; i++) {
    if (obj1.options[i].selected == true) {
      temp = obj1.options[i].value.split("|");
      buffer = buffer + '<img src="' + path1 + path2 + temp[2] + '" ' + temp[1] + '>';
    }
  }
  set_tag_support(obj2, buffer, '');
  return true;
}

function image_view(obj, path, title){
  window.open(path+'image_pop.php?p_title='+title+'&imagefile='+obj.src+'&width='+obj.style.width+'&height='+obj.style.height, '_blank','width='+obj.style.width+',height='+obj.style.height+',location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0');
}

function is_valid_time(tval) {
    var year  = tval.substring(0,4).replace(/\D/g,"");
    var month = tval.substring(5,7).replace(/\D/g,"");
    var day   = tval.substring(8,10).replace(/\D/g,"");
    var hour  = tval.substring(11,13).replace(/\D/g,"");
    var min   = tval.substring(14,16).replace(/\D/g,"");
    var sec   = tval.substring(17,19).replace(/\D/g,"");

  if (check_date(year, month, day, hour, min, sec)) return true;
    alert('시각을 바르게 입력해 주세요');
    return false;
}

function check_cb_set(obj) {
  var el_ary = form.elements, flag = '';
  if (obj.checked) flag = true; else flag = false;

  for(i=0; i<el_ary.length; i++) {
    if (el_ary[i].type == 'Checkbox' && el_ary[i].name.substring(0,4) == 'cb_r') el_ary[i].checked = flag;
  }
}


function set_preview_image(obj1, obj2, path1, path2) {
  temp = obj1.options[obj1.selectedIndex].value.split("|");
  var ext = temp[2].substring(temp[2].length-3).toLowerCase();
  if (!(ext == 'jpg' || ext == 'gif' || ext == 'bmp' || ext == 'png')) set_preview_no_image(obj2);
  else obj2.src = servicePath + '/attach/' + path1 + path2 + temp[2];
  return true;
}

function set_preview_no_image(obj) {
  obj.src = resourceURL + '/image/spacer.gif';
}

function check_date(year, month, day, hour, min, sec) {
  if (year < 1900 || year == '') return false;
  if (month > 12 || month == '') return false;
  if (day > count_days(year, month) || day == '') return false;
  if (hour > 23 || hour == '') return false;
  if (min > 60 || min == '') return false;
  if (sec > 60 || sec == '') return false;
  return true;
}

function count_days(year, month) {
  var days;
  if ((month == 1) || (month == 3) || (month == 5) || (month == 7) || (month == 8) || (month == 10) || (month == 12)) days = 31;
  else if ((month == 4) || (month == 6) || (month == 9) || (month == 11)) days = 30;
  else if (month == 2) {
    if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) days = 29;
    else  days = 28;
  }
  return days;
}

function save_pos(obj) {
  if (obj.createTextRange) obj.currentPos = document.selection.createRange().duplicate();
  return true;
}

function set_tag_support(obj, prefix, postfix) {
  if (document.selection) {
    if (obj.createTextRange && obj.currentPos) {
      obj.currentPos.text = prefix + obj.currentPos.text + postfix;
      obj.focus();
      save_pos(obj);
    } else obj.value = obj.value + prefix + postfix;
  } else if (obj.selectionStart && obj.selectionEnd) {
    var s1 = obj.value.substring(0, obj.selectionStart);
    var s2 = obj.value.substring(obj.selectionStart, obj.selectionEnd);
    var s3 = obj.value.substring(obj.selectionEnd);
    obj.value = s1 + prefix + s2 + postfix + s3;
  } else obj.value += prefix + postfix;
  return true;
}

function open_set(val) {
  if (val == 'mark_set') document.getElementById('color_set').style.display = 'none';
  else document.getElementById('mark_set').style.display = 'none';
  layer_toggle(document.getElementById(val));
}

function close_color_set(obj, col1) {
  layer_toggle(document.getElementById('color_set'));
  set_tag_support(obj, '<span style="color: ' + col1 + '">', '</span>');
}

function close_mark_set(obj, col1, col2) {
  layer_toggle(document.getElementById('mark_set'));
  set_tag_support(obj, '<span style="color: '+col1+'; background-color: '+col2+'; padding: 3px 1px 0px">', '</span>');
}

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_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_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

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];}}
}

// end of byTattertools.js

var sUserAgent = navigator.userAgent;
var fAppVersion = parseFloat(navigator.appVersion);

function compareVersions(sVersion1, sVersion2) {

    var aVersion1 = sVersion1.split(".");
    var aVersion2 = sVersion2.split(".");

    if (aVersion1.length > aVersion2.length) {
        for (var i=0; i < aVersion1.length - aVersion2.length; i++) {
            aVersion2.push("0");
        }
    } else if (aVersion1.length < aVersion2.length) {
        for (var i=0; i < aVersion2.length - aVersion1.length; i++) {
            aVersion1.push("0");
        }
    }
    for (var i=0; i < aVersion1.length; i++) {

        if (aVersion1[i] < aVersion2[i]) {
            return -1;
        } else if (aVersion1[i] > aVersion2[i]) {
            return 1;
        }
    }
    return 0;

}

var isOpera = sUserAgent.indexOf("Opera") > -1;
var isMinOpera4 = isMinOpera5 = isMinOpera6 = isMinOpera7 = isMinOpera7_5 = false;

if (isOpera) {
    var fOperaVersion;
    if(navigator.appName == "Opera") {
        fOperaVersion = fAppVersion;
    } else {
        var reOperaVersion = new RegExp("Opera (\\d+\\.\\d+)");
        reOperaVersion.test(sUserAgent);
        fOperaVersion = parseFloat(RegExp["$1"]);
    }

    isMinOpera4 = fOperaVersion >= 4;
    isMinOpera5 = fOperaVersion >= 5;
    isMinOpera6 = fOperaVersion >= 6;
    isMinOpera7 = fOperaVersion >= 7;
    isMinOpera7_5 = fOperaVersion >= 7.5;
}

var isKHTML = sUserAgent.indexOf("KHTML") > -1
              || sUserAgent.indexOf("Konqueror") > -1
              || sUserAgent.indexOf("AppleWebKit") > -1;

var isMinSafari1 = isMinSafari1_2 = false;
var isMinKonq2_2 = isMinKonq3 = isMinKonq3_1 = isMinKonq3_2 = false;
var isSafari = false;
if (isKHTML) {
    isSafari = sUserAgent.indexOf("AppleWebKit") > -1;
    isKonq = sUserAgent.indexOf("Konqueror") > -1;

    if (isSafari) {
        var reAppleWebKit = new RegExp("AppleWebKit\\/(\\d+(?:\\.\\d*)?)");
        reAppleWebKit.test(sUserAgent);
        var fAppleWebKitVersion = parseFloat(RegExp["$1"]);

        isMinSafari1 = fAppleWebKitVersion >= 85;
        isMinSafari1_2 = fAppleWebKitVersion >= 124;
    } else if (isKonq) {

        var reKonq = new RegExp("Konqueror\\/(\\d+(?:\\.\\d+(?:\\.\\d)?)?)");
        reKonq.test(sUserAgent);
        isMinKonq2_2 = compareVersions(RegExp["$1"], "2.2") >= 0;
        isMinKonq3 = compareVersions(RegExp["$1"], "3.0") >= 0;
        isMinKonq3_1 = compareVersions(RegExp["$1"], "3.1") >= 0;
        isMinKonq3_2 = compareVersions(RegExp["$1"], "3.2") >= 0;
    }

}

var isIE = sUserAgent.indexOf("compatible") > -1
           && sUserAgent.indexOf("MSIE") > -1
           && !isOpera;

var isMinIE4 = isMinIE5 = isMinIE5_5 = isMinIE6 = false;

if (isIE) {
    var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
    reIE.test(sUserAgent);
    var fIEVersion = parseFloat(RegExp["$1"]);

    isMinIE4 = fIEVersion >= 4;
    isMinIE5 = fIEVersion >= 5;
    isMinIE5_5 = fIEVersion >= 5.5;
    isMinIE6 = fIEVersion >= 6.0;
}

var isMoz = sUserAgent.indexOf("Gecko") > -1
            && !isKHTML;

var isMinMoz1 = sMinMoz1_4 = isMinMoz1_5 = false;

if (isMoz) {
    var reMoz = new RegExp("rv:(\\d+\\.\\d+(?:\\.\\d+)?)");
    reMoz.test(sUserAgent);
    isMinMoz1 = compareVersions(RegExp["$1"], "1.0") >= 0;
    isMinMoz1_4 = compareVersions(RegExp["$1"], "1.4") >= 0;
    isMinMoz1_5 = compareVersions(RegExp["$1"], "1.5") >= 0;
}

var isNS4 = !isIE && !isOpera && !isMoz && !isKHTML
            && (sUserAgent.indexOf("Mozilla") == 0)
            && (navigator.appName == "Netscape")
            && (fAppVersion >= 4.0 && fAppVersion < 5.0);

var isMinNS4 = isMinNS4_5 = isMinNS4_7 = isMinNS4_8 = false;

if (isNS4) {
    isMinNS4 = true;
    isMinNS4_5 = fAppVersion >= 4.5;
    isMinNS4_7 = fAppVersion >= 4.7;
    isMinNS4_8 = fAppVersion >= 4.8;
}

var isWin = (navigator.platform == "Win32") || (navigator.platform == "Windows");
var isMac = (navigator.platform == "Mac68K") || (navigator.platform == "MacPPC")
            || (navigator.platform == "Macintosh") || (navigator.platform == "MacIntel");

var isUnix = (navigator.platform == "X11") && !isWin && !isMac;

var isWin95 = isWin98 = isWinNT4 = isWin2K = isWinME = isWinXP = false;
var isMac68K = isMacPPC = false;
var isSunOS = isMinSunOS4 = isMinSunOS5 = isMinSunOS5_5 = false;

if (isWin) {
    isWin95 = sUserAgent.indexOf("Win95") > -1
              || sUserAgent.indexOf("Windows 95") > -1;
    isWin98 = sUserAgent.indexOf("Win98") > -1
              || sUserAgent.indexOf("Windows 98") > -1;
    isWinME = sUserAgent.indexOf("Win 9x 4.90") > -1
              || sUserAgent.indexOf("Windows ME") > -1;
    isWin2K = sUserAgent.indexOf("Windows NT 5.0") > -1
              || sUserAgent.indexOf("Windows 2000") > -1;
    isWinXP = sUserAgent.indexOf("Windows NT 5.1") > -1
              || sUserAgent.indexOf("Windows XP") > -1;
    isWinNT4 = sUserAgent.indexOf("WinNT") > -1
              || sUserAgent.indexOf("Windows NT") > -1
              || sUserAgent.indexOf("WinNT4.0") > -1
              || sUserAgent.indexOf("Windows NT 4.0") > -1
              && (!isWinME && !isWin2K && !isWinXP);
}

if (isMac) {
    isMac68K = sUserAgent.indexOf("Mac_68000") > -1
               || sUserAgent.indexOf("68K") > -1;
    isMacPPC = sUserAgent.indexOf("Mac_PowerPC") > -1
               || sUserAgent.indexOf("PPC") > -1;
}

if (isUnix) {
    isSunOS = sUserAgent.indexOf("SunOS") > -1;

    if (isSunOS) {
        var reSunOS = new RegExp("SunOS (\\d+\\.\\d+(?:\\.\\d+)?)");
        reSunOS.test(sUserAgent);
        isMinSunOS4 = compareVersions(RegExp["$1"], "4.0") >= 0;
        isMinSunOS5 = compareVersions(RegExp["$1"], "5.0") >= 0;
        isMinSunOS5_5 = compareVersions(RegExp["$1"], "5.5") >= 0;
    }
}

function analysis(msg,mode) {
  try {
    if(mode == undefined) {
      var temp ='<table border="1"  cellspacing="0">';
      for(var name in msg) {
        temp +='<tr>';
        temp +='<td>'+name+'</td><td>'
        temp += msg[name]
        temp +='</td>';
        temp +='</tr>';
      }
      temp +='</table>';
      return temp;
    } else if(mode ='a') {
      var temp ='';
      for(var name in msg) {
        temp +=name+'\t\t:'+msg[name]+'\n';
      }
      return temp
    }
  } catch (e) {
    //alert(e);
  }
}

function trace(msg,mode) {
  result = analysis(msg,mode);
  if(mode == undefined) {
    var traceWin = window.open('', "traceWin");
    traceWin.focus();
    traceWin.document.body.innerHTML = result;
  } else if(mode =='w') {
    alert(result);
  }
}

function openLinkInNewWindow(callee) {
  if (callee) {
    var url = callee.getAttribute("href");
    if (url) {
      window.open(url);
      return false;
    }
  }
  return true;
}


function toggleLayer(id) {
  try {
  var obj = document.getElementById(id);
  obj.style.display = (obj.style.display == "none") ? "block" : "none";
  } catch (e) {

  }
  return true;
}
function showLayer(id) {
  document.getElementById(id).style.display = "block";
  return true;
}
function hideLayer(id) {
  document.getElementById(id).style.display = "none";
  return true;
}

function findFormObject(caller) {

  for (var obj = caller; obj; obj = obj.parentNode) {

    if (obj.nodeName == "FORM")
      return obj;
  }


  return null;
}

function trim(str) {
  var start = 0;
  var end = str.length;
  for (var i = 0; i < str.length; i ++) {
    if (str.charAt(i) != " ") {
      start = i;
      break;
    }
  }
  for (var i = str.length - 1; i >= 0; i --) {
    if (str.charAt(i) != " ") {
      end = i + 1;
      break;
    }
  }
  return str.substring(start, end);
}

function checkValue(oField, message) {
  try {
    if (oField.value.length == 0) {
      alert(message);
      oField.focus();
      return false;
    }
    return true;
  } catch(e) {

    return false;
  }
}

function trimAll(oForm) {
  try {
    for (var i = 0; i < oForm.elements.length; i ++) {
      var tagName = oForm.elements[i].tagName.toLowerCase();
      var type = oForm.elements[i].type;
      /*
      if((tagName == "input" && type == "text") || tagName == "textarea")
        oForm.elements[i].value = trim(oForm.elements[i].value);
      */
    }
    return true;
  } catch (e) {
    alert(e.message);
  }
}

var oProgress = null;
function beginProgress() {
  endProgress();
  oProgress = document.createElement("span");
  oProgress.style.position = "absolute";
  oProgress.style.left = "0px";
  oProgress.style.top = "0px";
  oProgress.style.backgroundColor = "#FFFF99";
  oProgress.innerText = "???..";
  document.body.appendChild(oProgress);
}
function endProgress() {
  if (oProgress) {
    document.body.removeChild(oProgress);
    oProgress = null;
  }
}



if(isMoz) {
  XMLDocument.prototype.selectNodes= function(path) {
    var oEvaluator = new XPathEvaluator();
    var oResult = oEvaluator.evaluate(path, this, null, XPathResult.ORDERER_NODE_ITERATOR_TYPE, null);
    var result = new Array();
    var oElement = oResult.iterateNext();
    while(oElement) {
      result[oElement.nodeName]=oElement.firstChild.nodeValue;
      oElement = oResult.iterateNext();
    }
    return result;
  }
  XMLDocument.prototype.selectSingleNode = function(path) {
    var oEvaluator = new XPathEvaluator();
    var oResult = oEvaluator.evaluate(path, this, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
    return oResult.singleNodeValue;
  }
  Node.prototype.__defineGetter__("xml",function() {
    var os = new XMLSerializer();
    return os.serializeToString(this,"text/xml");
  });
}

function createHttp() {
  try {
    return new XMLHttpRequest();
  }
  catch (e) {
    var objectNames = ["MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
    for (var i = 0; i < objectNames.length; i ++) {
      try {
        return new ActiveXObject(objectNames[i]);
        break;
      }
      catch (e) {
      }
    }
    return null;
  }
}

/*
loadingIntervaler = function(loading) {
  try {
    if(loading) {
      document.body.style.cursor = "wait";
    } else {
      document.body.style.cursor = "default";
    }
    window.status = loading;
  } catch(e) {

  }
}

window.onload = function() {
  try {
    //setInterval("loadingIntervaler(loading)", 1);
  } catch(e) {
    alert(e.message);
  }
}
*/
var loading = false;

function getResponse(uri,content) {
  try {
    loading = true
    var body = document.body;
    var oHttp = createHttp();
    if(uri.indexOf('?') ==-1) aux = '?';
    else aux = '&';
    oHttp.open("POST", uri + aux+"time=" + (new Date()).getTime(), false);
    if(content == undefined) {
      content = '';
    } else {
      oHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    }
    oHttp.send(content);
    result = new Array();
    if(isSafari || isOpera) {
        resultNodes = oHttp.responseXML.firstChild.childNodes;
        for(var i=0; i<resultNodes.length; i++) {
          if(resultNodes.item(i).firstChild != null)
            result[resultNodes.item(i).nodeName]=resultNodes.item(i).firstChild.nodeValue;
        }
      loading = false
      delete oHttp;
      return result;
    } else if(isIE) {
      resultNodes = oHttp.responseXML.documentElement.childNodes;
      result = new Array();
      for(var i=0; i<resultNodes.length; i++) {
        result[resultNodes[i].nodeName] = resultNodes[i].text;
      }
      loading = false
      delete oHttp;
      return result;
    } else {
      loading = false
      var returnValue = oHttp.responseXML.selectNodes("/response/descendant::*");
      delete oHttp;
      return returnValue;
    }
    delete oHttp;
  } catch(e) {
    alert("exception");
    loading = false
    var escapeSpace = document.getElementsByName('body');
    var iframeElement = document.createElement('div');
    document.body.appendChild(iframeElement);
    iframeElement.innerHTML = '<iframe src="'+uri+'"style="display:none" onload="location.href=location.href"></iframe>';

    return false;
  }
}

function requestHttp(uri) {
  try{
    var oHttp = createHttp();
    oHttp.open("GET", uri + "&time=" + (new Date()).getTime(), false);
    oHttp.send("");
    if(isSafari || isOpera) {
      var returnValue = oHttp.responseXML.firstChild.firstChild.nextSibling.firstChild.nodeValue;
      delete oHttp;
      return returnValue;
    } else {
      var returnValue = oHttp.responseXML.selectSingleNode("/response/error").text;
      delete oHttp;
      return returnValue;
    }
  } catch (e) {
    window.status = e.messge;
  }
}

function requestHttpText(uri) {
  var oHttp = createHttp();
  oHttp.open("GET", uri + "&time=" + (new Date()).getTime(), false);
  oHttp.send("");
  var returnValue = oHttp.responseText;
  delete oHttp;
  return returnValue;
}

function requestHttpXml(uri) {
  var oHttp = createHttp();
  oHttp.open("GET", uri + "&time=" + (new Date()).getTime(), false);
  oHttp.send("");
  var returnValue = oHttp.responseXML;
  delete oHttp;
  return returnValue;
}

function requestPost(uri, content) {
  var oHttp = createHttp();
  oHttp.open("POST", uri + "&time=" + (new Date()).getTime(), false);
  oHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  oHttp.send(content+ "&time=" + (new Date()).getTime());
  var returnValue = oHttp.responseXML.selectSingleNode("/response/error").text;
  delete oHttp;
  return returnValue;
}

function requestPostText(uri, content) {
  var oHttp = createHttp();
  oHttp.open("POST", uri + "&time=" + (new Date()).getTime(), false);
  oHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  oHttp.send(content);
  var returnValue = oHttp.responseText;
  delete oHttp;
  return returnValue;
}

function setRequestBody(elementName, elementValue, boundary)
{
  var body = "";
  body += "--" + boundary + "\r\n";
  body += "Content-Disposition: form-data; name=\"" + elementName + "\"" + "\r\n\r\n";
  body += elementValue + "\r\n";
  return body;
}

function isNull(field,message) {
  if (field.value.length==0) {
    alert(message + '\t');
    field.focus();
    return true;
  }
  return false;
}

var tatterImagePopup = null;

function open_img(url) {
  try {
    var left = Math.floor((screen.availWidth - 250) / 2);
    var top = Math.floor((screen.availHeight - 100) / 2);
    try { tatterImagePopup.close(); } catch(e) { }
    tatterImagePopup = window.open("", "", "width=250, height=100, left=" + left + ", top=" + top + ", scrollbars=no, resizable=yes");
    tatterImagePopup.document.open("text/html", "replace");
    tatterImagePopup.document.write(
      '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r\n' +
      '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko">\r\n' +
      '  <head>\r\n' +
      '    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>\r\n' +
      '    <title> :: View :: </title>\r\n' +
      '    <style type="text/css">\r\n' +
      '      html, body { width: 100%; height: 100%; margin: 0; padding: 0; cursor: pointer; text-align: center; line-height: 0; }\r\n' +
      '      div { width: 100%; height: 100%; overflow: auto; }\r\n' +
      '    </style>\r\n' +
      '    <script type="text/javascript">\r\n' +
      ((navigator.userAgent.indexOf("Safari") > -1) ?
        '      function resizeImage() {\r\n' :
        '      window.onload = function() {\r\n') +
      '        var container = document.getElementById("Container");\r\n' +
      '        var image = document.getElementById("Image");\r\n' +
      '        var resizeWidth = 0, resizeHeight = 0, positionTop = 0, positionLeft = 0;\r\n' +
      '        var offsetTop = window.screenTop || window.screenY;\r\n' +
      '        var offsetLeft = window.screenLeft || window.screenX;\r\n' +
      '        if(navigator.userAgent.indexOf("Safari") > -1) {\r\n' +
      '          var width = Math.min(image.width + 50, screen.availWidth - 100);\r\n' +
      '          var height = Math.min(image.height + 50, screen.availHeight - 100);\r\n' +
      '          window.moveTo((screen.availWidth - width) / 2, (screen.availHeight - height) / 2);\r\n' +
      '          window.resizeTo(width, height);\r\n' +
      '          return;\r\n' +
      '        }\r\n' +
      '        if(container.scrollWidth > container.offsetWidth) {\r\n' +
      '          resizeWidth += container.scrollWidth - container.offsetWidth;\r\n' +
      '          if(container.offsetWidth + resizeWidth + 100 > screen.availWidth) {\r\n' +
      '            resizeWidth = screen.availWidth - container.offsetWidth - 100;\r\n' +
      '            positionLeft = -resizeWidth / 2;\r\n' +
      '            resizeHeight += 20;\r\n' +
      '          }\r\n' +
      '          else {\r\n' +
      '            positionLeft = -resizeWidth / 2;\r\n' +
      '          }\r\n' +
      '        }\r\n' +
      '        if(container.scrollHeight > container.offsetHeight) {\r\n' +
      '          resizeHeight += container.scrollHeight - container.offsetHeight;\r\n' +
      '          if(container.offsetHeight + resizeHeight + 100 > screen.availHeight - 50) {\r\n' +
      '            resizeHeight = screen.availHeight - container.offsetHeight - 100 - 40;\r\n' +
      '            positionTop = -resizeHeight / 2;\r\n' +
      '            resizeWidth += 20;\r\n' +
      '          }\r\n' +
      '          else {\r\n' +
      '            positionTop = -resizeHeight / 2;\r\n' +
      '          }\r\n' +
      '        }\r\n' +
      '        if(resizeWidth == 0 && resizeHeight == 0)\r\n' +
      '          image.style.marginTop = ((container.offsetHeight - image.height) / 2) + "px";\r\n' +
      '        window.moveBy(positionLeft, positionTop - 35);\r\n' +
      '        window.resizeBy(resizeWidth, resizeHeight);\r\n' +
      '      }\r\n' +
      '    </script>\r\n' +
      '  </head>\r\n' +
      '  <body onclick="window.close()">\r\n' +
      ((navigator.userAgent.indexOf("Safari") > -1) ?
        '    <div id="Container"><img id="Image" src="' + url + '" alt="" onload="resizeImage()"/></div>\r\n' :
        '    <div id="Container"><img id="Image" src="' + url + '" alt=""/></div>\r\n') +
      '  </body>\r\n' +
      '</html>'
    );
    tatterImagePopup.document.close();
    if(tatterImagePopup.document.focus)
      tatterImagePopup.document.focus();
  }
  catch(e) {
    window.open(url, "_blank");
  }
}

function openFullScreen(content,caption,root) {
  try {
  /*
  var code ='\
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\
  <html xmlns="http://www.w3.org/1999/xhtml">\
  <head>\
  <title>'+caption+' - iMazing</title>\
  <script type="text/javascript" src="'+root+'/script/common2.js"></script>\
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\
  <style>\
    body {\
      margin:0px;\
      width: 100%;\
      height: 100%\
    }\
  </style>\
  </head>\
  <body>\
    <script type="text/javascript">document.write(\''+content+'\')</script>\
  </body>\
  </html>';
  */
  } catch(e) {
  }
    img_view = window.open(content,'img_popup','width='+screen.width+',height='+screen.height+',left=0,top=0,scrollbars=no,resizable=yes');
    img_view.status = caption;
  try { img_view.document.focus(); }
  catch(e) { }
}

function scroller(target, acceleration) {
  try {
    var target = document.getElementById(target);
    var dest = document.body.scrollTop;
    status = target.scrollTop+'  '+document.body.scrollTop+'  '+acceleration+' = '+((target.offsetTop - document.body.scrollTop)/acceleration)
    dest += (target.offsetTop - document.body.scrollTop)/acceleration
    if ( document.body.scrollTop == dest)
      clearInterval(scrollerId);
    window.scroll(0, dest);
  } catch(e) {
    clearInterval(scrollerId);
    alert(e.message);
  }
}

function eleganceScroll(target, acceleration) {
  if(acceleration == undefined)
    acceleration = 8;
  scrollerId = window.setInterval("scroller('"+target+"',"+acceleration+")",1000/30);
}

function showJukeboxList(id,height){
  target = document.getElementById('jukeBoxContainer'+id);
  divTarget = document.getElementById('jukeBox'+id+'Div');
  flashTarget = document.getElementById('jukeBox'+id+'Flash');
  target.style.height = flashTarget.style.height = divTarget.style.height = height+'px';
}

function setUserSetting(name, value) {
  var request = new HTTPRequest("POST", blogURL + "/owner/setting/userSetting/set/");
  request.send("name=" + encodeURIComponent(name) + "&value=" + encodeURIComponent(value));
}

function getWindowCleintHeight() {
  return (window.innerHeight != null) ? window.innerHeight : document.documentElement.clientHeight;
}

function getWindowCleintWidth() {
  return (window.innerWidth != null) ? window.innerWidth : document.documentElement.clientWidth;
}

function getOffsetTop(obj)
{ return obj ? obj.offsetTop + getOffsetTop(obj.offsetParent) : 0; }

function getOffsetLeft(obj)
{ return obj ? obj.offsetLeft + getOffsetLeft(obj.offsetParent) : 0; }

function getPositionedOffset(obj) {
  var valueT = 0, valueL = 0;
  var css = null;
  do {
    valueT += obj.offsetTop  || 0;
    valueL += obj.offsetLeft || 0;
    obj = obj.offsetParent;
    if (obj) {
      if (obj.tagName == 'BODY') break;
      var p = obj.style.position;
      if(!p){
        if(STD.isIE) {
          css = obj.currentStyle;
        } else {
          css = document.defaultView.getComputedStyle(obj, null);
        }
            p = css ? css['position'] : null;
      }
      if (p == 'relative' || p == 'absolute') break;
    }
  } while (obj);
  return {x:valueL, y:valueT};
}

function updateFeed()
{
  var http = createHttp();
  if(http) {
    http.open("GET", blogURL + "/feeder?" + (new Date()).getTime(), true);
    http.send("");
  }
}

function searchChildNodes(obj, tagName) {
  var nodes = new Array();
  if(obj.hasChildNodes()) {
    for(var i=0; i<obj.childNodes.length; i++) {
      var node = obj.childNodes[i];
      if(node.nodeType != 1)
        continue;
      if(node.tagName.toUpperCase() == tagName.toUpperCase())
        nodes[nodes.length] = node;
      var childNodes = searchChildNodes(node, tagName);
      for(var j=0; j<childNodes.length; j++) {
        nodes[nodes.length] = childNodes[j];
      }
    }
  }
  return nodes;
}

function getEmbedCode(movie,width,height,id,bg,FlashVars,menu, transparent, allowScriptAccess, quality, bgcolor, version){
  try {
    if(movie == undefined || width == undefined || height == undefined)
      return false;

    if ( FlashVars == undefined) {
      var _FlashVars_object = '';
      var _FlashVars_embed = '';
    } else {
      var _FlashVars_object = '<param name="FlashVars" value="'+FlashVars+'" />';
      var _FlashVars_embed = ' FlashVars="'+FlashVars+'" ';
    }

    if ( menu == undefined) {
      var _menu_object = '';
      var _menu_embed = '';
    } else {
      var _menu_object = '<param name="menu" value="'+menu+'" />';
      var _menu_embed = ' menu="'+menu+'" ';
    }

    if ( transparent == undefined) {
      var _transparent_object = '';
      var _transparent_embed = '';
    } else {
      var _transparent_object = '<param name="wmode" value="'+transparent+'" />';
      var _transparent_embed = ' wmode="'+transparent+'" ';
    }

    if ( quality == undefined) {
      var _quality_object = '';
      var _quality_embed = '';
    } else {
      var _quality_object = '<param name="quality" value="'+quality+'" />';
      var _quality_embed = ' quality="'+quality+'" ';
    }

    if ( bgcolor == undefined) {
      var _bgcolor_object = '';
      var _bgcolor_embed = '';
    } else {
      var _bgcolor_object = '<param name="bgcolor" value="'+bgcolor+'" />';
      var _bgcolor_embed = ' bgcolor="'+bgcolor+'" ';
    }

    if ( allowScriptAccess == undefined) {
      var _allowScriptAccess_object = '';
      var _allowScriptAccess_embed = '';
    } else {
      var _allowScriptAccess_object = '<param name="allowScriptAccess" value="'+allowScriptAccess+'" />';
      var _allowScriptAccess_embed = ' allowScriptAccess="'+allowScriptAccess+'" ';
    }

    if (id == undefined) {
      var _id = "";
    } else {
      var _id = 'id="'+id+'"';
    }


    if  (version == undefined) {
      version = '7,0,0,0';
    }

    if(STD.isIE) {
      return '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+version+'" width="'+width+'" height="'+height+'" '+_id+' align="middle"><param name="movie" value="'+movie+'" />'+_allowScriptAccess_object+_FlashVars_object+_menu_object+_quality_object+_bgcolor_object+_transparent_object+'</object>';
    } else {
      return '<embed '+_id+' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+movie+'"'+' width="'+width+'"'+' height="'+height+'"'+_allowScriptAccess_embed+_FlashVars_embed+_menu_embed+_quality_embed+_bgcolor_embed+_transparent_embed+'/>'
    }

  } catch(e) {
    return false;
  }

}

function writeCode(str, id) {
  if(id == undefined) document.write(str);
  else document.getElementById(id).innerHTML = str;
}

function writeCode2(str, id) {
  if(id == undefined) document.write(str);
  else document.getElementById(id).innerHTML = str;
}
var StringBuffer = function()
{ this.buffer = new Array(); }

StringBuffer.prototype.append=function(str)
{ this.buffer[this.buffer.length] = str; }

StringBuffer.prototype.toString = function()
{ return this.buffer.join(""); }

if(!Array.prototype.push) {
  Array.prototype.push = function() {
    var startLength = this.length;
    for(var i=0; i<arguments.length; i++)
      this[startLength + i] = arguments[i];

    return this.length;
  }
}

if(!String.prototype.trim) {
  String.prototype.trim = function()
  { return this.replace(new RegExp("(^\\s*)|(\\s*$)", "g"), ""); }
}

if(!String.prototype.replaceAll) {
    String.prototype.replaceAll = function(source, target) {
        source = source.replace(new RegExp("(\\W)", "g"), "\\$1");
        target = target.replace(new RegExp("\\$", "g"), "$$$$");
        return this.replace(new RegExp(source, "gm"), target);
    }
}

if(!String.prototype.count) {
  String.prototype.count = function(search) {
    if(typeof search == "string")
      var matches = this.match(new RegExp(search.replace(new RegExp("(\\W)", "g"), "\\$1"), "g"));
    else
      var matches = this.match(search);
    return matches ? matches.length : 0;
  }
}

if(!String.prototype.indexOfCaseInsensitive) {
  String.prototype.indexOfCaseInsensitive = function(search, from) {
    var string = (typeof from == "undefined") ? this : this.substring(from, this.length);
    var result = (typeof search == "string") ? new RegExp(search.replace(new RegExp("(\\W)", "g"), "\\$1"), "i").exec(string) : search.exec(string);
    return result ? result.index + ((typeof from == "number") ? from : 0) : -1;
  }
}

function getTagChunks(string, tagName, callback) {
  var chunks = new Array();
  var pos1 = pos2 = 0;
  while((pos1 = string.indexOfCaseInsensitive(new RegExp("<" + tagName + "\\s", "i"), pos2)) > -1) {
    var chunk = "";
    do {
      if((pos2 = string.indexOfCaseInsensitive(new RegExp("</" + tagName, "i"), Math.max(pos1, pos2))) == -1) {
        return chunks;
      }
      pos2 += tagName.length + 3;
      chunk = string.substring(pos1, pos2);
    } while(chunk != "" && chunk.count(new RegExp("<" + tagName + "\\s", "gi")) != chunk.count(new RegExp("</" + tagName, "gi")));
    if(typeof callback == "function")
      chunk = callback(chunk);
    chunks[chunks.length] = chunk;
  }
  return chunks;
}

function toggleMoreLess(obj, num, txtMore, txtLess)
{
  oMore = document.getElementById('more' + num);
  oContent = document.getElementById('content' + num);

  if (txtMore.Length == 0) txtMore = 'more...';
  if (txtLess.Length == 0) txtLess = 'less...';

  if (oContent.style.display == 'none') {
    oContent.style.display = 'block';
    oMore.className = "moreless_top";
    obj.innerHTML = txtLess;

    oLess = document.createElement("P");
    oLess.id = "less" + num;
    oLess.className = "moreless_bottom";
    var txtMore2 = txtMore.replace(/&/g,'&amp;');
    var txtLess2 = txtLess.replace(/&/g,'&amp;');

    oLess.innerHTML = '<span style="cursor: pointer;" onclick="toggleMoreLess(this, \'' + num + '\', \'' + txtMore2 + '\', \'' + txtLess2 + '\'); return false;">' + txtLess + '<\/span>';

    after = oContent.nextSibling;
    oContent.parentNode.insertBefore(oLess, after);
  } else {
    oContent.style.display = 'none';
    oMore.className = "moreless_fold";
    oMore.childNodes[0].innerHTML = txtMore;

    removeItselfById('less' + num);
  }
}
function getParentByTagName(tag, obj)
{
  while (obj.tagName != tag.toUpperCase()) {
    obj = obj.parentNode;
  }
  return obj;
}
function removeItselfById(id) {
  document.getElementById(id).parentNode.removeChild(document.getElementById(id));
}
function getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} // Ends the "getSelectedRadio" function
function getSelectedRadioValue(buttonGroup) {
   // returns the value of the selected radio button or "" if no button is selected
   var i = getSelectedRadio(buttonGroup);
   if (i == -1) {
      return "";
   } else {
      if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)
         return buttonGroup[i].value;
      } else { // The button group is just the one button, and it is checked
         return buttonGroup.value;
      }
   }
} // Ends the "getSelectedRadioValue" function
function showMessage(str) {
  PM.showMessage("" + str, "right", "bottom");
}
function preventEnter(event, onEnter) {
    if (!event) event = window.event;
    if (event.keyCode == 13) {
        event.returnValue = false;
        event.cancelBubble = true;
        try {
            event.preventDefault();
        } catch(e) { }
    if(typeof(onEnter) == "function")
      onEnter();
        return false;
    }
    return true;
}
function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}

function copyUrl(url) {
  try {
    thisMovie('clipboardPoter').setClipBoard(url);
  } catch(e) {
    if(isIE) {
      window.clipboardData.setData('Text',url);
      window.alert(s_trackbackUrlCopied);
    }
  }
}

function onClipBorad(result) {
  alert(result ? s_trackbackUrlCopied : s_trackbackUrlCopyFailed);
}

function gotoURL(url,target) {
  if(url) {
    window.open(url, target);
  }
}

// for logo image on reply region
function removeBackgroundImage(target){
  target.style.backgroundImage = "";
}

function replaceAltImage(target, altimg){
  target.src = altimg;
  target.style.backgroundImage = "";
}
//]]>