var at = "@";
var h = "";
function p(line) { document.write(line+"\n"); }
function p0(line) { document.write(line); }
var year = "2007";
function swapyear() {
var s = location.href.
    replace(/confex.pl[?]MEETING.HTM/,"program.html").
    replace("/2007/","/2012/").
    replace("students.html","academia.html").
    replace("hs.html","precollege.html").
    replace("travel.html","directions.html").
    replace("advertise.html","advrtse.html")
    ;
if(s.match(/index.html/)) s = s.replace("/2012/","/2006/");
location.href = s;
}
function boilerplate_top(h) {
if(!h) h="";
p0('<name="_top"></name><a href="JavaScript:void(0)" onclick="swapyear()"><img src="/'+year+'/graf/nil.gif" height=10 width=10 alt="" title="" border=0></a>');
//p0('<name="_top"></name><table><tr><td height=3></td></tr></table x=halfspace>');
p('<table cellpadding=0 cellspacing=0 border=0 width="100%"><tr><td>\n');
p('<table width="100%" border="0" cellspacing=0 cellpadding=0 bgcolor="#CfCfCf" background="graf/greypin.jpg">');
p('  <tr>');
p('    <td width="208" valign=top>');
p('    <a href="index.html"><img src="'+h+'graf/MARM2007-131x130.jpg"');
p('	width="131" height="130" hspace=15 vspace=15');
p('	Xwidth="200" Xheight="286" border=0');
p('	title="MARM 2007 - Forging new connections in Chemistry"');
p('	alt="MARM 2007 - Forging new connections in Chemistry"');
p('    ></a></td>');
p('    <td align="center" valign="top">');
p('    <div align="center">');
p('    <img src="'+h+'graf/top_logo_2007_393x130.gif" alt="MARM 2007" width="393" height="130" alt="ACS Mid-Atlantic Regional Meeting, Ursinus College, Collegeville, PA" title="ACS Mid-Atlantic Regional Meeting, Ursinus College, Collegeville, PA" >');
p('    <table><tr><td height=3></td></tr></table x=halfspace>');
p('    <a href="'+h+'index.html" onMouseOver="MM_swapImage(\'Image12\',\'\',\'graf/b2_home.gif\',1)" onMouseOut="MM_swapImgRestore()"><img src="'+h+'graf/b1_home.gif" name="Image12" width="150" height="20" border="0" id="Image12"></a>&nbsp;	<!-- ');
p('    <a href="'+h+'welcome.html" onMouseOver="MM_swapImage(\'Image13\',\'\',\'graf/b2_welcome.gif\',1)" onMouseOut="MM_swapImgRestore()"><img src="'+h+'graf/b1_welcome.gif" name="Image13" width="150" height="20" border="0" id="Image13"></a>&nbsp;&nbsp;	 -->');
p('    <a href="'+h+'committee.html" onMouseOver="MM_swapImage(\'Image14\',\'\',\'graf/b2_committee.gif\',1)" onMouseOut="MM_swapImgRestore()"><img src="'+h+'graf/b1_committee.gif" name="Image14" width="150" height="20" border="0" id="Image14"></a>&nbsp; 	');
p('    <a href="http://membership.acs.org/p/philadelphia/" onMouseOver="MM_swapImage(\'Image15\',\'\',\'graf/b2_philyacs.gif\',1)" onMouseOut="MM_swapImgRestore()"><img src="'+h+'graf/b1_philyacs.gif" name="Image15" width="150" height="20" border="0" id="Image15"></a>&nbsp;&nbsp;');
p('    </div></td>');
p('    <td width="158" align="center" valign="center">');
p('      <table cellpadding=1>');
p('	<tr><td height=1></td></tr>');
var s='	<tr><td><a href="http://www.acs.org" target=_blank><img src="'+h+'graf/acsdia7.gif" Xwidth="130" height="123" title="American Chemical Society" border=0></a></td></tr>';
p(s);
//p('	<tr><td height=6></td></tr>'); p(s);
//p('	<tr><td height=6></td></tr>'); p(s);
p('      </table>');
p('    </td>');
p('  </tr>');
p('</table>');
p('<table><tr><td height=5></td></tr></table x=halfspace>');
}


function boilerplate_bottom(h) {
if(!h) h="";
p('<tr> ');
p('  <td bgcolor="#F7F7F7" background="graf/greypin.gif" valign=bottom width=120>');
p('    <div><span class=fineprint><script>TimeStamp("<nobr>Last modified:</nobr><br>")</script></span></div>');
p('    </td>');
p('  <td align="left" valign="middle" bgcolor="#F7F7F7" background="graf/greypin.gif" colspan=2>');
p('<table cellpadding=0 cellspacing=0 border=0 width="100%" >');
p('<tr><td align=center style="text-align:center" nowrap>');
var nb = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
p(nb+nb+nb);
p('<span class="fineprint">[ <i><a href="/'+year+'/private" class=gray style="font-weight:normal" title="password required">login</a></i> ]</span></td>');
p('<td align=right nowrap valign=top width="5%">');
p('<p class=p0><a href="mailto:webmaster22'+at+'marmacs.org?subject=Marm 2007">WebMaster E-Mail</a></p></td></tr></table>');
p('  </td>');
p('</tr>');
p('</table></td></tr>');
}

function Abstract(ses) {
//    alert("Abstract for session "+ses); // DEBUG
    NewWin('abstract.pl?'+ses,ses,800,500);
}

//////////////////////////////////////////

function toc_bgn(width) {
if(!width) var width ="";
p('<table '+width+' \
style="border-width:0px;border-spacing:0px;border-style:none;\
border-color:#0066CC;border-collapse:collapse;background-color:#216CAF"');
}
function toc_end() {
p('</table>');
}
var count=0;
function toc_item(h,name,link,fontclass,fontstyle) {
if(!h) h = "";
if(!fontclass) fontclass = "toc";
if(!fontstyle) fontstyle = "";
if(fontstyle ) fontstyle=" style='"+fontstyle+"'";
// if(++count < 3) alert("class=("+fontclass+")  style=("+fontstyle+")");
var a = "a";
if(link == "") a = "span";
var href = h+link;
if(!href.match(/^http/i)) 
    href = href.replace(/^[^/][/]+/,"http://marmacs.org/"+year+"/");
p('<tr><td align=center Xvalign=top \
style="border-width:thick;padding:3px;border-style:groove;border-color:#0066CC;\
background-color:#216CAF;text-align:center;"><'+a+' href="'+href+'" class='+fontclass+fontstyle+'>'+name+'</'+a+'></td></tr>');
}
function boilerplate_left(h) {
  if(!h) var h = "";
  toc_bgn("width=150");
//  toc_bgn("");
//  p("<tr bgcolor='#CfCfCf'><td><img src='graf/nil.gif' width=144 height=1 border=0></td></tr>");
//  toc_item(h,"<img src='graf/nil.gif' width=144 height=1 border=0><br>MARM 2007","index.html","gold","font-family:Comic Sans MS;font-style:normal;");
  toc_item(h,"MARM 2007","index.html","gold","font-family:Comic Sans MS;font-style:normal;");
  toc_item(h,"Photos","photos.html");
  toc_item(h,"General Meeting Information","general.html");
  toc_item(h,"Workshops &amp; Special Events","events.html");
  toc_item(h,"Awards","awards.html");
  toc_item(h,"Undergraduate Events","students.html");
  toc_item(h,"Pre-College Educators","hs.html");
  toc_item(h,"Sponsors at MARM","spnsrs.html");
  toc_item(h,"Technical Program","confex.pl?MEETING.HTM");
  toc_item(h,"Program Book","programbook.html");
  toc_item(h,"&nbsp;","");
  toc_item(h,"Submit an Abstract","submit.html");
  toc_item(h,"Register for MARM","register.html");
  toc_item(h,"&nbsp;","");
  toc_item(h,"Reserve your Hotel or Campus Housing","housing.html");
  toc_item(h,"Area Restaurants","restaurants.html");
  toc_item(h,"Directions","travel.html");
  toc_item(h,"Public Transport","publictransport.html");
  toc_item(h,"Local Attractions","attractions.html");
  toc_item(h,"Flyer","flyers.html");

//  toc_item(h,"Supporting Divs &amp; Socs","societies.html");
  toc_item(h,"&nbsp;","");
  toc_item(h,"<img src='graf/nil.gif' width=1 height=6 border=0><br><span style='font-size:1em;text-align:center;'><b>Other MARMs</b></span></br><img src='graf/nil.gif' width=1 height=6 border=0>"             ,"http://marmacs.org/"      ,"gold","","","padding-top:12px;padding-bottom:12px;");
//  toc_item(h,"&nbsp;","");
  toc_end()
  MM_preloadImages();
}

function MM_validateFormY(args0) { //v4.0
  var i,p,q,id,nm,nm1,val,rule,def,num,min,fld,max;
  var errors = '';
  var args=MM_validateFormY.arguments;
//  alert("MM_ValidateFormY:  argcount ="+args.length); //DEBUG
  for (i=0; i<(args.length-2); i+=3) {
    id   = args[i];
//    fld  = MM_findObj(args[i]);
    fld  = Obj(args[i]);   // Works much better!!
    def  = args[i+1];
    rule = args[i+2];
//    alert("id=("+id+")  rule=("+rule+")  fld=("+fld+")");
    if (fld) {
      nm  = fld.name+"";
      // Why doesn't the above pick up the name???  It used to work!
      //if(!nm || nm==null || nm==undefined || nm=='' || !nm.match(/[a-z]/i))
	  nm = id.replace(/_[0-9]*$/,"");
//      alert("A. MM_validateFormY: id=("+id+") name=("+nm+")  rule=("+rule+")"); //DEBUG
      nm1 = '\n'+nm.replace(/^[0-9 ]*/,"");
      val = fld.value+"";
      if (val!="") {
	if (rule.indexOf('isEmail')>-1) {
	  p = val.indexOf('@');
	  if (p<1 || p==(val.length-1))
	    errors += nm1+' must contain an e-mail address.\n';
	} else
	if (rule.indexOf('Num')>-1) {
	  if (isNaN(val)) {
	    errors += nm1+' must contain a number.\n';
	  } else
	  if (rule.indexOf('inRange') != -1) {
	    p=rule.indexOf(':');
	    min=rule.substring(8,p); max=rule.substring(p+1);
	    if (val<min || max<val)
	      errors += nm1+' must contain a number between '+min+' and '+max+'.\n';
	  }
	}
      } else
	if (rule.charAt(0) == 'R')
	  errors += nm1+' is required.\n';
    }
  }
  if (errors) {
    alert('The following error(s) occurred:\n'+errors);
    return false;
  }
  else {
    for (i=0; i<(args.length-2); i+=3) {
      fld  = MM_findObj(args[i]);
      def  = args[i+1];
      if(fld) {
	if(fld.value+'' == '' && def != null)
	    fld.value = def;
      }
    }
    return true;
  }
}


