function showTab(showtab, hidetab){
	for(i = 0; i < hidetab.length; i++){
		document.getElementById(hidetab[i]).className="";
		document.getElementById(hidetab[i]+"content").style.display = "none";
	}
	document.getElementById(showtab).className="current";
	document.getElementById(showtab+"content").style.display = "";
	document.getElementById("bottomcapimage").style.position = "relative";
	document.getElementById("bottomcapimage").style.position = "absolute";
}

function switchtoFeedback(){
	showTab('feedback',['questions','commissions']);
	document.getElementById('id_suggestion_type').value=3;
}
function switchtoQuestion(){
	showTab('questions',['feedback','commissions']);
	document.getElementById('id_suggestion_type').value=1;
}
function switchtoCommission(){
	showTab('commissions',['questions','feedback']);
	document.getElementById('id_suggestion_type').value=2;
}

function checkForComment(){
	if(window.location.href.indexOf("#c") != -1){
		showTab("comments",["information"]);
	}
}

function submitComment() {
  dojo.xhrPost( { 
    // The following URL must match that used to test the server.
    form: "commentForm",
    url: document.getElementById("commentForm").action, 
    handleAs: "text",

    timeout: 5000, // Time in milliseconds

    // The LOAD function will be called on a successful response.
    load: function(response, ioArgs) { 
      //alert(response);
      if(response.charAt(0)== "/"){
      	window.location.href = response;
      }
      else{
      	document.getElementById("commentformwrapper").innerHTML= response;
      }
      return response; 
    },

    // The ERROR function will be called in an error case.
    error: function(response, ioArgs) { 
      console.error("HTTP status code: ", ioArgs.xhr.status); 
      return response; 
      }
    
    });
  }


    
