function common() {
  var hotbox = document.getElementById('msg_sent');
  infanticide('msg_sent');

  var contact_name = document.getElementById("contact_name").value;
  if (contact_name == '') {
	hotbox.innerHTML = '<p class="form_error">Please tell us your name.</p>'; 
	return;
  }

  var contact_phone = document.getElementById("contact_phone").value;
  var contact_email = document.getElementById("contact_email").value;
  if ((contact_phone == '') && (contact_email == '')) {
	hotbox.innerHTML = '<p class="form_error">Please provide either a phone number or email address where we can contact you. Your information is, of course, kept private.</sp>'; 
	return;
  }

  var contact_note = document.getElementById("contact_note").value;
  if (contact_note == '') {
	hotbox.innerHTML = '<p class="form_error">Please leave a message so we know what to contact you about.</sp>'; 
	return;
  }

  var poststr = 'dowhat=contact_form&contact_name=' + escape(encodeURI(contact_name)) + '&contact_phone=' + escape(encodeURI(contact_phone)) + '&contact_email=' + escape(encodeURI(contact_email)) + '&contact_note=' + escape(encodeURI(contact_note));

  //  alert(poststr);
  var htob = false;
  if (window.XMLHttpRequest) {htob = new XMLHttpRequest();}
  else if (window.ActiveXObject) {htob = new ActiveXObject("Microsoft.XMLHTTP");}
  else {alert('Your browser does not support Ajax. Please upgrade!');}
  if (htob) {
	htob.open('POST', 'functs.php', true);
	htob.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	htob.setRequestHeader("Content-length", poststr.length);
	htob.setRequestHeader("Connection", "close");
	htob.onreadystatechange = function() {
	  if ((htob.readyState == 4) && (htob.status == 200)) {
		infanticide('msg_sent');
		hotbox.innerHTML = htob.responseText;
	  }
	}
	htob.send(poststr);
  }
  else {hotbox.innerHTML = '<p class="form_error">Your browser does not support Ajax. Please upgrade!</p>';}
}



function infanticide(where) {
  var killbox = document.getElementById(where);
  while (killbox.childNodes[0]) {
    killbox.removeChild(killbox.childNodes[0]);
  }
  if (killbox.childNodes[0]) {return false;}
  else {killbox.innerHTML = '&nbsp;'; return true;}
}


function swapimgs(which, shade) {
  var img = document.getElementById('nav_' + which);
  var mig = './images/' + which + '' + shade + '.png';
  if (img.src = mig) {return true;}
  else {alert('junk!');}
}

function iceme(which, ono) {
  var hotbox = document.getElementById(which);
  if (ono == 0) {
	infanticide(which);
	hotbox.innerHTML = '';
  }
  if (ono == 1) {
	hotbox.innerHTML = '<img src="./images/CakeIcerR.png" border="0" />';
  }
}



function fixHeight(which) {
  var bbox = document.getElementById('body_frame');
  var bodyh = bbox.offsetHeight;
  if (((which == 'home') || (which == 'cakes') || (which == 'our story') || (which == 'contact')) && (bodyh < 515)) {
	bbox.style.height = '511px';
  }
  if ((which == 'classes') && (bodyh < 565)) {
	bbox.style.height = '561px';
  }
  if ((which == 'gallery') && (bodyh < 599)) {
	bbox.style.height = '595px';
  }
}

