<!--
function BtnOver(btn){
btn.style.borderTopColor="#ffffff";
btn.style.borderBottomColor="#888070";
btn.style.borderLeftColor="#ffffff";
btn.style.borderRightColor="#888070";
}
function BtnClick(btn){
btn.style.borderTopColor="#888070";
btn.style.borderBottomColor="#ffffff";
btn.style.borderLeftColor="#888070";
btn.style.borderRightColor="#ffffff";
}
function BtnOut(btn){
btn.style.borderColor="#E4E4E4";
}
function dowork(work){
doc.focus();
doc.document.execCommand(work,false,null);
document.getElementById("EditorValue").value=doc.document.body.innerHTML;
doc.focus();
}

function doFontName(fn){
doc.focus();
doc.document.execCommand('FontName',false, fn);
document.getElementById("EditorValue").value=doc.document.body.innerHTML;
doc.focus();

}
function doFontSize(fs){
doc.focus();
doc.document.execCommand('FontSize',false, fs);
document.getElementById("EditorValue").value=doc.document.body.innerHTML;
doc.focus();
}

function setdivh(){
var obj=document.getElementById("editt").style.height;
document.getElementById("editt").style.height=(parseInt(obj,10)+100)+"px";
document.getElementById("Editor").style.height=document.getElementById("editt").style.height;
}
function setdivhdel(){
var obj=document.getElementById("editt").style.height;
document.getElementById("editt").style.height=(parseInt(obj,10)-100)+"px";
document.getElementById("Editor").style.height=document.getElementById("editt").style.height;
}
function ColorPalette_OnClick(fcolor){
doc.focus()
doc.document.execCommand('ForeColor',false,fcolor);
document.getElementById("EditorValue").value=doc.document.body.innerHTML;
doc.focus();
}

function doBackColor(fcolor){
Seewrite();
if(document.all){doc.document.execCommand('BackColor',false,fcolor);}
else
{doc.document.execCommand('hiliteColor',false,fcolor);}
document.getElementById("EditorValue").value=doc.document.body.innerHTML;
doc.focus();
}

function doInsertTable(){
doc.focus();
var dotable,tmpcol,tmprow,docol,dorow,algn
algn= document.getElementById("tba").value;
tmpcol="<td align="+algn+"></td>";
docol=""
dorow=""
for ( var i=0; i<document.getElementById("tbc").value; i++ ){
docol=docol+tmpcol;
}
docol="<tr>"+docol+"</tr>"
for ( var j=0; j<document.getElementById("tbr").value; j++ ){
dorow=dorow+docol;
}
dotable="<table width=300 border="+document.getElementById("tbb").value+" cellspacing="+document.getElementById("tbs").value+" cellpadding="+document.getElementById("tbp").value+"><tbody>"+dorow+"</tbody></table>"
if(document.all){doc.document.selection.createRange().pasteHTML(dotable);}
else
{doc.document.execCommand("insertHTML",false,dotable);}
document.getElementById("EditorValue").value=doc.document.body.innerHTML;
MM_showHideLayers('Layer3p','','hide');
doc.focus();
}
function dotitlewd(){
doc.focus();
titlewd="<fieldset><legend>點二下編輯抬頭..</legend>點二下編輯內文..</fieldset>";
 if(+"\v1"){doc.document.execCommand("insertHTML",false,titlewd);}
else{doc.document.selection.createRange().pasteHTML(titlewd);}
document.getElementById("EditorValue").value=doc.document.body.innerHTML;
doc.focus();
}
function doCreateLink(){
doc.focus();
target="target__show";
sURL=document.getElementById("url").value;
strgo = sURL.toLowerCase();
if ((strgo.indexOf("mailto:")!=-1) || (strgo.indexOf("callto:")!=-1) || (strgo.indexOf("http://")!=-1) || (strgo.indexOf("https://")!=-1) || (strgo.indexOf("ftp://")!=-1) || (strgo.indexOf("ymsgr:sendim?")!=-1)||(strgo.indexOf("msnim:chat?contact=")!=-1))
{
if(confirm('超連結要以開新視窗方式嗎??\n\n建議:\n\n如果是外部的網址(例如http://www.yahoo.com.tw)請按下[確定]\n\n如果是本站頁面(例如http://'+document.domain+'/page....)請按[取消]')){target="target__new"}
doc.document.execCommand('CreateLink',false,sURL+target);
document.getElementById("EditorValue").value=doc.document.body.innerHTML;
}
else
{ alert('您要連結的網址有誤!!\n\n必須是\n\nhttp://\n\nmailto:\n\ncallto:\n\nhttps://\n\nftp://\n\nmsnim:chat?contact=\n\nymsgr:SendIM?\n\n其中一種為開頭');}
doc.focus();
}

function OnFormSubmit(){
if(amobb=='nomob'){Seewrite()};
if(document.getElementById("EditorValue").value==""){alert("資料為空白.無法送出");}
else
{
strform=document.getElementById("EditorValue").value;
str=strform.toLowerCase();
var peten1="&amp;lt;%";
var peten2="%&amp;gt;";
var peten3="<%";
var peten4="%>";
var peten5="&lt;%";
var peten6="%&gt;";
if((str.indexOf(peten1)!=-1) || (str.indexOf(peten2)!=-1) || (str.indexOf(peten3)!=-1) || (str.indexOf(peten4)!=-1) || (str.indexOf(peten5)!=-1) || (str.indexOf(peten6)!=-1) || (str.indexOf("<script")!=-1)){
cgscript = str.replace(/<script[^>]*?>([\w\W]*?)<\/script>/ig,"<noscript>禁止Javascript程式碼!!</noscript>");
document.getElementById("EditorValue").value=cgscript;
alert("PLEASE DON'T KEY ALPHANUMERIC\n\n[不能輸入<%或%>及script標籤特殊字元,已自動修正‧您可以再送一次]");
SeePreview();
return false;
}

html=strform.replace(/<span class=\"Apple-style-span\" style=/gi,"<span iclass=\"Apple-style-span\" istyle=");
html=html.replace(/<table class=cobox/gi,"<table iclass=cobox");
html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
html = html.replace(/<\\?\?xml[^>]*>/gi, "");
html = html.replace(/<\/?\w+:[^>]*>/gi, "");
html = html.replace(/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/gi, "&nbsp;");
html=html.replace(/\<b\>\<\/b\>/gi,"");
html=html.replace(/<span iclass=\"Apple-style-span\" istyle=/gi,"<span class=\"Apple-style-span\" style=");
html=html.replace(/<table iclass=cobox/gi,"<table class=cobox");
strforma=html.replace(/target__new\/\"/g,"\" target=\"_blank\"");
strformb=strforma.replace(/target__new\"/g,"\" target=\"_blank\"");
strformc=strformb.replace(/target__show\/\"/g,"\" target=\"show\"");
strformd=strformc.replace(/target__show\"/g,"\" target=\"show\"");
strforme=strformd.replace(/<BR>/ig,"<br />");
strformf=strforme.replace(/<br>/ig,"<br />");
strformg=strformf.replace(/border=0/ig,"border=\'0\'");
lcasestr=strformg;
var thisurl="\"http://"+window.location.host+"/photo";
if(str.indexOf("FIREFOX") >= 0){
yescod=lcasestr.replace(/<img src=\"photo/ig,"<img src="+thisurl);
yyescod=yescod.replace(/<img src=\"..\/photo/ig,"<img src="+thisurl);
document.getElementById("EditorValue").value=yyescod;}
else
{document.getElementById("EditorValue").value=lcasestr;}
if(confirm("THIS FORM IS FINSH??\n編輯完成")){document.fHtmlEditor.submit();}}
}

function EditResource(){
PreviewMode();
doc.document.open();
doc.document.writeln('<html><head>');
doc.document.writeln("</head><body></body></html>");
doc.document.close();
doc.document.designMode = "On";
doc.document.contentEditable = true;
doc.focus();
}
function ClearAll(){
document.getElementById("EditorValue").value="";
doc.document.body.innerHTML=document.getElementById("EditorValue").value;
doc.focus();
}

function SeePreview(){
doc.document.body.innerHTML=document.getElementById("EditorValue").value;
}
function Seewrite(){
document.getElementById("EditorValue").value=doc.document.body.innerHTML;
}

function docfocus(){
doc.focus();}

function EditMode(){
PreviewMode();
document.getElementById("editt").style.display="block";
document.getElementById("EditorValue").style.display="none";
doc.document.open();
doc.document.writeln('<html><head>');
doc.document.writeln("</head><body></body></html>");
doc.document.close();
doc.document.designMode = "On";
}
function PreviewMode(){
document.getElementById("EditorValue").style.display="block";
document.getElementById("EditorValue").value=doc.document.body.innerHTML;
doc.document.open();
doc.document.writeln('<html><head>');
doc.document.writeln("</head><body></body></html>");
doc.document.close();
doc.document.designMode = "Off";
window.setTimeout('SeePreview()',100);
}

function LoadValue(){
var wdhtml=document.getElementById("wd").value;
var addhtml=document.getElementById("EditorValue").value+wdhtml;
doc.document.body.innerHTML=addhtml;
document.getElementById("EditorValue").value=addhtml;
EditMode();
document.getElementById("wd").value="";
}
function LoadValueImg(aar){
doc.focus();
var wdhtml=document.getElementById("wd").value;
if(document.all){doc.document.selection.createRange().pasteHTML(wdhtml);}
else
{doc.document.execCommand("insertHTML",false,wdhtml);}
Seewrite();
document.getElementById("wd").value="";
document.getElementById("mmsg").innerHTML=aar;
}
function ClearImg(){
str=document.getElementById("EditorValue").value;
if(confirm('您確定將圖片全部回復成原來大小嗎?')){
str=str.replace(/<img[^>]+src="([^"]+)"[^>]*>/ig,"<img src=$1 border=0>");
document.getElementById("EditorValue").value=str;}
SeePreview();
}

function YY_checkform() { //v4.65
//copyright (c)1998,2002 Yaromat.com
  var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;var myReq;
  for (var i=1; i<args.length;i=i+4){
    if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}
    var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));
    myV=myObj.value;
    if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){
      if (myReq&&myObj.value.length==0){addErr=true}
      if ((myV.length>0)&&(args[i+2]==1)){ //fromto
        var myMa=args[i+1].split('_');if(isNaN(parseInt(myV))||myV<myMa[0]/1||myV > myMa[1]/1){addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==2)){
          var rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;
      } else if ((myV.length>0)&&(args[i+2]==3)){ // date
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);
        if(myAt){
          var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];
          var myDate=new Date(myY,myM,myD);
          if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};
        }else{addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==4)){ // time
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
      } else if (myV.length>0&&args[i+2]==5){ // check this 2
            var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));
            if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!myObj1.checked){addErr=true}
      } else if (myV.length>0&&args[i+2]==6){ // the same
            var myObj1 = MM_findObj(args[i+1]);
            if(myV!=myObj1.value){addErr=true}
      }
    } else
    if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){
          var myTest = args[i].match(/(.*)\[(\d+)\].*/i);
          var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;
      if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
      if (args[i+2]==2){
        var myDot=false;
        for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
        if(!myDot){myErr+='* ' +args[i+3]+'\n'}
      }
    } else if (myObj.type=='checkbox'){
      if(args[i+2]==1&&myObj.checked==false){addErr=true}
      if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
    } else if (myObj.type=='select-one'||myObj.type=='select-multiple'){
      if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}
    }else if (myObj.type=='textarea'){
      if(myV.length<args[i+1]){addErr=true}
    }
    if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}
  }
  if (myErr!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+myErr)}
  else
  {OnFormSubmit();}
  document.MM_returnValue = (myErr=='');
}
var amobb="nomob";
var amob=navigator.userAgent || navigator.vendor || window.opera;
 if (/android|ipad|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(amob) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(amob.substr(0, 4))){var amobb='mob';setTimeout(function(){document.getElementById("editt").style.display="none";document.getElementById("EditorValue").style.display="block";parent.soQHi('soQ')},1500)}
//-->
