function convertToDate() { 
	var timestamp = parseInt(document.getElementById('timestamp_input').value);
	var result = "";
	if(isNaN(timestamp)) {
		result = "Please enter a valid timestamp...";
	} else {
		var tz = 0;
		tz = parseFloat(document.getElementById('timestamp_tz').options[document.getElementById('timestamp_tz').selectedIndex].value);
		var oDate = new Date((parseInt(document.getElementById('timestamp_input').value) + (tz*3600)) * 1000);
		var date = oDate.toGMTString();
		date = date.split(" ");
		var dayAlpha = getFullDay(date[0].substr(0,3));
		var month = getFullMonth(date[2]);
		var day = date[1];
		var year = date[3];
		var hour = date[4].substr(0,2);
		var minute = date[4].substr(3,2);
		var second = date[4].substr(6,2); 
		result = dayAlpha + ", " + month + " " + day + " " + year + ", " + hour + ":" + minute + ":" + second;
	}
	document.getElementById('timestamp_result').style.display = "block";
	document.getElementById('timestamp_result').innerHTML = result;
}
function convertToTimestamp() {
	var tz = 0;
	tz = parseFloat($('timestamp_tz').options[document.getElementById('timestamp_tz').selectedIndex].value);
	var oDate = new Date(Date.UTC(
		parseInt(document.getElementById('timestamp_year').value),
		parseInt(document.getElementById('timestamp_month').value)-1,
		parseInt(document.getElementById('timestamp_day').value),
		parseInt(document.getElementById('timestamp_hour').value),
		parseInt(document.getElementById('timestamp_minute').value),
		parseInt(document.getElementById('timestamp_second').value)));
	var timestamp = (oDate.getTime() / 1000.0) - (tz*3600);
	if(isNaN(timestamp)) { timestamp = "Please enter the correct date..."; }
	document.getElementById('timestamp_result').style.display = "block";
	document.getElementById('timestamp_result').innerHTML = timestamp;
}
function getFullMonth(month) {
	switch(month) {
		case "Jan":
			return "January";
		case "Feb":
			return "February";
		case "Mar":
			return "March";
		case "Apr":
			return "April";
		case "May":
			return "May";
		case "Jun":
			return "June";
		case "Jul":
			return "July";
		case "Aug":
			return "August";
		case "Sep":
			return "September";
		case "Oct":
			return "October";
		case "Nov":
			return "November";
		case "Dec":
			return "December";
	}
	return month;
}
function getFullDay(day) {
	switch(day) {
		case "Mon":
			return "Monday";
		case "Tue":
			return "Tuesday";
		case "Wed":
			return "Wednesday";
		case "Thu":
			return "Thursday";
		case "Fri":
			return "Friday";
		case "Sat":
			return "Saturday";
		case "Sun":
			return "Sunday";
	}
	return day;
}