$(document).ready(function(){
	
	//set overlay to body height
	$('#qq-overlay').height( $('body').height() );
	//close on overlay click and close button click
	$('#qq-overlay, a.qq-close-button').click(function(){ closeQQ(); });
		
	//show Quick Questions if true
	if(bShowQQ){
		showQQ();
	}
	
	//set Position to Content Layer
	setQQLayerPos();
	$(window).resize(function(){ setQQLayerPos(); });
	
	setQQLayerContent();
	
	function showQQ(){
		$('#qq-overlay').show();
		$('#qq-content').show();	
	}
	
	function closeQQ(){
		$('#qq-overlay').hide();
		$('#qq-content').hide();
	}
	
	function setQQLayerPos(){
		
		var wWidth = $('body').width();
		var cWidth = $('#qq-content').width();
		
		$('#qq-content').css({
			'left' : (wWidth - cWidth)/2 + 'px'
		})
	}
	
	function setQQLayerContent(){
		//Main question
		$('#qq-main-question').text( sMainQQ );
		
		var sContent = '';
		$.each(aAnswersQQ, function(index, value){
			if(bTypeQQ == 'checkbox'){
				sContent += '<p><span class="qq-field"><input name="' + value['name'] + '" value="' + value['value'] + '" type="checkbox" class="qqcheckbox" /></span><span class="qq-answer">' + value['text'] + '</span></p>';
			} else if(bTypeQQ == 'radio'){
				sContent += '<p><span class="qq-field"><input name="' + sRadioName + '" value="' + value['value'] + '" type="radio" class="qqcheckbox" /></span><span class="qq-answer">' + value['text'] + '</span></p>';
			}
		});
		$('#qq-form-fields').prepend(sContent);
	}
	
	
	
})
