$(function(){
	$.ajax({
		url: './xml/lightlinks.xml',
		type: 'GET',
		dataType: 'xml',
		timeout: 2000,
		error: function(){
			$('<div>').text('XML Load Error.').appendTo("#lightlink")
		},
		success: function(xml){
			$(xml).find("category").each(function(){
				var category_title = $(this).attr("value");
			
				$('<div class="caption"></div>')
				.html(category_title)
				.appendTo("#lightlink");
				$(this).find("link").each(function(){
					var link_title =  $(this).attr("title");
					var link_url =  $(this).attr("href");
					var link_banner = $($(this).find("banner")).attr("src");
					$('<div><a href="'+ link_url +'" title="' + link_title + '" target="_blank"><img src="' + link_banner + '" /></a></div>').appendTo("#lightlink");
				});
			
			});
			
	//	$("li.demo").html("");
		}
	});
});
/*
htmlLoding = function(docUrl, app){
	$.ajax({
		url: docUrl,
		type: 'GET',
		dataType: 'html',
		timeout: 2000,
		error: function(){
			$('<div>').text('XML Load Error.').appendTo(app)
		},
		success: function(doc){
			var h3  = $(doc).find('h3'),
			    div = $(doc).find('h3').next('div'),
			    i   = 0;

			$(h3).each(function(){
				$(app).append(h3[i]);
				$(app).append(div[i]);
				if(i>0){
					$(this).next('div').hide();
				}
				$(this).click(function(){
					$(this).next('div').slideToggle();
				});
				i+=1;
			}).css('cursor', 'pointer');
		}
	});
};
	*/

