/*
	Website scripts
	(c) Kerve Creative
*/

function popup(address,winurl,winwidth,winheight) {
	var new_window = window.open(address,winurl,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=' + winwidth + ',height=' + winheight);
}

function downloadFile(ide) {
	if((document.download_form.password.value != '')) {
		//document.location.href = '/pram.html?del=' + ide + '&ref=' + document.download_form.ref.value;
		document.download_form.item.value = ide;
		document.download_form.submit();
	} else {
		alert('Please ensure that you have entered your password.');	
	}
}
	
function validateLoginForm() {
	var errormessage = 'Please ensure that you have completed the following:\n';
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if(
		(document.login_form.firstname.value != '') &&
		(document.login_form.lastname.value != '') &&
		(document.login_form.publication.value != '') &&
		(document.login_form.email.value != '') &&
		(filter.test(document.login_form.email.value))
	) {
		document.login_form.submit();
	} else {
		if(document.login_form.firstname.value == '') {
			errormessage += "  > Your first name\n";
		}
		if(document.login_form.firstname.value == '') {
			errormessage += "  > Your last name\n";
		}
		if(document.login_form.publication.value == '') {
			errormessage += "  > Publication\n";
		}
		if(document.login_form.email.value == '') {
			errormessage += "  > Email address\n";
		} else {
			if((filter.test(document.login_form.email.value)) == false) {
				errormessage += "  > You must enter a valid email address\n";
			}
		}
		
		alert(errormessage);
	}
}


