/*********************** TIME METHODS ****************************/

/* get the actual time */
function getActualTime() {
	time = new Date()
	sec = time.getSeconds()
	hr = time.getHours()
	min = time.getMinutes()
}
	
/* Fix time to be display */
function fixTime() {
	if (hr <= "9") {
		hr = "0" + hr;
	}
	
	if (min <= "9") {
		min = "0" + min
	}
	if (sec <= "9") {
		sec = "0" + sec
	}
}
	
/* Update the actual time every second*/
function getClock() {
	getActualTime();
	fixTime();
	var actualTime = "" + hr + "." + min + ":" + sec;
	var timeout = setTimeout("getClock()", 1000);
	if(document.getElementById("clock")) {
		document.getElementById("clock").innerHTML = actualTime;
	}
}
/***************************************************/

/*********************** EMAIL METHODS ****************************/
function sendEmail(to, email, memo) {
	//build URL
	var page = "pages/mail.php?";
	page += "nombre=" + to + "&";
	page += "email=" + email + "&";
	page += "memo=" + memo;
	
	alert(page);
	
	new Ajax.Request(page, {
    	method:'post',
    	
    	onLoading: function() {
    		//loading(tag);
    	},
    	
    	onSuccess: function(transport) {
      		if(lang == 'es') {
      			alert('Gracias por comunicarse con nosotros.')
      		}
      		if(lang == 'en') {
      			alert('Thank you for the message.')
      		}
      		if(lang == 'de') {
      			alert('Danke für ihre Nachricht.')
      		}
    	},
    
    	onFailure: function() {
    		//errorMessage(tag);
    	}
	});
}
/***************************************************/

function getMap() {
	window.open('map.html', 'TAPAUS', 'width=800,height=650');
}
