// topnav
$(document).ready(function(){
		$.ajax({
				type: "GET",
				url: "xml/topnav.xml",
				dataType: "xml",
				success: function(xml) {
						$(xml).find('menu1').each(function(){
								var toptitle = $(this).attr('title');
								var topurl = $(this).attr('url');
								$('<a class="top" href="'+topurl+'"></a>').html('<span>'+toptitle+'</span>').prependTo('#menu1');
								$(this).find('child').each(function(){
										var childurl = $(this).attr('url');
										var childtitle = $(this).text();
										$('<li></li>').html('<a href="'+childurl+'">'+childtitle+'</a>').appendTo('#menu1 ul.dropdown');
								});
						});
						$(xml).find('menu2').each(function(){
								var toptitle = $(this).attr('title');
								var topurl = $(this).attr('url');
								$('<a class="top" href="'+topurl+'"></a>').html('<span>'+toptitle+'</span>').prependTo('#menu2');
								$(this).find('child').each(function(){
										var childurl = $(this).attr('url');
										var childtitle = $(this).text();
										$('<li></li>').html('<a href="'+childurl+'">'+childtitle+'</a>').appendTo('#menu2 ul.dropdown');
								});
						});
						$(xml).find('menu3').each(function(){
								var toptitle = $(this).attr('title');
								var topurl = $(this).attr('url');
								$('<a class="top" href="'+topurl+'"></a>').html('<span>'+toptitle+'</span>').prependTo('#menu3');
								$(this).find('child').each(function(){
										var childurl = $(this).attr('url');
										var childtitle = $(this).text();
										$('<li></li>').html('<a href="'+childurl+'">'+childtitle+'</a>').appendTo('#menu3 ul.dropdown');
								});
						});
						$(xml).find('menu4').each(function(){
								var toptitle = $(this).attr('title');
								var topurl = $(this).attr('url');
								$('<a class="top" href="'+topurl+'"></a>').html('<span>'+toptitle+'</span>').prependTo('#menu4');
								$(this).find('child').each(function(){
										var childurl = $(this).attr('url');
										var childtitle = $(this).text();
										$('<li></li>').html('<a href="'+childurl+'">'+childtitle+'</a>').appendTo('#menu4 ul.dropdown');
								});
						});
						$(xml).find('menu5').each(function(){
								var toptitle = $(this).attr('title');
								var topurl = $(this).attr('url');
								$('<a class="top" href="'+topurl+'"></a>').html('<span>'+toptitle+'</span>').prependTo('#menu5');
								$(this).find('child').each(function(){
										var childurl = $(this).attr('url');
										var childtitle = $(this).text();
										$('<li></li>').html('<a href="'+childurl+'">'+childtitle+'</a>').appendTo('#menu5 ul.dropdown');
								});
						});
						$(xml).find('menu6').each(function(){
								var toptitle = $(this).attr('title');
								var topurl = $(this).attr('url');
								$('<a class="top" href="'+topurl+'"></a>').html('<span>'+toptitle+'</span>').prependTo('#menu6');
								$(this).find('child').each(function(){
										var childurl = $(this).attr('url');
										var childtitle = $(this).text();
										$('<li></li>').html('<a href="'+childurl+'">'+childtitle+'</a>').appendTo('#menu6 ul.dropdown');
								});
						});
				}
		});
		
		$("li.top").hover(
				function() { $('ul', this).slideDown('fast'); $('a.top', this).addClass('hover'); },
				function() { $('ul', this).slideUp('fast'); $('a.top', this).removeClass('hover'); }
		);
});
