//load------------
var DHTML = (document.getElementById || document.all || document.layers);
function ap_getObj(name) {
    if (document.getElementById)
    {return document.getElementById(name).style; }
    else if (document.all) { return document.all[name].style;}
    else if (document.layers) { return document.layers[name];}
}
function ap_showWaitMessage(div,flag){
if (!DHTML) return; var x = ap_getObj(div);
x.visibility = (flag) ? 'visible':'hidden'
if(! document.getElementById) if(document.layers) x.left=280/2;
return true;
}

function MM_goToURL() {
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}



function ck_file(FILE,DEV){
 //obj='document.forms.FM.'+FILE
 file=FILE.value;
//file=document.forms.FM.FILE.value;
               filetmp=file.lastIndexOf(".");
               filesecend=file.substring(filetmp+1,file.length);
               filesec=filesecend.toUpperCase();
               if(filesec == "JPG" || filesec == "GIF" || filesec == "PNG" || filesec == "BMP"){
                  document.all[DEV].src="file:///" + file;
               }else{
                  alert("請先選擇檔案,檔案格式需為jpg,gif,png,bmp等格式")
                  return false;
               }
}

function ck_map(FILE){
 //obj='document.forms.FM.'+FILE
 file=FILE.value;
//file=document.forms.FM.FILE.value;
               filetmp=file.lastIndexOf(".");
               filesecend=file.substring(filetmp+1,file.length);
               filesec=filesecend.toUpperCase();
               if(filesec == "JPG" || filesec == "GIF" || filesec == "PNG" || filesec == "BMP"){
                 return true;
               }else{
                  alert("請先選擇檔案,檔案格式需為jpg,gif,png,bmp等格式")
                  return false;
               }
}

//--------call --------------------
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
//------ confirm ---------------------
function check(){
  if(confirm("你確定要刪除嗎?"))return true;
  else return false;
}

function dispMenu(menuName){
                if(menuName.style.display=='none')
                {
                        menuName.style.display='';
                }
                else
                {
                        menuName.style.display='NONE';
                }
                window.event.cancelBubble=true;
}
function disp_OFF_Menu(menuName1,menuName2,menuName3,menuName4,menuName5){
      menuName1.style.display='none';
      menuName2.style.display='none';
      menuName3.style.display='none';
      menuName4.style.display='none';
      menuName5.style.display='none';
      window.event.cancelBubble=true;
}
//---------BB--------------
                  function forum_copy(){
                     obj=document.selection.createRange();
                     obj.execCommand('copy');
                  }
                  function forum_cut(){
                     obj=document.selection.createRange();
                     obj.execCommand('copy');
                     document.selection.createRange().text='';
                  }
                  function forum_paste(txt){
                   //  alert(txt);
                   obja=document.Frm[txt]
                   obja.focus();
                   obj=document.selection.createRange();
                   obj.execCommand('paste');
                  }

                  var bbcode_array = new Array('b','i','u','s');
                  var bbmsg_array  = new Array('輸入文字將變粗體字',
                                               '輸入文字將變斜體字',
                                               '輸入文字將加底線',
                                               '輸入文字將加刪除線');
                  var bbhelp_array = new Array('粗體：[b]text[/b]',
                                               '斜體：[i]text[/i]',
                                               '底線：[u]text[/u]',
                                               '刪除線：[s]text[/s]',
                                               '剪下：將反白字串複製到剪貼簿並且將反白字串刪除',
                                               '複製：將反白字串複製到剪貼簿',
                                               '貼上：將剪貼簿內字串貼上',
                                               '[email]E-MAIL：連結電子郵件文字區塊[/email]',
                                               '[url]URL：連結URL文字區塊[/url]');

                  function forum(bbcode,txt){
                     string='';
                     for(i=0;i<bbcode_array.length;i++)
                        if(bbcode == bbcode_array[i]) break;
                     if(bbcode.length==1)
                     string = prompt(bbmsg_array[i],'');

                     if(string == null) return false;
                     obja=document.Frm[txt]
                     obja.focus();
                     if(document.selection.createRange().text){
                        document.selection.createRange().text = '['+bbcode+']' + string +'[/'+bbcode+']'
                     }else{
                     obja=document.Frm[txt]
                     obja.value=obja.value+ '['+bbcode+']' + string +'[/'+bbcode+']'
              //          document.Frm.document_body.value = document.Frm.document_body.value + '['+bbcode+']' + string +'[/'+bbcode+']'
                     }
              //       document.Frm.document_body.focus();
                     obja=document.Frm[txt]
                     obja.focus();
                  }
                  function show_help(msg,txt){
                   //  document.all['help'].innerHTML=msg;
                     document.all[txt].innerHTML=msg;
                  }