<!-- image
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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_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_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_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];}
}

//-->

<!-- showLayer

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function showhide(what){
  if (what.style.display=='none'){
   what.style.display='';
  }
  else{
   what.style.display='none'
  }
}

//-->

<!-- 
function chackLogOn(logon,URL)
{
	  if(logon == 0){
	  	alert("您尚未登入或請重新登入");
	  }else if(logon == 2){
	    window.location.href = '/ciaomusic/product/actions/productmgmt.do?cmd=PE0010';
	  }else{
	    window.location.href = URL;
	  }   
}

function validateRegisterForm(memberForm)
{
	var id = memberForm.id.value;
	var pw = memberForm.pw.value;
	var reenter = memberForm.reenter.value;
	var name = memberForm.name.value;
	var year = memberForm.year.value;
	var month = memberForm.month.value;
	var day = memberForm.day.value;
	var gender = memberForm.gender.value;
	var email = memberForm.email.value;
	var locate = memberForm.locate.value;
	var address = memberForm.address.value;

	if (id.length == 0 || id == null)
	{
		alert("未輸入手機號碼，請重新輸入");
		reInput(memberForm.id);
		return false;
	}

	idRE = /^09[0-9]{8}/;

	if (! idRE.test(id))
	{
	    alert("請重新輸入正確的手機號碼");
	    reInput(memberForm.id);
		return false;
	}

	if (pw.length == 0 || pw == null)
	{
		alert("未輸入密碼，請重新輸入");
		reInput(memberForm.pw);
		return false;
	}
  
  if (pw.length > 8)
	{
		alert("請重新輸入正確的密碼：4-8位的阿拉伯數字");
		reInput(memberForm.pw);
		return false;
	}
	
	//{4,8} 無法限制最大數目不超過8,原因不明
	pwRE = /^[0-9]{4,8}/;
	//alert(pw.match(pwRE));
	if (! pwRE.test(pw))
	{
	    alert("請重新輸入正確的密碼：4-8位的阿拉伯數字");
	    reInput(memberForm.pw);
		return false;
	}

	if (reenter.length == 0 || reenter == null)
	{
		alert("密碼確認欄未輸入，請重新輸入");
		reInput(memberForm.reenter);
		return false;
	}

	if (reenter != pw)
	{
		alert("密碼確認欄與密碼不一致，請重新輸入");
		reInput(memberForm.reenter);
		return false;
	}

	if (name.length == 0 || name == null)
	{
		alert("未輸入姓名，請重新輸入");
		reInput(memberForm.name);
		return false;
	}

	if (year.length == 0 || year == null)
	{
		alert("未輸入生日年份，請重新輸入");
		reInput(memberForm.year);
		return false;
	}

	yearRE = /19[0-9]{2}|200[0-6]{1}/;

	if (! yearRE.test(year))
	{
	    alert("生日年份應輸入四位數西元年份，請重新輸入");
	    reInput(memberForm.year);
		return false;
	}

	if (month.length == 0 || month == null)
	{
		alert("未輸入生日月份，請重新輸入");
		memberForm.month.focus();
		return false;
	}

	if (day.length == 0 || day == null)
	{
		alert("未輸入生日日期，請重新輸入");
		memberForm.day.focus();
		return false;
	}

	if (email.length == 0 || email == null)
	{
		alert("未輸入電子郵件，請重新輸入");
		reInput(memberForm.email);
		return false;
	}

	if (!checkEmail(email))
	{
		alert("電子郵件格式輸入錯誤，請重新輸入");
		reInput(memberForm.email);
		return false;
	}

	return true;
}

function vendorList(star,URL) {
		if (star.select3.selectedIndex == 0) {
			alert('請選擇機型');
		}else{
		  window.location =URL+star.select3.value;
	  }
		
}

function validateSearchForm(searchForm)
{
  var searchType = searchForm.searchType.value;
  var content = searchForm.content.value;
	var keyword = searchForm.keyword.value;
	
	if( searchType.length == 0 || searchType == null || searchForm.searchType.selectedIndex == 0){
		alert( "您沒選擇搜尋內容唷" );
		searchForm.searchType.focus();
		return false;
	}

	if( content.length == 0 || content == null || searchForm.content.selectedIndex == 0){
		alert( "您沒選擇產品類別唷" );
		searchForm.content.focus();
		return false;
	}

	if (keyword.length == 0 || keyword == null)
	{
		alert( "您沒輸入關鍵字唷" );
		reInput(searchForm.keyword);
		return false;
	}

	return true;
}

function focusKeyword(keywordInput)
{
    reInput(keywordInput); 
}

function doSearch(searchForm)
{
    if (validateSearchForm(searchForm))
    {
        searchForm.submit();
    } 
}

function reInput(input)
{
    input.select();
    input.focus();
}

function prelisten(title,file,contextPath) {
    pop=window.open(contextPath + "/preview.jsp?file="+file+"&title="+title,"WG_Preview_MIDI",'scrollbars=0,status=yes,width=289,height=151,left=300,top=70');
}

function picAniList(star,URL) {
    if (star.select3.selectedIndex == 0) {
			alert('請選擇瀏覽方式');
		}
		if (star.select3.selectedIndex == 1) {window.location =URL+'Suffix1=pic#newpic';}
		if (star.select3.selectedIndex == 2) {window.location =URL+'Suffix1=ani#newpic';}

}

function sanrioList(star,URL) {
    if (star.select3.selectedIndex == 0) {
			alert('請選擇瀏覽方式');
		}
		if (star.select3.selectedIndex == 1) {window.location =URL+'Suffix=kitty#newpic';}
		if (star.select3.selectedIndex == 2) {window.location =URL+'Suffix=pn#newpic';}
		if (star.select3.selectedIndex == 3) {window.location =URL+'Suffix=xo#newpic';}
		if (star.select3.selectedIndex == 4) {window.location =URL+'Suffix=mm#newpic';}
		if (star.select3.selectedIndex == 5) {window.location =URL+'Suffix=ts#newpic';}
		if (star.select3.selectedIndex == 6) {window.location =URL+'Suffix=ck#newpic';}
		if (star.select3.selectedIndex == 7) {window.location =URL+'Suffix=ta#newpic';}
		if (star.select3.selectedIndex == 8) {window.location =URL+'Suffix=sf#newpic';}
		if (star.select3.selectedIndex == 9) {window.location =URL+'Suffix=monkey#newpic';}
		if (star.select3.selectedIndex == 10) {window.location =URL+'Suffix=flower#newpic';}
		if (star.select3.selectedIndex == 11) {window.location =URL+'Suffix=ss#newpic';}
		if (star.select3.selectedIndex == 12) {window.location =URL+'Suffix=cn#newpic';}
		if (star.select3.selectedIndex == 13) {window.location =URL+'Suffix=cy#newpic';}

}

function cartoonList(star,URL) {
    if (star.select4.selectedIndex == 0) {
			alert('請選擇瀏覽方式');
		}
		if (star.select4.selectedIndex == 1) {window.location =URL+'Suffix=snoopy#newpic';}
		if (star.select4.selectedIndex == 2) {window.location =URL+'Suffix=panda#newpic';}
		if (star.select4.selectedIndex == 3) {window.location =URL+'Suffix=shin#newpic';}
		//if (star.select4.selectedIndex == 4) {window.location =URL+'Suffix=betty#newpic';}
		if (star.select4.selectedIndex == 4) {window.location =URL+'Suffix=ochaken#newpic';}
		if (star.select4.selectedIndex == 5) {window.location =URL+'Suffix=moomin#newpic';}
		if (star.select4.selectedIndex == 6) {window.location =URL+'Suffix=momo#newpic';}
		if (star.select4.selectedIndex == 7) {window.location =URL+'Suffix=gomu#newpic';}
		if (star.select4.selectedIndex == 8) {window.location =URL+'Suffix=dinga#newpic';}
		if (star.select4.selectedIndex == 9) {window.location =URL+'Suffix=wishwing#newpic';}
		if (star.select4.selectedIndex == 10) {window.location =URL+'Suffix=murphy#newpic';}
		if (star.select4.selectedIndex == 11) {window.location =URL+'Suffix=monchhichi#newpic';}
		//add by Jessica 2007.04.25
		if (star.select4.selectedIndex == 12) {window.location =URL+'Suffix=frog#newpic';}
		if (star.select4.selectedIndex == 13) {window.location =URL+'Suffix=doneoh#newpic';}
		if (star.select4.selectedIndex == 14) {window.location =URL+'Suffix=mcdull#newpic';}

}

function idolList(star,URL) {
    if (star.select4.selectedIndex == 0) {
			alert('請選擇瀏覽方式');
		}
		if (star.select4.selectedIndex == 1) {window.location =URL+'Suffix=hk#newpic';}
		if (star.select4.selectedIndex == 2) {window.location =URL+'Suffix=emi#newpic';}
		if (star.select4.selectedIndex == 3) {window.location =URL+'Suffix=idol#newpic';}
}

function artList(star,URL) {
    if (star.select4.selectedIndex == 0) {
			alert('請選擇瀏覽方式');
		}
		if (star.select4.selectedIndex == 1) {window.location =URL+'Suffix=redcapsule#newpic';}
		if (star.select4.selectedIndex == 2) {window.location =URL+'Suffix=no1#newpic';}
		if (star.select4.selectedIndex == 3) {window.location =URL+'Suffix=love#newpic';}
		if (star.select4.selectedIndex == 4) {window.location =URL+'Suffix=artkey#newpic';}
		if (star.select4.selectedIndex == 5) {window.location =URL+'Suffix=nature#newpic';}
		if (star.select4.selectedIndex == 6) {window.location =URL+'Suffix=Dylan#newpic';}
		if (star.select4.selectedIndex == 7) {window.location =URL+'Suffix=TI#newpic';}
		if (star.select4.selectedIndex == 8) {window.location =URL+'Suffix=Goway#newpic';}
		if (star.select4.selectedIndex == 9) {window.location =URL+'Suffix=kang#newpic';}
		if (star.select4.selectedIndex == 10) {window.location =URL+'Suffix=niva#newpic';}
		if (star.select4.selectedIndex == 11) {window.location =URL+'Suffix=power#newpic';}
		if (star.select4.selectedIndex == 12) {window.location =URL+'Suffix=white#newpic';}
}

//add by Sam 小額遠傳付費手機驗證 2008.01.15
function doPaymentFet(PaymentForm)
{
    if (validatePaymentFormFet(PaymentForm)) {
        PaymentForm.submit();
    }
}



function validatePaymentFormFet(PaymentForm)
{
	  
		if(document.PaymentForm.fettel.value == "" || document.PaymentForm.fettel.value == null) {
			alert("請填寫電話");
			PaymentForm.fettel.focus();
			  return false;
		}
	   
    
		 if(!document.PaymentForm.fettel.value.match("^(09)\\d{8}$")) {
	   	  alert('手機號碼格式錯誤,請重新輸入');
	   	  PaymentForm.fettel.focus();
	      return false;
	  }
	  
	  return true;
	
}
//add end

function doPayment(PaymentForm)
{
    if (validatePaymentForm(PaymentForm)) {
        PaymentForm.submit();
    }
}

function validatePaymentForm(PaymentForm)
{
    var payCodeValue = '';
    if(PaymentForm.payCode.length >0){

    	for (var i = 0; i < PaymentForm.payCode.length; i++) {
         if (PaymentForm.payCode[i].checked) {
             payCodeValue = PaymentForm.payCode[i].value;
             break;
         }
      }

      if (payCodeValue==null || payCodeValue.length==0) {
        alert("必須選擇付款方式");
        return false;
      }
      
    }else{

    	if(PaymentForm.payCode.checked){
    	payCodeValue = PaymentForm.payCode.value;
      }

      if (payCodeValue==null || payCodeValue.length==0) {
        alert("必須選擇付款方式");
        return false;
      }
      
    }
    

    return true;
}

/*
function validatePaymentFormBak(PaymentForm)
{
    var payCodeValue = '';
    for (var i = 0; i < PaymentForm.payCode.length; i++) {
         if (PaymentForm.payCode[i].checked) {
             payCodeValue = PaymentForm.payCode[i].value;
             break;
         }
    }

    if (payCodeValue==null || payCodeValue.length==0) {
        alert("必須選擇付款方式");
        return false;
    }

    return true;
}
*/

function validateUpdateMemberForm(memberForm)
{
	var name = memberForm.name.value;
	var year = memberForm.year.value;
	var month = memberForm.month.value;
	var day = memberForm.day.value;
	var gender = memberForm.gender.value;
	var email = memberForm.email.value;
	var locate = memberForm.locate.value;
	var address = memberForm.address.value;

	if (name.length == 0 || name == null)
	{
		alert("未輸入姓名，請重新輸入");
		reInput(memberForm.name);
		return false;
	}

	if (year.length == 0 || year == null)
	{
		alert("未輸入生日年份，請重新輸入");
		reInput(memberForm.year);
		return false;
	}

	yearRE = /19[0-9]{2}|200[0-6]{1}/;

	if (! yearRE.test(year))
	{
	    alert("生日年份應輸入四位數西元年份，請重新輸入");
	    reInput(memberForm.year);
		return false;
	}

	if (month.length == 0 || month == null)
	{
		alert("未輸入生日月份，請重新輸入");
		memberForm.month.focus();
		return false;
	}

	if (day.length == 0 || day == null)
	{
		alert("未輸入生日日期，請重新輸入");
		memberForm.day.focus();
		return false;
	}

	if (email.length == 0 || email == null)
	{
		alert("未輸入電子郵件，請重新輸入");
		reInput(memberForm.email);
		return false;
	}

	if (!checkEmail(email))
	{
		alert("電子郵件格式輸入錯誤，請重新輸入");
		reInput(memberForm.email);
		return false;
	}

	return true;
}

function validateUpdatePasswordForm(memberForm)
{
	var pw = memberForm.pw.value;
	var newpw = memberForm.newpw.value;
	var reenter = memberForm.reenter.value;

	if (pw.length == 0 || pw == null)
	{
		alert("未輸入舊密碼，請重新輸入");
		reInput(memberForm.pw);
		return false;
	}

	if (newpw.length == 0 || newpw == null)
	{
		alert("未輸入新密碼，請重新輸入");
		reInput(memberForm.newpw);
		return false;
	}

	if (reenter.length == 0 || reenter == null)
	{
		alert("密碼確認欄未輸入，請重新輸入");
		reInput(memberForm.reenter);
		return false;
	}

  if (newpw.length > 8)
	{
		alert("請重新輸入正確的密碼：4-8位的阿拉伯數字");
		reInput(memberForm.newpw);
		return false;
	}
	
	pwRE = /^[0-9]{4,8}/;

	if (! pwRE.test(newpw))
	{
	    alert("請重新輸入正確的新密碼：4-8位的阿拉伯數字");
	    reInput(memberForm.newpw);
		return false;
	}

	if (reenter != newpw)
	{
		alert("密碼確認欄與新密碼不一致，請重新輸入");
		reInput(memberForm.reenter);
		return false;
	}
}

function validateBuyPointForm(BuyPointForm)
{
    var patAmtValue = '';

    for (var i = 0; i < BuyPointForm.payAmt.length; i++) {
         if (BuyPointForm.payAmt[i].checked) {
             patAmtValue = BuyPointForm.payAmt[i].value;
             break;
         }
    }

    if (patAmtValue==null || patAmtValue.length==0) {
        alert("必須選擇儲值金額");
        return false;
    }

    return true;
}

function doBuyPoint(BuyPointForm)
{
    if (validateBuyPointForm(BuyPointForm)) {
        BuyPointForm.submit();
    }
}

function submitInquirePasswordForm(memberForm)
{
    if (validateInquirePasswordForm(memberForm)) {
        memberForm.submit();
    }
}

function validateInquirePasswordForm(memberForm)
{
	var id = memberForm.id.value;
	var year = memberForm.year.value;
	var month = memberForm.month.value;
	var day = memberForm.day.value;

	if (id.length == 0 || id == null)
	{
		alert("未輸入帳號，請重新輸入");
		reInput(memberForm.id);
		return false;
	}

	if (year.length == 0 || year == null)
	{
		alert("未輸入生日年份，請重新輸入");
		reInput(memberForm.year);
		return false;
	}

	yearRE = /19[0-9]{2}|200[0-6]{1}/;

	if (! yearRE.test(year))
	{
	    alert("生日年份應輸入四位數西元年份，請重新輸入");
	    reInput(memberForm.year);
		return false;
	}

	if (month.length == 0 || month == null)
	{
		alert("未輸入生日月份，請重新輸入");
		memberForm.month.focus();
		return false;
	}

	if (day.length == 0 || day == null)
	{
		alert("未輸入生日日期，請重新輸入");
		memberForm.day.focus();
		return false;
	}

	return true;
}

function doMail(mailForm)
{
    if (validateMailForm(mailForm))
    {
        mailForm.submit();
    }
}

function validateMailForm(mailForm)
{
	var name = mailForm.name.value;
	var telecom = mailForm.telecom.value;
	var rphone = mailForm.rphone.value;
	var email = mailForm.email.value;
	var phone = mailForm.phone.value;
	var body = mailForm.body.value;

	if (name.length == 0 || name == null)
	{
		alert("未輸入姓名，請重新輸入");
		reInput(mailForm.name);
		return false;
	}

	if (telecom.length == 0 || telecom == null)
	{
		alert("未輸入電信業者，請重新輸入");
		mailForm.telecom.focus();
		return false;
	}

	if (rphone.length == 0 || rphone == null)
	{
		alert("未輸入接收手機門號，請重新輸入");
		reInput(mailForm.rphone);
		return false;
	}

	if (email.length == 0 || email == null)
	{
		alert("未輸入信箱，請重新輸入");
		reInput(mailForm.email);
		return false;
	}

	if (!checkEmail(email))
	{
		alert("電子郵件格式輸入錯誤，請重新輸入");
		reInput(mailForm.email);
		return false;
	}

	if (phone.length == 0 || phone == null)
	{
		alert("未輸入聯絡電話，請重新輸入");
		reInput(mailForm.phone);
		return false;
	}

	if (body.length == 0 || body == null)
	{
		alert("未輸入您的問題或批評、建議，請重新輸入");
		reInput(mailForm.body);
		return false;
	}

	return true;
}

function checkEmail(emailStr) {
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^(\d{1,3})[.](\d{1,3})[.](\d{1,3})[.](\d{1,3})$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom + ")*$");
	var matchArray=emailStr.match(emailPat);
	if (matchArray == null) {
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];
	if (user.match(userPat) == null) {
		return false;
	}
	var IPArray = domain.match(ipDomainPat);
	if (IPArray != null) {
		for (var i = 1; i <= 4; i++) {
			if (IPArray[i] > 255) {
				return false;
			}
		}
		return true;
	}
	var domainArray=domain.match(domainPat);
	if (domainArray == null) {
		return false;
	}
	var atomPat=new RegExp(atom,"g");
	var domArr=domain.match(atomPat);
	var len=domArr.length;
	if ((domArr[domArr.length-1].length < 2) ||
		(domArr[domArr.length-1].length > 3)) {
			return false;
		}

	if (len < 2)
	{
		return false;
	}

	return true;
}

function doFatedataForm(FatedataForm)
{
     FatedataForm.submit();
}

function doEnterTel(EnterTelForm)
{
    if (validateEnterTelForm(EnterTelForm)) {
        EnterTelForm.submit();
    }
}

function validateEnterTelForm(EnterTelForm)
{
    EnterTelForm.phoneList.value = '';
    if( EnterTelForm.meOrOther[1].checked ){
		var receiver = EnterTelForm.tel.value;
		var receivers = receiver.split("\n");

		phoneRE = /09[0-9]{8}/;

		var testreceiver = /[^-+ 0-9]/;
		var count=0;
		var phoneList = "";
		for(i=0; i<receivers.length; i++){
		    receivers[i] = receivers[i].replace(/\s/, '');
		    if (phoneRE.test(receivers[i]))
		    {
		        if (count>0) {
		            phoneList = phoneList + ",";
		        }

		        phoneList = phoneList + receivers[i];

		        count++;
		    }
		}

		if (count>0) {
            EnterTelForm.phoneList.value = phoneList;
		}

		if (count==0) {
		    alert("必須輸入傳送給他人的電話號碼");
		    return false;
		}

		if (count>5) {
		    alert("傳送給他人的電話號碼最多只能輸入５組");
		    return false;
		}
	}
    return true;
}

function doFateEnterTel(EnterTelForm)
{
    if (validateFateEnterTelForm(EnterTelForm)) {
        EnterTelForm.submit();
    }
}

function validateFateEnterTelForm(EnterTelForm)
{
    EnterTelForm.phoneList.value = '';
    if( EnterTelForm.meOrOther[1].checked ){
		var receiver = EnterTelForm.tel.value;
		var receivers = receiver.split("\n");

		phoneRE = /09[0-9]{8}/;

		var testreceiver = /[^-+ 0-9]/;
		var count=0;
		var phoneList = "";
		for(i=0; i<receivers.length; i++){
		    receivers[i] = receivers[i].replace(/\s/, '');
		    if (phoneRE.test(receivers[i]))
		    {
		        if (count>0) {
		            phoneList = phoneList + ",";
		        }

		        phoneList = phoneList + receivers[i];

		        count++;
		    }
		}

		if (count>0) {
            EnterTelForm.phoneList.value = phoneList;
		}

		if (count==0) {
		    alert("必須輸入傳送給他人的電話號碼");
		    return false;
		}

		if (count>1) {
		    alert("命理產品傳送給他人的電話號碼最多只能輸入1組");
		    return false;
		}
	}
    return true;
}

function doDownload(DownloadForm)
{
    if (validateDownloadForm(DownloadForm)) {
        DownloadForm.submit();
    }
}

function validateDownloadForm(DownloadForm)
{
    return true;
}

// no active X
function flash(c,d,e) {
 var flash_tag = "";
 flash_tag = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
 flash_tag +='codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ';
 flash_tag +='WIDTH="'+c+'" HEIGHT="'+d+'" >';
 flash_tag +='<param name="movie" value="'+e+'">';
 flash_tag +='<param name="quality" value="high">';
 flash_tag +='<param name="wmode" value="transparent">';
 flash_tag +='<param name="allowScriptAccess" value="always">';
 flash_tag +='<embed src="'+e+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" ';
 flash_tag +='type="application/x-shockwave-flash"  WIDTH="'+c+'" HEIGHT="'+d+'"></embed></object>'
 document.write(flash_tag);
}

function validateMicroLogon(logonForm)
{
	var id = logonForm.userId.value;
	var pw = logonForm.pw.value;

	if (id.length == 0 || id == null)
	{
		alert("未輸入帳號，請重新輸入");
		reInput(logonForm.id);
		return false;
	}

	if (pw.length == 0 || pw == null)
	{
		alert("未輸入密碼，請重新輸入");
		reInput(logonForm.pw);
		return false;
	}

	return true;
}

function checkPayment(PaymentForm){
	
	if(PaymentForm.invoiceType[0].checked){
			PaymentForm.submit();
	}
	
	if(PaymentForm.invoiceType[1].checked){
		if(checkPaymentFormA(PaymentForm)){
			PaymentForm.submit();
		}
	}
	if(PaymentForm.invoiceType[2].checked){
		if(checkPaymentFormB(PaymentForm)){
			PaymentForm.submit();
		}
	}
}

function checkPaymentFormA(PaymentForm){
	 if(PaymentForm.pTitle.value.length == 0 || PaymentForm.pTitle.value == null){
			alert("買受人尚未填寫");
			return false;
		}
		if(PaymentForm.receiver.value.length == 0 || PaymentForm.receiver.value == null){
			alert("收件人尚未填寫");
			return false;
		}
		if(PaymentForm.zipCode.value.length == 0 || PaymentForm.zipCode.value == null){
			alert("郵遞區號尚未填寫");
			return false;
		}
		if(PaymentForm.addr.value.length == 0 || PaymentForm.addr.value == null){
			alert("地址尚未填寫");
			return false;
		}
		
		return true;
}

function checkPaymentFormB(PaymentForm){
	 if(PaymentForm.companyCode.value.length == 0 || PaymentForm.companyCode.value == null){
			alert("統一編號尚未填寫");
			return false;
		}
		if(PaymentForm.cTitle.value.length == 0 || PaymentForm.cTitle.value == null){
			alert("發票抬頭尚未填寫");
			return false;
		}
		if(PaymentForm.receiver.value.length == 0 || PaymentForm.receiver.value == null){
			alert("收件人尚未填寫");
			return false;
		}
		if(PaymentForm.zipCode.value.length == 0 || PaymentForm.zipCode.value == null){
			alert("郵遞區號尚未填寫");
			return false;
		}
		if(PaymentForm.addr.value.length == 0 || PaymentForm.addr.value == null){
			alert("地址尚未填寫");
			return false;
		}
		
		return true;
}

function goGamePortal(subId)
{
    var subId = subId;
    if(subId !=null && subId !="" && subId.length >0){
      setDay = new Date();
      setDay.setTime(setDay.getTime()+(1000*60)); //保留 Cookie
      expDay = setDay.toGMTString();
      document.cookie = "subId="+subId+";expires="+expDay+";path=/";
      
      //test 確定是否寫入
      /*
      theCookie = document.cookie;
      alert(theCookie);
      var arrCookie = theCookie.split(";");  
      
      
      for(var i=0;i<arrCookie.length;i++){
        var arr=arrCookie[i].split("=");
        if (arr[0] == "subId"){
          alert(arr[0]+" = "+arr[1]);
        }
      }     
      */
      window.location.href = "http://www.ciaomobile.com/game/";
      //window.location.href = "http://webtest.walkgame.com/game/";
      
    }else{
    	//若沒有 subId 則連過去時通知 對方殺掉 session中的會員資料,以防登出後連過去又登入
      window.location.href = "http://www.ciaomobile.com/game/product/actions/productmgmt.do?cmd=PW0000&ksession=true";
      //window.location.href = "http://webtest.walkgame.com/game/product/actions/productmgmt.do?cmd=PW0000&ksession=true";
    }
	  
}

function goGameProduct(subId,gcmd,gameShortCode,wapGameCode)
{
    var subId = subId;
    var gcmd = gcmd;
    var gameShortCode = gameShortCode;
    var wapGameCode = wapGameCode;
    
    if(subId !=null && subId !="" && subId.length >0){
      setDay = new Date();
      setDay.setTime(setDay.getTime()+(1000*30)); //保留 Cookie
      expDay = setDay.toGMTString();
      document.cookie = "subId="+subId+";expires="+expDay+";path=/";
      
      //test 確定是否寫入
      /*
      theCookie = document.cookie;
      alert(theCookie);
      var arrCookie = theCookie.split(";");  
      
      
      for(var i=0;i<arrCookie.length;i++){
        var arr=arrCookie[i].split("=");
        if (arr[0] == "subId"){
          alert(arr[0]+" = "+arr[1]);
        }
      }     
      */
      window.location.href = "http://www.ciaomobile.com/game/product/actions/productmgmt.do?cmd="+gcmd+"&shortCode="+gameShortCode+"&gameCode="+wapGameCode+"&pagealone=true";
      //window.location.href = "http://webtest.walkgame.com/game/product/actions/productmgmt.do?cmd="+gcmd+"&shortCode="+gameShortCode+"&gameCode="+wapGameCode+"&pagealone=true";
      
    }else{
      window.location.href = "http://www.ciaomobile.com/game/product/actions/productmgmt.do?cmd="+gcmd+"&shortCode="+gameShortCode+"&gameCode="+wapGameCode+"&pagealone=true";
      //window.location.href = "http://webtest.walkgame.com/game/product/actions/productmgmt.do?cmd="+gcmd+"&shortCode="+gameShortCode+"&gameCode="+wapGameCode+"&pagealone=true";
    }
	  
}


function goLogoff(URL1)
{
	 var URL1=URL1
   delCookie('subId');
   window.location.href = URL1;     
}



function delCookie(name)
{
	 var expires = new Date();
	 expires.setTime(expires.getTime()-1);
   document.cookie = name+"=;expires="+expires.toGMTString()+";path=/";
   return true;     
}


//-->

<!-- ajax
var ajax=null;
var dataDiv;
var dataTable;
var dataTableBody;
var offsetEl;
        
function initVars()
{
   dataTableBody = document.getElementById("courseDataBody");
   dataTable = document.getElementById("courseData");
   dataDiv = document.getElementById("popup");
}

function createXMLHttpRequest()
{  
   if (window.XMLHttpRequest)
   {
      // Mozilla, Safari, ...
      xmlHttp = new XMLHttpRequest();
      if (xmlHttp.overrideMimeType)
      {
         xmlHttp.overrideMimeType('text/xml');
      }
   }
   else if (window.ActiveXObject)
   {
      // IE
      try
      {
         xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
      }
      catch (e)
      {
         try
         {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
         }
         catch (e)
         {
            alert('Giving up :( Cannot create an XMLHTTP instance');
   
         }
      }
   }
}
        
function getCourseData(element)
{
   initVars();
   //createXMLHttpRequest();
   offsetEl = element;

   //var url = "/new55968/ToolTipServlet.do?albumId=" + escape(element.id) + "&ts=" + new Date().getTime();
   var data = "albumId="+ escape(element.id) + "&ts=" + new Date().getTime();
   ajax = ajax_Request("GET","/new55968/ToolTipServlet.do",data,callback); //使用 ajax.js
   
   //xmlHttp.open("GET", url, true);
   //xmlHttp.onreadystatechange = callback;
   //xmlHttp.send(null);
}

function callback()
{
   if ( ajax!=null && ajax.readyState == 4)
   {
      if (ajax.status == 200)
      {
         setData();
      }
   }
}

function XmlDocument() {}
XmlDocument.create = function () {
	if (document.implementation && document.implementation.createDocument) {//Firefox
		return document.implementation.createDocument("", "", null);
	} else if (window.ActiveXObject) {
		try {
			var prefix = ["MSXML2", "MSXML", "Microsoft", "MSXML3"];
			for (var i = 0; i < prefix.length; i++) {
				//return new ActiveXObject(prefix[i] + ".DomDocument"); 
				var obj = new ActiveXObject(prefix[i] + ".DomDocument"); 
				if (obj == null || typeof(obj) == 'undefined') {
					continue;
				} else {
					return obj;
				}
			}
		} catch (e) {
			throw new Error("My God, What version of IE are you using? IE5&+ is requiered.");
		}
	} else
		throw new Error("Cannot create DOM Document!");
}


function setData() { 
	     
	     clearData();     
       setOffsets();  
               
       
   //使用 JSON 開始
   var rtn = ajax.responseText;
   try{
     //eval("var jsonObj = "+ rtn +";");
	 var jsonObj = rtn.parseJSON(); //使用 json.js
   }catch(err){
     alert(err);
	 ajax = null;
	 return;
   }  

   var albumDate = jsonObj.date;
   var desp = jsonObj.desp;
   var albumName = jsonObj.albumName;
   
   //使用 JSON結束
   
   /*使用 XML的方式
        //原本xml資料的取法
       //var date2 = xmlHttp.responseXML.getElementsByTagName("date")[0].firstChild.data;
       //var date2 = xmlHttp.responseXML.getElementsByTagName("date").item(0).firstChild.data;
       //但為了解決節點內容為中文而無法分析節點的問題改為以下做法
       //判斷是否為IE瀏覽器
       if(isIEExplorer()){
       	 var xmlDoc = XmlDocument.create();
         var responseText = xmlHttp.responseText;
         xmlDoc.loadXML(responseText); //解決 Ie 節點內容為中文的問題 此行執行後造成 firefox無法顯示資料
                    
         var albumDate = xmlDoc.documentElement.getElementsByTagName("date")[0].firstChild.data;  //適用 IE
         var desp = xmlDoc.documentElement.getElementsByTagName("desp")[0].firstChild.data;  //適用 IE
         var albumName = xmlDoc.documentElement.getElementsByTagName("albumName")[0].firstChild.data;  //適用 IE
       }else{
       	 var albumDate = xmlHttp.responseXML.getElementsByTagName("date")[0].firstChild.data;  //適用 firefox
         var desp = xmlHttp.responseXML.getElementsByTagName("desp")[0].firstChild.data;  //適用 firefox
         var albumName = xmlHttp.responseXML.getElementsByTagName("albumName")[0].firstChild.data;  //適用 firefox
       }
                */ 
       var row, row2;
       var dateData = albumName + " (" + albumDate + ")"
       var despData = desp;
       //alert(despData);
       row = createRow(dateData);            
       row2 = createRow(despData);

       dataTableBody.appendChild(row);
       dataTableBody.appendChild(row2);
       

} 

function isIEExplorer(){
	var navigatorName ="Microsoft Internet Explorer";
	var isIE = false;
	if(navigator.appName == navigatorName){
	  isIE = true;
	}
	return isIE;
}

function createRow(data) {            
    var row, cell, txtNode;
    row = document.createElement("tr");
    
    cell = document.createElement("td");
    cell.setAttribute("width","150");
    cell.style.backgroundImage = "url(/new55968/portal/images/new55968/home/bg.jpg)";
    cell.style.fontSize = "12px";
    cell.style.color = "#FFFFFF"; 
    //cell.style.background = "transparent";
    //cell.style.border = "0";
    //cell.style.borderTopColor = "#0099FF";                  
    txtNode = document.createTextNode(data);
    cell.appendChild(txtNode);
    row.appendChild(cell);
   
    return row;  
}
        
function setOffsets() {
  var end = offsetEl.offsetWidth;
  var top = calculateOffsetTop(offsetEl);
  var left = calculateOffsetLeft(offsetEl);
  
  dataDiv.style.border = "black 1px solid";
   
  dataDiv.style.left = left + 85 + "px";
  dataDiv.style.top = top + "px";
}

function calculateOffsetTop(field) {
    return calculateOffset(field, "offsetTop");
}

function calculateOffsetLeft(field) {
    return calculateOffset(field, "offsetLeft");
}

function calculateOffset(field, attr) {
  var offset = 0;
  while(field) {
  	
    offset += field[attr]; 
    field = field.offsetParent;
  }
  return offset;
}

function clearData() {            
    var ind = dataTableBody.childNodes.length;            
    for (var i = ind - 1; i >= 0 ; i--) {
        dataTableBody.removeChild(dataTableBody.childNodes[i]);       
    }
    dataDiv.style.border = "none";
}

function validateLogon(logonForm)
{
	var userid = logonForm.userId.value;
	var pass = logonForm.pw.value;

	if (userid.length == 0 || userid == null)
	{
		alert("未輸入帳號，請重新輸入");
		reInput(logonForm.userId);
		return false;
	}

	if (pass.length == 0 || pass == null)
	{
		alert("未輸入密碼，請重新輸入");
		reInput(logonForm.pw);
		return false;
	}

	return true;
}

function safePrelisten(shortCode){
	window.open("/new55968/product/actions/safePrelisten.do?shortcode=" + shortCode,"WG_Preview_MIDI",'toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,status=no,resizable=no,width=289,height=151,left=300,top=70');
}

function playWma(file){
   wma_tag = '<embed loop=true autostart=1 controls=playbutton  hidden=false  ';
   wma_tag += 'src="'+ file +'" enablecontextmenu=0 ></embed>';
   document.write(wma_tag);
  }
//-->
