var RocketRoute = {
	defaultEmailText: 'enter email address here',
	popup_id : 'addpopup',
	
	validateEmail: function(field_id) {
		var email = document.getElementById(field_id);
		if (!email) {
			this.showMessage('Params Error');
			return false;
		}
		email = email.value;
		var regEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		if(regEmail.test(email) == false) {
			this.showMessage('Invalid Email address!');
			return false;
		}
		return true;
	},
	
	blurOnEmail: function(el) {
		var currentValue = el.value;
		if (currentValue == '') {
			el.value = this.defaultEmailText;
		}
	},
	
	focusOnEmail: function(el) {
		var currentValue = el.value;
		if (currentValue == this.defaultEmailText) {
			el.value = '';
		}
	},
	
	showMessage: function(message) {
		alert(message);
	},
	
	getDocumentHeight: function() {
	    return (document.body.scrollHeight > document.body.offsetHeight)?document.body.scrollHeight:document.body.offsetHeight;
	},

	showAddPopup: function() {
		document.getElementById(this.popup_id).style.display = "block";
		document.getElementById(this.popup_id).style.height = this.getDocumentHeight()+"px";
	},

	hideAddPopup: function() {
		document.getElementById(this.popup_id).style.display = "none";
	}
};
