$().ready(function() {
	
});

function SetPointBG(id){
	var pos = event.offsetX;
	var pos1 = Math.round(pos/15);
	var pos2 = pos1 * 15;
	document.getElementById("myPoint").style.width=pos2;
	document.getElementById("pointId").innerHTML=pos1*5;
}

function myPoint(contentid){
	if(setting.ischecklogin == 0 && getcookie('username') === null)
     {              
        alert('请先登录!');
		return;
     }
	 
	var mypoint = $('#pointId').text();
	var data = "contentid="+contentid+"&mypoint="+mypoint;
	var pname = getcookie('username') + contentid + 'ponit';
	if (getcookie(pname) !== null)
	{
		alert('您已打过分数!');
		return;
	}
	var url =  "/tuzi/setpoint.php?action=set";
	  $.ajax({
         type: "POST",
         url: url,
         data: data,
		 dataType: 'html',    
         contentType:"application/x-www-form-urlencoded;charset=utf8",
         success: function(msg){
			 alert('打分成功!您选择的分数为'+$('#pointId').text()+'分!');
			 var out = msg.split("||");
			 $('#point').text(out[0]);
			 $('#pointCount').text(out[1]);
			 $('.starOn').eq(0).width(out[2]);
			 setcookie(pname,mypoint,1);
         }
		}); 
}

function putYX(contentid){
	if(setting.ischecklogin == 0 && getcookie('username') === null)
     {              
        alert('请先登录!');
		return;
     }
	var data = "contentid="+contentid+"&content="+$('.ipt1').val();
	var pname = getcookie('username') + contentid + 'yx';
	if (getcookie(pname) !== null)
	{
		alert('您已发表过印象!');
		return;
	}
	var url =  "/tuzi/yinxiang.php?action=set&";
	  $.ajax({
         type: "POST",
         url: url,
         data: data,
		 dataType: 'html',    
         contentType:"application/x-www-form-urlencoded;charset=utf8",
         success: function(msg){
			 var out = msg.split("||");
			 if (out[0] == 0)
			 {
				 alert('发表成功!');
				 $('.ipt1').val('');
				 eval(out[1]);
				 setcookie(pname,'0',1);
			 }else{
				alert('发表失败!');
			 }
			 
         }
		});
}
function yxSupport(id,contentid){
	
	var data = "yxid="+id;
	var pname = getcookie('username') + contentid + 'yxs';
	if (getcookie(pname) !== null)
	{
		alert('您已发表过印象!');
		return;
	}
	var url =  "/tuzi/yinxiang.php?action=support&";
	  $.ajax({
         type: "POST",
         url: url,
         data: data,
		 dataType: 'html',    
         contentType:"application/x-www-form-urlencoded;charset=utf8",
         success: function(msg){
			 var out = msg.split("||");
			 if (out[0] == 0)
			 {
				 alert('支持成功!');
				 $('.ipt1').val('');
				 setcookie(pname,'0',1);
			 }else{
				alert('支持失败!');
			 }
			 
         }
		});
	return false;

}

function qidai(contentid){
	
	var data = "contentid="+contentid;
	var pname = contentid + 'qd';
	if (getcookie(pname) !== null)
	{
		alert('您已参与过!请明天再来!');
		return;
	}
	var url =  "/tuzi/qidai.php?action=set&";
	  $.ajax({
         type: "POST",
         url: url,
         data: data,
		 dataType: 'html',    
         contentType:"application/x-www-form-urlencoded;charset=utf8",
         success: function(msg){
			 if (msg == 0)
			 {
				 alert('操作成功!感谢您的参与!');
				 setcookie(pname,'0',1);
			 }else{
				alert('操作失败!');
			 }
			 
         }
		});
}

function cuicu(contentid){
	alert('此功能只对wodota高级会员开放!');
	return;
}


function huati(contentid,style){
	var data = "contentid="+contentid+"&style="+style;
	var pname = contentid + 'qd';
	if (getcookie(pname) !== null)
	{
		alert('您已参与过!请明天再来!');
		return;
	}
	var url =  "/tuzi/sethuati.php?action=set";
	  $.ajax({
         type: "POST",
         url: url,
         data: data,
		 dataType: 'html',    
         contentType:"application/x-www-form-urlencoded;charset=utf8",
         success: function(msg){
			 if (msg == 0)
			 {
				 alert('操作成功!感谢您的参与!');
				 setcookie(pname,'0',1);
			 }else{
				alert('操作失败!');
			 }
			 
         }
		});
}
