//
// Comportamientos especificas del sitio web
//



$(document).ready(function () {



//  show/hide questions&answers in step 2
$("div#question").css("display","none");
$("ul#basic-indice li a").click(function () { 

});

$("a#back-to-index").click(function () { 
      $("ul#basic-indice").css("display","block");
      $("div#question").css("display","none");
      $("div#seccion").css("overflow-y","auto");
});

$("a#back-to-index").click(function () { 
      $("ul#indice").css("display","block");
      $("div#question").css("display","none");
      $("div#seccion").css("overflow-y","auto");
});



//  show-hide-possible answers
			
$("div#posible-answers").css("display","none");
	$("a#show-answers").click(function () { 
      $("div#posible-answers").css("display","block");
      $("a#show-answers").css("display","none");
});			   
		
	$("a#hide-answers").click(function () { 
      $("div#posible-answers").css("display","none");
      $("a#show-answers").css("display","block");
});		



//accordion

		$('ul').accordion();					   
	var hash = window.location.hash.substr(1);
	var href = $('#contenido #cambia ul li a').each(function(){
		var href = $(this).attr('href');
		if(hash==href.substr(0,href.length-5)){
			var toLoad = hash+'.html #contenido';
			$('#contenido-externo').load(toLoad)
		}											
	});

	$('#contenido #cambia ul li a').click(function(){
								  
		var toLoad = $(this).attr('href')+' #contenido';
		$('#contenido-externo').hide('fast',loadContent);
		$('#load').remove();
		$('#contenido').append('<span id="load">Cargando contenido...</span>');
		$('#load').fadeIn('normal');
		window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
		function loadContent() {
			$('#contenido-externo').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#contenido-externo').show('normal',hideLoader());
		}
		function hideLoader() {
			$('#load').fadeOut('normal');
		}
		return false;
		


	});
	

	
});



