//Functions from html templates
function onHover(element,name){
	
};
function resizeStub(){
	var stubImg = document.getElementById("stubImg");
	var mainDiv = document.getElementById("main");
	var height = parseInt(mainDiv.offsetHeight);
	if(height<500){
		stubImg.setAttribute('height',500-height);
	}else{
		stubImg.setAttribute('height',1);
	}
};
function outHover(element,name){

};
// End Functions from html templates
function navigate(url){
	window.location = url
};
function navigateHiddenUrl(hiddenId,inputId){
	var hidden = document.getElementById(hiddenId);
	var input = document.getElementById(inputId);
	var strUrl = hidden.value.toString()+input.value.toString();
	window.location=strUrl;
};
function hideDialog(id){
	var dialog = dijit.byId(id);
	dialog.hide();
};
function showDialog(id,src){
	var dialog = dijit.byId(id);
	dialog.setHref(src);
	dialog.show();
};
function submitForm(formId,dialogId){
	dojo.xhrPost({
	url: document.getElementById(formId).action,
	load: function(response, ioArgs){
		var dialog = dijit.byId(dialogId);
		dialog.hide();
		dialog.setContent(response);
		dialog.show();
  		return response;
		},
	error: function(response, ioArgs){
  		dojo.byId(formId).innerHTML = 
    	"An error occurred, with response: " + response;
  		return response;
		},
	form:formId
			});
	};
var SHOW_IMAGE_ID = "show_image_id";
function showImg(src,element){
	var img = document.createElement("img");
	img.setAttribute("id",SHOW_IMAGE_ID);
	img.setAttribute("style",'z-index:10000;float:left;');
	img.src = src;
	element.appendChild(img);
};
function hideImg(){
	var el = document.getElementById(SHOW_IMAGE_ID);
	var parent = el.parentNode;
	parent.removeChild(el);
};


function showTree(selected){
	var parent = selected.parent();
	var tag = parent.get(0);
	var tagName = tag.tagName;
	if(tagName=="DIV"){
		parent.show();
		showTree(parent);
	}
}