function getCookie(c_name){
	if(document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + "=");
		if(c_start!=-1){
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if(c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}return "";
}
var pingjia = false;
function file_pj(id,hh,user,homego){
	if(pingjia == true){floatdiv("不好意思，您已经评价过啦！","#");return;}
	if(getCookie('pj' + id) != ""){floatdiv("不好意思，您已经评价过啦！","#");return;}
	var m_submit = "pj_file";
	var exp = new Date(); 
	exp.setTime(exp.getTime() + 24*60*60*1000);
	$.ajax({
		url:'post.php',
		type: 'post',
		data:{
			id:id,
			hh:hh,
			user:user,
			type:m_submit
		},
		dataType: 'text',
		error: function(){alert('文件评价失败,请稍候再试!');},
		success: function(result){
			//eval("var oo="+result+";");
			if(result=="success"){
				pingjia = true;
				document.cookie = "pj" + id + " = ok; path = /; domain = " + homego + "; expires=" + exp.toGMTString();
				//alert('恭喜您，评价成功！');
				floatdiv("恭喜您，评价成功！","#");
				document.getElementById("pingjia"+hh).innerHTML = parseInt(document.getElementById("pingjia"+hh).innerHTML) + 1 ;
			}else if(result=="user"){
				pingjia = true;
				//alert('无法评价自己的文件！');
				floatdiv("无法评价自己的文件！","#");
			}else if(result=="fail"){
				pingjia = true;
				//alert('不好意思，您已经评价过啦！');
				floatdiv("不好意思，您已经评价过啦！","#");
			}else if(result=="err"){
				//alert('非法提交!');
				floatdiv("非法提交!","#");
			}else{
				//alert('文件评价失败!');
				floatdiv("文件评价失败","#");
			}
		}
	});
}
window.onload=function(){
	document.getElementById("viewgg1").style.display="block";
	document.getElementById("viewgg2").style.display="block";
	//document.getElementById("viewgg3").style.display="block";
}
