// JavaScript Document
function submitlocatorKeywordForm(){
	
	if (document.locatorKeywordForm.locatorKeyword.value == ""){
		alert("Please enter a Mall, Area Code, or Zip Code.");
		document.locatorKeywordForm.locatorKeyword.focus();
		document.locatorKeywordForm.locatorKeyword.select();		
	}else{
		document.locatorKeywordForm.submit();
	}
}
function submitLocatorForm(){
	
	if (document.locatorForm.locationMall.value == "" && document.locatorForm.locationCode.value == "" && document.locatorForm.locationZip.value == ""){
		alert("Please enter a Mall, Area Code, or Zip Code.");
	}else{
		document.locatorForm.submit();		
	}
}
function submitEnewsShortcutForm(){
	
	if (!validEmail(document.enewsShortcutForm.enewsShortcutEmail.value)){
		alert("Please enter a valid Email Address.");
		document.enewsShortcutForm.enewsShortcutEmail.focus();
	}
	else{
		document.enewsShortcutForm.submit();		
	}
}

function submitEnewsForm(){
	
	if (document.enewsForm.enewsName.value == ""){
		alert("Please enter your Name.");
		document.enewsForm.enewsName.focus();
		document.enewsForm.enewsName.select();		
		
	}else if (!validEmail(document.enewsForm.enewsEmail.value)){
		alert("Please enter a valid Email Address.");
		document.enewsForm.enewsEmail.focus();
		document.enewsForm.enewsEmail.select();		
		
	}else if (document.enewsForm.enewsComments.value.length > 1000){
		alert("Please enter less than 1000 characters for Comments.");
		document.enewsForm.enewsComments.focus();
		document.enewsForm.enewsComments.select();			
		
	}else{
		document.enewsForm.submit();		
	}
}


function submitCareerForm(){
	
	if (document.careerForm.careerFName.value == ""){
		alert("Please enter your First Name.");
		document.careerForm.careerFName.focus();
		document.careerForm.careerFName.select();	
		
	}else if (document.careerForm.careerLName.value == ""){
		alert("Please enter your Last Name.");
		document.careerForm.careerLName.focus();
		document.careerForm.careerLName.select();

	}else if (document.careerForm.careerAddress.value == ""){
		alert("Please enter your Address.");
		document.careerForm.careerAddress.focus();
		document.careerForm.careerAddress.select();

	}else if (document.careerForm.careerCity.value == ""){
		alert("Please enter your City.");
		document.careerForm.careerCity.focus();
		document.careerForm.careerCity.select();
		
	}else if (document.careerForm.careerState.selectedIndex == 0){
		alert("Please enter your State.");
		document.careerForm.careerState.focus();	
	
	}else if (document.careerForm.careerZip.value == ""){
		alert("Please enter your Zip.");
		document.careerForm.careerZip.focus();
		document.careerForm.careerZip.select();	
		
	}else if (document.careerForm.careerPhone.value == ""){
		alert("Please enter your Home Phone.");
		document.careerForm.careerPhone.focus();
		document.careerForm.careerPhone.select();			
	
	}else if (!validEmail(document.careerForm.careerEmail.value)){
		alert("Please enter a valid Email Address.");
		document.careerForm.careerEmail.focus();
		document.careerForm.careerEmail.select();				
		
	}else{
		document.careerForm.submit();		
	}
}


function submitFriendForm(){
	
	if (document.sendFriendForm.sendFriendName.value == ""){
		alert("Please enter your Friend's Name.");
		document.sendFriendForm.sendFriendName.focus();
		document.sendFriendForm.sendFriendName.select();	
		
	}else if (!validEmail(document.sendFriendForm.sendFriendEmail.value)){
		alert("Please enter a valid Email Address for your Friend's Email.");
		document.sendFriendForm.sendFriendEmail.focus();
		document.sendFriendForm.sendFriendEmail.select();

	}else if (document.sendFriendForm.sendYourName.value == ""){
		alert("Please enter your Name.");
		document.sendFriendForm.sendYourName.focus();
		document.sendFriendForm.sendYourName.select();

	}else if (!validEmail(document.sendFriendForm.sendYourEmail.value)){
		alert("Please enter a valid Email Address for your Email.");
		document.sendFriendForm.sendYourEmail.focus();
		document.sendFriendForm.sendYourEmail.select();
	
	}else if (document.sendFriendForm.sendMessage.value.length > 250){
		alert("Please enter a Message 250 characters or less.");
		document.sendFriendForm.sendMessage.focus();
		document.sendFriendForm.sendMessage.select();					
		
	}else{
		document.sendFriendForm.submit();		
	}
}

function validEmail(addemailvalue) {
	invalidChars = " /:,;"
	if (addemailvalue == "") {
		return false
	}
	for (i=0; i<invalidChars.length; i++) {
		badChar = invalidChars.charAt(i)
		if (addemailvalue.indexOf(badChar,0) != -1) {
			return false
		}
	}
	atPos = addemailvalue.indexOf("@",1)
	if (atPos == -1) {
		return false
	}
		if (addemailvalue.indexOf("@",atPos+1) != -1) {
		return false
	}
	periodPos = addemailvalue.indexOf(".",atPos)
	if (periodPos == -1) {
		return false
	}
	if (periodPos+3 > addemailvalue.length) {
		return false
	}
	return true
}

function removeDefault(formValue)
{
	if(formValue.value == "MALL/AREA CODE/ZIP" || formValue.value == "[ENTER EMAIL ADDRESS]"){
		formValue.value = "";
	}
}
function launchMapQuest(winurl,winname,winfeatures) {
	window.open(winurl,winname,winfeatures);
}