function submitSearch(id, searchFor){
	if(!searchFor)
		searchFor = 'search';
	new_form = document.createElement('form');
	new_form.action = '/'+searchFor+'/'+document.getElementById(id).value;
	document.body.appendChild(new_form);
	new_form.submit();
}

function submitForm(formName){
	if (formName != null && formName != ""){
		document.forms[formName].submit();
	}
	else{
		document.forms.form.submit();
	}
}

function submitPoemForm(){
	poem_title = document.getElementById('id_poemTitle').value;
	poem_content = document.getElementById('id_poemContent').value;

	if(poem_title == '' || poem_content == ''){
		alert("Enter a title and poem before submitting");
		return False;
	}

	submitForm('poemSubmission');

}

function showPoemsInCategory(){
	sc = document.getElementById('searchCategory').value;
	if(sc != ''){
		document.location = "/category/"+sc;
	}
	else {
		alert("Select a category to browse");
	}
	return;
}
