function showPrintable (_url)
{
	c = _url.lastIndexOf ('?') == -1 ? '?' : '&';
	winopen (_url + c + 'MEDIA=print', 720, 500, 'yes');
}

function validateForm (_form)
{
	var validMail = /^[a-zA-Z0-9._-]+\@([a-zA-Z0-9_-]+\.){1,}[\w]{1,5}$/;
	var strError  = '';

	if (_form == null) {
	    return false;
	}

	with (_form) {
		if (elements['mailTo'].value == '') {
			strError += '- ' + ERR_RECEIVER_ADDRESS_MISSING + '\n';
		}
		else if (elements['mailTo'].value.search(validMail) == -1) {
			strError += '- ' + ERR_RECEIVER_ADDRESS_INVALID + '\n';
		}
		if (elements['mailFrom'].value == '') {
			strError += '- ' + ERR_SENDER_ADDRESS_MISSING + '\n';
		}
		else if (elements['mailFrom'].value.search(validMail) == -1) {
			strError += '- ' + ERR_SENDER_ADDRESS_INVALID + '\n';
		}
	}

	if (strError != '') {
		strAlert = ERR_INVALID_FORM_DATA + ':\n\n' + strError;
		window.alert (strAlert);
		return false;
	}

	return true;
}

function changePage (_offset)
{
	var form = document.getElementById ('formSearchResults');
	if (form == null) {
		return false;
	}
	
	var field = form.elements['recordsoffset'];
	if (field == null) {
	    return false;
	}
	
	field.value = _offset;
	form.submit();
}

function showCertificate (_name)
{
	image = _name.toLowerCase().replace(' ','');
	winopen ('certificate.xml?name=' + _name + '&image=' + image, 750, 500, 'yes');
}


function showContact (_div)
{
	var current = document.getElementById('currentContact');
	if ( current != null ) {
		var currentDiv = document.getElementById(current.value + '');
		if ( currentDiv != null ) {
			currentDiv.style.display = 'none';
		}
		current.value = _div;
	}

	var newDiv = document.getElementById(_div);
	if ( newDiv != null ) {
		newDiv.style.display = 'block';
	}
}
