function newWindow(file,window) {
    msgWindow=open(file,window,'scrollbars=0,resizable=0,status=0,menubar=0,toolbar=0,WIDTH=500,HEIGHT=655,top=5,left=10');
    if (msgWindow.opener == null) msgWindow.opener = self;
}

function launch(newURL, newName, newFeatures, orgName) {
                             var remote = open(newURL, newName, newFeatures);
                             if (remote.opener == null)
                               remote.opener = window;
                             remote.opener.name = orgName;
                             return remote;
}

function launchemail() {
                             myRemote = launch("/events/POP/thanks.shtml",
                                               "myRemote6",
                                               "height=350,width=350,top=5,left=10,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=1,toolbar=0,z-lock=0",
                                               "myWindow");
 }


function flyers(date) {
    msgWindow=open('flyers.php?date='+date,'flyers','scrollbars=0,resizable=0,status=0,menubar=0,toolbar=0,WIDTH=650,HEIGHT=350,top=5,left=10');
    if (msgWindow.opener == null) msgWindow.opener = self;
}

//----------------------------------------------------------------------------
// CONTACT FORM
//----------------------------------------------------------------------------

function trimString (str) {
  while (str.charAt(0) == ' ')
    str = str.substring(1);
  while (str.charAt(str.length - 1) == ' ')
    str = str.substring(0, str.length - 1);
  return str;
}

function validateContactForm () {

valid = true;


$('youremail').value = trimString($('youremail').value);


	/* Email */
		apos=$('youremail').value.indexOf("@");
		dotpos=$('youremail').value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) {valid = false; new Effect.Appear('email-error');}
		else new Effect.Fade('email-error');

		if (valid) {
			var url = 'contact_thanks.php';
			new Effect.Fade('form-container');
			var myAjax = new Ajax.Request(url, {method:'post', parameters:Form.serialize(document.myform)});
			$('form-result').innerHTML = '<h2>Thank you!</h2><br />We will be responding shortly.<br /><br />';
		}
		else {
		}

}
