﻿<!--
function get_tag(n,d) {
  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++) {
     for (j=0;!x&&j<d.forms[i].elements.length;j++) {
        if (d.forms[i].elements[j].name==n) x=d.forms[i].elements[j];
     }
  }
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=get_tag(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n);
  return x;
}

function ImgShow(Output,img,w,h,type,layout,link,target,alt) {
   if (!img || img=='&nbsp;') {
      if (Output==0) return;
      else if (Output==1) document.write("目前無圖片");
      else document.write(Output);
   }
   else {
      Iw = (w && w!='&nbsp;') ? ' width="'+w+'" ' : ''; Ih = (h && h!='&nbsp;') ? ' height="'+h+'" ' : ''; type = (type && type!='&nbsp;') ? type : 'IMAGE';
      switch(type) {
         case 'IMAGE':
            if (alt && alt!='&nbsp;') Ialt = ' alt="'+alt+'" '; else Ialt = '';
            str =  '<img src="'+img+'" border="0"'+Ialt+'>';
            if (!target || target=='&nbsp;') target= ' '; else target = ' target="'+target+'" '
            if (link && link!='0' && link!='&nbsp;') str = '<a href="'+link+'"'+target+'>'+str+'</a>';

         break;
         case 'FLASH':

            str = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+
            ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" '+
            Iw+Ih+'><PARAM NAME=movie VALUE="'+img+'">'+
            '<EMBED src="'+img+'" quality=high '+Iw+Ih+' TYPE="application/x-shockwave-flash" '+
            'PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">'+
            '</EMBED></OBJECT>';
         break;
      }
      if (layout=='0') layout = false;
      if (!layout) document.write(str);
      else return str;
   }

}

function ImgShow2(max,img,w,h,type,link) {
   if ( isNaN(w) ) w = 0;
   if ( isNaN(h) ) h = 0;
   big = ( w >= h ) ? w : h;
   size = ( w>=h ) ? 0 : 1;
   if ( big > max ) {
      if ( size==0 ) { w=max; h=0; }
      else { h=max; w=0; }
   }
   a = '<img src="/default/tmpl-img/001/img/space.gif" width="'+max+'">';
   ImgShow(a,img,w,h,type,0,link);
}

function ImgShow3(img,w,h,type,link,max,show,color1,color2) {
   max = parseInt(max);
   if ( max==0 || max=='' || isNaN(max) ) return;
   if ( isNaN(w) ) w = 0;
   if ( isNaN(h) ) h = 0;
   size = ( w>=h ) ? 0 : 1;
   if( show==1 ) {
      document.writeln('<table height='+max+' cellspacing=0 cellpadding=1 width='+max+' bgcolor='+color1+' border=0>');
      document.writeln('<tr>');
      document.writeln('<td>');
   }
   if ( size==0 ) { w=0; h=h; }
   else { h=h; w=0; }
   a = '<img src="/default/tmpl-img/001/img/space.gif" height="'+max+'">';
   document.writeln('<table cellspacing=0 cellpadding=0 width="'+max+'" height="'+max+'" ');
   if(isNaN(color2) ) document.writeln(' bgcolor='+color2);
   document.writeln(' border=0>');
   document.writeln('<tr>');
   document.writeln('<td align=center>');
   ImgShow(a,img,w,h,type,0,link);
   document.writeln('</td>');
   document.writeln('</tr>');
   document.writeln('</table>');
   if( show==1 ) {
      document.writeln('</td>');
      document.writeln('</tr>');
      document.writeln('</table>');
   }
}

function ImgPos1(pos,img,w,h,type,link,target,alt) {
   if ( !img || img=='&nbsp;') return;
   switch (pos) {
      case 'L':
         document.write('<table border=0 cellpadding=0 cellspacing=0 align=left><tr><td>'); ImgShow(1,img,w,h,type,0,link,target,alt);
         document.write('</td><td width=5><spacer></td></tr><tr><td colspan=2 height=5><spacer></td></tr></table>');
      break;
      case 'T':
         document.writeln('<table width=100% border=0 cellpadding=0 cellspacing=0><tr><td>'); ImgShow(1,img,w,h,type,0,link,target,alt);
         document.writeln('</td></tr><tr><td height=5><spacer></td></tr></table><br>');
      break;
      case 'M':
         document.write('<table border=0 cellpadding=0 cellspacing=0 align=center><tr><td>'); ImgShow(1,img,w,h,type,0,link,target,alt);
         document.write('</td></tr><tr><td height=5><spacer></td></tr></table>');
      break;
      case 'R':
         document.writeln('<table border=0 cellpadding=0 cellspacing=0 align=right><tr><td colspan=2 height=5><spacer></td></tr><tr><td width=5><spacer></td><td>');
         ImgShow(0,img,w,h,type,0,link,target,alt); document.writeln('</td></tr></table>');
      break;
   }
}
function ImgPos2(pos,img,w,h,type,link,target,alt) {
   if ( !img || img=='&nbsp;') return;
   switch(pos) {
      case 'B':
         document.writeln('<br><table width=100% border=0 cellpadding=0 cellspacing=0><tr><td height=5><spacer></td></tr><tr><td>');
         ImgShow(0,img,w,h,type,0,link,target,alt); document.writeln('</td></tr></table>');
      break;
   }
}

function ImgZoom(show,img,type) {
   if (!img || img=='&nbsp;') return;
   document.writeln("<a href=\"javascript:\" onclick=\"ZoomWin=window.open('zoom.asp?img="+img+"&type="+type+"','ZoomWin','status=yes,scrollbars=yes,resizable=yes');ZoomWin.moveTo(0,0);\" style=text-decoration:none>"+show+"</a>");
}

function ItemLink(id,show) {
   if (!id || id=='&nbsp;') return;
   document.writeln("<a href=\"item.asp?item_id="+id+"\">"+show+"</a>");
}

function CheckMe(formname,tagname,xstatus) {
   obj = get_tag(formname);
   for ( i=0; i<obj.length; i++) {
      if ( obj[i].name == tagname) {
         if (xstatus=='all' || xstatus==true) obj[i].status = true;
         else if (xstatus=='verbose') obj[i].status = !obj[i].status;
         else obj[i].status = false;
      }
   }
}

function ShowMsg(msg) {
   if (msg==0 || msg=="0" || msg=="&nbsp;" || msg=='' || msg.length<2) return;
   alert(msg);
}

function DivShow(DivName,status) {
   var Obj = get_tag(DivName);
   if (status=='0') status = false;
   if (status) Obj.style.display = '';
   else Obj.style.display = 'none';
}

function WinPopUp(URL,w,h,f,x,y)
{
   if(!w || w==0) var features = 'width=1024';
   else var features = 'width=' + w;
   if(!h || h==0) var features = features + ',height=1024';
   else var features = features + ',height=' + h;
   if (f==0 || !f)
      var features = features + ",scrollbars=yes";
   else
      var features = f;
   var POP = window.open(URL,'POPWINDOWS',features);
   POP.moveTo(0,0);
   return;
}

function Td1(a,word) {
   if ( a!=1 ) return;
   document.write("<td nowrap>"+word+"</td>");
}

function Td2(a,img,w,h,type,link,max,show,color1,color2) {
   if ( a!=1 ) return;
   document.write("<td align=center>");
   ImgShow3(img,w,h,type,link,max,show,color1,color2);
   document.write("</td>");
}

function ItemZA(preid,preimg,nextid,nextimg,zimg,ztype,zximg) {
   document.write("<table border=0 cellpadding=3 cellspacing=0 width=100% align=center><tr>");
   document.write("<td align=center>");ItemLink(preid,preimg);document.write("</td>");
   document.write("<td align=center>");ImgZoom(zximg,zimg,ztype);document.write("</td>");
   document.write("<td align=center>");ItemLink(nextid,nextimg);document.write("</td>");
   document.write("</tr></table>");
}
//-->