var showed=new Array(false, false);
var moving=false;
var startOther;	
function showHidePartners(){
	if( !moving ){
		
		
		if ( !showed[0] ){
			if ( showed[1] ){
				startOther=true;
				showHideTeam();
			}else{
				setTimeout("showPartners()",30);
				swap(document.getElementById('partners_menu'));
			}
		}else{
			setTimeout("hidePartners()",30);
			swap(document.getElementById('partners_menu'));
		}
		
	}

}

function showHideTeam(){
	if( !moving ){
		
		
		if ( !showed[1] ){
			if ( showed[0] ){
				startOther=true;
				showHidePartners();
				
			}else{
				setTimeout("showTeam()",30);
				swap(document.getElementById('team_menu'));
			}
		}else{
			setTimeout("hideTeam()",30);
			swap(document.getElementById('team_menu'));
		}
	}

}

function showPartners(){
	var partners = document.getElementById('menu_partners');
	partners.style.visibility="visible";
	var bottom = document.getElementById('menu_bottom');
	var team = document.getElementById('menu_team');
	team.style.visibility="hidden";
	if ( parseInt( bottom.style.marginTop )<60 ||  bottom.style.marginTop== ""){
		pushDown(bottom);	
		if (parseInt( bottom.style.marginTop )<54 ){
			pushDown(partners);	
		
		}
		moving=true;
		setTimeout("showPartners()",30);
	}else{
		moving=false;
		showed[0]=!showed[0];
	}
}

function hidePartners(){
	var partners = document.getElementById('menu_partners');
	var bottom = document.getElementById('menu_bottom');
	if ( parseInt( bottom.style.marginTop )>0 ||  bottom.style.marginTop== ""){
		pullUp(bottom);
		if (parseInt( bottom.style.marginTop )>6 ){
			pullUp(partners);
		}else {
			partners.style.marginTop="0px";
			bottom.style.marginTop="0px";
		}
		//alert(bottom.style.marginTop);
		moving=true;
		setTimeout("hidePartners()",30);
	}else{
		moving=false;
		showed[0]=!showed[0];
		if(startOther){
			startOther=false;
			showHideTeam();
		}
	}
}


function showTeam(){
	var team = document.getElementById('menu_team');
	team.style.visibility="visible";
	var middle = document.getElementById('menu_middle');
	var bottom = document.getElementById('menu_bottom');
	var partners = document.getElementById('menu_partners');
	partners.style.visibility="hidden";
	if ( parseInt( bottom.style.marginTop )<60 ||  bottom.style.marginTop== ""){
		
		pushDown(middle);
		pushDown(partners);
		pushDown(bottom);		
				
		if (parseInt( middle.style.marginTop )<50 ){
			pushDown(team);
		
		}else
			team.style.marginTop=46+'px';
		
		
		//alert(bottom.style.marginTop);
		moving=true;
		setTimeout("showTeam()",30);
	}else{
		moving=false;
		showed[1]=!showed[1];
	}
}

function hideTeam(){
	var team = document.getElementById('menu_team');
	var middle = document.getElementById('menu_middle');
	var partners = document.getElementById('menu_partners');
	var bottom = document.getElementById('menu_bottom');
	if ( parseInt( middle.style.marginTop )>0 ||  middle.style.marginTop== "" ){
		pullUp(middle);
		pullUp(bottom);
		pullUp(partners);
		
		
		if (parseInt( middle.style.marginTop )>6 ){
			pullUp(team);
		}else {
			team.style.marginTop="0px";
			middle.style.marginTop="0px";
			bottom.style.marginTop="0px";
			partners.style.marginTop="0px";
			
		}
		//alert(bottom.style.marginTop);
		moving=true;
		setTimeout("hideTeam()",30);
	}else{
		moving=false;
		showed[1]=!showed[1];
		if(startOther){
			startOther=false;
			showHidePartners();
		}
	}
}





function pushDown( dom ){
	if (dom.style.marginTop!= "" && dom.style.marginTop!= "0px" )
		dom.style.marginTop=(parseInt( dom.style.marginTop ) +9)+"px";
	else
		dom.style.marginTop="6px";
}

function pullUp( dom ){
	dom.style.marginTop=(parseInt( dom.style.marginTop ) -9)+"px";
	
}

function checkMoving(){
	if (!moving)
		ok=true;
}

function swap(img){
	var strOver  = "_on";
	var strOff = "_off";

	if (img.src.indexOf(strOver) != -1)
		img.src = img.src.replace(strOver,strOff)
	else
		img.src = img.src.replace(strOff,strOver)
}


function showTeamPhoto( name, event ){
	var dom =document.getElementById('photo');
	
	var theElement = event.currentTarget;
  	var posx = parseInt(theElement.style.left);
  	var posy = parseInt(theElement.offsetTop);
	
	dom.style.left= posx+'px';
	dom.style.top= (posy+270+ 20)+'px';
	
	//dom.style.left= posx+'px';
	//dom.style.top= (posy + 20)+'px';
	
	dom.src='images/roster/'+name+'_thumb.jpg';
	dom.style.visibility='visible';

}
function hideTeamPhoto(){
	var dom =document.getElementById('photo');
	dom.style.visibility='hidden';

}


function showHideTable(){
	var dom =document.getElementById('team_table_2');
	if ( dom.style.visibility == 'hidden' || dom.style.visibility == ''){
		dom.style.visibility='visible';
		dom.style.height='auto';
	}else{
		dom.style.visibility='hidden';
		dom.style.height='0px';
	}

}
function iconSizeInc(img){
	//var img = document.getElementById('albumicon'+id);
	img.width/=0.8;
	img.height/=0.8; 
} 

function iconSizeDec(img){
	//var img = document.getElementById('albumicon'+id);
	img.width*=0.8;
	img.height*=0.8; 
} 
