/*	
	filename:	bi_jquery.js
	author:		
	desc:
	
*/

			// check & display error messages
			function displayAlerts(code) {
				if (code == "good") {
					jQuery("#alerts").hide().html("<p>Thanks. An email has been sent to your account containing the download link.</p>").fadeIn("slow");
				}else if (code == "bad") {
					jQuery("#alerts").hide().html("<p>You must enter an email address to proceed</p>").fadeIn("slow");
				}else {
					jQuery("#alerts").hide().html("<p>Something has gone awry. Please try again</p>").show();
				}
			}

			//submit the form 
			function go() {
				var email = escape(document.mailingList.mailInput.value);
				
				// --> checks
				if (email != "") {
					postdata = 'email='+email;
					displayAlerts("good");
				} else {
					displayAlerts("bad");
				}
	
				// --> make request 
				jQuery.ajax({
					type: "GET",
					url: "./onsns83.php",
					contentType:"application/x-www-form-urlencoded", 
					data: postdata,
					dataType:"xml",
					success: function(xmlStr) {},
					error: function (xhr, textStatus) {}
				});	// end ajax request
				
			return false;
			}
			
			
			function keyp(e){
				var code = (window.event) ? event.keyCode : e.keyCode;
				e.preventDefault();
				if(code==13){
					go();
					return false;
				}
			}
 
			
			
jQuery(document).ready(function() {

		jQuery("#mailInput").corner("bl tl 10px");
		jQuery("#btnSubmit").click(function () {go();});
			
		jQuery("#alerts").hide();
		
		jQuery('#mailInput').onkeypress = function(e){	//submits form_lingubot if 'return' key is hit
								var code = (window.event) ? event.keyCode : e.keyCode;
								if(code==13){
									alert("hi");
									go();
									return false;
								}
							}

		

}); 
