function swapDivision(division,maximum){
	var y = 1;
	for(y = 1; y <= maximum; y++){
		var otherdivid = document.getElementById('divisionTable'+y);
		otherdivid.style.display=(y!=division)?'none':'block'; 
	}
}

function openPhotoFrame(src,width,height,description,name){
	this.open('galleries/picture.php?src='+src+'&description='+description+'&name='+name,'PhotoWindow','scrollbars=no,menubar=no,height='+height+',width='+width+',resizable=no,toolbar=no,location=no,status=no');
}

function swapOnRoster(flag,first_name,last_name,handle){
	var rosterHandle = document.getElementById('rosterHandle');
	rosterHandle.innerHTML='<img src="images/'+flag+'.gif" class="userFlag">'+first_name+' &#8220;<strong>'+handle+'</strong>&#8221; '+last_name;
}

function swapOffRoster(){
	var rosterHandle = document.getElementById('rosterHandle');
	rosterHandle.innerHTML='Select to view profile';
}

function swapTab(tableId,hoverColor){
	
	var tableArray = new Array();
	tableArray[0] = "profileHardware";
	tableArray[1] = "profileIngame";
	tableArray[2] = "profileFavorites";
	var oi = 0;
	for(oi=0;oi<=(tableArray.length-1);oi++){
		var currentArray = tableArray[oi];
		var currentView = document.getElementById(currentArray);
		currentView.style.display=(currentArray!==tableId)?'none':'inline';
		
		var currentText = document.getElementById(currentArray+'Text');
		currentText.style.fontWeight=(currentArray!==tableId)?'normal':'bold';
		currentText.style.color=(currentArray!==tableId)?'#a0b9ba':hoverColor;
		currentText.style.textDecoration=(currentArray!==tableId)?'underline':'none';
	}
}

function swapBudTab(tableId,hoverColor){
	
	var tableArray = new Array();
	tableArray[0] = "profileBuddies";
	tableArray[1] = "profileBuddied";
	var oi = 0;
	for(oi=0;oi<=(tableArray.length-1);oi++){
		var currentArray = tableArray[oi];
		var currentView = document.getElementById(currentArray);
		currentView.style.display=(currentArray!==tableId)?'none':'inline';
		
		var currentText = document.getElementById(currentArray+'Text');
		currentText.style.fontWeight=(currentArray!==tableId)?'normal':'bold';
		currentText.style.color=(currentArray!==tableId)?'#FFFFFF':hoverColor;
		currentText.style.textDecoration=(currentArray!==tableId)?'underline':'none';
	}
}

function clearInput(inputName,baseText){
	formInput = document.getElementById(inputName);
	formInput.value = (formInput.value == baseText) ? '' : formInput.value;
}

function fillInput(inputName,baseText){
	formInput = document.getElementById(inputName);
	formInput.value = (formInput.value == "") ? baseText : formInput.value;
}

function redirectPage(url,time){
	setTimeout("window.location='"+url+"'",time);
}

function swapMatchSelect(id,maximum){
	var h = 1;
	for(h=1;h<=maximum;h++){
		var sectionId1 = document.getElementById('divisionMapId'+h);
		sectionId1.style.display=(h!=id)?'none':'block'; 
		var sectionId2 = document.getElementById('divisionCompetitionId'+h);
		sectionId2.style.display=(h!=id)?'none':'block'; 
	}
}

function viewTime(){
	var today= new Date()
	var y = today.getFullYear();
	var month = today.getMonth();
	var d = today.getDate();
	var h = (today.getHours() < 10) ? "0"+today.getHours() : today.getHours();
	var m = (today.getMinutes() < 10) ? "0"+today.getMinutes() : today.getMinutes();
	var s = (today.getSeconds() < 10) ? "0"+today.getSeconds() : today.getSeconds();
	timeField = document.getElementById('timeField');
	timeField.value = d+'/'+(month+1)+'/'+y+' '+h+':'+m+':'+s;
}
function rosterSwitch(theRoster) {
    var roster = document.getElementById('rosterContent').childNodes;
    for(var i = 0; i < roster.length; i++) {
        if(roster[i].innerHTML) {
            roster[i].style.display = 'none';
        }
   }
    document.getElementById(theRoster).style.display = 'block';
}

	
function swapOnGame(game){
	var rosterHandle = document.getElementById('rosterTeam');
	rosterHandle.innerHTML=game;
}

function swapOffGame(){
	var rosterHandle = document.getElementById('rosterTeam');
	rosterHandle.innerHTML='';
}