// This script is copywrited and is the sole property of 4D Internet Solutions, Inc.
// It may not be used, copied, sold or reproduced in any form without the express written consent of 4D Internet Solutions, Inc.


document.write('<img id="sendemail" width=1px height=1px>');

function validateEmailAddress(emailAddress) {
    var regex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
    var ret = true;

    if (regex.test(emailAddress) == false) {
 		ret = false;    
   	}
    return(ret);
}


function sendEmail() {
		if (validateEmailAddress(document.getElementById('email-address').value)) {
	
			var image = document.getElementById('sendemail');
			image.src = "http://site.spytowne.com/map-price/mss-send-map-email.php?emailaddress=" + document.getElementById('email-address').value + "&productid=" + document.getElementById('mss-product-id').value  + "&productprice=" + document.getElementById('mss-map-sale-price').innerHTML + "&productcode=" + document.getElementById('mss-code').innerHTML + "&productname=" + escape(document.getElementById('mss-product-name').value) + "&rn=" + Math.random();
			
			
		} else {
			alert('Please enter a valid email address');
		}
	}

function changeDisplay(off, on) {
	if (off && off != ""){ 
		document.getElementById(off).style.display = 'none';
		}
	if (on && on != ""){
		document.getElementById(on).style.display = 'block';
		}
}
