﻿// JavaScript Document
<!--

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];}}
}

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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

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 ck_Focus(obj,str){
    if(obj.value == str){obj.value=''};
}

function ck_Blur(obj,str){
    if(obj.value == ''){obj.value=str};
}

function PrintTable(obj_content, screen_widths, screen_Heights, Home_Title, FunctionName) {

    var i ;
    var content = document.getElementById(obj_content).innerHTML;

    var LeftPosition = (screen_widths) ? (screen_widths-750)/2 : 0;
    var TopPosition  = (screen_Heights) ? (screen_Heights-480)/2 : 0 ;
	var link = '<link href="../css/vace.css" rel="stylesheet" type="text/css">\n';

    var new_window = window.open('','new','left=' + LeftPosition + ',top='+ TopPosition +',width=700,height=480,resizable=0,scrollbars=1,status=0');
    new_window.document.write(

    '<!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>',
    '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">',
    '<title>'+ Home_Title + '</title>'+link,
    '</head>',
    '<body>',
    '<div id="B2b">',
    '<div id="main2A">',
      '<table style="width:644px" border="0" cellpadding="0" cellspacing="0">',
       '<tr>',
        '<td>',
          '<table border="0" cellspacing="0" cellpadding="0" summary="Typesetting form">',
           '<tr>',
            '<td><img src="../images/VAC-E1-0_01.gif" alt="" width="25" height="42"></td>',
            '<td valign="bottom" background="../images/VAC-E1-0_02.gif">',
              '<table width="100%" border="0" cellspacing="2" cellpadding="0" summary="form:print">',
               '<tr>',
                 '<td width="100%" valign="middle" colspan="2"><span class="content-t">' + FunctionName + '</span></td>',
               '</tr>',
              '</table>',
           '</td>',
           '<td><img src="../images/VAC-E1-0_03.gif" alt="" width="24" height="42"></td>',
          '</tr>' + content,
       '</table>',
    '</div>',
    '</div>',
    '<div align="center"><br><input type="image" src="../images/VAC-E1-0-print.gif" value="Print" style="cursor:hand" onclick="window.location.reload();print();" title="print"></div><br>',
    '</body>',
    '</html>');
    //new_window.print();
}

//ajax active物件判斷
function js_createXMLHttpRequest(){

    if(window.ActiveXObject){
        var Js_xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }

    else{
        var Js_xmlHttp = new XMLHttpRequest();
    }

    return Js_xmlHttp;

}

//ajax tag產生顯示資料
function js_Show_SelectXML(js_objSapn, js_obj, js_dstr, js_objTy, js_vempty){
    
    var v_String;

    switch (js_objTy){

    case 'hidden':

           if (js_dstr.length > 0){
                js_obj.value = js_dstr[vi+1];
            }
            else
            {
                js_obj.value.length = 0;
            }

    case 'select':

           v_String = '<select name="' + js_obj + '" class="BVSelect">';

           if (js_dstr.length > 1) {

                v_String += '<option value="">' + js_vempty + '</option>';

                for(var vi = 0; vi < js_dstr.length-1 ; vi+=2)
                {
                    v_String += '<option value="' + js_dstr[vi] + '">' + js_dstr[vi+1] + '</option>';
                }
            }
            else
            {
                v_String += '<option value="">' + js_vempty + '</option>';
            }

            v_String += '</select>';

            js_objSapn.innerHTML = v_String;

    }

}
//open 視窗
function js_Open_Window(url)
    {
     var width = 680;
     var height = 600;
     LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
     TopPosition  = (screen.availHeight) ? (screen.availHeight-height)/2 : 0 ;
     window.open(url,'NewWindow','top='+ TopPosition+',left='+ LeftPosition+ ',width='+width+',height='+height+',resizable=0,scrollbars=1,status=0');
    }
//-->

