function textSwap(whatText) {
document.getElementById('block').innerHTML = whatText;
};

function createPopup(whichPopup) {
 largeImage.setBody(document.getElementById(whichPopup).innerHTML);
 largeImage.show();
};

function init() {
 contactPopup = new YAHOO.widget.Panel("contact", { 
 width:"420px", visible:false, dragOnly:true, constraintoviewport:true, effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration: 0.14}
 } );
 contactPopup.render();
 YAHOO.util.Dom.removeClass('contact', 'hide');
 YAHOO.util.Event.addListener("showcontact", "click", contactPopup.show, contactPopup, true);
 
 youtubePopup = new YAHOO.widget.Panel("youtube", { 
 width:"520px", visible:false, constraintoviewport:true, dragOnly:true, effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration: 0.14}
 } );
 youtubePopup.render();
 YAHOO.util.Dom.removeClass('youtube', 'hide');
 YAHOO.util.Event.addListener("showyoutube", "click", youtubePopup.show, youtubePopup, true);

 galleryPopup = new YAHOO.widget.Panel("gallery", { 
 width:"500px", visible:false, constraintoviewport:false, dragOnly:true, effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration: 0.14}
 } );
 galleryPopup.render();
 galleryPopup.hideEvent.subscribe(clearContent);
 // the listener for this one is on a separate function so we can use AJAX
};

function showPopup(e){
 YAHOO.util.Event.preventDefault(e); // suppress default link behaviour
 galleryPopup.setHeader(this.title); // set heading of popup div
 ajaxFunction(this.href,'gallerybody');
 YAHOO.util.Dom.removeClass('gallery', 'hide');
 galleryPopup.show();
};

function clearContent(){
 document.getElementById('gallerybody').innerHTML = "<p>Please wait while the content loads</p>";
};

var elements = ['showgallery1','showgallery2','showgallery3','showgallery4','showgallery5','showgallery6','showgallery7','showgallery8','showgallery9','showgallery10','showgallery11','showgallery12','showgallery13','showgallery14','showgallery15','showgallery16','showgallery17','showgallery18','showgallery19','showgallery20','showgallery21'];
YAHOO.util.Event.addListener(elements, "click", showPopup);

YAHOO.util.Event.addListener(window, "load", init);

function checkemail(str) {
 var filter =/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,7}|\d+)$/i;
 return (filter.test(str));
};

function validateFields() {
 if (document.form1.name.value=='' || document.form1.name.value=='name') {
  alert('Please enter your name.');
  if (document.form1.name.value=='name'){document.form1.name.value=''};
  document.form1.name.focus();
  return;
 }
 if (document.form1.email.value=='' || document.form1.email.value=='email') {
  alert('Please enter your email address.');
  if (document.form1.email.value=='email'){document.form1.email.value=''};
  document.form1.email.focus();
  return;
 }
 if (!checkemail(document.form1.email.value)) { 
  alert('Please enter a valid email address.');
  document.form1.email.focus();
  return;
 }  
 if (document.form1.message.value=='') {
  alert('Please enter your message.');
  document.form1.message.focus();
  return;
 }
 document.form1.submit();
};



