function jsonToOptions(array,valueCol,textCol){
	var result={};
	for(var c=0;c<array.length;c++){
		result[array[c][valueCol]]=array[c][textCol];
	}
	return(result);
}
var skip_confirm_message="If you continue, any information your have entered or edited in this form will NOT be saved.\n\nNote: Any previously saved data will not be lost if you continue.\n\nAre you sure you want to continue without saving?";
var alerted=false;


function showMessage(parent,opts){
	opts=(opts==null)?{}:opts;

	opts.title=(opts.title==null)?"":opts.title;
	opts.message=(opts.message==null)?"":opts.message;
	opts.show=(opts.show==null)?true:opts.show;
	opts.id=(opts.id==null)?"collapse":opts.id;
	opts.timeout=(opts.timeout==null)?-1:opts.timeout;
	opts.theme=(opts.theme==null)?"green":opts.theme;

	var html="<div class=\"collapsable_panel "+opts.theme+"\" id=\""+opts.id+"\">";
	
	if(opts.title.length>0){
		html+="<h1><a href=\"#\" class=\"close\" id=\""+opts.id+"_close\"><span>close</span></a>"+opts.title+"</h1>";
	}
	if(opts.message.length>0){
		html+="<div class=\"panel_content pad10\">"+opts.message+"</div>";
	}
	
	html+="</div>";

	$(parent).prepend(html);
	
	if(opts.show){
		$(parent+" #"+opts.id).show();
	}else{
		$(parent+" #"+opts.id).hide();
	}

	if(opts.show&&opts.timeout>0){
		$(document).oneTime(opts.timeout, function() {
			$(parent+" #"+opts.id).hide("slow");
		});
	}

	if(opts.title.length>0){
		$(parent+" #"+opts.id+" #"+opts.id+"_close").click(
			function(){
				$(parent+" #"+opts.id).hide("slow");
				return(false);
			}
		);
	}
}
