function doPost(url,data,async,callbackF, errorF){
	$.ajax({
		type:"POST",
		url:url,
		data:data,
		async:async,
		success:function(result){
			if(callbackF!=null){
				callbackF(result);
			}
		},
		error:function(xhr, msg, ex){
			if (errorF == undefined) {
				console.log(xhr, msg, ex);
				alert('请求失败');
				waitingStop();
			} else {
				errorF(xhr, msg, ex);
			}
		}
	});
}

function doPost2(url,data,callbackF){
	$.post(
		url, 
		data,
	    function(data){
			callbackF(data);
	    },
	    "json"
	);
}

function getFormData(formName){
	var inputs = $("form[name="+formName+"] :input");	
	var data = {};		
	$(inputs).each(function(){
		var input = $(this);
		if(input.attr('name')!=null && input.attr('name').length>0){
			data[input.attr('name')]=input.val();
		}			
	});
	return data;
}

function isWeiXin(){ 
	var ua = navigator.userAgent.toLowerCase();
	if(ua.match(/MicroMessenger/i) == 'micromessenger'){ 
		return true; 
	}else{ 
		return false; 
	} 
}

function showTips(showId,isOK){
	$('#div_tips').show();
	$("div.tips-item-div").each(function(){
		if($(this).attr('id') == showId){
			if(isOK){
				$(this).removeClass('tips-fail');
				$(this).addClass('tips-ok');
			}else{
				$(this).removeClass('tips-ok');
				$(this).addClass('tips-fail');
			}
			$(this).show();
		}else{
			$(this).hide();
		}
	});
}

function waitingStop(){
	if($("#waitingModal")!=null && $("#waitingModal").length>0){
		$("#waitingModal").slideUp("slow");
	}
}
function waiting(){
	var temp = 
		'<div class="modal waiting-modal"  id="waitingModal">'+
	    '	<figure>'+
	    '		<section><div></div></section>'+
	    '		<section><div></div></section>'+
	    '		<section><div></div></section>'+
	    '		<section><div></div></section>'+
	    '		<section><div></div></section>'+
		'		<section><div></div></section>'+
		'		<section><div></div></section>'+
		'		<section><div></div></section>'+
		'	</figure>'+
		'</div>';
	if($("#waitingModal").length==0){
		$("body").append(temp);
	}
	var modalHeight = $('#waiting-modal').find('figure').outerHeight(true);
	var dialogWidth = $("#waitingModal").find('figure').outerWidth(true);
	$("#waitingModal").find('figure').css({
		'top': '30%',
		'left': function () {  						
			return ($(window).width() - dialogWidth)/2;
		}
	});
	$("#waitingModal").slideDown("slow");
}