﻿
function text(s){return document.createTextNode(s);};function create(s){return document.createElement(s);};function get(s){return document.getElementById(s);};function item(s){return document.getElementsByName(s)[0];};function items(s){return document.getElementsByName(s);};function tag(s){return document.getElementsByTagName(s);};function LK(){event.returnValue=false;};document.oncontextmenu=LK;ondragstart=LK;onselectstart=LK;clear_options=function(o)
{while(o.options.length)
{o.remove(o.options.length-1);}};clear_childNodes=function(o)
{while(o.childNodes.length>0)
{o.removeChild(o.childNodes[o.childNodes.length-1]);}};setSelect=function(p,a)
{clear_options(p);for(var i in a)
{var o=create("OPTION");p.options.add(o);if(typeof(a[i][1])=="undefined")
{o.value=a[i];o.appendChild(text(a[i]));}
else
{o.value=a[i][0];o.appendChild(text(a[i][1]));}}};add_option=function(p,a)
{for(var i in a)
{var o=create("OPTION");p.options.add(o);if(typeof(a[i][1])=="undefined")
{o.value=a[i];o.appendChild(text(a[i]));}
else
{o.value=a[i][0];o.appendChild(text(a[i][1]));}}};scanAllTag=function()
{var o;for(var i=0;i<document.all.length;++i)
{o=document.all[i];o.disabled=true;}};scanElements=function()
{var o;for(var formNum=0;formNum<document.forms.length;++formNum)
for(var elemNum=0;elemNum<document.forms[formNum].elements.length;++elemNum)
{o=document.forms[formNum].elements[elemNum];document.write(o.type+" | "+o.value)}}
lockBody=function(t)
{var o=get("ifrMask");if(t)
{if(!o)
{o=create("IFRAME");o.id="ifrMask";o.style.position="absolute";o.frameBorder=0;o.scrolling="no";document.body.appendChild(o);}
o.style.filter="alpha(opacity=40)"
o.style.width=document.body.scrollWidth;o.style.height=document.body.scrollHeight;o.style.top=0;o.style.left=0;}
else
{if(o){document.body.removeChild(o);}}};LOG=function(str)
{var cp=document.URL.slice("file://".length);var pAppBase=cp.slice(0,cp.lastIndexOf("\\")+1).replace(/%20/g," ");var fso=new ActiveXObject("Scripting.FileSystemObject");f=fso.OpenTextFile(pAppBase+"\\log.txt",8);f.WriteLine(str+"\n");f.close();};trim=function(stringToTrim)
{return stringToTrim.replace(/^\s+|\s+$/g,"");};FILL=function(z,l)
{z="0000000000"+z;return z.slice(z.length-l);};ellipsis_row=function(id)
{var o=get(id);if(typeof(o[0])=="undefined")
{o.className="ellipsis_row";o.style.textDecoration="none";}
else
for(var i=0;i<o.length;++i)
{o[i].className="ellipsis_row";o[i].style.textDecoration="none";}};mustNumeric=function(o)
{if(isNaN(o.value))
{alert("此處必須為數值, 請確實填寫.");o.value=0;o.focus();}};getNowDate=function(n)
{var funName=getNowDate;var n=funName.arguments.length>0?funName.arguments[0]:0;now=new Date();D1=new Date(now.getYear(),now.getMonth()+1,now.getDate()+n)
return D1.getYear()+"/"+FILL(D1.getMonth(),2)+"/"+FILL(D1.getDate(),2);};getNowTime=function()
{var now=new Date();return now.getHours()+':'+now.getMinutes()+':'+now.getSeconds();};getNowTime2=function()
{var now=new Date();return now.getHours()+':'+now.getMinutes();};getNowDateTime=function()
{var now=new Date();return now.getYear()+'/'+eval(now.getMonth()+1)+'/'+now.getDate()+' '+now.getHours()+':'+now.getMinutes()+':'+now.getSeconds();};getPrefixPath=function(fld)
{var zDot="";if(typeof(fld)=="undefined"){fld="";}
var s=document.location.pathname.split("/");var iMax=1;if(isNaN(window.location.hostname.replace(/\./g,"")))
{if(window.location.hostname=="www.slc-travel.com.tw")
{iMax=1;}
else{iMax=0;}}
else{iMax=1;}
for(var i=s.length-1;i>iMax;--i)
{if(i==s.length-1)
{zDot=zDot+"./";}
else
{zDot=zDot+"../";}}
return zDot+fld;};fFindObjPrefix=function(oid,idx)
{var zHead="",sign="",a1=["",""];var oAll=tag("INPUT");for(var i=0;i<oAll.length;++i)
{var o=oAll[i];if(o.name.indexOf(":")>-1||o.name.indexOf("$")>-1)
{if(o.name.slice(0,1)=="_")
{sign=":";a1=o.name.split(sign);if(a1[1]==oid)
{if(typeof(idx)=="undefined")
{zHead=a1[0]+sign;}
else
{zHead="_ctl"+idx+sign;}
break;}}
else
{sign="$";a1=o.name.split(sign);if(a1[1]==oid)
{if(typeof(idx)=="undefined")
{zHead=a1[0]+sign;}
else
{zHead="ctl"+FILL(idx,2)+sign;}
break;}}}
else if(o.id.split("_").length>1)
{if(o.id.slice(0,1)=="_")
{sign="_";a1=o.id.slice(1).split(sign);if(a1[1]==oid)
{if(typeof(idx)=="undefined")
{zHead="_"+a1[0]+sign;}
else
{zHead="_"+"ctl"+idx+sign;}
break;}}
else
{sign="_";a1=o.id.split(sign);if(a1[1]==oid)
{if(typeof(idx)=="undefined")
{zHead=a1[0]+sign;}
else
{zHead="ctl"+FILL(idx,2)+sign;}
break;}}}}
return zHead;};transNA=function(sz)
{if(sz!="N/A")
{sz=parseInt(sz);}
else
{sz=0;}
return sz;};cloneObjEvent=function(t1,s1)
{var t2=t1.firstChild;var s2=s1.firstChild;for(;t2,s2;t2=t2.nextSibling,s2=s2.nextSibling)
{if(typeof(s2.onclick)=="function"){t2.onclick=s2.onclick;}
if(typeof(s2.ondblclick)=="function"){t2.ondblclick=s2.ondblclick;}
if(typeof(s2.onmouseover)=="function"){t2.onmouseover=s2.onmouseover;}
if(typeof(s2.onmouseout)=="function"){t2.onmouseout=s2.onmouseout;}
if(s2.childNodes.length>0)
{cloneObjEvent(t2,s2);}}};strHadEN=function(sz)
{var funName=strHadEN;var iMax=0;if(funName.arguments.length>1)
{iMax=funName.arguments[1];}
else
{iMax=sz.length;}
for(var i=0;i<iMax;++i)
if(charIsEN(sz.charAt(i)))
{return true;}
return false;};strAllIsEN=function(sz)
{var funName=strAllIsEN;var iMax=0;if(funName.arguments.length>1)
{iMax=funName.arguments[1];}
else
{iMax=sz.length;}
for(var i=0;i<iMax;++i)
if(!charIsEN(sz.charAt(i)))
{return false;}
return true;};charIsEN=function(c)
{var iASCII=c.charCodeAt(0);if((iASCII>=65&&iASCII<=90)||(iASCII>=97&&iASCII<=122)||!isNaN(c))
{return true;}
return false;};function chkTel(o)
{var v=o.value;if(v!="")
if(isNaN(v.replace(/-/g,"").replace(/#/g,""))||v.length<7)
{alert('電話格式錯誤!');o.focus();}};function chkAddr(o)
{var v=o.value;if(v!="")
{var iASCII=v.charCodeAt(0);if((iASCII>=65&&iASCII<=90)||(iASCII>=97&&iASCII<=122))
{alert('地址格式錯誤!');o.focus();}}};function chkEmail(o)
{var funName=chkEmail;var cSign=null;if(funName.arguments.length>1)
{cSign=funName.arguments[1];}
var v=o.value;if(v!="")
{var v2=v.replace(/@/g,"").replace(/\./g,"").replace(/-/g,"").replace(/_/g,"");if(cSign)v2=eval("v2.replace(/"+cSign+"/g,'')");if(v.indexOf("@")==-1||v.indexOf(".")==-1||!strAllIsEN(v2))
{alert('Mail格式錯誤!');o.focus();return false;}}
return true;};function DotNet_chkId(source,arguments)
{arguments.IsValid=true;event.srcElement.value=event.srcElement.value.toUpperCase();arguments.Value=arguments.Value.toUpperCase();var id=arguments.Value;get("btnSmt").disabled=false;if(isvalidchar(id))
{var httpReq=new myAJAX("./MSC_CheckID.aspx?chkId="+id);if(httpReq.getText()=="NO")
{alert("您已經是會員了，請直接登入會員!");get("btnSmt").disabled=true;}
httpReq=null;}
else
{arguments.IsValid=false;}};function DotNet_chkTel(source,arguments)
{arguments.IsValid=true;var v=arguments.Value;if(v!="")
if(isNaN(v.replace(/-/g,"").replace(/#/g,""))||v.length<7)
{arguments.IsValid=false;}};function DotNet_chkAddr(source,arguments)
{arguments.IsValid=true;var v=arguments.Value;if(v!="")
{var iASCII=v.charCodeAt(0);if((iASCII>=65&&iASCII<=90)||(iASCII>=97&&iASCII<=122))
{arguments.IsValid=false;}}};function DotNet_chkEmail(source,arguments)
{arguments.IsValid=true;var v=arguments.Value;if(v!="")
{var v2=v.replace(/@/g,"").replace(/\./g,"").replace(/-/g,"").replace(/_/g,"");if(v.indexOf("@")==-1||v.indexOf(".")==-1||!strAllIsEN(v2))
{arguments.IsValid=false;}}};crtFormModule=function()
{var oFrm=create("FORM");document.appendChild(oFrm);oFrm.method="POST";oFrm.crtWin=function()
{var wStyle="top=10,left=200,width=950,height=600,scrollbars=0,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0";if(this.crtWin.arguments.length>2)
{wStyle=this.crtWin.arguments[2];}
if(this.crtWin.arguments.length>0)
{this.target=this.crtWin.arguments[0];}
else
{this.target="_self";}
if(this.crtWin.arguments.length>1)
{return window.open("about:blank",this.target,wStyle);}};oFrm.putVar=function(n,v)
{var o;o=create("INPUT");o.type="hidden";o.name=n;o.value=v;this.appendChild(o);};return oFrm;};