// script by Josh Fraser (http://www.onlineaspect.com)

function calculate_time_zone(timeZone) {
	
	var i;
	// check just to avoid error messages
	if (document.getElementById('member_timezone')) {
		for (i = 0; i < document.getElementById('member_timezone').options.length; i++) {
			if (document.getElementById('member_timezone').options[i].value == timeZone) {
				document.getElementById('member_timezone').selectedIndex = i;
				break;
			}
		}
	}
}

function convert(value) {
	var hours = parseInt(value);
   	value -= parseInt(value);
	value *= 60;
	var mins = parseInt(value);
   	value -= parseInt(value);
	value *= 60;
	var secs = parseInt(value);
	var display_hours = hours;
	// handle GMT case (00:00)
	if (hours == 0) {
		display_hours = "00";
	} else if (hours > 0) {
		// add a plus sign and perhaps an extra 0
		display_hours = (hours < 10) ? "+0"+hours : "+"+hours;
	} else {
		// add an extra 0 if needed 
		display_hours = (hours > -10) ? "-0"+Math.abs(hours) : hours;
	}
	
	mins = (mins < 10) ? "0"+mins : mins;
	return display_hours+":"+mins;
}

