window.addEvent('domready', function() {
	SqueezeBox.assign($$('a[rel=boxed]'), {
		closable: false,
		onOpen: function(){
			var init = function(){
				if($("ContactForm")){
					var stateValue = $("ContactForm").getElement(".stateValue");
					stateValue.set("value", "7304");
					
					new FormValidator('ContactForm', {
						onFormValidate: function(passed, form, event){
							if(passed) {
								event.stop();
								
								form.set("send",{
									onComplete: function(response) {
										//$("sbox-btn-close").fireEvent("click");
										SqueezeBox.bound.close();
									}
								});

								form.send(); 
							}
						}
					});
				}
			};
			init.delay(250);
			
			$("sbox-btn-close").removeEvents("click");
			$("sbox-btn-close").addEvent("click", function(e){
				if(confirm("Closing this form will cancel changes you've made. Are you sure you don't want to send an email?")){
					SqueezeBox.bound.close();
				}
			});
		}
	});
	

});


	
