// JavaScript Document
function SubmitIt(num)  {
	var c = "colorcheck" + num;
	var s = "sizecheck" + num;
	var bc = "colors" + num;
	var bs = "sizes" + num;
	var buy = "buynow" + num;
	var check = "buycheck" + num;
	var size = document.getElementById(bs).value;
	var colors = document.getElementById(bc).value;
		if((colors == "") || (size == "")){
			if(size == ""){
				alert("Please select a size.");
				return false;
			}
			if(colors == ""){
				alert("Please select a color.");
				return false;
			}
		}
		else {
			document.getElementById(check).style.visibility = "visible";
			document.forms[buy].submit();
		}
		
	}
function launch_privacy(){
newwin = window.open("http://www.rallysportsonline.com/privacy.htm","privacy","height=400,width=500,top=50,left=250,scrollbars=1,resizable=0")

}
function enlargePopup(title, image, description){
	rallyWin = window.open("about:blank","_blank","width=500,height=700,scrollbars=no");
	rallyWin.document.write('<table width=100% border="0"><tr><td align="center"><img src="'+ image +'"></td></tr><tr><td><font color="red" face="Impact, Courier, monospace">'+ title + '</font><br><font size="2" face="Kristen ITC, Courier, monospace">' + description +'<font></td></tr><tr><td><a href="javascript:window.close();"><font color="#CCCCFF" face="Impact, Courier, monospace"><br><br><br>Close Window</font></a></td></tr></table>');
	rallyWin.document.write('<br><br><script type="text/javascript"> google_ad_client = "pub-5168772872394484";  /* smallBanner */  google_ad_slot = "6368775077"; google_ad_width = 468; google_ad_height = 60; </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>');
	rallyWin.document.close();
}
function enlarger(num){
 var e = "enlarge" + num;
 document.getElementById(e).style.visibility = "visible";
}
function enlargerOut(num){
 var e = "enlarge" + num;
 document.getElementById(e).style.visibility = "hidden";
}
function upShirt(shrt){
	//document.getElementById("rally").style.visibility = "hidden";
	document.getElementById(shrt).style.top = "36px";
	
}
function downShirt(shrt){
	//document.getElementById("rally").style.visibility = "visible";
	if (shrt != "x"){
		document.getElementById(shrt).style.top = "60px";
	}
}
function upShirt2(shrt, t){
	//document.getElementById("rally").style.visibility = "hidden";
	var pos = t + "px";
	document.getElementById(shrt).style.top = pos;
	
}
function downShirt2(shrt, t){
	//document.getElementById("rally").style.visibility = "visible";
	var pos = t + "px";
	if (shrt != "x"){
		document.getElementById(shrt).style.top = pos;
	}
}
function outofstock(num){
 var e = "stock" + num;
 document.getElementById(e).style.visibility = "visible";
}
function checks(num)  {
		var c = "colorcheck" + num;
		var s = "sizecheck" + num;
		var bc = "colors" + num;
		var bs = "sizes" + num;
		
		if(document.getElementById(bc).value == ""){
		 	document.getElementById(c).style.visibility = "hidden";
		}
		else{
			document.getElementById(c).style.visibility = "visible";
		}
		if(document.getElementById(bs).value == ""){
		 	document.getElementById(s).style.visibility = "hidden";
		}
		else{
			document.getElementById(s).style.visibility = "visible";
		}
}
function validate_required(field,alerttxt)
{
	with (field)
	{
		if (value==null||value=="")
		  {alert(alerttxt);return false}
		else {return true}
	}
}

function validate_email(field,alerttxt)
{

		with (field)
		{
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
			if (apos<1||dotpos-apos<2) 
			  {alert(alerttxt);return false}
			
			else {return true}
			}
}

function validate_form(thisform)
{
	with (thisform)
	{
		if (validate_required(Name,"Please enter a name.")==false)
		  {Name.focus();return false}
		else if (validate_required(Email,"Email must be filled out!")==false)
		  {Email.focus();return false}
		else if (validate_email(Email,"Not a valid e-mail address!")==false)
  		  {Email.focus();return false}
		else if (validate_required(capt,"Please enter the code that you see in the image!")==false)
  		  {capt.focus();return false}

		return true
		
	}
}