﻿<!--
  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 modalWin(url,title,width,height) {
 if (window.showModalDialog) {
  window.showModalDialog(url,title,"dialogWidth:"+ width +"px;dialogHeight:"+ height+"px");
 } else {
  window.open(url,title,'height='+ height +',width='+ width 
    +',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes');
 }
} 

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=no,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 newopenWithScoll(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 closeMe()
  {
     window.opener =null; 
     window.open("","_self"); 
     window.close();
  }
 
  function isSameSite(baseUrl)
  {
    if (opener == null)  //直接呼叫,showMessageDialog  opener = null
    {
      closeMe();
    }
   else
   {
     var srcUrl = opener.location.href;
     if (srcUrl.match(baseUrl) == "" || srcUrl.indexOf(baseUrl) != 0) { closeMe();}  // 非同網站
    }  
  } 
  
 
  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=210,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(rootPath+"/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 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) {
    
   var ifm = parent.document.getElementById(objId);
   if (ifm !=null)
   {
    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,_ocx)
{
  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(_ocx)) {  return  true;   }
    } catch(e) { return false; }
 }
  return false;
}


//-->
