jQuery(document).ready(function() {
    // splashimage / ajax request
    $.get("php_functions/splash-image.xml.php", function(xml) {
      	// format and output result
      	/*
      	$("#splashimage").html(
         	"filename: " +
         	$("filename", xml).text() +
         	" title: " +
         	$("title", xml).text()
      	);
      	*/
      	$("#splashimage")
    		.attr('src', "images/"+$("filename", xml).text())
    		.attr('alt', $("title", xml).text())
      	;
		if($("page", xml) && $("page", xml).text()) {
			if($("newWin", xml) && $("newWin", xml).text()>0)
				target='_blank';
			else
				target='_self';
			$("#splashimage").wrap('<a href="'+$("page", xml).text()+'" target="'+target+'" />');
		}
    });   
     
	// projects / get random
	//loadProjects(6);
     
	// projects / get all
	loadProjects('all');
});
 
// projects / ajax request
function loadProjects(num) { 
	$("#projectlist").html('<img src="images/loading.gif" alt="loading" border="0">');
	
	$.post("php_functions/projects.html.php", { num: num, req: 'ajax' }, function(data) {
    	//alert("Data Loaded");

    	// format and output result
    	$("#projectlist").html(data);
    }); 
}
