// JavaScript Document


function OpenMyAccountWindow(){
	MyAccount=dhtmlmodal.open('MyAccountBox', 'iframe', 'contact-us.php', 'Conact Us/Consultation Form', 'width=550px,height=370px,center=1,resize=0,scrolling=0')

MyAccount.onclose=function(){ //Define custom code to run when window is closed
	var theform=this.contentDoc.forms[0] //Access first form inside iframe just for your reference
	var theemail=this.contentDoc.getElementById("emailfield") //Access form field with id="emailfield" inside iframe
	if (theemail.value.indexOf("@")==-1){ //crude check for invalid email
		alert("Please enter a valid email address")
		return false //cancel closing of modal window
	}
	else{ //else if this is a valid email
		document.getElementById("YourAccount").innerHTML=theemail.value //Assign the email to a span on the page
		return true //allow closing of window
	}
}
} //End "penMyAccountWindow" function

