function doListen(src,img){
	var strHref = location.href.substring(0,location.href.lastIndexOf('/'));
	if (img.indexOf("..")>-1){
		img = strHref.substring(0,strHref.lastIndexOf('/')) + img.replace("..","");
  }else{
    img = strHref + "/" + img;
  }
  //alert(img);
	var url = "http://sell.e7play.com/promote/play.jsp?src="+src+"&img="+img;
	window.open(url,'_blank','height=115, width=100, location=0, resizable=0, scrollbars=0, toolbar=0');
}

/*
function doListen(src,img){
	var Win1 = open("","","width=100,height=100");
	Win1.document.open();	
	Win1.document.writeln("<HTML>");                                                                                                                           
	Win1.document.writeln("<HEAD>");                                                                                                                               
	Win1.document.writeln("<TITLE>試聽</TITLE>");                                                                                                        
	Win1.document.writeln("<script language=\"javascript\" type=\"text/javascript\" src=\"http://sell.e7play.com/promote/js/jquery.js\"></script>");                                                       
	Win1.document.writeln("<script language=\"javascript\" type=\"text/javascript\" src=\"http://sell.e7play.com/promote/js/jquery.media.js\"></script>");                                                 
	Win1.document.writeln("<script language=\"javascript\" type=\"text/javascript\" src=\"http://sell.e7play.com/promote/js/jquery.metadata.js\"></script>");                                              
	Win1.document.writeln("<script language=\"javascript\" type=\"text/javascript\" src=\"http://sell.e7play.com/promote/js/playv2.js\"></script>");                                                       
	Win1.document.writeln("</HEAD>");                                                                                                                             	                                                                                                                                     
	Win1.document.writeln("<BODY>");                                                                                                                               
	Win1.document.writeln("<div id=\"listenplayer\" style=\"Z-INDEX:1; LEFT:0px; POSITION:absolute; TOP:0px\"></div>");
	Win1.document.writeln("<img src=\""+img+"\" id=\"img\" style=\"CURSOR:pointer\" name=\""+ src +"\" alt=\"音樂試聽\" border=\"0\" value=\"Play\" class=\"listenmusic\" />");
	Win1.document.writeln("</BODY>");                                                                                                        
	Win1.document.writeln("</HTML>");                                                                                                                          
	Win1.document.close();
	Win1=null;
}
*/

var picUrl="http://emome.e7play.com/cht/hit.gif";
/*
進站來源
1. 需判斷本站與來源相似度,能接受如何的程度
2. 進站來源要記到多細?
*/
var promote_id0,opid0,product_id0,Content_No0;
function doPageview(promote_id,opid,product_id,content_no){
  var content_no=content_no;
	promote_id0=promote_id;opid0=opid;product_id0=product_id;
	if(product_id!=9)content_no=checkNoNums(content_no);
	var i=new Image(1,1);
  i.src=picUrl+"?promote_id="+promote_id+"&opid="+opid+"&product_id="+product_id+"&content_no="+content_no;
  
  i.onload=function() {return;}
  if(product_id==1){//如為首頁,要加做進站來源
  	var page=document.referrer;
  	var arrayPage=page.split("?");
  	product_id=0;
  	product_id0=0;
  	content_no0=arrayPage[0];
  	setTimeout("doPageview(promote_id0,opid0,9,content_no0)",5000);	
  }
}
//goStatus=下一頁是要openWindow(1)..還是本頁就秀(0)
function goNextPage(goStatus,promote_id,opid,strUrl){
	doPageview(promote_id,opid,10,strUrl);
	if(goStatus=="1")window.open(strUrl,"","");
	else window.location=strUrl;
}

  
//跑馬橫滴  
  function vMarquee(){
	  if(vdemo2.offsetHeight-vdemo.scrollTop<=0)
	  	vdemo.scrollTop=0;
	  else{
	  	vdemo.scrollTop+=1
	  }
  }
//跑馬直滴   
  function hMarquee(){
	  if(hdemo2.offsetWidth-hdemo.scrollLeft<=0)
	  	hdemo.scrollLeft-=hdemo1.offsetWidth
	  else{
	  	hdemo.scrollLeft++
	  }
  }
  //判斷數字~遇到非數字者即傳回
function checkNoNums(vv) {
	var rettmp="";
	vv=vv+"";
	if(vv.length>0){
		for (i=vv.length-1;i>=0;i--){
		   tmp=vv.substr(i,1)
			if (tmp<="9" && tmp>="0")rettmp=tmp+rettmp;
			else return rettmp;
		}
	}
	 return rettmp;
}