function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
  {
  document.getElementById('alert').innerHTML='<B><font color="CC0000">' + alerttxt + '</font></B>';
  return false
  }
else {return true}
}
}

function validate_form(thisform)
{
with (thisform)
{
if (validate_required(sender,"Sender Email must be filled out!")==false)
  {
	document.getElementById('sender').style.backgroundColor="FAF8CC";
	sender.focus();
	return false
  }
if (validate_required(friend,"Friend Email must be filled out!")==false)
  {
  document.getElementById('friend').style.backgroundColor="FAF8CC";
  friend.focus();
  return false
  }
}
}

function send2friend(url, title, school) {
	var newWindow=window.open('','name','height=500,width=400');
	newWindow.document.write('<html><head><meta content="text/html; charset=UTF-8"><title>VictoryStore.com: E-mail a Friend</title>');
	newWindow.document.write('<script language="javascript" src="http://www.victorystore.com/boosters/send2friend/send2friendjs.js" type="text/javascript"></script>');
	newWindow.document.write('</head><body background="http://www.victorystore.com/boosters/send2friend/'+ school +'/email-friend.jpg">');
	newWindow.document.write('<br /><br /><br /><br /><br /><br /><br />');
	newWindow.document.write('<form action="http://www.victorystore.com/send2friend.php?url='+ url + '" method="post" onsubmit="return validate_form(this)">');
	newWindow.document.write('<table border="0" cellpadding="0" cellspacing="0" width="400">');
	newWindow.document.write('<tr height="48">');
	newWindow.document.write('<td width="15">&nbsp;</td>');
	newWindow.document.write('<td width="185" colspan="2"><h2>Send this page to a friend</h2></td>');
	newWindow.document.write('<td width="15">&nbsp;</td>');
	newWindow.document.write('</tr>');
	newWindow.document.write('<tr height="38">');
	newWindow.document.write('<td>&nbsp;</td>');
	newWindow.document.write('<td colspan="2"><a href="' + url + '" target="_blank">' + title + '</a></td>');
	newWindow.document.write('<td>&nbsp;</td>');
	newWindow.document.write('</tr>');
	newWindow.document.write('<tr height="35">');
	newWindow.document.write('<td>&nbsp;</td>');
	newWindow.document.write('<td><b>Your E-mail Address:</b></td>');
	newWindow.document.write('<td><input type="text" name="sender" id="sender" maxlength="50" size="30"></td>');
	newWindow.document.write('<td>&nbsp;</td>');
	newWindow.document.write('</tr>');
	newWindow.document.write('<tr height="35">');
	newWindow.document.write('<td>&nbsp;</td>');
	newWindow.document.write('<td><b>Your Friend\'s E-mail:</b></td>');
	newWindow.document.write('<td><input type="text" name="friend" id="friend" maxlength="50" size="30"></td>');
	newWindow.document.write('<td>&nbsp;</td>');
	newWindow.document.write('</tr>');
	newWindow.document.write('<tr height="35">');
	newWindow.document.write('<td>&nbsp;</td>');
	newWindow.document.write('<td><b>Additional Notes:</b></td>');
	newWindow.document.write('<td><input type="text" name="note" id="note" maxlength="1000" size="30"></td>');
	newWindow.document.write('<td>&nbsp;</td>');
	newWindow.document.write('</tr>');
	newWindow.document.write('<tr height="60">');
	newWindow.document.write('<td>&nbsp;</td>');
	if (school == 'rockridge'){
	var mycolor = '#660000';
	} else if (school == 'davenport_central') {
	var mycolor = '#1c3f93';
	}
	newWindow.document.write('<td colspan="2"><input type="submit" value="Send this page to a friend" style="background-color: '+ mycolor +'; color: #ffffff;"></td>');
	newWindow.document.write('<td width="25">&nbsp;</td>');
	newWindow.document.write('</tr>');
	newWindow.document.write('</table>');
	newWindow.document.write('</form>');
	newWindow.document.write('<div style="position: absolute; bottom: 26px; right: 20px; "><a href="javascript:self.close()"><img src="http://www.victorystore.com/boosters/send2friend/'+ school +'/close.jpg" border="0" alt="close window"></a></div>');
	newWindow.document.write('<div id="alert" name="alert" style="position: absolute; top: 420px; left: 93px; "></div>');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

