$(function(){
	//动态星星评论
	$("div[id='star-1']").each(function(e){
		var group_id=$(this).attr('group_id');
		var name="score["+group_id+"]";
		var id='#function-hint_'+group_id;
		$(this).raty({
		hints: ['差评','差评', '中评', '中评', '好评'],//自定义分数
		starOff: 'iconpic-star-S-default.png',//默认灰色星星
		starOn: 'iconpic-star-S.png',//黄色星星
		path: ROOT_PATH+'Application/Home/View/default/common/images',//可以是相对路径
		number: 5,//星星数量，要和hints数组对应
		showHalf: true,
		targetText: '请选择评分',
		target: id,
		targetKeep : true,
		scoreName:'score['+group_id+']',
		
		});
	});
	//动态星星评论默认选中
	$("div[id='star-2']").each(function(e){
		var def=$(this).attr('default');
		if(def==0){def=5;}
		var group_id=$(this).attr('group_id');
		var id='#function-hint'+group_id;
		$(this).raty({
		hints: ['差评','差评', '中评', '中评', '好评'],//自定义分数
		starOff: 'iconpic-star-S-default.png',//默认灰色星星
		starOn: 'iconpic-star-S.png',//黄色星星
		path: ROOT_PATH+'Application/Home/View/default/common/images',//可以是相对路径
		number: 5,//星星数量，要和hints数组对应
		score:def,
		showHalf: true,
		targetText:'请选择评分',
		target: id,
		readOnly:true,
		noRatedMsg:'全五星',
		targetKeep : true,
		precision: false, //是否包含小数
		});
	});
	//标签评论
	$("p[id='tag_dd']").each(function(e){
		$(this).children('span').bind('click',function(){
			var group_id=$(this).attr('group_id');
			var span_id=$(this).attr('span_id');
			var og_id=$(this).attr('og_id');
			var tag=$(this).text();
			var cls=$(this).attr('class');
			if(cls=='on'){
				$(this).attr('class','');
				$("#span_"+span_id).remove();
			}else{
				$(this).attr('class','on');
				$(this).after('<input id="span_'+span_id+'" type="hidden" name=tag_'+group_id+'['+og_id+'][] value="'+tag+'">')
			}
		});
	});
});
//点评提交
function add_dp(){
	$('#add_dp_btn').attr('disabled',true);
	var query=new Object();
	query=$("form[name='dpform']").serialize();
	var url=APP+'Mobile/Dp/add_dp';
	$.ajax({
		url:url,
		data:query,
		datatype:'json',
		success:function(data){
			$('#add_dp_btn').attr('disabled',false);
			if(data.status==1){
				$.showSuccess(data.info,0,'hc');
			}else{
				$.showErr(data.info,0,'hc');
			}
			if(data.url)window.location.href=data.url;
		}
	});
}