function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
  {
  document.getElementById('alert').innerHTML='<B><font color="white" size="3">' + alerttxt + '</font></B>';
  return false
  }
else {return true}
}
}

function validate_form(thisform)
{
with (thisform)
{
if (validate_required(yourname,"Name must be filled out!")==false)
  {
  document.getElementById('yourname').style.backgroundColor="FAF8CC";
  yourname.focus();
  return false
  }
if (validate_required(sender,"Sender Email must be filled out!")==false)
  {
	document.getElementById('sender').style.backgroundColor="FAF8CC";
	sender.focus();
	return false
  }
if (validate_required(note,"Errors on page must be filled out!")==false)
  {
  document.getElementById('note').style.backgroundColor="FAF8CC";
  note.focus();
  return false
  }
}
}

function reperrors(url, title) {

	var newWindow=window.open("",'','height=500,width=400');
	var urltest = url.toLowerCase();
	var matchPos2 = 0;
	var matchPos = urltest.search("sitepage=productchooser");
	if (matchPos < 0)
	{
		var matchPos2 = urltest.search("sitepage=proof");
	}

if( (matchPos + matchPos2) < 0) {
	newWindow.document.write('<html><head><meta content="text/html; charset=UTF-8"><title>Victoryteamspirit.com: Report errors on this page</title>');
	newWindow.document.write('<link href="http://www.victoryteamspirit.com/teamstyle2.css" rel="stylesheet" type="text/css">');
	newWindow.document.write('<script language="javascript" src="http://www.victoryteamspirit.com/reperrors.js" type="text/javascript"></script>');
	newWindow.document.write('</head><body background="http://www.victoryteamspirit.com/images/reperrors.gif">');
	newWindow.document.write('<br /><br /><br />');
	newWindow.document.write('<form action="http://www.victoryteamspirit.com/forms/reperrors.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="20">');
	newWindow.document.write('<td width="15">&nbsp;</td>');
	newWindow.document.write('<td width="185" colspan="2"><h4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Report errors on this page</h4></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"><b><a href="' + url + '" target="_blank">' + title + '</a></b></td>');
	newWindow.document.write('<td>&nbsp;</td>');
	newWindow.document.write('<tr height="60">');
	newWindow.document.write('<td>&nbsp;</td>');
	newWindow.document.write('<td><b>Your Name:</b></td>');
	newWindow.document.write('<td><input type="text" name="yourname" id="yourname" maxlength="50" size="30"></td>');
	newWindow.document.write('<td>&nbsp;</td>');
	newWindow.document.write('</tr>');
	newWindow.document.write('<tr height="60">');
	newWindow.document.write('<td><input type="hidden" name="fullurl" value="' + url + '">&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="60">');
	newWindow.document.write('<td>&nbsp;</td>');
	newWindow.document.write('<td><b>Phone Number:</b></td>');
	newWindow.document.write('<td><input type="text" name="phone number" id="note" maxlength="50" 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>');
	newWindow.document.write('<td><b>Errors on Page:</b></td>');
	newWindow.document.write('<td><textarea name="note" id="note" cols=25 rows=5></textarea></td>');
	newWindow.document.write('<td>&nbsp;</td>');
	newWindow.document.write('</tr>');
	newWindow.document.write('<tr height="60">');
	newWindow.document.write('<td>&nbsp;</td>');
	newWindow.document.write('<td colspan="2"><input type="submit" value="Report Errors" style="background-color: #f89828; color: black;"></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.victoryteamspirit.com/images/close.gif" border="0" alt="close window"></a></div>');
	newWindow.document.write('<div id="alert" name="alert" style="position: absolute; top: 450px; left: 80px; "></div>');
	newWindow.document.write('</body></html>');
	}
else
	{
		newWindow.document.write('<html><head><meta content="text/html; charset=UTF-8"><title>Victoryteamspirit.com: E-mail a Friend</title>');
		newWindow.document.write('<script language="javascript" src="http://www.victoryteamspirit.com/forms/reperrors.js" type="text/javascript"></script>');
		newWindow.document.write('</head><body background="http://www.victoryteamspirit.com/images/reperros.gif">');
		newWindow.document.write('<br /><br /><br /><br /><br />');
		newWindow.document.write("<p style='padding-left:20px;padding-right:20px;'>We are sorry!  You are not able to send this page to your friend!</p>");
		if (matchPos > 0 )
		{
			newWindow.document.write("<p style='padding-left:20px;padding-right:20px;'>If you would like to send one of the designs to your friend, click on the design below and from the editor, click on the Email To Friend option.</p>");
		}
		if (matchPos2 > 0 )
		{
			newWindow.document.write("<p style='padding-left:20px;padding-right:20px;'>If you would like to send this design to your friend, go back one page to the editor and from there, click on the Email To Friend option.</p>");
		}
		newWindow.document.write("<p style='padding-left:20px;padding-right:20px;'>Again, we are sorry!  Thank you for using our system!</p>");
		newWindow.document.write('<div style="position: absolute; bottom: 26px; right: 20px; "><a href="javascript:self.close()"><img src="http://www.victorystore.com/send2friend/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();
}


