var Contact = $H();
var ContactClass = Class.create({
    showMap: function() {
		Shadowbox.open({
		    player: 'html',
		    title: 'QuantumDigital, Inc. Location',
		    content: '',
		    height: 400,
		    width: 700,
		    options: {
		        onFinish: function(item){
		            if(GBrowserIsCompatible()) {
		                var map = new GMap2(document.getElementById('shadowbox_content'));
                        map.addControl(new GSmallMapControl());
                        map.addControl(new GMapTypeControl());
    	                geocoder = new GClientGeocoder();
    	                if (geocoder) {
	                        geocoder.getLatLng(
	                           '8702 Cross Park Dr., Austin, TX 78754',
                                function(point) {
                                    map.setCenter(point, 13);
			                        var marker = new GMarker(point);
			                        map.addOverlay(marker);
			                        marker.openInfoWindowHtml('QuantumDigital, Inc.<br />8702 Cross Park Dr.<br />Austin, TX 78754');
			                    }
			                );
	                    }
		            }
		        }
		    }
		});
		return false;
    }
});

function validator()
{
	var obj = document.brokerForm;
	if (obj.first_name.value == "") {
		alert("Please enter your first name.");
		obj.first_name.focus();
		return false;
	}
	if (obj.last_name.value == "") {
		alert("Please enter your last name.");
		obj.last_name.focus();
		return false;
	}
	if (obj.company.value == "") {
		alert("Please enter your company name.");
		obj.company.focus();
		return false;
	}
	if (obj.street.value == "") {
		alert("Please enter your address.");
		obj.street.focus();
		return false;
	}
	if (obj.city.value == "") {
		alert("Please enter your city.");
		obj.city.focus();
		return false;
	}
	if (obj.state.value == "") {
		alert("Please enter your state.");
		obj.state.focus();
		return false;
	}
	if (obj.zip.value == "") {
		alert("Please enter your zip code.");
		obj.zip.focus();
		return false;
	}
   if(obj.phone.value.search(/\d{3}\-\d{3}\-\d{4}/)==-1) {
      alert("The phone number you entered is not valid.\r\nPlease enter a phone number with the format xxx-xxx-xxxx.");
      obj.phone.focus();
      return false;
	}
	if (obj.email.value == "") {
		alert("Please enter a valid email address.");
		obj.email.focus();
		return false;
	}
    if(-1 == obj.email.value.indexOf("@")) { 
       alert("Your email address must contain an '@'.");
       obj.email.focus(); 
       return false; 
       }
     if(-1 != obj.email.value.indexOf(",")) { 
       alert("Your email cannot contain ',' in it.");
       obj.email.focus(); 
       return false; 
       }
      if(-1 != obj.email.value.indexOf("#")) { 
       alert("Your email cannot contain a '#' in it.");
       obj.email.focus(); 
       return false; 
       }
       if(-1 != obj.email.value.indexOf("!")) { 
       alert("Your email cannot contain a '!' in it.");
       obj.email.focus(); 
       return false; 
       }
    	if(obj.email.value.length ==
         (obj.email.value.indexOf("@")+1) ) {
       obj.email.focus();
       alert("Your email must contain domain name after the '@'.");
       return false;
       }
                                                              
	if (obj.title.value == "") {
		alert("Please enter your job title.");
		obj.title.focus();
		return false;
	}
	if (obj.agents.value == "") {
		alert("Please enter the number of agents.");
		obj.agents.focus();
		return false;
	}												
	return true;
}
