   	uploadfields=1;
   	function addUploadfield(name) {
   		uploadfields++;
   		$("#upload_fields_" + name).prepend('<input type="file" id="upload_' + name + uploadfields + '" name="upload_' + name + uploadfields + '" /><br />');
   	}
   
   	function toAnswer(name) {
	   		$("#answerHeader").slideDown();
	   		$("#commentHeader").slideUp();
   			$("#tx_comments_pi1_submit").slideDown();
   	   		$("#tx_comments_pi1_content").slideDown();
   	   	   	$("#answer_fields").slideDown();
   			$("#tx_"+ name +"_pi1_is_answer").attr('value', '1');  
   			$("#tx_comments_pi1_change_view").attr('value', 'Post a comment');   					
   	}
   	
   	function toComment(name) {
	   		$("#answerHeader").slideUp();
	   		$("#commentHeader").slideDown();
	   		$("#replyHeader").slideDown();
   			$("#tx_comments_pi1_submit").slideDown();
   			$("#tx_comments_pi1_content").slideDown();
   			//$("#tx_comments_pi1_content").slideDown();
	   		$("#answer_fields").slideUp();
   			$("#upload_" + name + 1).attr('value', '');
			$("#upload_fields_" + name).html("");

   			uploadfields=1;
			$("#tx_"+ name +"_pi1_tags").attr('value', '');   			
   			$("#tx_"+ name +"_pi1_is_answer").attr('value', '0');   
   			$("#tx_comments_pi1_change_view").attr('value', 'Post an answer');	
   	}
   	
   	function checkNewQuestionFields(form) {
   	    error = "";
  	    if ($("#form_description").val() == "") error = "You forgot to enter a description!";
   	    if ($("#form_question").val() == "") error = "You forgot to enter a short description!";   
        if ($("input#form_title").val() == "") error = "You forgot to enter a title!";
        if (error != "") {
            alert(error);
            return false;
        }   	   
        return true;
   	}
   	
   	function deleteFile(filename,number) {
        $("span#file_" + number).hide();
        $("#new_question_form").append('<input type="hidden" name="tx_questionanswer_pi1[delete_file_' + number + ']" value="' + filename + '">');
   	}   	
   	

