var questionJs = {
	
	init: function() {
		var element = jQuery('#login .value');

		jQuery("a.submit").click(function() {
			questionJs.toggle();
			return false;
		});
	},

	toggle : function(item) {
		var inputValue = document.getElementById('question_form').value;
		var infoFrame = jQuery("#question-frame .klick-frame span.value").html('Ihre Frage<br />sofort stellen.');
		
		jQuery("#question-frame .form-frame").css('display','none');
		
		document.getElementById('uid3').value = '';
		
		document.getElementById('uid3').value = inputValue;

		console.log(jQuery("#question-frame .tx-powermail-pi1 .tx_powermail_pi1_fieldwrap_html_textarea"));
		jQuery("#question-frame .tx-powermail-pi1 .tx_powermail_pi1_fieldwrap_html_textarea").value = "test";
		jQuery('#question-frame').addClass('question-frame-full');
		jQuery('#question-frame .tx-powermail-pi1').slideDown(1000);
	}
}

jQuery(document).ready(function() {
	jQuery('#question-frame .tx-powermail-pi1').hide();
	
	if(document.getElementById('uid11')) {
		
	}
	else {
		showInstant();
	}
	
	//console.log(document.getElementById('uid3').innerHTML);
	if(document.getElementById('uid11').innerHTML != '') {
		showInstant();
		return;
	}
	
	jQuery("a.submit").click(function() {
		showFrame();
		return false;
	});
	
	jQuery("#question-frame").hoverIntent({
		sensitivity: 3,
		interval: 500,
		over: showFrame,
		timeout: 500,
		out: hideFrame
	});
});

function showFrame() { 
	var inputValue = document.getElementById('question_form').value;
	var infoFrame = jQuery("#question-frame .klick-frame span.value").html('Stellen Sie uns<br />Ihre Frage.');
	
	jQuery("#question-frame .form-frame").css('display','none');
	
	if(document.getElementById('uid11')) {
		document.getElementById('uid11').value = '';
		document.getElementById('uid11').value = inputValue;
	}
	
	//console.log(jQuery("#question-frame .tx-powermail-pi1 .tx_powermail_pi1_fieldwrap_html_textarea"));
	jQuery("#question-frame .tx-powermail-pi1 .tx_powermail_pi1_fieldwrap_html_textarea").value = "test";
	jQuery('#question-frame').addClass('question-frame-full');
	jQuery('#question-frame .tx-powermail-pi1').slideDown(750);	
} 

function hideFrame() {
	return false;
}

function showInstant() {
	jQuery("#question-frame .form-frame").css('display','none');
	jQuery('#question-frame').addClass('question-frame-full');
	jQuery("#question-frame .klick-frame span.value").html('Ihre Frage<br />sofort stellen.');
	jQuery('#question-frame .tx-powermail-pi1').show();
}