
/************************************************************************************************************
(C) www.dhtmlgoodies.com, November 2005

This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	

Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.

Thank you!

www.dhtmlgoodies.com
Alf Magne Kalleland

************************************************************************************************************/

var dhtmlgoodies_slideSpeed_product = 300;	// Higher value = faster
var dhtmlgoodies_timer_product =1;	// Lower value = faster

var objectIdToSlideDown_product = 1;
var dhtmlgoodies_activeId_product = false;
var dhtmlgoodies_slideInProgress_product = false;
function showHideContent_product(e,inputId)
{
	if(dhtmlgoodies_slideInProgress_product)return;
	dhtmlgoodies_slideInProgress_product = true;
	if(!inputId)inputId = this.id;
	inputId = inputId + '';
	var numericId = inputId.replace(/[^0-9]/g,'');
	var answerDiv = document.getElementById('dhtmlgoodies_product_a' + numericId);

	objectIdToSlideDown_product = false;
	
	if(!answerDiv.style.display || answerDiv.style.display=='none'){		
		if(dhtmlgoodies_activeId_product &&  dhtmlgoodies_activeId_product!=numericId){			
			//alert(document.getElementById(inputId))
			//document.getElementById(inputId).className='dhtmlgoodies_question_active_sub';

			objectIdToSlideDown_product = numericId;
			slideContent_sub(dhtmlgoodies_activeId_product,(dhtmlgoodies_slideSpeed_product*-1));
		}else{
			//alert(document.getElementById(inputId))
			//document.getElementById(inputId).className='dhtmlgoodies_product_question_active';
			answerDiv.style.display='block';
			answerDiv.style.visibility = 'visible';
			slideContent_sub(numericId,dhtmlgoodies_slideSpeed_product);
		}
	}else{
		slideContent_sub(numericId,(dhtmlgoodies_slideSpeed_product*-1));
		dhtmlgoodies_activeId_product = false;
	}	
}

function slideContent_sub(inputId,direction)
{
	
	if(direction==-10)
	{
	document.getElementById('dhtmlgoodies_product_q'+inputId).className='dhtmlgoodies_product_question';
	}
	var obj =document.getElementById('dhtmlgoodies_product_a' + inputId);
	var contentObj = document.getElementById('dhtmlgoodies_product_ac' + inputId);
	height = obj.clientHeight;
	if(height==0)height = obj.offsetHeight;
	height = height + direction;
	rerunFunction = true;
	if(height>contentObj.offsetHeight){
		height = contentObj.offsetHeight;
		rerunFunction = false;
	}
	if(height<=1){
		height = 1;
		rerunFunction = false;
	}

	obj.style.height = height + 'px';
	var topPos = height - contentObj.offsetHeight;
	if(topPos>0)topPos=0;
	contentObj.style.top = topPos + 'px';
	if(rerunFunction){
		setTimeout('slideContent_sub(' + inputId + ',' + direction + ')',dhtmlgoodies_timer_product);
	}else{
		if(height<=1){
			obj.style.display='none'; 
			if(objectIdToSlideDown_product && objectIdToSlideDown_product!=inputId){
				document.getElementById('dhtmlgoodies_product_a' + objectIdToSlideDown_product).style.display='block';
				document.getElementById('dhtmlgoodies_product_a' + objectIdToSlideDown_product).style.visibility='visible';
				slideContent_sub(objectIdToSlideDown_product,dhtmlgoodies_slideSpeed_product);				
			}else{
				dhtmlgoodies_slideInProgress_product = false;
			}
		}else{
			dhtmlgoodies_activeId_product = inputId;
			dhtmlgoodies_slideInProgress_product = false;
		}
	}
}



function initShowHideDivs_product()
{
	var divs = document.getElementsByTagName('DIV');
	var divCounter = 1;
	for(var no=0;no<divs.length;no++){
		if(divs[no].className=='dhtmlgoodies_product_question'){
			divs[no].onclick = showHideContent_product;
			divs[no].id = 'dhtmlgoodies_product_q'+divCounter;
			
			var answer = divs[no].nextSibling;
			while(answer && answer.tagName!='DIV'){
				answer = answer.nextSibling;
			}
			answer.id = 'dhtmlgoodies_product_a'+divCounter;	
			contentDiv = answer.getElementsByTagName('DIV')[0];
			contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px'; 	
			contentDiv.className='dhtmlgoodies_product_answer_content';
			contentDiv.id = 'dhtmlgoodies_product_ac' + divCounter;
			answer.style.display='none';
			answer.style.height='1px';
			divCounter++;
		}		
	}	
	showHideContent_product(false, 1);
}
// JavaScript Document
