var opened_obj = false;
var opened_title_obj = false;

acc = {
	show: function(title_obj,obj){
		if(opened_obj != false){
			opened_obj.blindUp({duration: .2});
			opened_title_obj.morph('background: #ffffff;color: #000000;',{duration: .3});
		}
		if(opened_obj != obj){
			opened_obj = obj;
			opened_title_obj = title_obj;
			obj.blindDown({duration: .2,delay: .3});
			title_obj.morph('background: #415358;color: #ffffff;',{duration: .3});
		}else{
			opened_obj = false;
			opened_title_obj = false;
		}
	}
}

function load_request(url,obj){
	var code_block = obj.up().next();
	code_block.value = "Sending Request...";
	new Ajax.Request(url,{
		onSuccess: function(t){
			code_block.value = t.responseText;
		}
	});
}

function show_div(obj){
	$('methods').blindUp({duration: .2});
	$('welcome').blindUp({duration: .2});
	$$('.docs').each(function(s){if(s.style.display == 'block'){s.fade({duration: .3});}});
	$(obj).appear({delay: .4,afterFinish: function(){$(obj).setStyle('display: block;');}});
}

nav = {
	show: function(className){
		$$('.wrap').each(function(s){s.setStyle('display: none;');});
		$$('.'+className+'_wrap').each(function(s){s.appear();});
	}
}

function toggle_methods(){
	if($('methods').style.display=='none'){
		$('methods').blindDown({duration: .3});
	}else{
		$('methods').blindUp({duration: .2});
	}
}

window.onload = function(){
	$$('.toggle_bar').each(function(a){
		a.onclick = function(){
			acc.show(a,a.next());
		}
	});
	$$('.docs').each(function(s){
		s.setStyle('display: none');
	});
}

