$(document).ready(function(){
	$("#navigation li ul").fadeOut("600");
	$("#navigation li").hover(
		function(){$("ul", this).animate({height: "show"}, 400);},
		function(){$("ul", this).animate({height: "hide"}, 500);}
	);
  	if (document.all) {
		$("#navigation li").hoverClass("dropmenu");
	}
});

$.fn.hoverClass = function(c) {
	return this.each(function() {
		$(this).hover(
			function() {$(this).addClass(c);},
			function() {$(this).removeClass(c);}
		);
	});
};

$(document).ready( function() {
  $(".nav li a").mouseover( function() {
    $(this).animate({backgroundColor: "#c7cb7b", color: "#4d5a11"}, {queue:false, duration: 150 });
  }).mouseout( function() {
    $(this).animate({backgroundColor: "#4d5a11", color: "#fff"}, {queue:false, duration: 150});
  });
  $(".nav li ul li a").mouseover( function() {
    $(this).animate({backgroundColor: "#c7cb7b", color: "#4d5a11"}, {queue:false, duration: 150 });
  }).mouseout( function() {
    $(this).animate({backgroundColor: "#9bb000", color: "#fff"}, {queue:false, duration: 150});
  });
  $(".links a.maplink, .links a.contactlink, .links a.homelink").mouseover( function() {
    $(this).animate({color: "#535c28"}, {queue:false, duration: 300 });
  }).mouseout( function() {
    $(this).animate({color: "#fff"}, {queue:false, duration: 300});
  });
});


function show_loading() {
  document.getElementById('div_content').innerHTML = '<img src="images/loading.gif" style="padding-left: 200px; padding-top: 110px"><p style="text-align: center">Laden...</p>';
}

function content_callback(resp) {
  document.getElementById('div_content').innerHTML = resp;
  str = document.getElementById('div_page_title').innerHTML;
  if (str != '') {
    document.title = 'Rendezvous Training | '+str;
  } else {
    document.title = 'Rendezvous Training';
  }
}


function changebg(category_id, subpage_id) {	$(".background:visible").animate({opacity: "hide"}, 1000);
	if (category_id == 1) { element = 'homebg'; document.getElementById('flashtitle').style.background = 'url(../images/flashtitle_home.jpg) no-repeat bottom';}
	else if (category_id == 2) { element = 'programmasbg'; document.getElementById('flashtitle').style.background = 'url(../images/flashtitle_programmas.jpg) no-repeat bottom';}
	else if (category_id == 3) { element = 'maatwerkbg'; document.getElementById('flashtitle').style.background = 'url(../images/flashtitle_maatwerk.jpg) no-repeat bottom';}
	else if (category_id == 4) { element = 'trainingbg'; document.getElementById('flashtitle').style.background = 'url(../images/flashtitle_rendezvous.jpg) no-repeat bottom';}
	else if (category_id == 5) { element = 'contactbg'; document.getElementById('flashtitle').style.background = 'url(../images/flashtitle_contact.jpg) no-repeat bottom';}
	else  { element = 'homebg'; document.getElementById('flashtitle').style.background = 'url(../images/flashtitle_home.jpg) no-repeat bottom';}
	$("#"+element).animate({opacity: "show"}, 1000);
	show_loading();
  ajaxObj.call('action=fetch_content&cat='+category_id+'&sub='+subpage_id, content_callback);
}


function set_url(url) {
  cur_url = window.location.href;
  cur_url = cur_url.replace(/#.*/, '');
  window.location.href = 'index.php'+url;
  url = url.replace(/#/, '');
  values = url.split(',');
  changebg(values[0], values[1]);
}
