﻿$(document).ready(function () {
	$("#formRequestMoreInformation").submit(function (event) {
		// stop form from submitting normally    
		event.preventDefault();

		$.ajax({
			url: "http://" + document.location.host + "/send/RequestMoreInformation", // 69.169.168.51:81
			global: false,
			type: "GET",
			data: ({ CompanyName: $('#CompanyName').val(), Name: $('#Name').val(), Phone: $('#Phone').val(), Email: $('#Email').val() }),
			dataType: "script",
			async: true,
			cache: false
			//success: function (msg) { alert(msg); }
		});
		$('#btnSubmit').css('display', 'none');
		setTimeout("window.location.replace('ThankYou.html');", 250);
		//window.location.replace("ThankYou.html");
	});

	$("#formPatientEducationPacket").submit(function (event) {
		// stop form from submitting normally    
		event.preventDefault();

		$.ajax({
			url: "http://" + document.location.host + "/send/PatientEducationPacket", // 69.169.168.51:81
			global: false,
			type: "GET",
			data: ({ FirstName: $('#FirstName').val(), LastName: $('#LastName').val(), Phone: $('#Phone').val(), Email: $('#Email').val(), AsyraSerial: $('#AsyraSerial').val() }),
			dataType: "script",
			async: true,
			cache: false
			//success: function (msg) { alert(msg); }
		});
		$('#btnSubmit').css('display', 'none');
		setTimeout("window.location.replace('ThankYou.html');", 250);
		//window.location.replace("ThankYou.html");
	});


});


function CheckWatermark(jqElement, defaultText) {
	jqElement.watermark(defaultText);

	if ((jqElement.val() != '') && (jqElement.val() != defaultText)) {
		jqElement.removeClass('watermark');
	}
}

$.watermark.options = {
	className: 'watermark',
	useNative: false,
	hideBeforeUnload: false
};

//$('#CompanyName').watermark('*Company Name');
//$('#Name').watermark('*First and Last Name');
//$('#Phone').watermark('*Phone');
//$('#Email').watermark('*Email address');

iTimeOut = 100;
setTimeout("CheckWatermark($('#CompanyName'), '*Company Name');", iTimeOut);
setTimeout("CheckWatermark($('#Name'), '*First and Last Name');", iTimeOut);
setTimeout("CheckWatermark($('#Phone'), '*Phone');", iTimeOut);
setTimeout("CheckWatermark($('#Email'), '*Email address');", iTimeOut);
setTimeout("CheckWatermark($('#FirstName'), '*First Name');", iTimeOut);
setTimeout("CheckWatermark($('#LastName'), '*Last Name');", iTimeOut);
setTimeout("CheckWatermark($('#AsyraSerial'), '*Asyra Serial #');", iTimeOut);

$.watermark.options = {
	className: 'watermark',
	useNative: false,
	hideBeforeUnload: false
};

