function fullwindow(URL) {
	window.open(URL,"openwindow","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=2000,height=2000")
}
function smallwindow(URL,l,t,w,h) {
	smallwinRef=window.open(URL,l+t+w+h,"left="+l+",top="+t+", toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+w+",height="+h);
	smallwinRef.focus()
}
	function download_request() {
		var valid=1
		var name=document.downloadform.name.value
		var namefilter=/\w+/i
		var address1=document.downloadform.address1.value
		var addressfilter=/\w+/i
		var city=document.downloadform.city.value
		var cityfilter=/\w+/i
		var postcode=document.downloadform.postcode.value
		var postcodefilter=/\w+/i
		var email=document.downloadform.email.value
		var emailfilter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		var church=document.downloadform.church.value
		var churchfilter=/\w+/i
		var locality=document.downloadform.locality.value
		var localityfilter=/\w+/i
		if ( !namefilter.test(name) ) {
   			alert("Please enter a valid name.");
   		}
		else if ( !addressfilter.test(address1) ) {
   			alert("Please enter a valid address.");
   		}
		else if ( !cityfilter.test(city) ) {
   			alert("Please enter a valid city.");
   		}
		else if ( !postcodefilter.test(postcode) ) {
   			alert("Please enter a valid postcode.");
   		}
		else if ( !emailfilter.test(email) ) {
			alert("Please enter a valid email address.");
   		}
		else if ( !churchfilter.test(church) ) {
			alert("Please enter a valid church name.");
   		}
		else if ( !localityfilter.test(locality) ) {
			alert("Please enter a valid church locality.");
   		}
		else {
			fullwindow('/shop/login/download/?email=' + email + '&name=' + name + '&resource=' + document.downloadform.resource.value + '&kp=' + document.downloadform.kp.value + '&url=' + document.downloadform.url.value + '&address1=' + document.downloadform.address1.value+ '&address2=' + document.downloadform.address2.value+ '&city=' + document.downloadform.city.value + '&postcode=' + document.downloadform.postcode.value + '&church=' + document.downloadform.church.value + '&locality=' + document.downloadform.locality.value);
			window.location=document.downloadform.redirect.value;
		}
	}

