// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults


	function updateForm( eventEl ) {
		if( eventEl && eventEl.name == "new_file" ) {

			var file_info = path_parts( eventEl.value );	

			$('new_name').value = file_info[1];
		
		}
	}

	function path_parts( filepath ) {

		var SEPARATOR = "/";
		if (navigator.appVersion.indexOf("Win")!=-1) {
			SEPARATOR = "\\";
		}

		var filepath_str = new String(filepath);

		var last_separator_idx = filepath_str.lastIndexOf(SEPARATOR);

		if( last_separator_idx != -1 ) {
			var folder = filepath_str.substr(0,last_separator_idx);
			var file   = filepath_str.substr(last_separator_idx + SEPARATOR.length);
			return new Array(folder,file);
		}
		else {
			return new Array("","");
		}

	}
function show_tab(tab,count){
	for(var i=0;i<count;i++){
		obj=tab.split('_')[0]+"_"+i;
		liobj=obj.toString()+"_li";
		$(obj).hide();
		$(liobj).classNames().remove('active');
	}
	$(tab).show();
	$(tab+"_li").classNames().set('active');
}