function SetDefaultEmail(obj)
{
	if(obj.value == ""){
		obj.value = "Enter email address";
	}
}
function Openwindow(){
	document.getElementById("div_program_shedule").style.display="" ;
}

function RmvDefaultEmail(obj)
{
	obj.value = "";
}
$(document).ready(function() {
  $("#sendmail").click(function () {
	var from = $("#txtmail").val();
	if(isValidEmailAddress(from)){
		var data = 'from=' + from;
		$.ajax({
				url: "sendmail_ajax.php",	
				type: "GET",
				data: data,		
				cache: false,
				success: function (html) {				
					//if process.php returned 1/true (send mail success)
					if (html) {					
						//hide the form
						//$('.form').fadeOut('slow');					
						alert(html);
						$("#txtmail").val("Enter email address");
						//show the success message
						//$('.done').fadeIn('slow');
						
					//if process.php returned 0/false (send mail failed)
					} else alert('Sorry, unexpected error. Please try again later.');				
				}		
			});
		}else { alert ("Enter a valid Email");}
  });
});
	function isValidEmailAddress(emailAddress) {
 		var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
 		return pattern.test(emailAddress);
	}

