function init(xml,color) {
	$.ajax({
		type: "GET",
		url: "../xml/" + xml + ".xml",
		dataType: "xml",
		success: function(xmlData) {
			xmlDataSet = xmlData;
			browseXML(xml,color);
			// segment(xml);
			var header = "";
			var movie = "";
			var copy = "";
			$(xmlDataSet).find('item').each(function(i){
				title = $('title:eq(0)', xmlDataSet).text();
				movie = $('movie:eq(0)',xmlDataSet).text()
				copy = $('copy:eq(0)',xmlDataSet).text()
				setTimeout(function () {
					$('#video-column h4').empty().append(title);
					$('#video-column p').empty().append(copy);
				}, 500);
			});
			$('#clip').media({
				width: 320, 
				height: 260, 
				src: '../fla/flvplayer.swf?file=../flv/' + movie + '.flv'
			}); 		
			setTimeout("$('#clipDesc').fadeIn('slow')", 500);
		}
	});
	$('#selectmenu select').change(function() {
		var segment = $(this).val();
		document.location.href = "../" + segment + "/";
	});
}
function loadClip(num) {
	$('#clip').hide();
	$('#clipDesc').fadeOut();
	var header = $('#title' + num).text();
	var movie = $('#movie' + num).text();
	var copy = $('#copy' + num).text();
	var link = $('#link' + num).text();
	// alert(link);
	var linkURL = $('#linkURL' + num).text();
	var linkText = $('#linkText' + num).text();
	if (link == 'y') {
		thislink = "<a href=\"" + linkURL + "\">" + linkText + "</a>";
	}
	setTimeout(function () {
		$('#video-column h4').empty().append(header);
		$('#video-column p').empty().append(copy);
		if (link == 'y') {
			$('#video-column li').empty().append(thislink);
			} else {
			$('#video-column li').empty();
		}
		$('#clip').show();
	}, 500);
	$('#clip').media({
		width: 320, 
		height: 260, 
		src: '../fla/flvplayer.swf?file=../flv/' + movie + '.flv'
	}); 		
	setTimeout("$('#clipDesc').fadeIn('slow')", 500);
}
function browseXML(xml,color) {
	switch(xml) {
		case 'topvideos':
			node = 'tv';
		break;
		case 'lightersideh': // lighterside for home page (blue backgrounds)
			node = 'lsh';
		break;
		case 'coverstory':
			node = 'cv';
		break;
		case 'lighterside':
			node = 'ls';
		break;
		case 'portraits':
			node = 'po';
		break;
		case 'conversations':
			node = 'cs';
		break;
		case 'travelogue':
			node = 'tr';
		break;
		case 'sessions': // should be same for home page
			node = 'se';
		break;
		case 'impressions':
			node = 'im';
		break;
		case 'myatlanta':
			node = 'ma';
		break;
		case 'roots':
			node = 'ro';
		break;
		case 'inthekitchen':
			node = 'ik';
		break;
		case 'moneymatters':
			node = 'mm';
		break;
		case 'pathfinders':
			node = 'pf';
		break;
	}
	// alert(node);
	var color = color;
	var clipList = "";
	var alt = "";
	clipList += "<ol>";
	$(xmlDataSet).find("item").each(function(i) {
		i % 2 == 0 ? alt = " class=\"alt\"" : alt = "";
		i % 2 == 0 ? thumb = "-alt" : thumb = "";
		clipList += "<li" + alt + "><a href=\"#\" onclick=\"loadClip('" + i + "');return false;\"><img src=\"../thumbs/videothumb_" + node + "_" + (i+1) + ".gif\" width=\"75\" height=\"60\" alt=\"[movie]\"/></a>";
		// clipList += "<li" + alt + "><a href=\"#\" onclick=\"loadClip('" + i + "');return false;\"><img src=\"../imgs/vidthumb_" + color + thumb + ".gif\" width=\"75\" height=\"60\" alt=\"[movie]\"/></a>";
		clipList += "<span id=\"title" + i + "\"><a href=\"#\" onclick=\"loadClip('" + i + "');return false;\">" + $("title:eq(" + i + ")",xmlDataSet).text()  + "</a></span><br />";
		clipList += "<span id=\"movie" + i + "\"class=\"fragment\">" + $("movie:eq(" + i + ")",xmlDataSet).text() + "</span>";
		clipList += "<span id=\"length" + i + "\">| " + $("length:eq(" + i + ")",xmlDataSet).text() + " |</span>";
		clipList += "<span id=\"copy" + i + "\" class=\"fragment\">" + $("copy:eq(" + i + ")",xmlDataSet).text() + "</span>";
		if ($("link:eq(" + i + ")",xmlDataSet).text() == 'y') {
			clipList += "<span id=\"link" + i + "\" class=\"fragment\">" + $("link:eq(" + i + ")",xmlDataSet).text() + "</span>";
			clipList += "<span id=\"linkURL" + i + "\" class=\"fragment\">" + $("linkurl:eq(" + i + ")",xmlDataSet).text() + "</span>";
			clipList += "<span id=\"linkText" + i + "\" class=\"fragment\">" + $("linktext:eq(" + i + ")",xmlDataSet).text() + "</span>";
		}
		clipList += "</li>";
	});
	clipList += "</ol>";
	$("#xmlClips").html(clipList);
}
