﻿<!--
  var strcss = " border-style:groove;background-color:#FFFFFF;font-size:12px;display:none;position:absolute; ";
  var pos = null;
  var chidwin = null;
  var bgcolor= null;
   
function key13(e){
  if (e) {   var keycode = e.keyCode; }
  else {  var keycode = e.which; }
  
  if (keycode ==13) {return true;}
  else { return false ;}
}

function newopen(url,title,width,height){
//   var w = width+width*0.05;
//   var h = height+height*0.05;	
//   var x =parseInt((screen.width-w) / 2);	
//   var y = parseInt((screen.height-h)/ 2);	
   var w = width;
   var h = height;	
   var x =0;	
   var y = 0;	

   var cond = "top="+y+",left="+x+",width="+w+",height="+h;
   cond = cond+",scrollbars=yes,toolbar=no,status=no,menubar=no,directories=no";  
   cond = cond+",location=no,resizable=yes,titlebar=no";  
   chidwin=window.open(url,title,cond);
   chidwin.focus();
 }

 function overcolor(obj){ 
   bgcolor = obj.style.backgroundColor;
   obj.style.backgroundColor ="#FFFF77";
   return;
  }

 function outcolor(obj) { 
  obj.style.backgroundColor = bgcolor; 
  return; 
 }
 
 
  function getMousePos(e){
   pos = new Array();
   if (e) {  // IE
      pos[0]= e.clientX+document.documentElement.scrollLeft; 
      pos[1]= e.clientY+document.documentElement.scrollTop+20; 
   } else {  // FF
      pos[0] = e.layerX+window.pageXOffset+10; 
      pos[1]= e.layerY+window.pageYOffset+10; 
   }
//   if (document.getElementsByName("popwin")[0]) {
//    document.getElementsByName("popwin")[0].style.left = pos[0] ;
//    document.getElementsByName("popwin")[0].style.top =  pos[1] ;
//   } 
   return pos;
 }
 
  function openCalendar(id){
    var app = navigator.appName;
    if (app.match("Internet Explorer")) { // IE
      x = event.screenX;
      y = event.screenY+20;
    } else { //FF
      x = pos[0];
      y = pos[1];
    }

	var dh = (y+180) - screen.availHeight;
   if (dh > 0) { y = y - dh- 50; }	

   var cond = "top="+y+",left="+x+",width=200,height=180";
   cond = cond+",scrollbars=no,toolbar=no,status=no,menubar=no,directories=no";  
   cond = cond+",location=no,resizeable=yes,titlebar=no";  
    calwin=window.open(virDir+"../calendar.aspx?adate="+id+"&kind=","calendar",cond);  // kind='' west kind='0' chinese
    calwin.moveTo(x,y);
    calwin.focus();
}

function isLeapYear(yy){
  return (((0 == yy % 4) && (0 != (yy % 100))) ||(0 == yy % 400)) ? true : false;
}

  function closeMe()
  {
     window.opener =null; 
     window.open("","_self"); 
     window.close();
  }
 
  function isSameSite(baseUrl)
  {
    if (opener == null)  //直接呼叫
    {
      closeMe();
    }
   else
   {
     var srcUrl = opener.location.href;
     if (srcUrl.match(baseUrl) == "" || srcUrl.indexOf(baseUrl) != 0) { closeMe();}  // 非同網站
    }  
  } 


 function checkDate(sender,args)     // useing for .net customervalidate  to check date format on client 
 {
    args.IsValid = isDate(args.Value);
    return;
 }
 
 function isDate(sDate){
  var aDate = new Date();
  var daysofMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
  
  if (sDate =="") { return false;}
   sDate = sDate.replace(/\./g,"/").replace(/\-/g,"/");
   var aryDate = new Array(3);
   aryDate = sDate.split("/");
   if (aryDate[0] == undefined || aryDate[1] == undefined || aryDate[2] ==undefined)  { return false;}
   
   try
    {

     var yy = eval(aryDate[0]);
     var mm = eval(aryDate[1]);
     var dd = eval(aryDate[2]);
     
     
     if (isLeapYear(yy)) { daysofMonth[1] =29; } 
     if (mm < 1 || mm > 12 || dd < 1) {  return false;}
     if (dd > daysofMonth[mm-1] ) { return false;}
     
       aDate.setFullYear(yy);  
       aDate.setMonth(mm-1);  
       aDate.setDate(dd);
       return true;
   }  
   catch (e) {
     return false; 
   }
 }

function ResizeIframe(objId) {
    
   ifm = parent.document.getElementById(objId);
   if (ifm != undefined)
    {
	   ifm.height = document.body.scrollHeight;
	   ifm.width = document.body.scrollWidth;
   }
}


function radioValue(obj)
{
  var r = "";
  for(var i=0; i < obj.length; i++)  
   { 
     if (obj[i].checked) { return obj[i].value; };
   }
  return r;
}

function showError(errText,br)
{
  return br + "&nbsp;<font style='font-size:12px; background-color:#ffffff; color:red'>" + errText +"</font>";
}

function openBook(pp) 
{
  document.getElementById("ifmxx").src ="check.aspx?pid="+pp;
}

function trialBook(pp) 
{
   newopen('trialBook.aspx?pid='+pp,'trial','800','600');
}

function ptestBook(pp) 
{
   newopen('trialBook.aspx?pid='+pp,'trial','1024','768');
}

function counterKey(obj1,obj2,ln,e)  // auto next tab
{
	  if (e) {var keycode = e.keyCode; }
  	  else {  var keycode = e.which; }

    if(obj1.value.length==ln) {obj2.focus();}
}


function isInstalled(_software,_mimeType,_activex)
{
 navigator.plugins.refresh();
 if (navigator.plugins && navigator.plugins.length) {
	x = navigator.plugins[_software];
	if (x) {
		return true;
	}
 } else if (navigator.mimeTypes && navigator.mimeTypes.length) {
	x = navigator.mimeTypes[_mimeType];
	if (x && x.enabledPlugin)
		return  true;
 } else if(window.ActiveXObject) {
    try
    {
        if(new ActiveXObject(_activex)) {
            return  true;
        }
    }catch(e){ return false;}
 }
 
 return false;

}

function createZoom() {
	document.write('<div id="xoom" style="position: absolute; display: none; left: 0px; top: 0px; width: 16px;');
	document.write('    height: 13px; z-index: 1; background-color: #333333; filter: alpha(opacity=50);');
	document.write('    opacity: 0.5; ">');
	document.write('</div>');
	document.write('<div id="zoom" style="position: absolute; width:800px; height:350px; display: none;');
	document.write('    top: auto; left: auto; z-index: 2;">');
	document.write('    <div id="xclose" style="float: right; background-color: #ffffff;">');
	document.write('        <a href="#" onclick="closeZoom();" class="t2b" style="border: solid 1px black; vertical-align: bottom">');
	document.write('            x.關閉</a>');
	document.write('    </div>');
	document.write('    <div id="xcontent" style="width: 100%; height: 100%; overflow: hidden; border: solid 1px black;');
	document.write('        background-color: #ffffff; white-space: nowrap;">');
	document.write('    </div>');
	document.write('</div>    ');
}

function closeZoom() {
	document.getElementById('xoom').style.display = 'none';
	document.getElementById('xoom').style.height = "0px";
	document.getElementById('xoom').style.width = "0px";
	document.getElementById('zoom').style.display = 'none';
	document.getElementById("xcontent").innerHTML = "&nbsp";
}

function scrollZoom() {
    if (document.getElementById('xoom') != null && document.getElementById('xoom').style.display == 'block') {
        moveZoom('block', '', '','');
    }
}

function innerZoom(objID, width, height, left, top, parentIframe, button) {

    document.getElementById("xclose").style.display = (button=="no"?"none":"block");

    document.getElementById("xcontent").innerHTML = document.getElementById(objID).innerHTML;

    document.getElementById("zoom").style.width = width + 'px';
    document.getElementById("zoom").style.height = height + 'px';

    moveZoom("block", left, top, parentIframe);

}


function ajaxZoom(url, param, resultype, width, height, left, top, fun1, fun2, parentIframe,button) {

    document.getElementById("xclose").style.display = (button == "no" ? "none" : "block");

	var ajax = new myAjax();
	ajax.runAjax(url, "POST", param, "xcontent", resultype, fun1, fun2);
	document.getElementById("zoom").style.width = width + 'px';
	document.getElementById("zoom").style.height = height + 'px';

	moveZoom("block", left, top, parentIframe);
}


function iframeZoom(url, width, height, left, top,parentIframe,button) {

    document.getElementById("xclose").style.display = (button == "no" ? "none" : "block");
    
    document.getElementById("zoom").style.width = width + 'px';
	document.getElementById("zoom").style.height = height + 'px';
	

	document.getElementById("xcontent").innerHTML = "<iframe src='" + url + "' frameborder='0' width='100%' height='100%' scrolling='no' ></iframe>";
	moveZoom("block", left, top, parentIframe);
}

function moveZoom(visible, left, top, parentIframe) {

	var zoom = document.getElementById("zoom");
	var xoom = document.getElementById("xoom");


	if (visible == "block") {
		zoom.style.display = "block";
		xoom.style.display = "block";

		var hh = (document.documentElement.scrollHeight > document.body.scrollHeight ? document.documentElement.scrollHeight : document.body.scrollHeight);
        
		if ( window.screen.availHeight > hh )
		{
		  xoom.style.height = window.screen.availHeight+ "px";
		}
		else
		{
		  xoom.style.height = hh + "px";
		}
		
		xoom.style.width = window.screen.availWidth + "px";
    }
    


	if (zoom.style.display == "none") { return; }

	var h = zoom.style.height.replace('px', '');
	var w = zoom.style.width.replace('px', '');



	var offy = (document.body.scrollTop > document.documentElement.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop);
	var offx = (document.body.scrollLeft > document.documentElement.scrollLeft ? document.body.scrollLeft : document.documentElement.scrollLeft);
	var cH = (document.body.clientHeight > document.documentElement.clientHeight ? document.body.clientHeight: document.documentElement.clientHeight);
	var cW = (document.body.clientWidth > document.documentElement.clientWidth ? document.body.clientWidth : document.documentElement.clientWidth);


	if (cH < h) {
	    toSizeIframe(parentIframe, '', h);
	}
    
    
	if (top == "" && left == "") {
		top = (cH - h) / 2 + offy;
		left = (cW - w) / 2 + offx;
    }
    else if (top !="" && left ==""){
		top = ((parseInt(top) + parseInt(h)) > (cH-10) ? cH - h - 10 : top) + offy;
		left = (cW - w) / 2 + offx;
	}
    else if (top =="" && left !="")
    {
		top = (cH - h) / 2 + offy;
		left = ((parseInt(left) + parseInt(w)) > (cW-10) ? cW - w - 10 : left) + offx;
    }
	else {
		top = ((parseInt(top) + parseInt(h)) > (cH-10) ? cH - h - 10 : top) + offy;
		left = ((parseInt(left) + parseInt(w)) > (cW-10) ? cW - w - 10 : left) + offx;
	}

	zoom.style.top = (top < 0 ? 0 : top) + "px"; // px for FF
	zoom.style.left = (left < 0 ? 0 : left) + "px";

}


 function sleep(milliseconds) {
    var aTime0 = new Date().getTime();
    var i = 0;
    do {
        var aTime1 = new Date().getTime();
        i = aTime1 - aTime0;
    } while (i < milliseconds);
    
}
//-->


    function play(ff) {

        var  scrip = '<object id="Exobud" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject" height="45" width="150">';
        scrip += '<param name="url" value="' + ff + '" >';
        scrip +='<param name="autoStart" value="true">';
        scrip +='<param name="loop" value="0">';
        scrip +='<param name="enableContextMenu" value="false">';
        scrip +='<param name="uiMode" value="mini">';
        scrip +='<embed id="Exobud-ff" src="' + ff + '"  hidden="true" autostart=true type="video/x-ms-wmv" height="45" width="150" >';
        scrip +='</embed>';
        scrip +='</object> ';
        document.getElementById("ifmusic").contentWindow.document.write(scrip);

      //document.getElementById("ifmusic").contentWindow.document.write('<embed type="audio/mpeg" src="' + ff + '" hidden="true" width="376" height="32"></embed>');
    }


