$(window).load(function(){
	if ($('#inviteForm')) {
		$('#inviteForm').submit(
	function() {
		var error		= '';
		var fromFirstName = $.trim($('#fromFirstName').attr('value'));
		var	fromEmail = $.trim($('#fromEmail').attr('value'));
		var txtEmails	= $.trim($('#emailaddress').attr('value'));
		var message	= $.trim($('#message').attr('value'));
		if (fromEmail == '') {
					error += 'Please specify your email address in From textbox.\n';
					$('#fromEmail').focus();
		}
		if (txtEmails == '') {
					error += 'Please specify TO email address.\n';
					$('#emailaddress').focus();
		}
		if (message == '') {
					error += 'Please enter message description.\n';
					$('#messages').focus();
		}
		if (txtEmails!=''){
			var re = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			var email = txtEmails.split(',');
			for (var i = 0; i < email.length; i++) {
				if (!re.test($.trim(email[i]))) {
					error += 'Please specify valid email address in TO Text box.\n';
					
				}
			}
		}
		if (fromFirstName == '') {
					error += 'Please specify your first name.\n';
					$('#fromFirstName').focus();
		}
		if ($.trim(error)) {
			alert(error);
			return false;
		}
		return true;
			}
		);
	}
});

function redirectToPage(ServerPath){
	document.location.href= ServerPath;
}

function emailTextBoxVal(formName,val) {
	emailVal = formName.message.value;
	if (emailVal == val) {
		formName.message.value = '';
	}
	return true;
}

function emailTextBoxValFrom(formName,val) {
	emailVal = formName.fromEmail.value;
	if (emailVal == val) {
		formName.fromEmail.value = '';
	}
	return true;
}

function emailTextBoxValAdd(formName,val) {
	emailVal = formName.emailaddress.value;
	if (emailVal == val) {
		formName.emailaddress.value = '';
	}
	return true;
}
