//added
//window.attachEvent("onload",ProcessHref);
function ProcessHref()
{
   var Links= document.getElementsByTagName("A");
   if(Links!=null&&Links.length>0)
   { 
     //查找单曲试听
     var pattern=/http:\/\/www.top100.cn\/PageRedirect.aspx\?Productid\=(M[0-9]{10})/i;  
     var comingStr="javascript:play('http://www.top100.cn/Audition/Play.htm?ProductID=$1')";
     for(var i=0;i<Links.length;i++)
     {
       
       Links[i].href= Links[i].href.replace(pattern,comingStr);
       Links[i].target="";
     }
     
     //查找包月畅听
     //<a href="/Payment/Period/PeriodLogin.aspx?Productid=M0047802002&ServiceID=602902"  target=_blank >
     pattern=/http:\/\/www.top100.cn\/Payment\/Period\/PeriodLogin.aspx\?Productid\=(M[0-9]{10})&ServiceID\=602902/i;
     comingStr="javascript:play('http://www.top100.cn/Audition/Play.htm?ProductID=$1&ServiceID=602902')";
     for(var i=0;i<Links.length;i++)
     {       
       Links[i].href= Links[i].href.replace(pattern,comingStr);
       Links[i].target="";
     }
     
     pattern=/\/Payment\/Period\/PeriodLogin.aspx\?Productid\=(M[0-9]{10})&ServiceID\=602902/i;
     comingStr="javascript:play('http://www.top100.cn/Audition/Play.htm?ProductID=$1&ServiceID=602902')";
     for(var i=0;i<Links.length;i++)
     {       
       Links[i].href= Links[i].href.replace(pattern,comingStr);
       Links[i].target="";
     }
   }
}
//以下是与播放器有关的操作的脚本
////////////////////////////////////////////////////////
//打开一个弹出式窗口，如果此窗口已经存在，则只是加入。
function GetCookie(name)
{
    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
    if(arr != null) return unescape(arr[2]); return null;
}
//异步调用，判断是否是包月用户
function IsBaoYue(callback,context)
{
 var url="/ajax/Top100Web.Audition.PlayAJAX,Top100Web.ashx";
 return new ajax_request(url + '?_method=IsBaoYue&_session=rw','',callback, context);
}


//////////////addtag.js///////////////////////
function addTagsJs()
{
	if (readCookie("userName") =="")
	{
		ShowEditBox("请先登陆，再写标签！");
		return false;
	}
	
	//alert(document.getElementById("hFromID").value);
	var fromID = document.all("hFromID").value;
	var itemType = document.all("hItemType").value;
	if (document.all("TagName").value.replace(/(^[ |　]*)|([ |　]*$)/g, "")=="" || document.all("TagName").value.replace(/(^[ |　]*)|([ |　]*$)/g, "")=="添写您的内容！")
	{
		ShowEditBox("请填写标签内容！");
		return false;
	}
	var tagName = escape(document.all("TagName").value.replace(/(^[ |　]*)|([ |　]*$)/g, ""));
	
	//alert(fromID + itemType +  tagName);
	//assiStr()
	addTagAjax.TagSelect(fromID,itemType,assiStrDo);

}
function returnFunc(strvar)
{
	
	//alert(strvar.value);
	if (strvar.value == null)
	{
		ShowEditBox("写标签失败，请与客服联系！谢谢您的点击。也许是您长时间未激活页面造成的，请重新登陆一下，再填写标签。");
		ReadTag();
	}
	else
	{
		ShowEditBox("标签加入成功！");
		ReadTag();
		try
		{
			//document.all("RowAddTag").style.display="none";
			//document.all("TagTitle").innerHTML="添加标签";
		}
		catch(exceptionObj) 
		{	
		}
	}
	
}
function ReadTag()
{
	var fromID = document.all("hFromID").value;
	var itemType = document.all("hItemType").value;
	//alert(fromID +"--" + itemType);
	addTagAjax.TagSelect(fromID,itemType,WriteFunc);
}
function WriteFunc(tempVal)
{
	var ds = tempVal.value;
	var html="<table width=360px><tr><td>";
	
	if(ds != null && typeof(ds) == "object" && ds.Tables != null && ds.Tables[0].Rows.length != 0) 
	{
		var b = ds.Tables[0].Rows.length;
		var a = (0<ds.Tables[0].Rows.length);
		for(var i=0; i<ds.Tables[0].Rows.length; i++) 
			{
			//alert(ds.Tables[0].Rows[i].TAGNAME);
			html = html + "&nbsp;&nbsp;&nbsp;<a href=/product/tags.aspx?TAGID="+ds.Tables[0].Rows[i].TAGID +"&TAGName="+ escape(ds.Tables[0].Rows[i].TAGNAME) +" style=\"TEXT-DECORATION: underline\" target=_blank>" + unescape(ds.Tables[0].Rows[i].TAGNAME) +"</a>";
			} 
		html += "</td></tr></table>";	
	//	alert(html);
		document.all("TagsList").innerHTML =html;
	}
	else
	{
		document.all("TagsList").innerHTML ="暂时还没有标签。";
	}
}
//比较要加入的标签是否存在

function assiStrDo(tempVal)
{
	var ds = tempVal.value;
	var tagName = document.all("TagName").value.replace(/(^[ |　]*)|([ |　]*$)/g, "");
	var ISEXIST = true;
	if (ds.Tables[0].Rows.length != 0)
	{
		for(var i=0; i<ds.Tables[0].Rows.length; i++) 
		{
			//alert("循环内" + ISEXIST);
			if (tagName == ds.Tables[0].Rows[i].TAGNAME)
			{
				//alert("判断" + ISEXIST);
				ISEXIST = true;
				break;
			}else{
			ISEXIST = false;
			}
		}
	}else
	{
			ISEXIST = false;
	} 
	//alert("循环外" + ISEXIST);
	//ISEXIST = false;
		//alert(ISEXIST);
	if (ISEXIST)
	{
		ShowEditBox("已经有这些标签了！");
		return;
	}else{
		document.all("TagsList").innerHTML = "加载中，请稍后... ...";
		//ISEXIST = false;
	}
	var fromID = document.all("hFromID").value;
	var itemType = document.all("hItemType").value;
	addTagAjax.AddTag(fromID,itemType,tagName,returnFunc);

}
//用于PLAYLIST脚本函数
var divName;
function PrintImg(divName2,tagID)
{
	//alert("传过来" + divName2); 
	divName = divName2;
	addTagAjax.SelectFourTagImg(tagID,returnPrintImg);
//	alert(divName);	
}
function returnPrintImg(tempVal)
{
	var ds = tempVal.value;
	var html="";
	if (ds.Tables[0].Rows.length == 0)
	{
		for(var i=0; i<ds.Tables[0].Rows.length; i++) 
		{
			//alert(ds.Tables[0].Rows[i].TAGNAME);
			html = html + "&nbsp;&nbsp;&nbsp;<img src=" + ds.Tables[0].Rows[i].SMALLIMAGE +">";
		}
	}
	else
	{
		html="暂时还没有标签...";
	}
	//alert(divName); 
	document.all(divName).innerHTML =html;
}
//自动完成功能
function FindRelate()
{
	//document.all("SelectedMenu").innerHTML = document.all("InputText").value;
	//debugger;
	var iptText = document.all("TagName").value;
	addTagAjax.autoComplete(iptText,retTags);
}
function retTags(tempVal)
{
	var ds = tempVal.value;
	//debugger;
	var dslenth = ds.Tables[0].Rows.length;
	var html='';
	for (var i = 0 ;i< 10 ;i++ )
	{
		if (i < dslenth)
		{
			html +='<a href=javascript:setValue(\'';
			html += escape(ds.Tables[0].Rows[i]["TAGNAME"]) + '\')>';
			html += ds.Tables[0].Rows[i]["TAGNAME"];
			html += "</a>";
		}
		else
		{
			break;
		}				
	}
	document.all("SelectedMenu").innerHTML = html;
	var menuitems=document.getElementById("SelectedMenu");
	if (menuitems.innerHTML != "")
	{
		menuitems.style.visibility = "visible";
		menuitems.onmouseover=function(){menuitems.style.visibility = "visible";};
	}
	menuitems.onmouseout=function(){menuitems.style.visibility = "hidden";};
	//document.all("SelectedMenu").class="dropmenudiv2";
}
function setValue(tempVal)
{
	document.all("TagName").value=unescape(tempVal);
	var menuitems=document.getElementById("SelectedMenu");
	menuitems.style.visibility = "hidden";
}
function showSelectedMenu()
{
	var menuitems=document.getElementById("SelectedMenu");
	if (menuitems.innerHTML != "")
	{
		menuitems.style.visibility = "visible";
	}
}
function showAddRow()
{
	//debugger;
	if (document.all("RowAddTag").style.display == "block")
	{
		document.all("RowAddTag").style.display="none";
		document.all("TagTitle").innerHTML="&nbsp;&nbsp;添加标签";
	}else
	{
		document.all("RowAddTag").style.display="block";
		document.all("TagTitle").innerHTML="&nbsp;&nbsp;隐藏添加标签行";
	}
}
//////////////addblogJs.js///////////////////////
//用户在操作成功后使用的对象
var TEMP_OBJECT;
var thisObjectID;
var thisCommentsType;
var thisBlogPage;
var thisBlogPageSize;
var thisBlogNextPage;
var thisBlogPreviousPage;
var thisBlogCountPage;
var showFirPage;
var showPreviousPage;
var showNextPage;
var showLastPage;

var box;


function ShowBlog(ObjectID,CommentsType,thisPageSize,curPage)
{	
document.all("showBlogArea").innerHTML ="正在读取数据，请稍后... ..。";
	thisObjectID = ObjectID;
	thisCommentsType = CommentsType;
	thisBlogPageSize = thisPageSize;
	//设置翻页变量
	thisBlogCountPage = Math.ceil(thisBlogRecordCount/thisBlogPageSize);
	//alert(thisBlogRecordCount);
	//debugger;
	thisBlogPage = curPage;
	//alert(thisBlogPage);
	if (thisBlogPage !=1)
	{
		thisBlogPreviousPage = thisBlogPage-1;
	}
	if (thisBlogPage == thisBlogCountPage)
	{
		thisBlogNextPage=thisBlogCountPage;
	}
	else
	{
		thisBlogNextPage = thisBlogPage+1;
	}
	
	if (thisBlogPage == 1 && thisBlogCountPage !=1)
	{
		showFirPage = "DISPLAY: none";
		showPreviousPage = "DISPLAY: none";
		showNextPage = "DISPLAY: block";
		showLastPage = "DISPLAY: block";

	}
	if (thisBlogPage >= thisBlogCountPage && thisBlogCountPage !=1)
	{
		showFirPage = "DISPLAY: block";
		showPreviousPage = "DISPLAY: block";
		showNextPage = "DISPLAY: none";
		showLastPage = "DISPLAY: none";
	}
	if (thisBlogPage != thisBlogCountPage && thisBlogPage != 1)
	{
		showFirPage = "DISPLAY: block";
		showPreviousPage = "DISPLAY: block";
		showNextPage = "DISPLAY: block";
		showLastPage = "DISPLAY: block";
	}
	if ( thisBlogCountPage == 1 || thisBlogCountPage == 0)
	{
		showFirPage = "DISPLAY: none";
		showPreviousPage = "DISPLAY: none";
		showNextPage = "DISPLAY: none";
		showLastPage = "DISPLAY: none";
	}
	document.all("showBlogArea").innerHTML ="正在读取数据，请稍后... ...";
	//alert("sfsf");
	addTagAjax.BlogList(ObjectID,CommentsType,thisBlogPageSize,thisBlogPage,retBlogList);
	
	//document.all("showBlogArea").innerHTML ="取出的数据！！";
}
function retBlogList(retVal)
{
	//alert("取完数据");
	var ds = retVal.value;
	var rowsCount = ds.Tables[0].Rows.length;
	var html = '';
	//alert(rowsCount);
	if (rowsCount != 0)
	{
		for(var i = 0; i < rowsCount; i++)
		{
			
			html += '<ul class="text4">';
			html += '<li class="l1">';
			var tempUserPhoto = 'http://image.top100.cn/WebImg/PImg/' + ds.Tables[0].Rows[i].USERIMAGE;
			if (ds.Tables[0].Rows[i].USERIMAGE =="" || ds.Tables[0].Rows[i].USERIMAGE == null)
			{
				tempUserPhoto ="http://image.top100.cn/webImg/Pimg/Default.gif";
			}
			else
			{
				tempUserPhoto = "http://image.top100.cn/WebImg/PImg/" + ds.Tables[0].Rows[i].USERIMAGE;
			}
			if (ds.Tables[0].Rows[i].CREATE_BY != 0 )
			{
				html += '<a href="http://user.top100.cn/Start.aspx?userID='+ds.Tables[0].Rows[i].CREATE_BY+'" target=_blank>'+ '<img src ="';
				html += tempUserPhoto;
				html += '" border=0>';
				html += '</a>';
			}
			else
			{
				html += '<img src ="';
				html += tempUserPhoto;
				html += '" border=0>';
			}
			html += '</li>';
			html += '<li class="l2">';
			html += '<img src="http://image.top100.cn/webImg/icon_user.gif">';
			if (ds.Tables[0].Rows[i].CREATE_BY != 0 )
			{
			   html += '<a href="http://user.top100.cn/Start.aspx?userID='+ds.Tables[0].Rows[i].CREATE_BY+'" target=_blank>'+ds.Tables[0].Rows[i].NICKNAME+'</a>';
			}
			else
			{
			   html += ds.Tables[0].Rows[i].NICKNAME;
			}
			html += '&nbsp;|';
			var d  = ds.Tables[0].Rows[i].CREATE_DATE;		
			html +=  d.getYear() + "-" + ( d.getMonth() + 1 ) + "-" + d.getDate();
			html += '</li>';		
			html += '<li class="l3" style="font-weight:500;">';
			var tempContent = ds.Tables[0].Rows[i].COMMENTS;
			
			html += tempContent;
			html += '</li></ul><div class="clear blank10"></div>';
			
			if (thisBlogRecordCount==0)
			{
				thisBlogRecordCount = rowsCount;
			}	
			if (thisBlogPage == 1 )
			{
				//thisBlogCountPage=1;
			}		
		}
		var ImgServer = 'http://Image.top100.cn/WebImg/';
		html +='<table width="40%"><tr><td>共有评论 '+thisBlogRecordCount+' 条</td><td>'+thisBlogPage+'页/'+thisBlogCountPage+'页</td><td><img src="'+ImgServer+'first.gif" style = "'+showFirPage+';CURSOR:hand" border=0 onClick="ShowBlog(thisObjectID,thisCommentsType,thisBlogPageSize,1)"></td><td><img src="'+ImgServer+'Previous.gif" style = "'+showPreviousPage+';CURSOR:hand"  border=0 onClick="ShowBlog(thisObjectID,thisCommentsType,thisBlogPageSize,thisBlogPreviousPage)"></td><td><img src="'+ImgServer+'Next.gif" style = "'+showNextPage+';CURSOR:hand"  border=0 onClick="ShowBlog(thisObjectID,thisCommentsType,thisBlogPageSize,thisBlogNextPage)"></td><td><img src="'+ImgServer+'Last.gif" style = "'+showLastPage+';CURSOR:hand"  border=0 onClick="ShowBlog(thisObjectID,thisCommentsType,thisBlogPageSize,thisBlogCountPage)"></td></tr></table>';
	}
	else
	{
		html +='<table><tr><td colspan = 5 align = "right">暂时还没有评论。</td></tr>';
		html +='<table>';
	}	
	document.all("showBlogArea").innerHTML = html;
	//alert (html);
}
//输出星
function PrintStar(starNum)
{
	var retVal="";
	if (starNum == 0)
	{
		retVal += "未评分"
	}
	else
	{
		for (var i = 1; i <= starNum; i++)
		{
			retVal += "<img src = http://image.top100.cn/WebImg/star.gif>";
		}
	}
	return retVal;
}
//添加产品blog评论
function ShowaddBlogBox()
{
	if (allowAnonymity != 1)
	{
		if (readCookie("userName") =="")
		{
			ShowEditBox("请先登陆，再填写评论！");
			return false;
		}
	}
	box = new EditBox();
	box.init();	
	box.set("width", 450);
	box.set("height", 300);
	box.set("src", 3);
	box.set("title", "请填写你的评论内容：");
	box.html(MUSIC_ADD_BLOG_HTML);
}
function addBlog()
{
	//alert(readCookie("userName"));
	//if (allowAnonymity != 1)
	//debugger;
	var blog_title = "评论";
	var blog_body = CovertCRLFToBR(document.all("blog_body").value.replace(/(^[ |　]*)|([ |　]*$)/g, ""));
	if (blog_body=="")
	{
		ShowEditBox("内容不能为空，请填写... ...");
		return false;
	}
	var tempTitle ="评论";
	//var tempBody = changeBody();
	//var tempUserID = document.all("TxtUserID").value;
	var tempCommentsType = document.all("TxtCommentsType").value;
	var tempRdo = document.all("RdoCommentScore");
	//alert(tempRdo.length);
	var tempCommentScore=0;
		
	var tempObjectid = document.all("TxtObjectid").value;
	//alert(tempTitle);
	//alert(tempBody);
	if (tempTitle)
	{
		//alert("提交数据");
		addTagAjax.AddBlog(blog_title,blog_body,tempCommentsType,tempObjectid,tempCommentScore,retrunAddBlog);
		
	}
}
function CovertCRLFToBR(s) 
{ 
    var i; 
    var s2 = s; 
    
    while(s2.indexOf("\n")>0) 
    { 
		i = s2.indexOf("\n"); 
		s2 = s2.substring(0, i) + "<br>" 
		+ s2.substring(i + 1, s2.length); 
    } 
    return s2; 
}
function changeTitle()
{
	var blog_title = document.all("blog_title").value;
	if (blog_title == "")
	{
		document.all("checkTitle").style.display = "block";
		return false;
	}
	else
	{
		document.all("checkTitle").style.display = "none";
		return true;
	}
}
function changeBody()
{
	var blog_body = document.all("blog_body").value;
	if (blog_body == "")
	{
		document.all("checkBlog_body").style.display = "block";
		return false;
	}
	else
	{
		document.all("checkBlog_body").style.display = "none";
		return true;
	}
}
function retrunAddBlog(retrunVar)
{
	if (retrunVar.value)
	{
		ShowEditBox("您填写的评论已经发布成功！");
		//alert("box.reset");
		try
		{
			document.all("blog_body").value="";
			document.all("blog_title").value="";
			box.reset();
		}
		catch(exceptionObj) 
		{}
		ShowBlog(document.all("TxtObjectid").value,document.all("TxtCommentsType").value,thisBlogPageSize,1);
	}else
	{
		ShowEditBox("您填写的评论由于某些原因未发布成功，请直接与我们客服联系，谢谢您的点击！也许是您长时间未激活页面造成的，请重新登陆一下，再填写标签。");
	}
}
//内容html代码
var MUSIC_ADD_BLOG_HTML=		'	<table border="0" align="center" cellpadding="0" cellspacing="0" ID="Table1">\
			<tr>\
				<td><img src="../usercontrol/image/musiclist_xgtj_5.jpg" width="463" height="8"></td>\
			</tr>\
			<tr>\
				<td bgcolor="#efe8da"><table width="100%" border="0" cellspacing="0" cellpadding="0" ID="Table2">\
						<tr>\
							<td width="1"></td>\
							<td bgcolor="#f6f3ec"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#f2ebe0"\
									ID="Table3">\
									<tr>\
										<td width="5%" height="40" align="center"><img src="../usercontrol/image/musiclist_xgtj_d.jpg" width="11" height="11"></td>\
										<td width="10%"><span class="yylb">标题：</span></td>\
										<td width="75%"><input name="blog_title" onChange="changeTitle()" type="text" size="43" maxlength="50" ID="blog_title"></td>\
										<td width="10%" align="left"><div id = "checkTitle" style="DISPLAY: none;"><font color="#ff0000">**必填</font></div>\
										</td>\
									</tr>\
									<tr>\
										<td height="40" align="center"><img src="../usercontrol/image/musiclist_xgtj_d.jpg" width="11" height="11"></td>\
										<td>评分：</td>\
										<td colSpan="2">\
											<INPUT type="radio" value="5" name="RdoCommentScore"><img src="http://image.top100.cn/WebImg/star.gif"><img src="http://image.top100.cn/WebImg/star.gif"><img src="http://image.top100.cn/WebImg/star.gif"><img src="http://image.top100.cn/WebImg/star.gif"><img src="http://image.top100.cn/WebImg/star.gif">\
										    <INPUT type="radio" value="4" name="RdoCommentScore"><img src="http://image.top100.cn/WebImg/star.gif"><img src="http://image.top100.cn/WebImg/star.gif"><img src="http://image.top100.cn/WebImg/star.gif"><img src="http://image.top100.cn/WebImg/star.gif">\
										    <INPUT type="radio" value="3" name="RdoCommentScore" checked><img src="http://image.top100.cn/WebImg/star.gif"><img src="http://image.top100.cn/WebImg/star.gif"><img src="http://image.top100.cn/WebImg/star.gif">\
										    <INPUT type="radio" value="2" name="RdoCommentScore"><img src="http://image.top100.cn/WebImg/star.gif"><img src="http://image.top100.cn/WebImg/star.gif">\
										    <INPUT type="radio" value="1" name="RdoCommentScore"><img src="http://image.top100.cn/WebImg/star.gif">\
										    <INPUT type="radio" value="0" name="RdoCommentScore">不评分\
										</td>\
									</tr>\
									<tr>\
										<td height="40" align="center"><img src="../usercontrol/image/musiclist_xgtj_d.jpg" width="11" height="11"></td>\
										<td><span class="yylb">内容：</span></td>\
										<td><textarea name="blog_body" onChange="changeBody()" rows="15" ID="blog_body" style="WIDTH: 315px;"></textarea></td>\
										<td align="left"><div id = "checkBlog_body" style="DISPLAY: none;"><font color="#ff0000">**必填</font></div>\
										</td>\
									</tr>\
									<tr>\
										<td>\</td>\
										<td></td>\
										<td height=30 align=center><input onClick="addBlog();" type=image src=../usercontrol/image/musiclist_xgtj_tj.gif></td>\
									</tr>\
									<tr>\
										<td  colSpan="4">&nbsp;</td>\
									</tr>\
								</table>\
							</td>\
							<td width="1"></td>\
						</tr>\
					</table>\
				</td>\
			</tr>\
		</table>\
			</td>\
			</tr>\
			<tr>\
				<td  valign="top"><img src="../usercontrol/image/musiclist_xgtj_6.gif" width="463" height="8"></td>\
			</tr>\
		</table>';	


//显示大段评论内容时
tPopWait=0;//停留tWait豪秒后显示提示。
tPopShow=10000;//显示tShow豪秒后关闭提示
showPopStep=20;
popOpacity=99;

sPop=null;
curShow=null;
tFadeOut=null;
tFadeIn=null;
tFadeWaiting=null;

document.write("<style type='text/css'id='defaultPopStyle'>");
document.write(".cPopText {  font-family: ; background-color: #f8f8f3; color:#030303;border: 1px #000000 solid; font-size: ; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 3px; padding-bottom: 1px; filter: Alpha(Opacity=0)}");
document.write("</style>");
document.write("<div id='dypopLayer' style='position:absolute;z-index:1000;' class='cPopText'></div>");
function showPopupText(){
var o=event.srcElement;
	MouseX=event.x;
	MouseY=event.y;
	if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};
        if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""};
	if(o.dypop!=sPop) {
			sPop=o.dypop;
			clearTimeout(curShow);
			clearTimeout(tFadeOut);
			clearTimeout(tFadeIn);
			clearTimeout(tFadeWaiting);	
			if(sPop==null || sPop=="") {
				dypopLayer.innerHTML="";
				dypopLayer.style.filter="Alpha()";
				dypopLayer.filters.Alpha.opacity=0;	
				}
			else {
				if(o.dyclass!=null) popStyle=o.dyclass 
					else popStyle="cPopText";
				curShow=setTimeout("showIt()",tPopWait);
			}
	}
}

function showIt(){
		dypopLayer.className=popStyle;
		dypopLayer.innerHTML=sPop;
		//popWidth=dypopLayer.clientWidth*0.8;
		popWidth = 700;
		popHeight=dypopLayer.clientHeight;
		if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24
			else popLeftAdjust=0;
		if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24
			else popTopAdjust=0;
		//dypopLayer.style.left=MouseX+document.body.scrollLeft+popLeftAdjust;
		//dypopLayer.style.top=MouseY+100+document.body.scrollTop+popTopAdjust;
		dypopLayer.style.left=MouseX-800+document.body.scrollLeft;
		if (sPop.Lenth > 2000)
		{
			dypopLayer.style.top=MouseY-600+document.body.scrollTop;
		}
		else
		{
			dypopLayer.style.top=MouseY-200+document.body.scrollTop;
		}
		dypopLayer.style.filter="Alpha(Opacity=0)";
		dypopLayer.style.width = 700;
		fadeOut();
}

function fadeOut(){
	if(dypopLayer.filters.Alpha.opacity<popOpacity) {
		dypopLayer.filters.Alpha.opacity+=showPopStep;
		tFadeOut=setTimeout("fadeOut()",1);
		}
		else {
			dypopLayer.filters.Alpha.opacity=popOpacity;
			tFadeWaiting=setTimeout("fadeIn()",tPopShow);
			}
}

function fadeIn(){
	if(dypopLayer.filters.Alpha.opacity>0) {
		dypopLayer.filters.Alpha.opacity-=1;
		tFadeIn=setTimeout("fadeIn()",1);
		}
}
//document.onmouseover=showPopupText;

//截取中英文字符
function substr(s,nStart,nEnd)
{
	var i=0;
	var j=nStart; //下标起始位置
	var nLen=s.length;
	if(nEnd<nLen) nLen=nEnd; //如果结束位置小于整个字符串的长度
	while (i<nLen) //循环检查制定的结束字符串位置是否存在中文字符
	{
	if(s.charCodeAt(j)>256) //返回指定下标字符编码，大于265表示是中文字符
	{ i = i+2 } //是中文字符，那计数增加2
	else
	{ i = i+1 } //是英文字符，那计数增加1
	j=j+1
	}
	if(i>nLen) //如果计数变量值i大于字符串长度，则表示有中文字符，则增量会变大，所以下标变量要-1
	j = j-1;
	if(j>nStart) //如果下标大于起始长度，则返回有效的字符串
	return s.substring(nStart,j)
	else
	return ""
}
//////////////incplaylist.js///////////////////////

	var PlayListpageSize=9;
	var PlayListpageNumber=1;
	var PlayListpageCount = 0;
	var thisPlayListNextPage;
	var thisPlayListPreviousPage;
	var showPlayListFirPage;
	var showPlayListPreviousPage;
	var showPlayListNextPage;
	var showPlayListLastPage;
	
	
	function PlayListPage(productContentID,pageSize,pageNumber)
	{
		//debugger;
		//alert(document.all("Setpage").innerHTML);
		document.all("Setpage").innerHTML = "载入中... ...";
		PlayListpageNumber = pageNumber;
		if (PlayListpageNumber !=1)
		{
			thisPlayListPreviousPage = PlayListpageNumber - 1;
		}
		if (PlayListpageNumber == PlayListpageCount)
		{
			thisPlayListpageNextPage = PlayListpageCount;
		}
		else
		{
			thisPlayListpageNextPage = PlayListpageNumber + 1;
		}		

		addTagAjax.incSongPlayList(productContentID,pageSize,pageNumber,retPlayListContentSong);
	}	
	function retPlayListContentSong(temValue)
	{
		//debugger;
		var ds = temValue.value;
		var rowsCountPlayList = ds.Tables[0].Rows.length;
		if (rowsCountPlayList != 0)
		{
	
			if (PlayListpageNumber !=1)
			{
				thisPlayListPreviousPage = PlayListpageNumber-1;
			}
			if (PlayListpageNumber == PlayListpageCount)
			{
				thisPlayListNextPage=PlayListpageCount;
			}
			else
			{
				thisPlayListNextPage = PlayListpageNumber+1;
			}
			
			if (PlayListpageNumber == 1 && PlayListpageCount !=1)
			{
				showPlayListFirPage = "DISPLAY: none";
				showPlayListPreviousPage = "DISPLAY: none";
				showPlayListNextPage = "DISPLAY: block";
				showPlayListLastPage = "DISPLAY: block";

			}
			if (PlayListpageNumber >= PlayListpageCount && PlayListpageCount !=1)
			{
				showPlayListFirPage = "DISPLAY: block";
				showPlayListPreviousPage = "DISPLAY: block";
				showPlayListNextPage = "DISPLAY: none";
				showPlayListLastPage = "DISPLAY: none";
			}
			if (PlayListpageNumber != PlayListpageCount && PlayListpageNumber != 1)
			{
				showPlayListFirPage = "DISPLAY: block";
				showPlayListPreviousPage = "DISPLAY: block";
				showPlayListNextPage = "DISPLAY: block";
				showPlayListLastPage = "DISPLAY: block";
			}
			if ( PlayListpageCount == 1 || PlayListpageCount == 0)
			{
				showPlayListFirPage = "DISPLAY: none";
				showPlayListPreviousPage = "DISPLAY: none";
				showPlayListNextPage = "DISPLAY: none";
				showPlayListLastPage = "DISPLAY: none";
			}

			
			var SongHtml2='';
				document.all("PlayListContent").innerHTML='<table id="PlayListContent2" width="95%" border=0></table>';
				var tblUpdate = document.all("PlayListContent2");
			    var row;
				var cell;
				//debugger;
				//tblUpdate.childNodes[0].outerHTML="<Tbody></Tbody>";
				//tblUpdate.childNodes[0].innerHTML="";
				var tbody = tblUpdate.childNodes[0];
				//var tbody = document.createElement("body");
				//tblUpdate.appendChild(tbody);
				var rownum = rowsCountPlayList % 3==0 ? rowsCountPlayList/3 : rowsCountPlayList/3+1;
				//tbody.innerTEXT="";
				for (var i=0; i < rownum; i++)
				{
					row = document.createElement( "TR" );
					tbody.appendChild( row );
					for (var j=0; j<3; j++)
					{
						var k = i*3 +j;
						if (k>=rowsCountPlayList)break;
						cell = document.createElement( '<TD id=td_'+(i*3+j)+'>' );
						row.appendChild( cell );
						
						SongHtml2='';
						SongHtml2 += '<table width=100% border=0>\
								<tr>\
									<td width=74 style="BORDER-RIGHT: lightgrey solid; BORDER-TOP: lightgrey solid; BORDER-LEFT: lightgrey solid; BORDER-BOTTOM: lightgrey solid"><iframe width=74 height=74 frameborder=no scrolling=no src = \'';
						SongHtml2 += 		'/UserControl/fourImgPlaylist.aspx?tagid=';
						SongHtml2 +=        ds.Tables[0].Rows[k].TAGID;
						SongHtml2 += 		'&picSize=37\'></iframe></td>\
											<td>\
												<table>\
													<tr><td><a href=\'';
						SongHtml2 += 		'/product/PlayList.aspx?tagid=';
						SongHtml2 += 		ds.Tables[0].Rows[k].TAGID;
						SongHtml2 += 		'\' target=_blank><b>';
						SongHtml2 += 		ds.Tables[0].Rows[k].NAME;
						SongHtml2 += 		'</b></a></td></tr>\
													<tr><td>';
						if (ds.Tables[0].Rows[k].NICKNAME != null)
						{
							SongHtml2 += 		'<img src="http://image.top100.cn/webImg/icon_user.gif"><a href="http://user.top100.cn/Start.aspx?userID='+ds.Tables[0].Rows[k].WONER+'" target=_blank>'+ds.Tables[0].Rows[k].NICKNAME+'</a>';
						}
						SongHtml2 += 		'</td></tr><tr><td>';
						if (ds.Tables[0].Rows[k].CUTSCORE != null)
						{
							SongHtml2 += PrintStar(ds.Tables[0].Rows[k].CUTSCORE);
						}
						SongHtml2 += '</td></tr><tr><td>';
						if (ds.Tables[0].Rows[k].CREATE_ON != null)
						{
							var d  = ds.Tables[0].Rows[k].CREATE_ON;		
							SongHtml2 +=  d.getYear() + "-" + ( d.getMonth() + 1 ) + "-" + d.getDate() +"创建";
						}
						SongHtml2 += '</td></tr>\
										</table>\
									</td>\
								</tr>\
								<tr><td height=15></td></tr>\
							</table>';
						cell.innerHTML = SongHtml2;
					}
				}
				
				document.all("Setpage").innerHTML ='<table width="100%" align=right><tr><td width=60%></td><td>共有列表 '+ thisCountPlayList +' 个</td><td>'+PlayListpageNumber+'页/'+PlayListpageCount+'页</td><td><img src="http://Image.top100.cn/webImg/first.gif" style = "'+showPlayListFirPage+';CURSOR:hand" border=0 onClick="PlayListPage(thisTagID,PlayListpageSize,1)" title ="首页"></td><td><img src="http://Image.top100.cn/webImg/Previous.gif" style = "'+showPlayListPreviousPage+';CURSOR:hand"  border=0 onClick="PlayListPage(thisTagID,PlayListpageSize,thisPlayListPreviousPage)" title ="上页"></td><td><img src="http://Image.top100.cn/webImg/Next.gif" style = "'+showPlayListNextPage+';CURSOR:hand"  border=0 onClick="PlayListPage(thisTagID,PlayListpageSize,thisPlayListNextPage)" title ="下页"></td><td><img src="http://Image.top100.cn/webImg/Last.gif" style = "'+showPlayListLastPage+';CURSOR:hand"  border=0 onClick="PlayListPage(thisTagID,PlayListpageSize,PlayListpageCount)" title ="尾页"></td></tr></table>';
		}
		else
		{
			//return  '暂时没有相关记录。';
			document.all("PlayListContent").innerHTML = "";
			document.all("Setpage").style.display="none";
			document.all("isShowIncPlaylist").style.display="none";	
		}
	}
	//输出星
function PrintStar(starNum)
{
	var retVal="";
	if (starNum != 0)
	{
		for (var i = 1; i <= starNum; i++)
		{
			retVal += "<img src =\"http://Image.top100.cn/webImg/star.gif\">";
		}
	}
	return retVal;
}
//////////////hearingsong.js///////////////////////

	function ShowHearingSong(productID,recNum)
	{
		addTagAjax.SeleHearUser(productID,recNum,retSeleHearUser);
		function retSeleHearUser(tempVal)
		{
			var ds = tempVal.value;
			var retNum = ds.Tables[0].Rows.length;
			var HearingSongHtml='';
			for(var i = 0; i < retNum; i++)
			{
				var j=i+1;
				if (j % 3 == 1)
				{
					HearingSongHtml += '<table border=0 width=95% align=center><tr>';				
				}
				HearingSongHtml += '<td width="33%">';
				HearingSongHtml += '<table width="33%">';
				HearingSongHtml += '<tr>';
				HearingSongHtml += '<td><a href=\"http://user.top100.cn/Start.aspx?userID='+ds.Tables[0].Rows[i].USERID+'\" target=_blank>';
				HearingSongHtml += '<IMG height="60" src=\'http://Image.top100.cn/webImg/Pimg/'+ ds.Tables[0].Rows[i].USERIMAGE + '\' width=\"60\" border=0>';
				HearingSongHtml += '</a></td>';
				HearingSongHtml += '</tr>';
				HearingSongHtml += '<tr>';
				HearingSongHtml += '<td align="center"><img src="http://image.top100.cn/webImg/icon_user.gif"><a href=\"http://user.top100.cn/Start.aspx?userID='+ds.Tables[0].Rows[i].USERID+'\" target=_blank>'+  ds.Tables[0].Rows[i].NICKNAME.substring(0,8).replace('@','＠') + '</a></td>';
				HearingSongHtml += '</tr>';
				HearingSongHtml += '</table>';			
				
				HearingSongHtml += '</td>';
				if (j % 3 == 0 && j!=1)
				{
					HearingSongHtml += '</tr></table>';				
				}
			}
			//alert(HearingSongHtml);
			document.all("hearingSongHtml").innerHTML = HearingSongHtml;
		}

	}
///////////////单曲页标题////////////////////////////
function init()
{
	GetTitle();
}
function GetTitle()
{
	var inputstr=songNavLabel.innerHTML;
	var outputstr="";
	outputstr=inputstr.replace(/<a[^>]+>(.*?)<\/a>/gi,"$1");
	outputstr=outputstr.replace(/<span[^>]+>(.*?)<\/span>/gi,"$1");
	outputstr=outputstr.replace(/&gt;/g,">");
	outputstr=outputstr.replace(/&amp;/g,"&");
	window.document.title=outputstr;
}
////////////////////MV页面////////////////////////////
function MM_CheckFlashVersion(reqVerStr,msg){
	with(navigator){
		var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
		var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
		if (!isIE || !isWin){  
		var flashVer = -1;
		if (plugins && plugins.length > 0){
			var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
			desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
			if (desc == "") flashVer = -1;
			else{
			var descArr = desc.split(" ");
			var tempArrMajor = descArr[2].split(".");
			var verMajor = tempArrMajor[0];
			var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
			var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
			flashVer =  parseFloat(verMajor + "." + verMinor);
			}
		}
		// WebTV has Flash Player 4 or lower -- too low for video
		else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

		var verArr = reqVerStr.split(",");
		var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
		
		if (flashVer < reqVer){
			if (confirm(msg))
			window.location = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
		}
		}
	} 
}
function showDivSongScore(value)
{//divSongScore.style.display="";
//submitSongScore.style.display="none";
Form1.SubmittedSongScore.value=value; 
__doPostBack('UpdateProductScore',''); 
}
function showCanNotBuySongs()
{if(document.Form1.CanNotBuySong.value!="")
alert("该专辑以下歌曲暂不提供下载,版权授权正在进行中:"+document.Form1.CanNotBuySong.value);
}

function openwindow()
{
	var urls = document.getElementById("productids").value;
	
	window.open('/PlayMtv.aspx?productid='+urls,'newwindow','width=600,height=339');				
}
function writeStatistical(tempStr)
{
	var tempInfo = tempStr.value;
	var myArray = new Array("0", "0", "0");
	myArray = tempInfo.split(",");
	document.getElementById("userBrowse").innerHTML = "共被&nbsp;" + myArray[0] +"&nbsp;用户浏览";
	document.getElementById("userComments").innerHTML = "共被&nbsp;" + myArray[1] +"&nbsp;用户评论";
	document.getElementById("userFavorites").innerHTML = "共被&nbsp;" + myArray[2] +"&nbsp;用户收藏";
}
function KeyDown()
{
	var gk=event.keyCode;
	if(gk==13) 
	{
		event.keyCode = 9;
		return; 
	}
}
//////////////////////////////


