// JavaScript Document

geterrimg = function(obj){
	obj.src='/images/zw.gif';
}

chkvotefrom = function(){
	var status = 'false';
	objs = document.getElementsByName('PuserID[]');
	
	for(i=0;i<objs.length;i++){
		if(objs[i].checked==true){
			status = 'true';
		}
	}
	if(status=='true'){
		return true;
	}else{
		alert('至少要为选择一位候选人');
		return false;
	}
	
	
		
}

function isNumber(String)
{ 
    var Letters = "1234567890"; //可以自己增加可输入值
    var i;
    var c;
      if(String.charAt( 0 )=='-')
 return false;
      if( String.charAt( String.length - 1 ) == '-' )
          return false;
     for( i = 0; i < String.length; i ++ )
     {
          c = String.charAt( i );
   if (Letters.indexOf( c ) < 0)
          return false;
}
     return true;
}


function __vote(type,id){
	$.ajax({
	  type: "GET",
	  url: "http://chuangxin.jyb.cn/ajax.php?do=do&id="+id+"&type="+type,
	  data: "",
	  success: function(msg){
		if(isNumber(msg)){
			$('#'+id).html(msg);
			alert('感谢您的支持');
		}else{
			strobj = msg.split("|");
			if(strobj[0]=='0'){
				alert(strobj[1]);	
			}else if(strobj[0]=='1'){
				alert(strobj[1]);
				//window.location.href = "http://login.jyb.cn/?forward=http://vote.jyb.cn";
				window.location.href = "#login";
			}else if(strobj[0]=='2'){
				alert(strobj[1]);
				window.location.href = "http://login.jyb.cn/user_mod.php?forward=http://vote.jyb.cn";
			}
			
		}
		
	  }
	});
}

function commentchk(){
	if($("#contents").val()==''){
		alert('评论内容不能为空');
		$("#contents").focus();
		return false;
	}

	if($("#chknum").val()==''){
		alert('验证码不能为空');
		$("#chknum").focus();
		return false;
	}
}

function _chk(){
	
	if($("#Pname").val()==''){
		alert('姓名不能为空');
		$("#Pname").focus();
		return false;
	}
	
	if($("#Age").val()==''){
		alert('年龄不能为空');
		$("#Age").focus();
		return false;
	}
	
	if($("#party").val()==''){
		alert('政治面貌不能为空');
		$("#party").focus();
		return false;
	}
	
	if($("#Workunit").val()==''){
		alert('工作单位不能为空');
		$("#Workunit").focus();
		return false;
	}
	
	if($("#intro").val()==''){
		alert('人物事迹不能为空');
		$("#intro").focus();
		return false;
	}
	
}
