function useHomeTeam(gameid,rainout,tourney,division){		
	var fieldList = 
	   document.getElementById
	  ("fieldid").options;
	var field = fieldList.item(fieldList.selectedIndex).value;
	
	var optionList = 
	   document.getElementById
	  ("teamidhome").options;
	var data = '';
	var len = optionList.length;
	for(i=0; i<len; i++){
		if(optionList[i].selected==true)
			data += optionList.item(i).value;	
	}
	
	if(division != ''){
		div = division;
	}
	else{
		var divisionList = 
		   document.getElementById
		  ("divisionid").options;
		  var div = '';
		var len = divisionList.length;
		for(i=0; i<len; i++){
			if(divisionList[i].selected==true)
				div += divisionList.item(i).value;	
		}
		//alert(data);
	}
	if(location.href.indexOf( 'schedule.php' ) == -1) {	
		if(rainout > 0 ){
			if(tourney == '1'){
				window.location = "game.php?id=" + gameid  + "&divisionid=" + div + "&rainout=" + rainout + "&teamidhome=" + data + "&fieldid=" + field + "&tournament";
			} else{ 
				window.location = "game.php?id=" + gameid  + "&divisionid=" + div + "&rainout=" + rainout + "&teamidhome=" + data + "&fieldid=" + field;
			}
		}	
		else{
			if(tourney == '1'){
				window.location = "game.php?id=" + gameid + "&divisionid=" + div + "&teamidhome=" + data + "&fieldid=" + field + "&tournament";
			} else{ 
				window.location = "game.php?id=" + gameid  + "&divisionid=" + div + "&teamidhome=" + data + "&fieldid=" + field;
			}		
		}
	}
	else{
		if(rainout > 0 ){
			if(tourney == '1'){
				window.location = "schedule.php?id=" + gameid  + "&divisionid=" + div + "&rainout=" + rainout + "&teamidhome=" + data + "&fieldid=" + field + "&tournament";
			} else{ 
				window.location = "schedule.php?id=" + gameid  + "&divisionid=" + div + "&rainout=" + rainout + "&teamidhome=" + data + "&fieldid=" + field;
			}
		}	
		else{
			if(tourney == '1'){
				window.location = "schedule.php?id=" + gameid + "&divisionid=" + div + "&teamidhome=" + data + "&fieldid=" + field + "&tournament";
			} else{ 
				window.location = "schedule.php?id=" + gameid  + "&divisionid=" + div + "&teamidhome=" + data + "&fieldid=" + field;
			}		
		}
	}
}

function useDivision(gameid,tourney){	
	var fieldList = 
	   document.getElementById
	  ("fieldid").options;
	var field = fieldList.item(fieldList.selectedIndex).value;
		
	var optionList = 
	   document.getElementById
	  ("divisionid").options;
	var data = '';
	var len = optionList.length;
	for(i=0; i<len; i++){
		if(optionList[i].selected==true)
			data += optionList.item(i).value;	
	}
	//alert(data);
	//alert(location.href);
	if(location.href.indexOf( 'schedule.php' ) == -1) {	
		if(tourney=='1'){
			window.location = "game.php?id=" + gameid + "&divisionid=" + data + "&fieldid=" + field + "&tournament";		
		}else{
			window.location = "game.php?id=" + gameid + "&divisionid=" + data + "&fieldid=" + field;		
		}
		
	}
	else{
		if(tourney=='1'){
			window.location = "schedule.php?id=" + gameid + "&divisionid=" + data + "&fieldid=" + field + "&tournament";		
		}else{
			window.location = "schedule.php?id=" + gameid + "&divisionid=" + data + "&fieldid=" + field;		
		}
	}
	
}
function showLeague(){
	e=document.getElementById('myIFRAME');
	var	querystring = e.src.substring(e.src.indexOf("?"))
	e.src = 'games.php' + querystring;
	
}	
function showTournament(){
	e=document.getElementById('myIFRAME');
	var	querystring = e.src.substring(e.src.indexOf("?"))
	e.src = 'tournaments.php' + querystring;
	
}	
function setfocus(a_field_id) {
    myObj = document.getElementById(a_field_id);
    myObj.focus();
}
function scrollUp(){
	e = document.getElementById('schedule');
	e.style.top = e.style.top - 20;
	//window.scrollBy(0,-20); // horizontal and vertical scroll increments
}
function scrollDown(){
	window.scrollBy(0,20); // horizontal and vertical scroll increments
}

