﻿$(document).ready(function() {
	$("#btnSend").click(function() {
			var hidetype = $("#hideType").val();
		var language = $("#LanguageCode");

		var name = $("#txtName");
		var phone = $("#txtPhone");
		var email = $("#txtEmail");
		var txtUrl = $("#txtUrl");
		var subject = $("#txtSubject");
	if (name.val() == "") {
//		alert("Please fill in the names of!");
		var nameAlert = $("#hideAlertName").val();
			alert(nameAlert);

			name.focus();
			return;
		}
			if (phone.val() == "") {
     //	var messageAlert = $("#hideAlertMessage").val();
		//	alert(messageAlert);
			alert("Please fill in the phone!");

			phone.focus();
			return;
		}
		if (email.val() == "") {
	var emailalert = $("#hideAlertEmail").val();
				alert(emailalert);
		//alert("Please fill in the e-mail!");
			email.focus();
			return;
		}
		if(txtUrl.val()==""){
		alert("please fill in the Website url");
		txtUrl.focus();
		return;
		}
		if(subject.val()==""){
		alert("please fill in the Message");
		subject.focus();
		return;
		}


				$.ajax({
				type: "POST",
				url: "../handler/XMLSendMessageToUs.ashx",
				data: "subject=" + subject.val() + "&language=" + language +"&url=" + txtUrl +"&name=" + name.val() + "&email=" + email.val() + "&phone=" + phone.val() + "&type=" + hidetype + "",
				success: function(msg) {
					if (msg == "1") {
					    var success=$("#hidesuccess").val();
						alert(success);
						$(".clearValue").val("");
					}
					else {
						var sorry=$("#hidesorry").val();
						alert(sorry);
					}

				}
			});
		
        })
	
	
});
	

