<!-- //ajax
var xmlHttp;
function createXHR(){
    if (window.XMLHttpRequest){
	   xmlHttp=new XMLHttpRequest();
	}else if (window.ActiveXObject){
	   xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	if(!xmlHttp){
	  alert('您使用的瀏覽器不支援XMLHTTP物件');
	  return false;
	}
}
//檢查使用者帳號是否註冊過
function sendrequest(id){
	if(id!=""){
    createXHR();
	var url='user_xml.php?ID='+id;
	xmlHttp.open('GET',url,true);
	xmlHttp.onreadystatechange=catchResult;
	
	//xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(null);
	}else{
	   alert('請輸入會員帳號');
	}
}

function catchResult(){
	if (xmlHttp.readyState==4){
		if (xmlHttp.status == 200) {
			var xmlDoc=xmlHttp.responseXML.documentElement;
			    
    			if (xmlDoc.getElementsByTagName("useryn")[0].childNodes[0].nodeValue=='True'){
    				document.getElementById('chkr').innerHTML='此帳號已有人使用';
					document.forms.useryn.value="no";
    			}else{				
    				document.getElementById('chkr').innerHTML='此帳號尚無人使用';
					document.forms.useryn.value="ok";
    			}
		}
	}
}
//-->
<!--//
function LTrim(str) { 
 return str.replace(/^[ \t\n\r]+/g, "");
}

/**** RTrim(string):去除右空格 ****/
function RTrim(str) {
 return str.replace(/[ \t\n\r]+$/g, "");
} 


/**** Trim(string):去除前後空格 ****/
function Trim(str){
	return str.replace(/\s/g, "");
	//return RTrim(LTrim(str));
}

//-->
<!--//
function noKeyIn(input, ErrorMsg)
{  
    var inputV=input.value;
	inputV=inputV.replace(/&nbsp;/g,"")
	
	if (Trim(inputV)=='')
   	{
     		input.focus();
     		alert(ErrorMsg);
     		return true;
    }
	return false;
}

//-->
<!-- //查詢信箱格式是否正確
function CheckMail(mail) 
{
    var email = mail;
    /*var rege = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9])+$/;
    if (email.length == 0 || rege.exec(email) == null) 
    {
        return false;
    }
    return true;*/
	return /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(email);
}
//-->
<!-- //

function membercheck(){
	if (noKeyIn(document.forms.account, "請輸入E-MAIL。")  )
     	{document.forms.account.focus();     	
     	return false;
		}
    if (!CheckMail(document.forms.account.value))
    {
        alert('E-mail格式錯誤,請勿包含特殊字元');
        document.forms.account.focus();
        return false;
    }	
	if (noKeyIn(document.forms.userpwd, "請輸入密碼。")  )
     	{document.forms.userpwd.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.checkpwd, "請輸入密碼確認。")  )
     	{document.forms.checkpwd.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.captcha, "請輸入驗證碼。")  )
     	{document.forms.captcha.focus();     	
     	return false;
		}
	if(document.forms.checkpwd.value!=document.forms.userpwd.value){
	   alert("密碼與密碼確認不一樣，請再確認！");
	   return false;
	}
	
	if (document.forms.useryn.value=="no"){
	    alert('請變更信箱');
		return false;
	}
	document.forms.submit();     	
    return true;
}

function membercheck2(){
	
	if (noKeyIn(document.forms.username, "請輸入姓名。")  )
     	{forms.username.focus();     	
     	return false;
		}	
	
	if (noKeyIn(document.forms.birY, "請選擇出生年份。")  )
     	{document.forms.birY.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.birM, "請選擇出生月份。")  )
     	{document.forms.birM.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.birD, "請選擇出生日。")  )
     	{document.forms.birD.focus();     	
     	return false;
		}
	/*if (noKeyIn(forms.idno, "請輸入身份證字號。")  )
     	{forms.idno.focus();     	
     	return false;
		}*/
	if (noKeyIn(document.forms.zipcode, "請輸入郵遞區號。")  )
     	{document.forms.zipcode.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.addr, "請輸入住址。")  )
     	{document.forms.addr.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.cellphone, "請輸入行動電話。")  )
     	{document.forms.cellphone.focus();     	
     	return false;
		}
	document.forms.submit();     	
    return true;
}
function membercheck3(){
	if (noKeyIn(document.forms.account, "請輸入E-MAIL。")  )
     	{document.forms.account.focus();     	
     	return false;
		}
	if (!CheckMail(document.forms.account.value))
    {
        alert('E-mail格式錯誤');
        return false;
    }	
	if (noKeyIn(document.forms.userpwd, "請輸入密碼。")  )
     	{document.forms.userpwd.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.checkpwd, "請輸入密碼確認。")  )
     	{document.forms.checkpwd.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.captcha, "請輸入驗證碼。")  )
     	{document.forms.captcha.focus();     	
     	return false;
		}
	if(document.forms.checkpwd.value!=document.forms.userpwd.value){
	   alert("密碼與密碼確認不一樣，請再確認！");
	   return false;
	}
	
	if (document.forms.useryn.value=="no"){
	    alert('請變更帳號');
		return false;
	}
	if (noKeyIn(document.forms.cmyname, "請輸入公司名稱。")  )
     	{document.forms.cmyname.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.username, "請輸入姓名。")  )
     	{document.forms.username.focus();     	
     	return false;
		}	

	if (noKeyIn(document.forms.email, "請輸入電子信箱。")  )
     	{document.forms.email.focus();     	
     	return false;
		}
	if (!CheckMail(document.forms.email.value))
    {
        alert('mail格式錯誤');
        document.forms.email.focus();
        return false;
    }	
	document.forms.submit();     	
    return true;
}
function logincheck(){
		
	if (noKeyIn(document.logform.user, "請輸入E-MAIL。")  )
     	{document.logform.user.focus();     	
     	return false;
		}
	if (!CheckMail(document.logform.user.value))
    {
        alert('E-MAIL格式錯誤');
        return false;
    }
    if (noKeyIn(document.logform.pwd, "請輸入密碼。")  )
     	{document.logform.pwd.focus();     	
     	return false;
		}
	document.logform.submit();     	
    return true;
}
function logincheck2(){	
	if (noKeyIn(document.forms.user, "請輸入E-MAIL。")  )
     	{document.forms.user.focus();     	
     	return false;
		}
	if (!CheckMail(document.forms.user.value))
    {
        alert('E-MAIL格式錯誤');
        return false;
    }		
    if (noKeyIn(document.forms.pwd, "請輸入密碼。")  )
     	{document.forms.pwd.focus();     	
     	return false;
		}
	document.forms.submit();     	
    return true;
}
function PWDcheck(){
	if (noKeyIn(document.forms.userpwd, "請輸入密碼。")  )
     	{document.forms.userpwd.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.checkpwd, "請輸入密碼確認。")  )
     	{document.forms.checkpwd.focus();     	
     	return false;
		}
	if(document.forms.checkpwd.value!=document.forms.userpwd.value){
	   alert("密碼與密碼確認不一樣，請再確認！");
	   return false;
	}
	document.forms.submit();     	
    return true;
}
function orderdata(status){
   if(status==true){
      document.forms.username_r.value=document.forms.username.value;
	  document.forms.addr_r.value=document.forms.addr.value;
	  if(document.forms.cellnum.value!=""){
	     tel=document.forms.cellnum.value;
	  }else if(document.forms.cmy.value!=""){
		 tel=document.forms.cmy.value;
	  }else if(document.forms.hom.value!=""){
         tel=document.forms.hom.value;
      }
	  document.forms.tel_r.value=tel;
      if(document.forms.sex[0].checked){
	     document.forms.sex_r[0].checked=true;
	  }
	  if(document.forms.sex[1].checked){
	     document.forms.sex_r[1].checked=true;
	  }
   }else{
      document.forms.username_r.value="";
	  document.forms.addr_r.value="";
	  document.forms.tel_r.value="";
	  document.forms.sex_r[0].checked=false;
	  document.forms.sex_r[1].checked=false;
   }
}

function ordercheck(){
	if (noKeyIn(document.forms.username, "請輸入訂購人姓名。")  )
     	{document.forms.username.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.addr, "請輸入訂購人地址。")  )
     	{document.forms.addr.focus();     	
     	return false;
		}
	if (document.forms.cellnum.value=="" && document.forms.cmy.value=="" && document.forms.hom.value=="" )
     	{
	    alert("請輸入訂購人聯絡電話");
     	return false;
		}
		
	if (noKeyIn(document.forms.username_r, "請輸入收件人姓名。")  )
     	{document.forms.username_r.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.addr_r, "請輸入收件地址。")  )
     	{document.forms.addr_r.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.tel_r, "請輸入收件人聯絡電話。")  )
     	{document.forms.tel_r.focus();     	
     	return false;
		}
	document.forms.submit();     	
    return true;
}

function chgimg(picname){
      document.getElementById("showpic").src=picname;
	  document.getElementById("picsrc").href=picname;
}

function forgetcheck(){
	if (noKeyIn(document.forms.user, "請輸入帳號。")  )
     	{document.forms.user.focus();     	
     	return false;
		}
	if(document.forms.birY.value=="" || document.forms.birM.value=="" || document.forms.birD.value==""){
	   alert("日期格式不完整");
	   return false;
	}

	document.forms.submit();     	
    return true;
}

function qacheck(){
	if (noKeyIn(document.forms.user, "請輸入姓名。")  )
     	{document.forms.user.focus();     	
     	return false;
		}
    if (noKeyIn(document.forms.email, "請輸入電子信箱。")  )
     	{document.forms.email.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.qtext, "請輸入問題內容。")  )
     	{document.forms.qtext.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.captcha, "請輸入驗證碼。")  )
     	{document.forms.captcha.focus();     	
     	return false;
		}
	document.forms.submit();     	
    return true;
}

function qacheck2(){
	if (noKeyIn(document.forms.user, "請輸入姓名。")  )
     	{document.forms.user.focus();     	
     	return false;
		}
    if (noKeyIn(document.forms.email, "請輸入電子信箱。")  )
     	{document.forms.email.focus();     	
     	return false;
		}
	if (noKeyIn(document.forms.qtext, "請輸入問題或建議內容。")  )
     	{document.forms.qtext.focus();     	
     	return false;
		}
	document.forms.submit();     	
    return true;
}
function paycheck(){
	datetag=(new  Date(document.forms.date1.value)).getDay();
	if( datetag==0 || datetag==6){
	   alert('請選擇上班時間');
	   return false;
	}
	
	if(document.forms.invotype[1].checked==true){
		
	   if (noKeyIn(document.forms.invat, "請輸入統一編號。")  )
     	{    	
     	return false;
		}
		if (noKeyIn(document.forms.inhead, "請輸入發票抬頭。")  )
     	{
     	return false;
		}
	}
	document.forms.submit();
	return true;
	
}
function paymethod(method){
    switch(method){
		case "atm":
		    document.getElementById("atm").style.display='block';
		    document.getElementById("bung").style.display='none';
			document.getElementById("cod").style.display='none';
			document.getElementById("card").style.display='none';
		break;
	    case "bung":
		    document.getElementById("bung").style.display='block';
			document.getElementById("cod").style.display='none';
			document.getElementById("card").style.display='none';
			document.getElementById("atm").style.display='none';
		break;
		case "cod":
		    document.getElementById("bung").style.display='none';
			document.getElementById("cod").style.display='block';
			document.getElementById("card").style.display='none';
			document.getElementById("atm").style.display='none';
		break;
		case "card":
		    document.getElementById("bung").style.display='none';
			document.getElementById("cod").style.display='none';
			document.getElementById("card").style.display='block';
			document.getElementById("atm").style.display='none';
		break;
		default:
		    document.getElementById("bung").style.display='none';
			document.getElementById("cod").style.display='none';
			document.getElementById("card").style.display='none';
			document.getElementById("atm").style.display='none';
	}
}

function epapercheck(formname,type){
	var Eforms=eval('document.'+formname);
    switch(type){
	  case "add":
		if (noKeyIn(Eforms.email2, "請輸入E-MAIL。")  )
			{Eforms.email2.focus();     	
			return false;
			}
		Eforms.submit();     	
		return true;
	  break;
	  case "cancel":
	    if (noKeyIn(Eforms.email2, "請輸入E-MAIL。")  )
			{Eforms.email2.focus();     	
			return false;
			}
		Eforms.action='epapercancel.php';
		Eforms.submit();     	
		return true;
	  break;
	}
}

function linkcheck(){
	
	if (noKeyIn(document.forms.sname, "請輸入商店名稱。")  )
		{document.forms.sname.focus();     	
		return false;
		}
	if (noKeyIn(document.forms.smail, "請輸入E-MAIL。")  )
		{document.forms.smail.focus();     	
		return false;
		}
	/*if (noKeyIn(forms.content, "請輸入商店簡介。")  )
		{	
		return false;
		}*/
	if (noKeyIn(document.forms.captcha, "請輸入驗證碼。")  )
     	{document.forms.captcha.focus();     	
     	return false;
		}
	document.forms.submit();     	
	return true;
	  
}

function coopercheck(){
	
	if (noKeyIn(document.forms.cname, "請輸入公司名稱。")  )
		{document.forms.cname.focus();     	
		return false;
		}
	if (noKeyIn(document.forms.email, "請輸入電子信箱。")  )
		{document.forms.email.focus();     	
		return false;
		}
	/*if (noKeyIn(forms.content, "請輸入商店簡介。")  )
		{	
		return false;
		}*/
	if (noKeyIn(document.forms.captcha, "請輸入驗證碼。")  )
     	{document.forms.captcha.focus();     	
     	return false;
		}
	document.forms.submit();     	
	return true;
	  
}
function registercheck(){
    if (noKeyIn(document.forms.proserno, "請輸入產品序號。")  )
		{forms.proserno.focus();     	
		return false;
		}
	if (noKeyIn(document.forms.dscb, "請輸入故障描述。")  )
		{forms.dscb.focus();     	
		return false;
		}
	
	document.forms.submit();     	
	return true;

}
//判斷是否為數字
function IsNumber(num)
{
    if(!isNaN(num)){
        return false;
	}else{
    	return true;
	}
}
//判斷是否為整數
function IsInteger(num)
{
    var objRegExp  = /^-?\d+$/;
 
    if(objRegExp.test(num)){
        return false;
	}else{
    	return true;
	}
}

function storecheck(actype){
  len=document.forms.pronum.length;
  if(len>0){
     for(i=0;i<len;i++){
		//判斷是否為數字
		if(IsNumber(document.forms.pronum[i].value)){
		    alert('訂購量非數字格式');
			return false;
		}
		//判斷是否為整數
		if(IsInteger(document.forms.pronum[i].value)){
		    alert('訂購量非整數');
			return false;
		}
		//判斷是否為正整數
		if(parseInt(document.forms.pronum[i].value,10) < 0){
			alert('訂購量請勿小於0');
			return false;
		}
		//判斷訂購量是否大於庫存量
	    if(parseInt(document.forms.pronum[i].value,10) > parseInt(document.forms.store[i].value,10)){
			alert('訂購量請勿大於庫存量');
			return false;
		}
		document.forms.pronum[i].value=parseInt(document.forms.pronum[i].value,10);
	 }
  }else{
	  	//判斷是否為數字
		if(IsNumber(document.forms.pronum.value)){
		    alert('訂購量非數字格式');
			return false;
		}
		//判斷是否為整數
		if(IsInteger(document.forms.pronum.value)){
		    alert('訂購量非整數');
			return false;
		}
		//判斷是否為正整數
		if(parseInt(document.forms.pronum.value,10) < 0){
			alert('訂購量請勿小於0');
			return false;
		}
		//判斷訂購量是否大於庫存量
        if(parseInt(document.forms.pronum.value,10) > parseInt(document.forms.store.value,10)){
			alert('訂購量請勿大於庫存量');
			return false;
		}
        document.forms.pronum.value=parseInt(document.forms.pronum.value,10);
  }
  if(actype=="update"){
  	document.forms.submit();
  }else if(actype=="checkout"){
	  
    document.forms.action="paystep1.php";
	document.forms.submit();
	
  }
  return true;
}

function edmusercheck(){
    if (noKeyIn(document.forms.username, "請輸入姓名。")  )
		{document.forms.username.focus();     	
		return false;
		}
	if (noKeyIn(document.forms.email, "請輸入E-MAIL。")  )
		{document.forms.email.focus();     	
		return false;
		}
	
	document.forms.submit();     	
	return true;
}
function returncheck(){
    
	var num=document.forms.selnumber.value;
	var tag=0;
	
	if(num>1){
		
	  for(i=0;i<num;i++){
		
		if(document.forms.returnnum[i].value>0){
			tag=tag+1;
		}
	  }
	  if(tag<=0){
		    alert("退貨數量請大於0");
			return false;
	  }
	}else{
	   if(document.forms.returnnum.value<=0){
            alert("退貨數量請大於0");
			return false;
	   }
	}
	
	if (noKeyIn(document.forms.reason, "請輸入原因。")  )
		{document.forms.reason.focus();     	
		return false;
		}
	
	document.forms.submit();     	
	return true;
}
function addcartcheck(){
    if(document.proforms.buyid.value==""){
	   alert("請選擇產品規格");
	   return false;
	}
	document.proforms.submit();
	return true;
}
function memberaction(){

	if(document.forms.membertype[0].checked){
	    document.forms.action="../m1/member_add1.php";
		document.forms.submit();
	}else if(document.forms.membertype[1].checked){
		document.forms.action="../m2/member_add1.php";
		document.forms.submit();
	}else{
	    document.forms.submit();
	}
	
}

function Marquee()
{
	this.ID = document.getElementById(arguments[0]);
	if(!this.ID)
	{
		//alert("蠟猁扢离腔\"" + arguments[0] + "\"場宎趙渣昫\r\n潰脤梓ID扢离岆瘁淏!");
		this.ID = -1;
		return;
	}
	this.Direction = this.Width = this.Height = this.DelayTime = this.WaitTime = this.CTL = this.StartID = this.Stop = this.MouseOver = 0;
	this.Step = 1;
	this.Timer = 30;
	this.DirectionArray = {"top":0 , "up":0 , "bottom":1 , "down":1 , "left":2 , "right":3};
	if(typeof arguments[1] == "number" || typeof arguments[1] == "string")this.Direction = arguments[1];
	if(typeof arguments[2] == "number")this.Step = arguments[2];
	if(typeof arguments[3] == "number")this.Width = arguments[3];
	if(typeof arguments[4] == "number")this.Height = arguments[4];
	if(typeof arguments[5] == "number")this.Timer = arguments[5];
	if(typeof arguments[6] == "number")this.DelayTime = arguments[6];
	if(typeof arguments[7] == "number")this.WaitTime = arguments[7];
	if(typeof arguments[8] == "number")this.ScrollStep = arguments[8];
	this.ID.style.overflow = this.ID.style.overflowX = this.ID.style.overflowY = "hidden";
	this.ID.noWrap = true;
	this.IsNotOpera = (navigator.userAgent.toLowerCase().indexOf("opera") == -1);
	if(arguments.length >= 7)this.Start();
}

Marquee.prototype.Start = function()
{
	if(this.ID == -1)return;
	if(this.WaitTime < 800)this.WaitTime = 800;
	if(this.Timer < 20)this.Timer = 20;
	if(this.Width == 0)this.Width = parseInt(this.ID.style.width);
	if(this.Height == 0)this.Height = parseInt(this.ID.style.height);
	if(typeof this.Direction == "string")this.Direction = this.DirectionArray[this.Direction.toString().toLowerCase()];
	this.HalfWidth = Math.round(this.Width / 2);
	this.HalfHeight = Math.round(this.Height / 2);
	this.BakStep = this.Step;
	this.ID.style.width = this.Width + "px";
	this.ID.style.height = this.Height + "px";
	if(typeof this.ScrollStep != "number")this.ScrollStep = this.Direction > 1 ? this.Width : this.Height;
	var templateLeft = "<table cellspacing='0' cellpadding='0' style='border-collapse:collapse;display:inline;'><tr><td noWrap=true style='white-space: nowrap;word-break:keep-all;'>MSCLASS_TEMP_HTML</td><td noWrap=true style='white-space: nowrap;word-break:keep-all;'>MSCLASS_TEMP_HTML</td></tr></table>";
	var templateTop = "<table cellspacing='0' cellpadding='0' style='border-collapse:collapse;'><tr><td>MSCLASS_TEMP_HTML</td></tr><tr><td>MSCLASS_TEMP_HTML</td></tr></table>";
	var msobj = this;
	msobj.tempHTML = msobj.ID.innerHTML;
	if(msobj.Direction <= 1)
	{
		msobj.ID.innerHTML = templateTop.replace(/MSCLASS_TEMP_HTML/g,msobj.ID.innerHTML);
	}
	else
	{
		if(msobj.ScrollStep == 0 && msobj.DelayTime == 0)
		{
			msobj.ID.innerHTML += msobj.ID.innerHTML;
		}
		else
		{
			msobj.ID.innerHTML = templateLeft.replace(/MSCLASS_TEMP_HTML/g,msobj.ID.innerHTML);
		}
	}
	var timer = this.Timer;
	var delaytime = this.DelayTime;
	var waittime = this.WaitTime;
	msobj.StartID = function(){msobj.Scroll()}
	msobj.Continue = function()
				{
					if(msobj.MouseOver == 1)
					{
						setTimeout(msobj.Continue,delaytime);
					}
					else
					{	clearInterval(msobj.TimerID);
						msobj.CTL = msobj.Stop = 0;
						msobj.TimerID = setInterval(msobj.StartID,timer);
					}
				}

	msobj.Pause = function()
			{
				msobj.Stop = 1;
				clearInterval(msobj.TimerID);
				setTimeout(msobj.Continue,delaytime);
			}

	msobj.Begin = function()
		{
			msobj.ClientScroll = msobj.Direction > 1 ? msobj.ID.scrollWidth / 2 : msobj.ID.scrollHeight / 2;
			if((msobj.Direction <= 1 && msobj.ClientScroll <= msobj.Height + msobj.Step) || (msobj.Direction > 1 && msobj.ClientScroll <= msobj.Width + msobj.Step))			{
				msobj.ID.innerHTML = msobj.tempHTML;
				delete(msobj.tempHTML);
				return;
			}
			delete(msobj.tempHTML);
			msobj.TimerID = setInterval(msobj.StartID,timer);
			if(msobj.ScrollStep < 0)return;
			msobj.ID.onmousemove = function(event)
						{
							if(msobj.ScrollStep == 0 && msobj.Direction > 1)
							{
								var event = event || window.event;
								if(window.event)
								{
									if(msobj.IsNotOpera)
									{
										msobj.EventLeft = event.srcElement.id == msobj.ID.id ? event.offsetX - msobj.ID.scrollLeft : event.srcElement.offsetLeft - msobj.ID.scrollLeft + event.offsetX;
									}
									else
									{
										msobj.ScrollStep = null;
										return;
									}
								}
								else
								{
									msobj.EventLeft = event.layerX - msobj.ID.scrollLeft;
								}
								msobj.Direction = msobj.EventLeft > msobj.HalfWidth ? 3 : 2;
								msobj.AbsCenter = Math.abs(msobj.HalfWidth - msobj.EventLeft);
								msobj.Step = Math.round(msobj.AbsCenter * (msobj.BakStep*2) / msobj.HalfWidth);
							}
						}
			msobj.ID.onmouseover = function()
						{

							if(msobj.ScrollStep == 0)return;
							msobj.MouseOver = 1;
							clearInterval(msobj.TimerID);
						}
			msobj.ID.onmouseout = function()
						{
							if(msobj.ScrollStep == 0)
							{
								if(msobj.Step == 0)msobj.Step = 1;
								return;
							}
							msobj.MouseOver = 0;
							if(msobj.Stop == 0)
							{
								clearInterval(msobj.TimerID);
								msobj.TimerID = setInterval(msobj.StartID,timer);
							}
						}
		}
	setTimeout(msobj.Begin,waittime);
}

Marquee.prototype.Scroll = function()
{
	switch(this.Direction)
	{
		case 0:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollTop += this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollTop >= this.ClientScroll)
				{
					this.ID.scrollTop -= this.ClientScroll;
				}
				this.ID.scrollTop += this.Step;
			}
		break;

		case 1:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollTop -= this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollTop <= 0)
				{
					this.ID.scrollTop += this.ClientScroll;
				}
				this.ID.scrollTop -= this.Step;
			}
		break;

		case 2:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollLeft += this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollLeft >= this.ClientScroll)
				{
					this.ID.scrollLeft -= this.ClientScroll;
				}
				this.ID.scrollLeft += this.Step;
			}
		break;

		case 3:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollLeft -= this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollLeft <= 0)
				{
					this.ID.scrollLeft += this.ClientScroll;
				}
				this.ID.scrollLeft -= this.Step;
			}
		break;
	}
}

function weblink(type){
	switch(type){
		case "yahoo":
		    window.open("http://tw.user.bid.yahoo.com/tw/user/my_5ghome","_blank","");
		break;
		case "pchome":
			window.open("http://store.pchome.com.tw/5ghome/","_blank","");
		break;
		case "ruten":
			window.open("http://class.ruten.com.tw/user/index00.php?s=5ghome_my","_blank","");
		break;
		case "blog":
			window.open("http://tw.myblog.yahoo.com/cable-5ghome/","_blank","");
		break;
		case "yellow":
			window.open("http://5ghome.web66.com.tw/","_blank","");
		break;
	}
}

function paypagecheck(){
	datetag=(new  Date(document.forms.date1.value)).getDay();
	if( datetag==0 || datetag==6){
	   alert('請選擇上班時間');
	   return false;
	}
	
	if(document.forms.invotype[1].checked==true){
		
	   if (noKeyIn(document.forms.invat, "請輸入統一編號。")  )
     	{    	
     	return false;
		}
		if (noKeyIn(document.forms.inhead, "請輸入發票抬頭。")  )
     	{
     	return false;
		}
	}
	document.forms.submit();
	return true;
	
}
function paycount(){
	if(document.forms.payoption[1].checked==true){
	    if(document.forms.dev[0].checked==true){
			if(document.forms.tot.value>1000){
			   document.forms.postage.value=30;
			}else if(document.forms.tot.value>2500){
			   document.forms.postage.value=0;
			}else{
			   document.forms.postage.value=80;
			}
		}else if(document.forms.dev[1].checked==true){
		    if(document.forms.tot.value>1000){
			   document.forms.postage.value=50;
			}else if(document.forms.tot.value>300){
			   document.forms.postage.value=0;
			}else{
			   document.forms.postage.value=130;
			}
		}
	}else{
	     document.forms.postage.value=40;
	}
	document.forms.total.value=parseFloat(document.forms.tot.value)+parseFloat(document.forms.postage.value);
}
function linksfun(){
	createXHR();
	var url='linkrand.php';
	xmlHttp.open('POST',url,true);
	xmlHttp.onreadystatechange=linksResult;
	xmlHttp.send(null);

}
function linksResult(){
	logos="";
	document.getElementById('linksdiv').innerHTML="";
	if (xmlHttp.readyState==4){
		
		if (xmlHttp.status == 200) {
    			logos=xmlHttp.responseText;
    			document.getElementById('linksdiv').innerHTML=logos;    			
		}
	}
}
function rebateYN(){
    if(document.getElementById('rbYN').checked==true){
	    document.getElementById('rbdiv').style.display="block";
	}else{
		document.getElementById('rbdiv').style.display="none";
	}
}
function rebateCheck(){
   var mRB=parseInt(document.getElementById('minusRB').value,10);
   var maxRB=parseInt(document.getElementById('maxrebate').value,10);
   var tcost=parseInt(document.getElementById('totcost').value,10);
   //判斷是否為數字
	if(IsNumber(mRB)){
		alert('折抵點數非數字格式');
		document.getElementById('minusRB').value=0;
		return false;
	}
	//判斷是否為整數
	if(IsInteger(mRB)){
		alert('折抵點數非整數');
		document.getElementById('minusRB').value=0;
		return false;
	}
   //判斷是否為正整數
	if(mRB < 0){
		alert('折抵點數請於小於0');
		return false;
	}
   //判斷是否
   if(mRB>maxRB){
	    alert('折抵點數請勿超過您的累積紅利點數，請重新輸入');
		document.getElementById('minusRB').value=0;
   }else if(mRB<10 && mRB >0){
	    alert('單筆消費使用的折抵點數勿小於10點，請重新輸入');
		document.getElementById('minusRB').value=0;
   }else if(mRB>1000){
	    alert('單筆消費最多只能折抵1000點，請重新輸入');
		document.getElementById('minusRB').value=0;  
   }else if(mRB>tcost){
	    alert('折抵金額高於商品總額，請重新輸入');
		document.getElementById('minusRB').value=0;
   }
}
//paystep1Count(付款方式,商品總額-折抵點數)
function paystep1Count(pm,total){
	
	switch(pm){
	   case "ATM":
	   	 postf=100;
		 if(document.forms.shipoption[0].checked==true){
		 	 if(total<499){
		    	postf=40;
			 }else if(total>=499){
				postf=0;
			 }
		 }else if(document.forms.shipoption[1].checked==true){
		 	 if(total<1000){
		    	postf=100;
			 }else if(total>=1000){
				postf=0;
			 }
		 }
	   break;
	   case "COD":
	     postf=130;
		 if(total<1200){
		    postf=130;
		 }else if(total>=1200){
		    postf=0;
		 }
	   break;
	   case "BUNGOVER":
		 postf=0;
	   break;
	   case "CREDITCARD":
	   	 postf=100;
		 if(document.forms.cardoption[0].checked==true){
		 	 if(total<499){
		    	postf=40;
			 }else if(total>=499){
				postf=0;
			 }
		 }else if(document.forms.cardoption[1].checked==true){
		 	 if(total<1000){
		    	postf=100;
			 }else if(total>=1000){
				postf=0;
			 }
		 }
	   break;
	}
	document.getElementById('postfee').innerHTML=postf;
	document.getElementById('paytotal').innerHTML=total+postf;
}
//-->