// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
document.observe('dom:loaded', function (event) {
  if($('contact')) {
  // Find the button that we want to disable
  var button = $('ButtonDomID');
  // Disable it!
  button.disabled = true;
  
  // Find the field that is required:
  var required_field = $('FieldDomID_1');
  var required_field = $('FieldDomID_2');
  var required_field = $('FieldDomID_3');
  var required_field = $('FieldDomID_4');
  
  // Set up an observer to monitor this field
  new Field.Observer(required_field, 0.3, function() {
    // If field == '' then button disabled = true
    button.disabled = ($F(required_field) === '');
    });
		}
  if($('store') || $('prod_show')) { 
	/*$A(document.forms).each(function(el) {
		el.a[1].observe('click', function(el) {
			//if(this.element[1])
			alert('hey');
		});							  
  	});*/
	$$('.mockSubmit').each(function(el){
		el.observe('click', function() {
			var storeIt = el.name;
			var selectColor = storeIt + 'Color';
			var selectSize = storeIt + 'Size';
			if($(selectColor) || $(selectSize)) {
				if($(selectColor).value == "" || $(selectSize).value == "") {
					alert('You must choose a size and color in order to proceed!');
				} 
				else {
					document.getElementById(storeIt).submit();
				}
			}
			else {
				document.getElementById(storeIt).submit();
			}

		});
	});
  }
});