
var t960 = new Object();

t960.showUpload=function(){
}
var  flag=false;
function AddText(vface){
	$("#comment_body").val($("#comment_body").val() + vface);
	$("#facecont").hide();
}
function reAddText(vface,v){
	$("#re_comment_body_"+v).val($("#re_comment_body_"+v).val() + vface);
	$("#facecont_"+v).hide();
}
function reply_ms(rid){
	$("#reply_"+rid).show();
}
function checkAll(form, name) {
	for(var i = 0; i < form.elements.length; i++) {
		var e = form.elements[i];
		if(e.name.match(name)) {
			e.checked = form.elements['chkall'].checked;
		}
	}
}

function reply_co(rid,cid){
	
	var cb=$("#re_comment_body_"+rid).val();
	
	if (cb==""){ 
		alert("请填写留言内容");
		document.getElementById("re_comment_body_"+rid).focus();
		return false;
	}
	
	$.post("index.php?mod=comments&do=club",
	{
		"method":'readd',
		"actid":cid,
		"id":rid,
		"content":cb
	},
	function(e){
		if(e==1){
	 		alert("回复留言成功");
	 		$("#re_comment_body_"+rid).val('');
	 		$("#comments").load('index.php?mod=comments&do=club&actid='+cid,	
				function(){
					$(this).fadeIn()
				}
			);
	 	}else{
	 		alert(e);
	 	}
	})
}

function delete_ms(cid,id){
	if(confirm("确定删除？")){
		$.get("index.php?mod=comments&do=club&method=delete&actid="+cid+"&id="+id, function(data){
  				if(data == 1){
  					alert('删除成功');
  					$('#m_'+id).remove();
  				} else {
  					alert(data);
  				}
		}); 
	}
}


function  DrawImage(ImgD,maxwidth){
     var  image=new  Image();
     image.src=ImgD.src;
     if(image.width>0  &&  image.height>0){
       flag=true;
       if(image.width/image.height>=  maxwidth/maxwidth){
         if(image.width>maxwidth){     
         ImgD.width=maxwidth;
         ImgD.height=(image.height*maxwidth)/image.width;
         }else{
         ImgD.width=image.width;     
         ImgD.height=image.height;
         }
        
         }
       else{
         if(image.height>maxwidth){    
         ImgD.height=maxwidth;
         ImgD.width=(image.width*maxwidth)/image.height;          
         }else{
         ImgD.width=image.width;    
         ImgD.height=image.height;
         }
       
         }
       }
} 

function CheckUrl(str)
{
    var pattern = /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/;
    if(!pattern.exec(str)) {
    	return false;
    }
    return true;
}

function radio_checked (str){
	jQuery("input[name='"+str+"']:first").attr("checked",true);          
}

function check_quantity(str){
	var r = /^[0-9]*[1-9][0-9]*$/
	return r.test(str);
}

function check_price(str){
	var re = /^\d+(.\d{1,20})?$/;
	return re.test(str);
	
}


