// JavaScript Document
function validEmailFormat(email) {
	if (email=='') { return false; }
	emailFilter = /^.+@.+\..{2,3}$/;
	emailIllegal = /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
	return((!(!email.match(emailIllegal) && emailFilter.test(email)))?false:true);
}
function validateEmail(email) {
	isValid = validEmailFormat(email);
	if (!isValid) alert("Your email address doesn't seem correct.  Please try again.");
	return(isValid);
}

function newsletterSignupx(storeid) {
	document.writeln('<table border="0" cellpadding="0" cellspacing="0" width="160">');
	document.writeln('  <tbody><tr>');
	document.writeln('	<td colspan="5"><img src="http://content.cafepress.com/si/cpTemp.867745.boxtop_nwsltr.gif" alt="" height="24" width="160"></td>');
	document.writeln('  </tr>');
	document.writeln('  <tr>');
	document.writeln('	<td bgcolor="#272a85"><img src="http://www.cafepress.com/cp/info/img/spacer.gif" alt="" height="10" width="1"></td>');
	document.writeln('	<td bgcolor="#bebfda"><img src="http://www.cafepress.com/cp/info/img/spacer.gif" alt="" height="1" width="9"></td>');
	document.writeln('');
	document.writeln('	<td bgcolor="#bebfda"><img src="http://www.cafepress.com/cp/info/img/spacer.gif" alt="" height="1" width="142"></td>');
	document.writeln('	<td bgcolor="#bebfda"><img src="http://www.cafepress.com/cp/info/img/spacer.gif" alt="" height="1" width="7"></td>');
	document.writeln('');
	document.writeln('	<td bgcolor="#272a85"><img src="http://www.cafepress.com/cp/info/img/spacer.gif" alt="" height="10" width="1"></td>');
	document.writeln('  </tr>');
	document.writeln('  <tr>');
	document.writeln('	<td bgcolor="#272a85"><img src="http://www.cafepress.com/cp/info/img/spacer.gif" alt="" height="10" width="1"></td>');
	document.writeln('	<td bgcolor="#bebfda"><img src="http://www.cafepress.com/cp/info/img/spacer.gif" alt="" height="1" width="9"></td>');
	document.writeln('	<td bgcolor="#bebfda">');
	document.writeln('	  <form method="post" action="http://assets.'+storeid+'.com/newsletter.php" name="nlform" onsubmit="return validateEmail(txtEmail.value)">');
//	document.writeln('	  <form method="post" action="http://assets.'+storeid+'.com/newsletter.php" name="nlform" >');
	document.writeln('');
	document.writeln('		<input name="storeid" value="'+storeid+'" type="hidden">');
	document.writeln('');
	document.writeln('		<input name="cbstore" value="on" type="hidden">');
	document.writeln('		<input name="emailtype" value="1" type="hidden">');
	document.writeln('		<input name="sendmail" value="true" type="hidden">');
	document.writeln('		<span class="smallprint">Enter your email to receive product features and specials!  Yeah!</span><br>');
	document.writeln('		<img src="http://www.cafepress.com/cp/info/img/spacer.gif" height="8" width="1"><br>');
	document.writeln('		<input name="txtEmail" size="22" maxlength="50" value="your email" onfocus="this.value=\'\';" type="text">');
	document.writeln('		<br>');
	document.writeln('');
	document.writeln('		<img src="http://www.cafepress.com/cp/info/img/spacer.gif" height="8" width="1"><br>');
	document.writeln('');
	document.writeln('		<input name="submit" value=" join " type="submit">');
	document.writeln('	  </form>');
	document.writeln('	</td>');
	document.writeln('	<td bgcolor="#bebfda"><img src="http://www.cafepress.com/cp/info/img/spacer.gif" alt="" height="1" width="7"></td>');
	document.writeln('	<td bgcolor="#272a85"><img src="http://www.cafepress.com/cp/info/img/spacer.gif" alt="" height="10" width="1"></td>');
	document.writeln('  </tr>');
	document.writeln('  <tr>');
	document.writeln('	<td colspan="5"><img src="http://content.cafepress.com/si/cpTemp.867745.boxbottom.gif" alt="" height="10" width="160"></td>');
	document.writeln('');
	document.writeln('  </tr>');
	document.writeln('</tbody></table>');
}

function newsletterSignup(storeid) {
	document.writeln('\n\n<!-- NEWSLETTER TABLE -->');
	document.writeln('<div style="background-color:'+bgcolor+';font-family:Verdana, Arial, Helvetica, sans-serif;font-weight:bold;font-size:12px;"><img src="http://assets.'+storeid+'.com/images/navbox_storenewsletter.gif" width="160" height="24" border="0"></div>');
	document.writeln('<div style="border:1px solid '+bordercolor+';padding:4px;background-color:'+bgcolor+';layer-background-color:'+bgcolor+';visibility:visible;color:#ffffff;padding-left:10px">');
	document.writeln('<div style="margin-bottom:12px">');
	document.writeln('	  <form method="post" action="http://assets.'+storeid+'.com/newsletter.php" name="nlform" onsubmit="return validateEmail(txtEmail.value)">');
//	document.writeln('	  <form method="post" action="http://assets.'+storeid+'.com/newsletter.php" name="nlform" >');
	document.writeln('');
	document.writeln('		<input name="storeid" value="'+storeid+'" type="hidden">');
	document.writeln('');
	document.writeln('		<input name="cbstore" value="on" type="hidden">');
	document.writeln('		<input name="emailtype" value="1" type="hidden">');
	document.writeln('		<input name="sendmail" value="true" type="hidden">');
	document.writeln('		<span class="smallprint">Enter your email to receive product features and specials!  Yeah!</span><br>');
	document.writeln('		<img src="http://www.cafepress.com/cp/info/img/spacer.gif" height="8" width="1"><br>');
	document.writeln('		<input name="txtEmail" size="22" maxlength="50" value="your email" onfocus="this.value=\'\';" type="text">');
	document.writeln('		<br>');
	document.writeln('');
	document.writeln('		<img src="http://www.cafepress.com/cp/info/img/spacer.gif" height="8" width="1"><br>');
	document.writeln('');
	document.writeln('		<input name="submit" value=" join " type="submit">');
	document.writeln('	  </form>');
	document.writeln('</div>');
	document.writeln('</div>');
	document.writeln('<!-- END NEWSLETTER TABLE -->\n\n');
}

newsletterSignup(window.location.pathname.split('/')[1]);
