
//网站路径(域名)控制器
(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';
})();
function SendVoteToProcessCenter(params,ProcessCenterURL,div){
	var proxy = document.getElementById("ServiceFrame").contentWindow;
	proxy.SubmitRequestNoAction(params,ProcessCenterURL,div);
}

function castVoteCallback(result,jsonString){
	if(result.substring(0,1)!=1){//失败
		if(result.substring(0,1)!=2){
			alert(result.substring(1,result.length));
		}else{
			window.open(X.PATH.SUPPORT+"login/login/12530/_/_/_/_/space/p.html");
		}
		document.getElementById('castVote').disabled="";
	}else{
		params="jsonString="+jsonString;
		SendVoteToProcessCenter(params,X.PATH.VIP+"jsp/v3_fans/fans/fans_bbs_castvote.jsp","voteDiv");
	}
	
}

function castVote(obj,topicId,forumid,singerid){
	var choices=document.getElementsByName(obj);
	var aOptionals=new Array;
	for(var i=0;i<choices.length;i++){
		if(choices[i].checked){
			aOptionals.push((choices[i].value));
		}
	}
	if(!aOptionals.length){
		alert("嗨，你要投票给哪一项呀？");
		return;
	}
	var jsonObject=new Object;
	jsonObject.voteItems=aOptionals;
	jsonObject.topicId=topicId;
	jsonObject.forumid=forumid;
	jsonObject.singerid=singerid;
	//先校验
	document.getElementById('castVote').disabled="disabled";
	remotejs(X.PATH.VIP+"jsp/v3_fans/fans/castvote_verify.jsp","castVoteCallback",jsonObject);
}
