function pc3AccordionInitialize( brickId, action, fixHeight, animationDuration, tangens ){	//set defaults for accordion	accordion = document.getElementById(brickId);	accordion.boxes = new Array();	accordion.steps = 1;	accordion.tangens = tangens;	accordion.degrees = (Math.atan(accordion.tangens) * 360) / (Math.PI * 2);	accordion.activeBox = null;	accordion.fixedHeight = false;	if ( action == "onmouseover" || ( action == "onclick" && fixHeight == 1 ) ) accordion.fixedHeight = true;	//gather all boxes	firstToOpen = null;	maxTitleHeight = 0;	maxContentHeight = 0;	accordion.numberOfBoxes = 0;	for( i = 0; i < accordion.childNodes.length; i++ ){		box = accordion.childNodes[i];		if ( box.nodeType == 1 ){			box.accordion = accordion;			box.position = accordion.numberOfBoxes;			accordion.numberOfBoxes++;			box.boxTitle = box.childNodes[0];			box.boxTitle[action] = pc3AccordionBoxToggle;			box.boxTitle.box = box;			if ( !firstToOpen ) firstToOpen = box.boxTitle;			box.boxTitle.style.cursor = "pointer";			box.titleHeight = parseInt(box.boxTitle.scrollHeight);			if ( box.titleHeight > maxTitleHeight ) maxTitleHeight = box.titleHeight;					box.boxContent = box.childNodes[1];			box.contentHeight = parseInt(box.boxContent.scrollHeight);			if ( box.contentHeight > maxContentHeight ) maxContentHeight = box.contentHeight;			accordion.boxes[box.position] = box;		}	}	//set defaults for boxes	for( i = 0; i < accordion.numberOfBoxes; i++ ){		box = accordion.boxes[i];		if ( accordion.fixedHeight ){			box.titleHeight = maxTitleHeight;			box.contentHeight = maxContentHeight;		}		box.direction = "";		box.style.overflow = "hidden";		box.currentHeight = 0;		box.displayedHeight = 0;		box.boxTitle.style.height = box.titleHeight +"px";		box.boxContent.style.height = box.contentHeight +"px";		box.style.height = box.titleHeight +"px";	}		firstToOpen[action]();	accordion.steps = (animationDuration * 25) / 1000;}function pc3AccordionBoxToggle(){	box = this.box;	if ( box.accordion.activeBox != box ){		box.accordion.activeBox = box;		box.activeBoxes = new Array();		boxCounter = 0;		for(var i = 0; i < box.accordion.numberOfBoxes; i++){			currentBox = box.accordion.boxes[i];			if ( box.position == currentBox.position ){				if ( currentBox.direction == 'close' && currentBox.displayedHeight > 0 ) pc3SetAccordionBoxReverse(currentBox);				if ( currentBox.displayedHeight < currentBox.contentHeight ) currentBox.direction = 'open';				else currentBox.direction = '';			} else {				if ( currentBox.direction == 'open' && currentBox.displayedHeight < currentBox.contentHeight ) pc3SetAccordionBoxReverse(currentBox);				if ( currentBox.displayedHeight > 0 ) currentBox.direction = 'close';				else currentBox.direction = '';				if ( currentBox.direction ){					box.activeBoxes[boxCounter] = currentBox.position;					boxCounter++;				}			}		}		if ( box.accordion.fixedHeight ) pc3AccordionBoxSlideFixed( box );		else pc3AccordionBoxSlide( box );	}}function pc3AccordionBoxSlideFixed( box ){	if ( box == box.accordion.activeBox ){		step = box.contentHeight / box.accordion.steps;		if ( step < 0.5 ) step = 0.51;		box.currentHeight = Math.round(box.currentHeight + step);		displayedHeight = pc3AccordionBoxGetDisplayHeight(box, box.direction);		totalMove = displayedHeight - box.displayedHeight;		if ( displayedHeight >= box.contentHeight || totalMove <= 0 ){			box.currentHeight = box.contentHeight;			box.displayedHeight = box.currentHeight;			totalMove = 10000;			box.direction = '';		} else {			box.displayedHeight = displayedHeight;		}		box.style.height = (box.titleHeight + box.displayedHeight)+"px";		totalMoveHeight = 0;		remainingTotalMove = totalMove;				numberOfActiveBoxes = box.activeBoxes.length;		for(var i = 0; i < numberOfActiveBoxes; i++) totalMoveHeight = totalMoveHeight + box.accordion.boxes[box.activeBoxes[i]].displayedHeight;				removeBoxes = new Array();		removeBoxesCounter = 0;		for(var i = 0; i < numberOfActiveBoxes; i++){			if ( box == box.accordion.activeBox ){				currentBox = box.accordion.boxes[box.activeBoxes[i]];				if ( i == (numberOfActiveBoxes - 1) ){					currentBox.displayedHeight = currentBox.displayedHeight - remainingTotalMove;				} else {					move = Math.round((totalMove * currentBox.displayedHeight) / totalMoveHeight);					if ( move > remainingTotalMove ) move = remainingTotalMove;					remainingTotalMove = remainingTotalMove - move;					currentBox.displayedHeight = currentBox.displayedHeight - move;				}				if ( currentBox.displayedHeight <= 0 ){					currentBox.displayedHeight = 0;					currentBox.currentHeight = 0;					currentBox.direction = '';					removeBoxes[removeBoxesCounter] = i;					removeBoxesCounter++;				} else {					currentBox.currentHeight = pc3AccordionBoxGetCurrentHeight(currentBox);				}				currentBox.style.height = (currentBox.titleHeight + currentBox.displayedHeight)+"px";			}		}		for(var i = 0; i < removeBoxes.length; i++) box.activeBoxes.splice((removeBoxes[i]-i),1);		if ( box.activeBoxes.length > 0 || box.contentHeight != box.displayedHeight ) setTimeout(function() { pc3AccordionBoxSlideFixed(box); },40);	}}function pc3AccordionBoxSlide( box ){	if ( box == box.accordion.activeBox ){		allBoxesMoved = true;		for(var i = 0; i < box.accordion.numberOfBoxes; i++){			currentBox = box.accordion.boxes[i];			if ( currentBox.direction ){				step = currentBox.contentHeight / box.accordion.steps;				if ( step < 0.5 ) step = 0.51;				if ( box.position == currentBox.position ){					currentBox.currentHeight = Math.round(currentBox.currentHeight + step);					if ( currentBox.currentHeight >= currentBox.contentHeight ){						currentBox.currentHeight = currentBox.contentHeight;						currentBox.displayedHeight = currentBox.currentHeight;						currentBox.direction = '';					} else {						currentBox.displayedHeight = pc3AccordionBoxGetDisplayHeight(currentBox, currentBox.direction);						allBoxesMoved = false;					}				} else {					currentBox.currentHeight = Math.round(currentBox.currentHeight - step);					if ( currentBox.currentHeight <= 0 ){						currentBox.currentHeight = 0;						currentBox.displayedHeight = currentBox.currentHeight;						currentBox.direction = '';					} else {						currentBox.displayedHeight = pc3AccordionBoxGetDisplayHeight(currentBox, currentBox.direction);						allBoxesMoved = false;					}				}				currentBox.style.height = (currentBox.titleHeight + currentBox.displayedHeight)+"px";			}		}				if ( !allBoxesMoved ) setTimeout(function() { pc3AccordionBoxSlide(box); },40);	}}function pc3AccordionBoxGetDisplayHeight( box, direction ){	if ( direction == "open" ) return box.contentHeight - Math.round(box.contentHeight * pc3AccordionBoxGetFactor( box, box.direction ));	else return Math.round(box.contentHeight * pc3AccordionBoxGetFactor( box, box.direction ));}function pc3AccordionBoxGetFactor( box, direction ){	if ( direction == "open" ) pastDegrees = box.accordion.degrees - ((box.currentHeight * box.accordion.degrees) / box.contentHeight);	else pastDegrees = (box.currentHeight * box.accordion.degrees) / box.contentHeight;	if ( pastDegrees > box.accordion.degrees ) pastDegrees = box.accordion.degrees;	if ( pastDegrees < 0 ) pastDegrees = 0;	return Math.tan((pastDegrees * (Math.PI * 2)) / 360) / box.accordion.tangens;}function pc3SetAccordionBoxReverse( box ){	degrees = (Math.atan(box.accordion.tangens - (pc3AccordionBoxGetFactor( box, box.direction ) * box.accordion.tangens)) * 360) / (Math.PI * 2);	if ( box.direction == "open" ) box.currentHeight = Math.round((box.contentHeight * degrees) / box.accordion.degrees);	else box.currentHeight = box.contentHeight - Math.round((box.contentHeight * degrees) / box.accordion.degrees);}function pc3AccordionBoxGetCurrentHeight( box ){	degrees = (box.displayedHeight * box.accordion.degrees) / box.contentHeight;	tangens = (degrees * box.accordion.tangens) / box.accordion.degrees;	return Math.round((((Math.atan(tangens) * 360) / (Math.PI * 2)) * box.contentHeight) / box.accordion.degrees);}