function sendEmail(){
	$.ajax({
		url:'sendEmail.php',
		type:'POST',
		data:'company='+$('#companyName').val()+'&industry='+$('#industry').val()+'&client='+$('#clientName').val()+'&position='+$('#position').val()+'&phone='+$('#phone').val()+'&email='+$('#email').val()+'&website='+$('#siteAddress').val()+'&project='+$('#project').val()+'&content='+$('#content').val(),
		dataType:'text',
		timeout:10000,
		beforeSend:function(){
			var info = {companyName:'公司名称',industry:'行业或领域',clientName:'姓名',phone:'电话号码',project:'服务项目'};
			var emptyValue = alertSend(info);
			if(emptyValue){
				return false;
			}
			$("#button").css("display","none");
			$("#message").css("display","block");
		},
		error:function(){},
		success:function(text){
			$("#button").css("display","block");
			$("#message").css("display","none");
			$("#button").empty();
//			$("#button").html(text);
			jAlert(text,'　　');
			reset();
		}
	});
}

function alertSend(ids){
	var emptyObj = new Array();
	var bool = false;;
	$.each( ids, function(i, n){
		var value = $.trim($('#'+i).val());
		if(value == "" || value == null){
			emptyObj.push(n);
			bool = true;
		}
	});

	if(bool){
		jAlert("<br />【 "+emptyObj.join(",")+" 】 <span style='color:red'>必填项</span>",'　　');
	}

	return bool;
}

function reset(){
	$('#companyName').val("");
	$('#industry').val("");
	$('#clientName').val("");
	$('#position').val("");
	$('#phone').val("");
	$('#email').val("");
	$('#siteAddress').val("");
	$('#project').val("");
	$('#content').val("");
}
