// JavaScript Document
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_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_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];}
}

function MM_displayLayers() { 
   //v6.0 
   var i, p, v, obj, args = MM_displayLayers.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') ? '' : (v == 'hidden') ? 'none' : v; 
         } 
         obj.display = v; 
      } 
   } 
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

//開啟新視窗
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//加到我的最愛
function agree(main,title){
	window.external.AddFavorite(main,title);
}
//包月購買
function monthBuy(f){
	dourl = '/month/month_buy.php?month_id='+f;
	window.open(dourl,'購買包月服務','width=550,height=500');
}
//包月取消訂購
function monthCancel(f){
	dourl = '/month/month_cancel.php?month_id='+f;
	window.open(dourl,'取消包月服務','width=550,height=450');
}
//包月收看
function monthPlay(f){
	dourl = '/month/month_play.php?media_id='+f;
	window.open(dourl,'收看包月影片','width=550,height=670');
}
//包月收看
function month24hrPlay(f){
	dourl = '/month/month_24hr_play.php?month_id='+f;
	window.open(dourl,'收看包月影片','width=550,height=670');
}

//VOD影片收看
function doPlay(form,mode){
	var myindex=URLFORM.dest.selectedIndex; // number of selection
	str = new String(URLFORM.dest.options[myindex].value); // value of selection
	if(mode==2){ pStr= "/preview.php?url_id="+str;
		window.open(pStr,"playwin","width=750,height=600,scrollbars=auto");
	} else { pStr= "/show.php?url_id="+str+'&';
		window.open(pStr,"playwin","width=550,height=670,scrollbars=auto");
	}
}
//38元促銷影片收看
function do38coPlay(str){
	pStr= "/38co_play.php?media_id="+str+'&';
	//window.open(pStr,"playwin","width=550,height=670");
	window.open(pStr,"","");
}

//關閉滑鼠右鍵
function disableRightClick(e)
{
  var message = "Right click disabled";
  
  if(!document.rightClickDisabled) // initialize
  {
    if(document.layers) 
    {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = disableRightClick;
    }
    else document.oncontextmenu = disableRightClick;
    return document.rightClickDisabled = true;
  }
  if(document.layers || (document.getElementById && !document.all))
  {
    if (e.which==2||e.which==3)
    {
      return false;
    }
  }
  else
  {
    return false;
  }
}

//彈跳新視窗限只出現一個
var Acoins=0;
function popUpWindow(URLStr,features)
{
  if(Acoins)
  {
    if(!Acoins.closed) Acoins.close();
  }
  popUpWin = open(URLStr, 'Acoins',features);
}
