function checkTeam(confInfo)  {
	if (document.addteam.owner.value=="")  {
		alert("Please enter an owner's name!");
		return false;
	}
	if (document.addteam.team.value=="")  {
		alert("Please enter a team name!");
		return false;
	}
	if (document.addteam.email.value=="")  {
		alert("Please enter an email address!");
		return false;
	}
	if (!checkEmail(document.addteam.email.value))  {
		alert("Please enter a valid email address!");
		return false;
	}
	if (document.addteam.password.value=="")  {
		alert("Please enter a password!");
		return false;
	}
	if (document.addteam.screenname.value=="")  {
		alert("Please enter a screen name!");
		return false;
	}
	if (document.addteam.tradeInitials.value=="")  {
		alert("Please enter trade initials!");
		return false;
	}
	var conf=confInfo.split(",");
	if (document.addteam.conference.options[document.addteam.conference.selectedIndex].value == conf[0])  {
		if (conf[1] == 6)  {
			alert("Sorry, there's already 6 teams in this conference!");
			return false;
		}
	} else {
		if (conf[3] == 6)  {
			alert("Sorry, there's already 6 teams in this conference!");
			return false;
		}
	}
	return true;
}

function checkEmail(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
		return false;
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		  return false;
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false;
	}
	if (str.indexOf(at,(lat+1))!=-1){
		return false;
	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false;
	}
	if (str.indexOf(dot,(lat+2))==-1){
		return false;
	}
	if (str.indexOf(" ")!=-1){
		return false;
	}
	return true;
}

function checkOwnerInfo()  {
	if (document.ownerinfo.owner.value=="")  {
		alert("Please enter your name!");
		return false;
	}
	if (document.ownerinfo.screenName.value=="")  {
		alert("Please enter your screen name!");
		return false;
	}
	if (!isNumeric(document.ownerinfo.homePhone.value))  {
		alert("Please enter a valid phone number!");
		return false;
	}
	if (!isNumeric(document.ownerinfo.mobilePhone.value))  {
		alert("Please enter a valid phone number!");
		return false;
	}
	if (document.ownerinfo.emailAddress.value=="")  {
		alert("Please enter an email address!");
		return false;
	}
	if (!checkEmail(document.ownerinfo.emailAddress.value))  {
		alert("Please enter a valid email address!");
		return false;
	}
	if (document.ownerinfo.newpassword.value != "")  {
		if (document.ownerinfo.repeatpassword.value=="")  {
			alert("Please enter passwords correctly!");
			return false;
		}
		if (document.ownerinfo.newpassword.value != document.ownerinfo.repeatpassword.value)  {
			alert("Sorry but new passwords don't match!");
			return false;
		}
	}
	if (document.ownerinfo.loadimage.value == "yes")  {
		if (document.ownerinfo.newdefaultImage.value != "")  {
			alert("Please select a new image file name!");
			return false;
		}
	}
    document.getElementById("submitbutton").disabled=true;
	return true;
}


function checkTheImageExists()  {
	if (document.ownerinfo.newdefaultImage.value != "")  {
		<!-- check whether the image already exists on the server -->
		checkImageExists(document.ownerinfo.newdefaultImage.value);
	} else {
		document.ownerinfo.loadimage.value="no";
	}
}

function checkThePhotoExists()  {
	if (document.photoinfo.newPhoto.value != "")  {
		<!-- check whether the image already exists on the server -->
		checkImageExists(document.photoinfo.newPhoto.value);
	} else {
		document.photoinfo.loadimage.value="no";
	}
}

function checkThePhotoThumbnailExists()  {
	if (document.photoinfo.newPhotoThumb.value != "")  {
		<!-- check whether the image already exists on the server -->
		checkImageExists(document.photoinfo.newPhotoThumb.value);
	} else {
		document.photoinfo.loadimage.value="no";
	}
}

function checkFAForm(styles)  {
	if (document.freagencyform.freeagency.value.length == 0)  {
		alert("Please enter your request!");
		return false;
	}
	return true;
}

function checkAnnouncement(styles)  {
	if (styles=="oldannouncement")  {
		if (document.oldannouncement.announcement.value.length == 0)  {
			alert("Please enter some text!");
			return false;
		}
	} else {
		if (document.newannouncement.announcement.value.length == 0)  {
			alert("Please enter some text!");
			return false;
		}
	}
	return true;
}

function checkPhoneNumber(which)  {
	if (which == "home")  {
		if (!isNumeric(document.ownerinfo.homePhone.value))  {
			alert("Please enter a valid phone number!");
			document.ownerinfo.homePhone.value = "";
		}
	}
	if (which == "mobile")  {
		if (!isNumeric(document.ownerinfo.mobilePhone.value))  {
			alert("Please enter a valid phone number!");
			document.ownerinfo.mobilePhone.value = "";
		}
	}
}

function isNumeric(string)  {
   var ValidChars = "-0123456789";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < string.length && IsNumber == true; i++)    { 
      Char = string.charAt(i); 
      if (ValidChars.indexOf(Char) == -1)   {
         IsNumber = false;
      }
   }
   return IsNumber;
}

function checkNflPlayer()  {
	if (document.nflplayer.playerName.value=="")  {
		alert("Please enter a name!");
		return false;
	}
	return true;
}

function checkAlterPlayer()  {
	var counter=0;
	if (document.alterplayer.q.options[document.alterplayer.q.selectedIndex].value=="q")  {
		counter++;
	}
	if (document.alterplayer.r.options[document.alterplayer.r.selectedIndex].value=="r")  {
		counter++;
	}
	if (document.alterplayer.w.options[document.alterplayer.w.selectedIndex].value=="w")  {
		counter++;
	}
	if (document.alterplayer.t.options[document.alterplayer.t.selectedIndex].value=="t")  {
		counter++;
	}
	if (document.alterplayer.k.options[document.alterplayer.k.selectedIndex].value=="k")  {
		counter++;
	}
	if (document.alterplayer.d.options[document.alterplayer.d.selectedIndex].value=="d")  {
		counter++;
	}
	if (counter == 6)  {
		alert("Please select a player!");
		return false;
	}
	if (counter != 5)  {
		alert("Please only select 1 player!");
		return false;
	}
	return true;
}

function goBack(url)  {
  this.location.href=url;
}

function checkEmailForm()  {
	if (document.sendemail.emailtext.value.length==0)  {
		alert("Please enter some text!");
		return false;
	}
	return true;
}

function getNewPlayers()  {
	var theOutput="";
	for (var x=0;x<document.addroster.players.length;x++)  {
		if (document.addroster.players.options[x].selected)  {
			theOutput = theOutput+document.addroster.players.options[x].value+";";
		}
	}
	document.addroster.playerlist.value=theOutput;
}

function checkAddRoster()  {
	if (document.addroster.playerlist.value=="" || document.addroster.playerlist.value==";")  {
		if (document.addroster.action.value=="add")  {
			var theText=" add to roster!";
		} else {
			var theText=" remove from roster!";
		}
		alert("Please selects player(s) to"+theText);
		return false;
	}
	var count=0;
	for (var x=0;x<document.addroster.teamID.length;x++)  {
		if (document.addroster.teamID.options[x].selected)  {
			count++;
		}
	}
	if (count == 0)  {
		alert("Please select a FFL team!");
		return false;
	}
	return true;
}


function checkMoveIR()  {
	if (document.moveir.teamID.options[document.moveir.teamID.selectedIndex].value == "x")  {
		alert("Please select a team!");
		return false;
	}
	var count=0;
	for (var x=0;x<document.moveir.players.length;x++)  {
		if (document.moveir.players.options[x].selected)  {
			count++;
		}
	}
	if (count == 0)  {
		alert("Please select a player!");
		return false;
	}
	return true;
}

function checkMoveDev()  {
	if (document.movedev.teamID.options[document.movedev.teamID.selectedIndex].value == "x")  {
		alert("Please select a team!");
		return false;
	}
	var count=0;
	for (var x=0;x<document.movedev.players.length;x++)  {
		if (document.movedev.players.options[x].selected)  {
			count++;
		}
	}
	if (count == 0)  {
		alert("Please select a player!");
		return false;
	}
	return true;
}


function resetRemoveRoster()  {
	var selectList = document.getElementById("playerRoster");
	while(selectList.lastChild){
    	selectList.removeChild(selectList.lastChild);
	}
}


function checkPassword()  {
	if (document.passwordform.new1.value == "" && document.passwordform.new2.value == "")  {
		alert("Please enter new passwords!");
		return false;
	}
	if (document.passwordform.new1.value != document.passwordform.new2.value)  {
		alert("Please make sure the passwords match!");
		return false;
	}
	var response = confirm("Do you really want to change this password?");
	if (response)  {
		return true;
	} else {
		return false;
	}
}


function checkSendMessage()  {
	if (document.messageform.messagetext.value.length == 0)  {
		alert("Please enter a message!");
		return false;
	}
	var response = confirm("Confirm to send the message");
	if (response)  {
		return true;
	} else {
		return false;
	}
}


function updateList()  {
	var theOutput="";
	for (var x=0;x<document.protectform.playerList.length;x++)  {
		if (!document.protectform.playerList.options[x].selected)  {
			theOutput = theOutput+document.protectform.playerList.options[x].value+";";
		}
	}
	document.protectform.players.value=theOutput;
}


function newUpdateList()  {
	var theOutput="";
	for (var x=0;x<document.protectform.playerList.length;x++)  {
		if (document.protectform.playerList.options[x].selected)  {
			theOutput = theOutput+document.protectform.playerList.options[x].value+";";
		}
	}
	document.protectform.players.value=theOutput;
}


function updateCullList()  {
	var theOutput="";
	for (var x=0;x<document.cullform.playerList.length;x++)  {
		if (document.cullform.playerList.options[x].selected)  {
			theOutput = theOutput+document.cullform.playerList.options[x].value+";";
		}
	}
	document.cullform.players.value=theOutput;
}


function checkProtectedFive()  {
	var counter=0;
	for (var x=0;x<document.protectform.playerList.length;x++)  {
		if (document.protectform.playerList.options[x].selected)  {
			counter++;
		}
	}
	if (counter != 5)  {
		alert("Please select 5 players!");
		return false;
	}
	return true;
}

function checkCullList()  {
	var counter=0;
	for (var x=0;x<document.cullform.playerList.length;x++)  {
		if (document.cullform.playerList.options[x].selected)  {
			counter++;
		}
	}
	if (counter == 0)  {
		alert("Please select atleast 1 player!");
		return false;
	}
	return true;
}

function addNewPhotoFolder()  {
	if (document.photoFolder.folderName.value == "")  {
		alert("Please enter a folder name!");
		return false;
	}
	var length=eval(document.getElementById("photoFolders").options.length+1);
	var value="x:"+document.photoFolder.folderName.value+":"+length+":0";
	var display=document.photoFolder.folderName.value+" (0)";
	document.getElementById("photoFolders").options[document.getElementById("photoFolders").options.length] = new Option(display,value);
	document.photoFolder.folderName.value="";
	document.photoFolder.folderList.value=document.photoFolder.folderList.value+value+";";
	return false;
}


function displayPhotoFolderInfo()  {
	var theLine=document.getElementById("photoFolders").options[document.getElementById("photoFolders").options.selectedIndex].value;
	var theBits= theLine.split(":");
	document.photoFolder.folderPosition.value=theBits[2];
	document.photoFolder.folderName.value=theBits[1];
	return false;
}


function updatePhotoFolderName()  {
	if (document.photoFolder.folderName.value == "")  {
		alert("Please enter a folder name!");
		return false;
	}
	var thisBox=document.photoFolder.photoFolders
	currentSelected = thisBox.selectedIndex;
	var position=document.getElementById("photoFolders").options[document.getElementById("photoFolders").options.selectedIndex].value;
	var theBits=position.split(":");
	<!--document.getElementById("photoFolders").options[(theBits[2]-1)]=null;
	var value=theBits[0]+":"+document.photoFolder.folderName.value+":"+theBits[2]+":"+theBits[3];
	var display=document.photoFolder.folderName.value+" ("+theBits[3]+")";
	document.getElementById("photoFolders").options[currentSelected] = new Option(display,value);
	document.photoFolder.folderPosition.value="";
	document.photoFolder.folderName.value="";
	updatePhotoFolderList();
	return false;
}


function updatePhotoFolderList()  {
	<!-- cycle through select and build up new list -->
	var string="";
	for (var x=0;x<document.photoFolder.photoFolders.length;x++)  {
		string = string + document.getElementById("photoFolders").options[x].value+";";

	}
	document.photoFolder.folderList.value=string;
}


function movePhotoFolder(direction)  {
	var thisBox=document.photoFolder.photoFolders
	currentSelected = thisBox.selectedIndex;
	totalItems = thisBox.length;
	if (currentSelected == -1) {
		alert("Please select a folder to move!");
		return false;
	} else {
		if ((direction=="up" && currentSelected == 0) || (direction=="down" && currentSelected == totalItems-1)) {
		} else {
			if (direction=="up") {
				changeWith = currentSelected - 1;
			}
			if (direction=="down") {
				changeWith = currentSelected + 1;
			}
			optionValue = thisBox.options[changeWith].value;
			optionText = thisBox.options[changeWith].text;
			thisBox.options[changeWith].value = thisBox.options[currentSelected].value;
			thisBox.options[changeWith].text = thisBox.options[currentSelected].text;
			thisBox.options[currentSelected].value = optionValue;
			thisBox.options[currentSelected].text = optionText;
			thisBox.selectedIndex = changeWith;
			updatePhotoFolderList();
		}
	}
}


function deletePhotoFolder()  {
	var thisBox=document.photoFolder.photoFolders
	theSelected = thisBox.selectedIndex;
	if (theSelected == -1) {
		alert("Please select a folder to delete!");
		return false;
	} else {
		theID = thisBox.options[theSelected].value;
		thisBox.options[theSelected] = null;
		document.photoFolder.folderDeleteList.value = document.photoFolder.folderDeleteList.value + theID+";";
		updatePhotoFolderList();
	}
	document.photoFolder.folderName.value="";
	return false;
}

function clearPhotoFolderName()  {
	document.photoFolder.folderName.value="";
	document.photoFolder.photoFolders.selectedIndex = -1;
}


function deleteImageBox()  {
	document.ownerinfo.newdefaultImage.value="";
	return false;
}


function noHideSubmit()  {
	document.forms['ownerinfo'].reset();
	document.getElementById("submitbutton").disabled=false;
}


function noHideScheduleSubmit()  {
	document.forms['scheduleupload'].reset();
	document.scheduleupload.submitbutton.disabled=false;
}


function checkPhotoAdd()  {
	if (document.photoinfo.loadimage.value == "yes")  {
		alert("Please select another image name!");
		return false;
	}
	if (document.photoinfo.newPhoto.value == "")  {
		alert("Please select a photo!");
		return false;
	}
	if (document.photoinfo.newPhotoThumb.value == "")  {
		alert("Please select a photo thumbnail!");
		return false;
	}
	if (document.photoinfo.newPhoto.value == document.photoinfo.newPhotoThumb.value)  {
		alert("Photo and thumbnail cannot have the same names!");
		return false;
	}
	if (document.photoinfo.caption.text.length > 150)  {
		alert("Caption is too long!");
		return false;
	}
    document.photoinfo.submitbutton.disabled=true;
	return true;
}


function getCharLeft()  {
	var maxLength=150;
	var minLength=0;
    var theMessage = document.photoinfo.caption.value;
    var messageSize = maxLength - theMessage.length;
    var leftSize =  document.photoinfo.charLeft.value;
    if  (messageSize != leftSize)  {
		document.photoinfo.charLeft.value = messageSize; 
    }
    if (messageSize < minLength)  {
		document.photoinfo.caption.value = theMessage.substring(0,maxLength);
		alert ("Maximum message length reached.");
		document.photoinfo.charLeft.value = minLength;
     }
}


function checkPhotoDelete()  {
	if (document.photoinfo.photodeleteList.value=="")  {
		alert("Please select photo(s) to delete!");
		return false;
	}
	return true;
}


function updatePhotoDeleteList()  {
	var theOutput="";
	for (var x=0;x<document.photoinfo.photoList.length;x++)  {
		if (document.photoinfo.photoList.options[x].selected)  {
			theOutput = theOutput+document.photoinfo.photoList.options[x].value+",";
		}
	}
	document.photoinfo.photodeleteList.value=theOutput;
}

function updatePhotoMoveList()  {
	var theOutput="";
	for (var x=0;x<document.photoinfo.photoList.length;x++)  {
		if (document.photoinfo.photoList.options[x].selected)  {
			theOutput = theOutput+document.photoinfo.photoList.options[x].value+",";
		}
	}
	document.photoinfo.photomoveList.value=theOutput;
}

function checkPhotoMove()  {
	if (document.photoinfo.photomoveList.value == "")  {
		alert("Please select photos to move!");
		return false;
	}
	if (document.photoinfo.photoFolderDestination.options[document.photoinfo.photoFolderDestination.selectedIndex].value == "x")  {
		alert("Please select a destination folder!");
		return false;
	}
	if (document.photoinfo.photoFolderDestination.options[document.photoinfo.photoFolderDestination.selectedIndex].value == document.photoinfo.photoFolder.options[document.photoinfo.photoFolder.selectedIndex].value)  {
		alert("Sorry but you've selected the same source and destination folders!");
		return false;
	}
	return true;
}


function checkPhotoAlter()  {
	if (document.photoinfo.photoalterList.value == "")  {
		alert("Please select photo to alter!");
		return false;
	}
	if (document.photoinfo.photoFolder.options[document.photoinfo.photoFolder.selectedIndex].value == "x")  {
		alert("Please select a photo folder!");
		return false;
	}
	if (document.photoinfo.caption.value.length > 150)  {
		alert("Caption is too long!");
		return false;
	}
	return true;
}


function checkLineupOK()  {
	var posArray=new Array("qb","rb1","rb2","rb3","wr1","wr2","wr3","te","k","d");
	for (x=0;x<posArray.length;x++)  {
		if (eval("document.picklineup."+posArray[x]+".options.length") == 0)  {
			alert("Please select a player!!");
			return false;
		}
		if (eval("document.picklineup."+posArray[x]+".options[document.picklineup."+posArray[x]+".selectedIndex].value") == "x")  {
			alert("Please select a player!");
			return false;
		}
	}
	return true;
}


function checkAdminLineupOK()  {
	var posArray=new Array("qb","rb1","rb2","rb3","wr1","wr2","wr3","te","k","d");
	var count=0;
	for (x=0;x<posArray.length;x++)  {
		if (eval("document.picklineup."+posArray[x]+".options.length") != 0)  {
			if (eval("document.picklineup."+posArray[x]+".options[document.picklineup."+posArray[x]+".selectedIndex].value") != "x")  {
				count++;
			}
		}
	}
	if (count == 0)  {
		alert("Please select atleast one player!");
		return false;
	}
	return true;
}




function checkLineupEmailOK()  {
	var theForm = document.picklineup;
	var count=0;
	if (theForm.qb.options[theForm.qb.selectedIndex].value == "x")  {
		count++;
	}
	if (theForm.rb1.options[theForm.rb1.selectedIndex].value == "x")  {
		count++;
	}
	if (theForm.wr1.options[theForm.wr1.selectedIndex].value == "x")  {
		count++;
	}
	if (theForm.te.options[theForm.te.selectedIndex].value == "x")  {
		count++;
	}
	if (theForm.k.options[theForm.k.selectedIndex].value == "x")  {
		count++;
	}
	if (theForm.d.options[theForm.d.selectedIndex].value == "x")  {
		count++;
	}
	if (count == 6)  {
		alert("Please select atleast 1 player!");
		return false;
	}
	return true;
}


function checkTradeForm()  {
	var theForm=document.tradeform;
	var otherFail=0;
	var myFail=0;
	var otherPlayer=0;
	var myPlayer=0;
	if (theForm.otherteam.options[theForm.otherteam.selectedIndex].value == "x")  {
		alert("Please select the opposing team!");
		return false;
	}
	if (theForm.gettingplayer1.options[theForm.gettingplayer1.selectedIndex].value == "x")  {
		otherFail++;
	} else {
		otherPlayer++;
	}
	if (theForm.gettingplayer2.options[theForm.gettingplayer2.selectedIndex].value == "x")  {
		otherFail++;
	} else {
		otherPlayer++;
		if (theForm.gettingplayer3.options[theForm.gettingplayer3.selectedIndex].value == "x")  {
		  otherFail++;
		} else {
		  otherPlayer++;
		}
	}
	if (otherFail > 1 && otherPlayer != 0)  {
		alert("Please select correct opposing options!");
		return false;
	}
	if (theForm.gettingdraft1year.options[theForm.gettingdraft1year.selectedIndex].value != "x")  {
		if (theForm.gettingdraft1round.options[theForm.gettingdraft1round.selectedIndex].value == "x")  {
		  alert("Please select a draft pick for year "+theForm.gettingdraft1year.options[theForm.gettingdraft1year.selectedIndex].value);
		  return false;
		}
	}
	if (theForm.gettingdraft2year.options[theForm.gettingdraft2year.selectedIndex].value != "x")  {
		if (theForm.gettingdraft2round.options[theForm.gettingdraft2round.selectedIndex].value == "x")  {
		  alert("Please select a draft pick for year "+theForm.gettingdraft2year.options[theForm.gettingdraft2year.selectedIndex].value);
		  return false;
		}
	}
	if (theForm.gettingdraft3year.options[theForm.gettingdraft3year.selectedIndex].value != "x")  {
		if (theForm.gettingdraft3round.options[theForm.gettingdraft3round.selectedIndex].value == "x")  {
		  alert("Please select a draft pick for year "+theForm.gettingdraft3year.options[theForm.gettingdraft3year.selectedIndex].value);
		  return false;
		}
	}
	
	if (theForm.giveupplayer1.options[theForm.giveupplayer1.selectedIndex].value == "x")  {
		myFail++;
	} else {
		myPlayer++;
	}
	if (theForm.giveupplayer2.options[theForm.giveupplayer2.selectedIndex].value == "x")  {
		myFail++;
	} else {
		myPlayer++;
		if (theForm.giveupplayer3.options[theForm.giveupplayer3.selectedIndex].value == "x")  {
		  myFail++;
		} else {
		  myPlayer++;
		}
	}
	if (myFail > 1 && myPlayer != 0)  {
		alert("Please select your correct options!");
		return false;
	}
	if (theForm.giveupdraft1year.options[theForm.giveupdraft1year.selectedIndex].value != "x")  {
		if (theForm.giveupdraft1round.options[theForm.giveupdraft1round.selectedIndex].value == "x")  {
		  alert("Please select a draft pick for year "+theForm.gettingdraft1year.options[theForm.giveupdraft1year.selectedIndex].value);
		  return false;
		}
	}
	if (theForm.giveupdraft2year.options[theForm.giveupdraft2year.selectedIndex].value != "x")  {
		if (theForm.giveupdraft2round.options[theForm.giveupdraft2round.selectedIndex].value == "x")  {
		  alert("Please select a draft pick for year "+theForm.gettingdraft2year.options[theForm.giveupdraft2year.selectedIndex].value);
		  return false;
		}
	}
	if (theForm.giveupdraft3year.options[theForm.giveupdraft3year.selectedIndex].value != "x")  {
		if (theForm.giveupdraft3round.options[theForm.giveupdraft3round.selectedIndex].value == "x")  {
		  alert("Please select a draft pick for year "+theForm.gettingdraft3year.options[theForm.giveupdraft3year.selectedIndex].value);
		  return false;
		}
	}
	/* if (myPlayer != otherPlayer)  {
		alert("Please select same number of players on each side");
		return false;
	} */
	return true;
}


function updateTrade(tradeID,page)  {
	this.location.href="sitetradeconditions.php?tradeID="+tradeID+"&p="+page;
}


function confirmTradeCondition()  {
	var result=confirm("Have you chosen the correct options from the selects?");
	if (result)  {
		return true;
	} else {
		return false;
	}
}


function checkConferenceNames(checkString)  {
	var theCheck=checkString.split(",");
	for (var x=0;x<theCheck.length;x++)  {
		theLine=eval("document.conferences."+theCheck[x]);
		if (theLine.value == "")  {
			alert("Please enter a conference name!");
			return false;
		}
	}
	return true;
}


function swapTeams()  {
	var team1=document.conferences.conf1.options[document.conferences.conf1.selectedIndex].value;
	var team2=document.conferences.conf2.options[document.conferences.conf2.selectedIndex].value;
	var string1="";
	var string2="";
	var t1IDArray=new Array();
	var t1NameArray=new Array();
	var t2IDArray=new Array();
	var t2NameArray=new Array();
	var temp=new Array();
	
	for (var x=0;x<document.conferences.conf1.length;x++)  {
		if (team1 != document.conferences.conf1.options[x].value)  {
			temp=document.conferences.conf1.options[x].value.split(":");
			string1=string1+temp[0]+",";
			t1NameArray[t1NameArray.length]=temp[1];
			t1IDArray[t1IDArray.length]=document.conferences.conf1.options[x].value;
			temp=new Array();
		} else {
			temp=document.conferences.conf1.options[x].value.split(":");
			string2=string2+temp[0]+",";
			t2NameArray[t2NameArray.length]=temp[1];
			t2IDArray[t2IDArray.length]=document.conferences.conf1.options[x].value;
			temp=new Array();
		}
	}
	for (x=0;x<document.conferences.conf2.length;x++)  {
		if (team2 != document.conferences.conf2.options[x].value)  {
			temp=document.conferences.conf2.options[x].value.split(":");
			string2=string2+temp[0]+",";
			t2NameArray[t2NameArray.length]=temp[1];
			t2IDArray[t2IDArray.length]=document.conferences.conf2.options[x].value;
			temp=new Array();
		} else {
			temp=document.conferences.conf2.options[x].value.split(":");
			string1=string1+temp[0]+",";
			t1NameArray[t1NameArray.length]=temp[1];
			t1IDArray[t1IDArray.length]=document.conferences.conf2.options[x].value;
			temp=new Array();
		}
	}
	
	document.conferences.conf1String.value=string1;
	document.conferences.conf2String.value=string2;
	
	while(document.conferences.conf1.lastChild){
    	document.conferences.conf1.removeChild(document.conferences.conf1.lastChild);
	}
	for (x=0;x<t1IDArray.length;x++)  {
		document.conferences.conf1.options[document.conferences.conf1.options.length] = new Option(t1NameArray[x],t1IDArray[x]);
	}

	while(document.conferences.conf2.lastChild){
    	document.conferences.conf2.removeChild(document.conferences.conf2.lastChild);
	}
	for (x=0;x<t2IDArray.length;x++)  {
		document.conferences.conf2.options[document.conferences.conf2.options.length] = new Option(t2NameArray[x],t2IDArray[x]);
	}

}


function checkDraftCreate()  {
	if (document.draftcreate.details.value.length==0)  {
		alert("Please enter some text!");
		return false;
	}
	return true;
}


function checkDraftDetails()  {
	if (document.draftlist.year.options.length == 0)  {
		alert("Please select a year!");
		return false;
	}
	return true;
}


function reloadDraftEdit()  {
	if (document.draftedit.year.options[document.draftedit.year.selectedIndex].value != "x")  {
		this.location.href="sitedraftedit.php?year="+document.draftedit.year.options[document.draftedit.year.selectedIndex].value;
	} else {
		this.location.href="sitedraftedit.php";
	}
}


function getDraftPosition()  {
	var pos=document.draftinfo.pos.options[document.draftinfo.pos.selectedIndex].value;
	var year=document.draftinfo.year.value;
	this.location.href="draftshow.php?year="+year+"&pos="+pos;
}


function getDraftNFLTeam()  {
	var nfl=document.draftinfo.nfl.options[document.draftinfo.nfl.selectedIndex].value;
	var year=document.draftinfo.year.value;
	this.location.href="draftshow.php?year="+year+"&nfl="+nfl;
}

function getDraftFFLTeam()  {
	var ffl=document.draftinfo.ffl.options[document.draftinfo.ffl.selectedIndex].value;
	var year=document.draftinfo.year.value;
	this.location.href="draftshow.php?year="+year+"&ffl="+ffl;
}

function getDraftDetails()  {
	var year=document.draftcreate.year.options[document.draftcreate.year.selectedIndex].value;
	if (year == "x")  {
		return false;
	}
	this.location.href="sitedraftedit.php?year="+year;
}

function checkRetireTeam()  {
	if (document.retireteam.team.options[document.retireteam.team.selectedIndex].value == "x")  {
		return false;
	}
	var check=confirm("Do you REALLY want to retire this team?");
	if (check)  {
		return true;
	} else {
		return false;
	}
}

function checkUnretireTeam(confInfo)  {
	if (document.unretireteam.owner.value=="")  {
		alert("Please enter an owner's name!");
		return false;
	}
	if (document.unretireteam.team.value=="")  {
		alert("Please enter a team name!");
		return false;
	}
	if (document.unretireteam.email.value=="")  {
		alert("Please enter an email address!");
		return false;
	}
	if (!checkEmail(document.unretireteam.email.value))  {
		alert("Please enter a valid email address!");
		return false;
	}
	if (document.unretireteam.password.value=="")  {
		alert("Please enter a password!");
		return false;
	}
	if (document.unretireteam.screenname.value=="")  {
		alert("Please enter a screen name!");
		return false;
	}
	var conf=confInfo.split(",");
	if (document.unretireteam.conference.options[document.unretireteam.conference.selectedIndex].value == conf[0])  {
		if (conf[1] == 6)  {
			alert("Sorry, there's already 6 teams in this conference!");
			return false;
		}
	} else {
		if (conf[3] == 6)  {
			alert("Sorry, there's already 6 teams in this conference!");
			return false;
		}
	}
	return true;
}


function checkSchedule()  {
	var taArray=new Array();
	var tbArray=new Array();
	var nArray=new Array();
	for (var x=0;x<6;x++)  {
		taArray[x]=eval("document.schedule.a"+x+".value");
		tbArray[x]=eval("document.schedule.b"+x+".value");
	}
	nArray = taArray.concat(tbArray);
	for (x=0;x<nArray.length;x++)  {
		for (y=0;y<nArray.length;y++)  {
			if (nArray[x] == nArray[y] && x != y)  {
				alert("You've selected the same team twice!");
				return false;
			}
		}
	}
	return true;
}


function checkInputStats()  {
	if (document.inputstats.player.options[document.inputstats.player.selectedIndex].value == "x")  {
		alert("Please select a player!");
		return false;
	}
	if (!isNumeric(document.inputstats.passyards.value))  {
		alert("Please enter a correct value for passing yards!");
		return false;
	}
	if (!isNumeric(document.inputstats.rushyards.value))  {
		alert("Please enter a correct value for rushing yards!");
		return false;
	}
	if (!isNumeric(document.inputstats.recyards.value))  {
		alert("Please enter a correct value for receiving yards!");
		return false;
	}
	return true;
}


function checkFreeAgencyOrder(size)  {
	var theDoc=document.freeagency;
	for (x=0;x<size;x++)  {
		for (y=1;y<size;y++)  {
			if (x != y)  {
				team1=eval("theDoc.team"+x+".options[theDoc.team"+x+".selectedIndex].value");
				team1ID=team1.split(":");
				team2=eval("theDoc.team"+y+".options[theDoc.team"+y+".selectedIndex].value");
				team2ID=team2.split(":");
				if (team1ID[1] == team2ID[1])  {
					alert("Sorry, you've picked the same team twice");
					return false;
				}
			}
		}
	}
	return true;
}


function showFreeAgencyOrder()  {
	window.open("showfreeagencyorder.php","fa",'height=350, width=250, scrollbars=no, resizeable=no, status=no');
}


function showTradeInitials(vis, options, info)  {
	window.open("showtradeinitials.php","fa",'height=350, width=300, scrollbars=no, resizeable=no, status=no');
}

function showTradeInitials_Fail(vis, options, info)  {
  // Pass true to gray out screen, false to ungray
  // options are optional.  This is a JSON object with the following (optional) properties
  // opacity:0-100         // Lower number = less grayout higher = more of a blackout 
  // zindex: #             // HTML elements with a higher zindex appear on top of the gray out
  // bgcolor: (#xxxxxx)    // Standard RGB Hex color code
  // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
  // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
  // in any order.  Pass only the properties you need to set.
  var options = options || {}; 
  var zindex = options.zindex || 50;
  var opacity = options.opacity || 75;
  var opaque = (opacity / 100);
  var bgcolor = options.bgcolor || '#000000';
  var dark=document.getElementById('darkenScreenObject');
  if (!dark) {
    // The dark layer doesn't exist, it's never been created.  So we'll
    // create it here and apply some basic styles.
    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.position='absolute';                 // Position absolutely
        tnode.style.top='0px';                           // In the top
        tnode.style.left='0px';                          // Left corner of the page		
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='darkenScreenObject';                   // Name it so we can find it later
		
	var msgnode = document.createElement('div');           // Create the box layer.
		msgnode.style.position='fixed';                 // Position fixed
        msgnode.style.display='none';                      // Start out Hidden
        msgnode.id='box';                   				// Name it so we can find it later
		// give it a size and align it to center
		msgnode.style.width = "250px";
		msgnode.style.height = "360px";
		msgnode.style.marginLeft= "-150px";      
		msgnode.style.marginTop= "-250px"; 
		msgnode.style.textAlign = 'center';
		msgnode.style.top= "50%";                           // In the top	
		msgnode.style.left="50%";                          // Left corner of the page	
	tbody.appendChild(msgnode);                            // Add it to the grey screen
    tbody.appendChild(tnode);                            // Add it to the web page
    dark=document.getElementById('darkenScreenObject');  // Get the object.
  }
  if (vis) {
    // Calculate the page width and height 
    if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
        var pageWidth = 50+document.body.scrollWidth+'px';
        var pageHeight = document.body.scrollHeight+'px';
    } else if( document.body.offsetWidth ) {
      var pageWidth = 50+document.body.offsetWidth+'px';
      var pageHeight = document.body.offsetHeight+'px';
    } else {
       var pageWidth='100%';
       var pageHeight='100%';
    }   
    //set the shader to cover the entire page and make it visible.
    dark.style.opacity=opaque;                      
    dark.style.MozOpacity=opaque;                   
    dark.style.filter='alpha(opacity='+opacity+')'; 
    dark.style.zIndex=zindex;        
    dark.style.backgroundColor=bgcolor;  
    dark.style.width= pageWidth;
    dark.style.height= pageHeight;
    dark.style.display='block';  

	document.getElementById("box").style.zIndex = zindex+10;
	document.getElementById("box").style.border = "#000 solid 1px";
	document.getElementById("box").style.display = "block";

	document.getElementById("box").onclick = function() //attach a event handler to hide both div
	{
		dark.style.display="none";
		document.getElementById("box").style.display = "none";
		document.body.style.overflow = 'auto';
		
	}
	document.getElementById("box").style.backgroundColor="#FFF";
	var theContents = "";
	theContents = theContents + "<table width='100%' border='0' cellpadding='2' cellspacing='2' height='100%'>";
	theContents = theContents + "<tr><td colspan='2' align='center'><span class='headLine'>Team Trade Initials</span></td></tr>";
	theContents = theContents + "<tr><td colspan='2'>&nbsp;</td></tr>";
	var theInfo = info.split(":");
	var count = 0;
	for (var x=0;x<theInfo.length;x++)  {
		if (theInfo[x] != "")  {
			if (count == 0)  {
				theContents = theContents + "<tr><td align='right'>"+ theInfo[x]+"</td>";
				count = 1;
			} else {
				theContents = theContents + "<td align='left'>... "+ theInfo[x]+"</td></tr>";
				count = 0;
			}
		}
	}
	theContents = theContents + "<tr><td colspan='2'>&nbsp;</td></tr>";
	theContents = theContents + "<tr><td colspan='2' align='center'>Click to close</td></tr>";
	theContents = theContents + "</table>";	
	
	document.getElementById("box").innerHTML = theContents;
  } else {
     dark.style.display='none';
  }
}


function checkCommentForm()  {
	var theDoc=document.ownercomments;
	if (theDoc.mvp.value.length==0)  {
		alert("Please enter a team MVP");
		return false;
	}
	if (theDoc.bestdraft.value.length==0)  {
		alert("Please enter a best draft pick");
		return false;
	}
	if (theDoc.worstdraft.value.length==0)  {
		alert("Please enter a worst draft pick");
		return false;
	}
	if (theDoc.bestmoment.value.length==0)  {
		alert("Please enter the season's best moment");
		return false;
	}
	if (theDoc.worstmoment.value.length==0)  {
		alert("Please enter the season's worst moment");
		return false;
	}
	if (theDoc.funniestmoment.value.length==0)  {
		alert("Please enter the season's funniest moment");
		return false;
	}
	return true;
}


function getSeasonInfo()  {
	var year=document.seasoninfo.pickyear.options[document.seasoninfo.pickyear.selectedIndex].value;
	if (year == "x")  {
		return false;
	}
	this.location.href="siteseasoninfo.php?year="+year;
}


function checkSeasonInfo()  {
	if (document.seasoninfo.year.value=="")  {
		return false;
	}
	if (document.seasoninfo.info.value.length == 0)  {
		alert("Please enter some text!");
		return false;
	}
}

function calculateScores(week)  {
	/*var week=document.inputstats.week.value;
	document.getElementById("calcScores").disabled=true;*/
	this.location.href="sitecalculatescoresstart.php?week="+week;
}

function checkInputScores()  {
	
	
}

function getPrintDraftList()  {
	var teamID=document.getElementById("team").options[document.getElementById("team").selectedIndex].value;
	if (teamID != "x")  {
		window.open("siteshowpredraftlist.php?id="+teamID,"list");
	}
}

function checkFeedbackForm()  {
	if (document.feedbackform.feedback.value.length == 0)  {
		alert("Please enter some text!");
		return false;
	}
	return true;
}


function checkRecalculate()  {
	if (confirm("Do you REALLY want to recalculate the scores?"))  {
		return true;
	} else {
		return false;
	}
}


function checkTradeInitials(ids)  {
	var IDs=ids.split(",");
	var theItem="";
	for (var x=0;x<IDs.length;x++)  {
		theItem=eval("document.initials.team"+IDs[x]+".value");
		if (theItem.length > 3 || theItem == "")  {
			alert("Please fill in all the fields correctly!");
			return false;
		}
	}
	for (x=0;x<IDs.length;x++)  {
		for (var y=0;y<IDs.length;y++)  {
			if (IDs[x] != IDs[y])  {
				theItem1=eval("document.initials.team"+IDs[x]+".value");
				theItem2=eval("document.initials.team"+IDs[y]+".value");
				if (theItem1 == theItem2)  {
					alert("Duplicate initials found!");
					return false;
				}
			}
		}
	}
	return true;
}


function checkDraftUpload()  {
	if (document.draftupload.draftfile.value == "")  {
		alert("Please select a file!");
		return false;
	}
	document.scheduleupload.submitbutton.disabled=true;
	return true;
}


function checkPreviewForm()  {
	if (document.previewform.preview.value.length == 0)  {
		alert("Please enter the preview text!");
		return false;
	} else {
		return true;
	}
}

function getMovieCharLeft()  {
	var size=document.movieform.description.value.length;
	if (size > 500)  {
		alert("Too many characters!");
		document.movieform.description.value = document.movieform.description.value.substring(0,500);
	} else {
		document.movieform.charLeft.value=eval(500-size);
	}
}


function checkMovieAdd()  {
	if (document.movieform.file.options[document.movieform.file.selectedIndex].value == "x")  {
		alert("Sorry but there are no file's to add!");
		return false;
	}
	if (document.movieform.title.value == "")  {
		alert("Please enter a title");
		return false;
	}
	if (document.movieform.description.value.length == 0)  {
		alert("Please enter a description");
		return false;
	}
	return true;
}


function updateByeWeekTeamList()  {
	<!-- cycle through select and build up new list -->
	var string="";
	for (var x=0;x<document.byeweek.teams.length;x++)  {
		if (document.getElementById("teams").options[x].selected)  {
			string = string + document.getElementById("teams").options[x].value+";";
		}
	}
	document.byeweek.teamsList.value=string;
}


function checkIndexPhoto()  {
	if (document.indexphoto.newphoto.value == "")  {
		alert("Please select a photo!");
		return false;
	}
	return true;
}


function checkNewStandings(number)  {
	var list=number.split(":");
	for (var x=0;x<list.length;x++)  {
		for (var y=0;y<list.length;y++)  {
			if (list[x] != list[y])  {
				var teamA=eval("document.changestandings."+list[x]+".options[document.changestandings."+list[x]+".selectedIndex].value");
				var teamB=eval("document.changestandings."+list[y]+".options[document.changestandings."+list[y]+".selectedIndex].value");
				if (teamA == teamB)  {
					alert("A team has been selected twice!");
					return false;
				}
			}
		}
	}
	return true;
}


function checkFAform()  {
	if (document.faform.info.value.length == 0)  {
		alert("Please enter some information!");
		return false;
	}
	return true;
}


function checkindexphoto()  {
	if (document.changeindexphoto.newPhoto.value == "")  {
		alert("Please select a new photo!");
		return false;
	}
	return true;
}


function printFreeAgencyRequests()  {
	document.getElementById("printJob").src="printfreeagencyrequests.php";
}


function freeagencyAllDone()  {
	this.location.href="processfreeagencyrequests.php";
}


function viewFreeAgencyRequest(id)  {
	window.open("siteviewfreeagencyrequest.php?id="+id,"fa",'height=550, width=550, scrollbars=no, resizeable=no, status=no');
}
