//网站路径(域名)控制器
(function(){
	window.X||(window['X']={});
	X.domain = "10086.cn";
	X.PATH={
		ROOT:"http://music.10086.cn/newweb/",
		SUPPORT:"http://mdll.10086.cn/newweb/",
		VIP:"http://mapi.10086.cn/newweb/",
		CLUB:"http://mclub.10086.cn",
		WM:"http://wm.10086.cn",		
		M:"http://m.10086.cn",
		CONTENT:"http://content.12530.com/"		
	}
	//重载域名
	X.PATH.WAP=X.PATH.M;
	document.domain='10086.cn';
})();
if(window.location.host=='music.10086.cn'){
	document.domain='10086.cn';
}
function refreshImgPwd(obj) {
	var now = new Date();
	var number = now.getSeconds();
	var number1 = Math.random();
	var imgurl = X.PATH.SUPPORT+"jsp/common/validatecode.jsp?random=" + number1;
	document.getElementById(obj).src = imgurl;
}

function reply(num){
	var username = document.getElementById("userName"+num).innerHTML;
	var element = document.getElementById("ulelement"+num).getElementsByTagName("li");
	var text = document.getElementById("votecontent").value;
	document.getElementById("votecontent").focus();
		if(username.indexOf('>') != -1){
			username = username.substr(username.indexOf('>')+1);
			var temp = username.substr(0,username.indexOf('<'))+username.substr(username.indexOf('>')+1)
			username = temp;
		}
		var content = '';
		for(var i=3;i<element.length;i++){
			content += element[i].innerHTML+"\r\n";
		}
	if(text==""){
		document.getElementById("votecontent").value = username+" 在上文中提到："+"\r\n"+content+"-------------------------------------------"+"\r\n";
	}else{
		document.getElementById("votecontent").value = text+"\r\n"+username+" 在上文中提到："+"\r\n"+content+"-------------------------------------------"+"\r\n";
	}
	document.getElementById("votecontent").focus();
}

function comment_submit(){
	var content = document.getElementById('votecontent').value;
	var validcode = document.getElementById('verifyCode').value;

	if(content==""){
		alert("内容不能为空");
		return false;
	}
	if(juge_script(content)){
		alert("内容不能含有<script>");
		return false;
	}
	if(validcode==""){
		alert("请输入验证码！");
		return false;
	}
	if(validcode.length!=4){
		alert("验证码不正确");
		return false;
	}

	if(content.length>1000)
	{
		alert("内容太长,请修改,谢谢");
		return false;
	}

    if(content.indexOf("%") != -1||content.indexOf("/") != -1||content.indexOf("&") != -1||content.indexOf("\\") != -1||content.indexOf("+") != -1||content.indexOf("<") != -1||content.indexOf(">") != -1){
    	alert("输入内容不能包含“%”，“/”，“&”，“\\”，“+”，“<”，“>”,请重试！");
    	return false;
    }
   
   	content = encodeURI(content);
   	content = content.replace(/\?/g,"%3F");
   	content = content.replace(/#/g,"%23");
   	content = content.replace(/;/g,"%3b");
   
	window.parent.document.getElementById('bt_comment_submit').disabled = true;
	var params = "commentContent=" + content + "&contentid="+contentid+"&contenttype="+contenttype+"&validateCode="+validcode;
	
	//alert(params);
	var proxy = document.getElementById("proxyframe").contentWindow;
	proxy.SubmitComment(params);
 }
 
 function juge_script(mobile)
{
	var mob = mobile.toUpperCase();
	if (/SCRIPT/.test(mob))
	{
		return true;
	}
	else
	{
		return false;
	
	}
}

function F_ShowComment(params){
	var proxy = document.getElementById("proxyframe").contentWindow;
	proxy.Show_Comment(params);
}

function nextPage(pagetype,pageNo,totalpage){
 		var nowpage = parseInt(pageNo); 
 		var totalpage = parseInt(totalpage);
     	if(pagetype==0){//上
     	 	 nowpage =  nowpage-1; 
     	 	 if(nowpage<1){
     	  	  nowpage = 1;
     			return;
     	 	 }
			goPage(nowpage);
     	}else{//下
     	  nowpage =  nowpage+1;
     	  if(nowpage>totalpage){
     	     nowpage = totalpage; 
     		 return;
     	  }
     	  goPage(nowpage);
     	}
}

function goPage(page){
     	var params = "contentid="+contentid+"&contenttype="+contenttype+"&pageNo="+page;
     	F_ShowComment(params);
 }
 
 function deletecomment(commentid){
 	if(confirm("是否要删除您的评论？")){
     	var params = "delCommentId="+commentid;
		var proxy = document.getElementById("proxyframe").contentWindow;
		proxy.DeleteComment(params);
	}
 }
 
 function jumpvoteposi(){
	document.getElementById("votecontent").focus();
}

function jumpanchor(anchor){
	var url = window.location.href;
	if(url.indexOf('#')!=-1){
		url = url.substring(0,url.indexOf('#'));
	}
	window.location.href = url+'#'+anchor;
}
