// JScript File

function toggleWhichPub(selBox)  {
	var thevalue;
	thevalue = selBox.options[selBox.selectedIndex].text;
	if (thevalue == "Advertisement")  {
		document.getElementById("whichpub").style.display = "block";
		document.getElementById("whichpubLabel").style.display = "block";
		}
	else  {
		document.getElementById("whichpub").style.display = "none";
		document.getElementById("whichpubLabel").style.display = "none";
		}
	}
	
$(document).ready(function(){

	$('#submitimage').click(function(){

		var nameString = $('#title').val() + $('#firstname').val() + $('#surname').val();
		nameString = nameString.toLowerCase();


		if((nameString.indexOf('bikini') || nameString.indexOf('super') || nameString.indexOf('micro')) > -1){return false}
		else{
			var msg = "";
			if ($('#title').val() == "") msg = "Your Title is missing..\n";
			if ($('#surname').val() == "") msg = msg + "Your Surname is missing..\n";
			if ($('#address1').val() == "") msg = msg + "The First Line of your Address is missing..\n";
			if ($('#town').val() == "") msg = msg + "The Town is missing..\n";
			if ($('#county').val() == "") msg = msg + "The County/State is missing..\n";
			if ($('#postzip').val() == "") msg = msg + "The Postal/Zip code is missing..\n";
			if ($('#country').val() == "") msg = msg + "The Country is missing..\n";
			if ($('#telephone').val() == "") msg = msg + "Your Telephone Number is missing..\n";
			var email = $('#email').val();
			if (email == ""||((email.indexOf("@") == -1)||email.indexOf(".") == -1)) { 
				msg = msg + "Your Email Address is either missing or in an invalid format..\n"; 
				}
			if (msg != "")  { 
				msg = msg + "\nPlease try again.";
				alert(msg);
				return false; 
				}
			else {
				document.brochureForm.action = "do-brochure-request.aspx";			
				$('#brochureForm').submit();
			}	
		}
	});
});