var survey;			
survey = new Lightbox('survey');
//survey.open();

Event.observe('bg_fade', 'click', function () {
	survey.close();
});    

new Carousel('carousel-wrapper', $$('#carousel-content .slide'), $$('a.carousel-control', 'a.carousel-jumper'), {beforeMove: function () { navigate(); }, duration: 0.5,wheel:false} );

function navigate(){	
	//check direaction
	if( direction == 'next' ){
		//increase current count
		$( questionsCurrentCountId ).innerHTML = parseInt( $( questionsCurrentCountId ).innerHTML ) + 1;        
	}else if( direction == 'previous' ){
		//decrease current count
		$( questionsCurrentCountId ).innerHTML = parseInt( $( questionsCurrentCountId ).innerHTML ) - 1;
	}
	
	questionsCurrentCountValue = $( questionsCurrentCountId ).innerHTML;
	questionsTotalCountValue =  $( questionsTotalCountId ).value;
	
	//set submit button visibility
	if( questionsCurrentCountValue == questionsTotalCountValue ){
		$( submitSurveyId ).style.display = 'block';
	}else{
		$( submitSurveyId ).style.display = 'none';
	}
	
	//set next button visibility
	if( questionsCurrentCountValue == questionsTotalCountValue ){
		$( nextQuestionId ).style.display = 'none';
	}else{
		$( nextQuestionId ).style.display = 'block';
	}
	
	//set previous button visibility
	if( questionsCurrentCountValue == 1 ){
		$( prevQuestionId ).style.display = 'none';
	}else{
		$( prevQuestionId ).style.display = 'block';
	}
	
	//set width for navigation selected zone
	$( navigationSelectedZoneId ).style.width  = parseInt( navigationSelectedWidth ) * questionsCurrentCountValue + 'px';
	
	//set width for navigation text zone
	$( navigationTextZoneId ).style.width  = parseInt( navigationSelectedWidth ) * questionsCurrentCountValue + 'px';
	
}
