<!--

var origHeight;
var origWidth;
var contentHeight;

$(function(){
	
	origHeight = $(window).height();
	origWidth = $(window).width();
	contentHeight = $('#content').height();
	
	$(window).resize(function() {
		resizeEvent();
	});

	// Resize
	resizeEvent();

});

function resizeEvent() {

	var height = $(window).height();
	var width = $(window).width();
	
	$('.body').css('width', width + 'px');
	$('.body').css('min-width', '625px');
	
	$('#MESSAGE').css('height', height - 345 + 'px');
	$('#MESSAGE').css('min-height', '80px');
	
	$('#NAME').css('width', width - 250 + 'px');
	$('#EMAIL').css('width', width - 250 + 'px');
	$('#MESSAGE').css('width', width - 250 + 'px');
	
	$('#content').css('height', height - 105 + 'px');
	
	if (width - 277 > 348) { $('#BannerCenter').css('width', width - 277 + 'px'); } else { $('#BannerCenter').css('width', '348px'); }
}

function getLayer(id) {
	if (document.getElementById) {
		return document.getElementById(id);
	} else if (document.layers && document.layers[id] != null) {
		return document.layers[id];
	} else if (document.all) {
		return document.all[id];
	}
}

function showError(id) {
	var obj = getLayer(id);
	if (obj != null) {
		obj.style.visibility = 'visible';
		obj.src = 'images/errorsmall.gif';
		return true;
	}
}

function hideError(id) {
	var obj = getLayer(id);
	if (obj != null) { obj.style.visibility = 'hidden';	}
}

function validateField(field, id) {
	if ($.trim(field.value) == '') {
		return showError(id);
	} else {
		hideError(id);
		return false;
	}
}

function validateEmail() {
	var email = $.trim(document.login.EMAIL.value);
	if (email != '') {
		if (email.match(/^[\-!#$%&'*+\\.\/0-9=?A-Z^_`a-z{|}~]+@[\-!#$%&'*+\\\/0-9=?A-Z^_`a-z{|}~]+\.[\-!#$%&'*+\\.\/0-9=?A-Z^_`a-z{|}~]+$/)) {
			hideError('EmailError');
			return false;
		} else {
			showError('EmailError');
			return true;
		}
	}
}

function validateOfflineForm() {

	if (validateField(document.OfflineMessageForm.NAME, 'NameError') || validateField(document.OfflineMessageForm.EMAIL, 'EmailError') || validateField(document.OfflineMessageForm.MESSAGE, 'MessageError')) {
		return false;
	}
	return true;
}

function validateDial() {
	var dial = document.CallForm.COUNTRY.value;
	document.CallForm.DIAL.value = dial.substring(dial.indexOf('+'));
}

function getTimezone() {
	var datetime = new Date();
	if (datetime) {
		return datetime.getTimezoneOffset();
	} else {
		return '';
	}
}

function validateCallForm() {

	var localtime = getTimezone();
	document.CallForm.TIMEZONE.value = localtime;

	if (validateField(document.CallForm.NAME, 'NameError') || validateField(document.CallForm.EMAIL, 'EmailError') || validateField(document.CallForm.TELEPHONE, 'TelephoneError') || validateField(document.CallForm.MESSAGE, 'MessageError') || validateField(document.CallForm.MESSAGE, 'SecurityError')) {
		return false;
	}
	return true;
}

//-->
