/*
    Funktionen zum auf- und zuklappen der Profile Menues

    Autor           : Joachim Ruf
    Erstellungsdatum: 2007.11.27
    Version         : 1.0
*/



// === Globale Variablen ===
var globUrl = 'http://test2.ilove-you.net/';





function expand( secId, picPath, maxWidth, maxHeight )
{
	var isExpand = document.getElementById('body'+secId).style.visibility;
	if(isExpand == "hidden")
	{
		//Prüfe beim expandieren ob eine Box mit Id größer oder kleiner 1 als die gegenwärtige Id geöffnet ist und schließe diese
        if( document.getElementById('body' + parseInt(secId + 1) ) != null )
            collapse( parseInt(secId + 1) );
		
        if( document.getElementById('body' + parseInt(secId - 1) ) != null )
            collapse( parseInt(secId - 1) );
            
            
		
		//Öffne gegenwärtige Box
		document.getElementById('body'+secId).style.visibility = 'visible';
		document.getElementById('bodyBoarder'+secId).style.visibility = 'visible';
		document.getElementById('bodyLink'+secId).style.visibility = 'visible';


		//alert(globUrl + 'thumbnail.php?image=' + picPath + '&amp;maxWidth=' + maxWidth + '&amp;maxHeight=' + maxHeight);	
		if( document.getElementById('pic'+secId).src != picPath )
			document.getElementById('pic'+secId).src = globUrl + 'thumbnail.php?image=' + picPath + '&maxWidth=' + maxWidth + '&maxHeight=' + maxHeight;
		
		//document.getElementById('pMHead'+secId).style.zIndex = '10';
	}
}

function collapse(secId)
{
	var isExpand = document.getElementById('body'+secId).style.visibility;

	if(isExpand == "visible")
	{
		document.getElementById('body'+secId).style.visibility = 'hidden';
		document.getElementById('bodyBoarder'+secId).style.visibility = 'hidden';
		document.getElementById('bodyLink'+secId).style.visibility = 'hidden';
		//document.getElementById('pMHead'+secId).style.zIndex = '0';
	}
}



var globalI = 0; var globalJ = 0;
var bodyBoarderName = ""; var bodyName = "";
function expandMenu()
{
	if(globalI == 0)
	{
		globalI = 2;
		globalJ = 2;
		document.getElementById(bodyName).style.visibility = 'visible'; //Menubereich vor Verschiebung anzeigen
	}
	
	if(globalI <= 220) //Vertikale Verschiebung bis auf 220Pixel
	{
		j = (2 * globalJ) - (globalJ / 2) + globalJ;
		globalJ = j;
	
		if(globalJ>220)
			document.getElementById(bodyBoarderName).style.height = "220px";	
		else
			document.getElementById(bodyBoarderName).style.height = globalJ + "px";
	}
	
	if(globalI <= 450) //Horizontale Verschiebung bis auf 450Pixel
	{
		i = (2 * globalI) - (globalI / 2) + globalI;
		globalI = i;
	
		if(globalI>450)
		{
			document.getElementById(bodyBoarderName).style.width = "450px";
			document.getElementById(bodyBoarderName).style.visibility = 'visible';	
		}
		else
		{
			document.getElementById(bodyBoarderName).style.width = globalI + "px";
			window.setTimeout("expandMenu()", 50);
		}
	}
}
