var J = jQuery.noConflict();

function SearchMessage(type) {
	switch (type) {
	case 0:
		// 没搜到结果
		var ser = J(":radio[name='isSearch'][checked='true']").val();
		var email = J('#email').val();
		var val = J('#sKey').val();
		if (email != '') {
			var sug = J('#content_f').val();
			if (sug != '') {

				J.post("../SearchMessage.php", {
					mode:'post',
					isSearch : ser,
					sKey : val,
					email : email,
					content_f : sug,
					isSearch_b : 'N'
				}, function(msg) {
					J("#feedback_search_1").hide();
					J("#feedback_search_2").hide();
					J("#feedback_search").css('padding_bottom', "15px");
					J("#feedback_search").css('color', "red");
		           if(msg==1){
		        	   var text = 'Thanks for your cooperation, and CUCAS will improve searching quality according to your suggestions!';
			
		           }else{
		        	   var text = 'Sorry for the inconvenience\! Your suggestions cannot be summitted right now\. Any problems please contact webmaster\@cucas\.cn\.';  
		           }
		           J("#feedback_search").html(text);

				});

			} else {
				alert("Please enter your suggestions.");
				J('#content_f').focus();

			}
		} else {
			alert("Please enter your E-mail.");
			J('#email').focus();
		}

		break;
	case 1:// 搜索到想要的结果
		var val = J('#sKey').val();
		var email = J('#email').val();
		var sug = J('#content_f').val();
		J.post("../SearchMessage.php", {
			mode:'post',
			isSearch : 'Y',
			sKey : val,
			email : email,
			content_f : sug,
			isSearch_b : 'Y'
		}, function(msg) {
			J("#feedback_search_1").hide();
			J("#feedback_search_2").hide();
			J("#feedback_search").css('padding_bottom', "15px");
			J("#feedback_search").css('color', "red");
           if(msg==1){
        	   var text = 'Thanks for your cooperation, and CUCAS will improve searching quality according to your suggestions!';
	
           }else{
        	   var text = 'Sorry for the inconvenience\! Your suggestions cannot be summitted right now\. Any problems please contact webmaster\@cucas\.cn\.';  
           }
           J("#feedback_search").html(text);
		});
		break;
	case 2:
		J("#feedback_search_1").hide();
		J("#feedback_search_2").hide();
		J("#feedback_search")
				.html(
						"Thanks for your cooperation, and CUCAS will improve searching quality according to your suggestions!");
		J("#feedback_search").css('padding_bottom', "15px");
		J("#feedback_search").css('color', "red");
		break;
	case 3:
		J('#feedback_search_2').hide();
		break;
	case 4:
		J(":radio[name='isSearch'][value='N']").attr('checked', true);
		J('#feedback_search_2').show();
		break;

	}
}
