$(document).ready(function() {
	

  // Hide all menu
  $('.acc_container').hide();

  // Find the parrent div id for the active a 
  var $v = $('#navi h2').next().find('.active').parent().parent().attr('id');
    
  // If the parent does not exist, set it to 0 to open the first menu 
  if ( ! $v ){
  	var $v="z0";
  }
  
  // Div to open will have the same name with out the z
  $v.replace(/z/i, "");
  $('#' + $v).addClass('active').next().show();
  $('#' + $v).slideDown();

  

  //On Click
	$('.acc_trigger').click(function(){
	  
		if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
			$('.acc_trigger').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
			$(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
		}
		return false; //Prevent the browser jump to the link anchor
	}); 


	

  if ($('#top_informations').length){
	  setTimeout(function() { $('#top_informations').hide("fold", {}, 1000); } , 20000);
	}
  
	$('#question_answer').hide();
	var $info_ori = $("div#extra_add h4").html();
	
	
	
	$("#line2_a").click(function() {
		 $('html').load("http://www.bealondoner.com");
		 url = "http://www.bealondoner.com/";
		 window.location.replace(url);
		 //window.location(url);

	
	});
	
	$("input").click(function() {
	   	if ( $(this).attr('id') != "null" && $(this).attr('id') != "submit_question") {
		 		$('#question_answer').show(300);
	   		var $parent_id = $(this).attr('name');
     		var $div_id = $(this).attr('id');
     		var $info_tmp = $("#" + $parent_id ).html();
     		var $info = $info_tmp.replace(/<p>|<\/p>/gi, "");
	   		$('#parent_id').val($parent_id);
     		var $tmp = "Answer to " + $div_id + " :";
     		$("div#extra_add h4").text($tmp);
     		$("#question_2").text($info);
     		$('html, body').animate({ scrollTop: $("#submit_question").offset().top}, 1200);
    	}
     
 	});
 	

	$("button").click(function() {
		
 	   $("div#extra_add h4").text($info_ori);
     $('#parent_id').val("");
     $('#question_answer').hide(800);
  });


  $('abbr').tooltip({ 
    track: true, 
    delay: 0, 
    showURL: false, 
    showBody: " - ", 
    extraClass: "pretty", 
    fixPNG: true, 
    opacity: 0.95, 
    left: 0,
    top: 30
	});








});

