function validate_form () {
   
   	// validate
    if ( document.registerForm.first_name.value == "" ) {
        alert ( "Please enter your first name." );
		document.registerForm.first_name.focus();
        return false;
    }
	
	// validate
	if ( document.registerForm.last_name.value == "" ) {
        alert ( "Please enter your last name." );
		document.registerForm.last_name.focus();
        return false;
    }
	
	// validate
	if ( document.registerForm.email.value == "" ) {
        alert ( "Please enter your email." );
		document.registerForm.email.focus();
        return false;
    }
	// validate
	if ( document.registerForm.address.value == "" ) {
        alert ( "Please enter your address." );
		document.registerForm.address.focus();
        return false;
    }
	// validate
	if ( document.registerForm.city.value == "" ) {
        alert ( "Please enter your city." );
		document.registerForm.city.focus();
        return false;
    }
	// validate
	if ( document.registerForm.zip.value == "" ) {
        alert ( "Please enter your zip." );
		document.registerForm.zip.focus();
        return false;
    }
	
		
	// check to see if they selected a source 
	if (document.registerForm.state.selectedIndex == 0) {
		alert("Please select a state.");
		document.registerForm.state.focus();
		return false;
	}
	
				
	
	if (true) {
		var toSubmit = confirm("do you really want to submit?");
	}
	
	return toSubmit;
	
	
}	

function setWinner(clickedObjId,row)
{
	
	document.getElementById('row'+row).innerHTML = '<div align="center"><img src="team_logos/' + clickedObjId + '.gif" width="80" height="80" /></div>';
	document.getElementById('winner'+row).value = clickedObjId;

}

function preloader () {

	imageObj = new Image();
	
	for(var i=0; i<=31; i++) 
	{
		imageObj.src = 'team_logos/' + i + '.gif';
	}

}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


	
function checkMyForm () {
	
	// validate
	if ( document.picks.OT26.value == "" ) {
        alert ( "Please enter your Rose Bowl overtime wager." );
		document.picks.OT26.focus();
        return false;
    }
	// validate
	if ( document.picks.OT27.value == "" ) {
        alert ( "Please enter your Sugar Bowl overtime wager." );
		document.picks.OT27.focus();
        return false;
    }
	// validate
	if ( document.picks.OT28.value == "" ) {
        alert ( "Please enter your Fiesta Bowl overtime wager." );
		document.picks.OT28.focus();
        return false;
    }
	// validate
	if ( document.picks.OT29.value == "" ) {
        alert ( "Please enter your Orange Bowl overtime wager." );
		document.picks.OT29.focus();
        return false;
    }
	// validate
	if ( document.picks.OT32.value == "" ) {
        alert ( "Please enter your BCS Championship overtime wager." );
		document.picks.OT32.focus();
        return false;
    }
	
	
	//loop through each hidden field
	for (var i=1; i<=32; i++) {
			
		// validate
		if ( document.getElementById('winner' + i).value == "") {
			
			alert("You didn't make picks for every game. Please double check.");
			return false;
					
		}
	
	}
	
	// validate
	if ( document.picks.tiebreaker.value == "" ) {
        alert ( "Please enter the tiebreaker." );
		document.picks.tiebreaker.focus();
        return false;
    }
		
	// check to see if they selected a all their fourth and longs 
	if (document.picks.F1.selectedIndex == 0 || document.picks.F2.selectedIndex == 0 || document.picks.F3.selectedIndex == 0 || document.picks.F4.selectedIndex == 0 ) {
		alert("Please select all your fourth 'n shorts.");
		document.picks.F1.focus();
		return false;
	}
			
	if (true) {
		var toSubmit = confirm("Do you really want to submit?");
	}
	
	return toSubmit;


}

function editCheck () {
	
	//loop through each hidden field
	for (var i=1; i<=32; i++) {
			
		// validate
		if ( document.getElementById('winner' + i).value == "") {
			
			alert("You didn't make picks for every game. Please double check.");
			return false;
					
		}
	
	}
	
		
	// validate
	if ( document.picks.OT26.value == "" ) {
        alert ( "Please enter your overtime wager." );
		document.picks.OT26.focus();
        return false;
    }
	// validate
	if ( document.picks.OT27.value == "" ) {
        alert ( "Please enter your overtime wager." );
		document.picks.OT27.focus();
        return false;
    }
	// validate
	if ( document.picks.OT28.value == "" ) {
        alert ( "Please enter your overtime wager." );
		document.picks.OT28.focus();
        return false;
    }
	// validate
	if ( document.picks.OT29.value == "" ) {
        alert ( "Please enter your overtime wager." );
		document.picks.OT29.focus();
        return false;
    }
	// validate
	if ( document.picks.OT32.value == "" ) {
        alert ( "Please enter your overtime wager." );
		document.picks.OT32.focus();
        return false;
    }
		
	


}

var arrOptionBoxes = new Array("F1","F2","F3","F4");


function fnCheckOptions(f)
{
	var arrAlert = {};	
	for (i=0;i<arrOptionBoxes.length;i++)
	{
		objBox = eval("f."+arrOptionBoxes[i]);
		if (box = fnInArray(arrAlert,objBox.selectedIndex))
		{
			alert ("You have 2 or more 4th 'n shorts that are the same.");
			return false;
		}
		else 
		{
			arrAlert[arrOptionBoxes[i]] = objBox.selectedIndex;
		}
			
	}
}

function fnInArray(arrAlert,intSelected)
{
	for (strKey in arrAlert)
	{
		if (arrAlert[strKey] == intSelected)
		{
			return strKey;
		}
	}
	return false;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function clearField(obj) {
	if (obj.defaultValue==obj.value) obj.value = '';
}