dojo.addOnLoad(function() {
	
	var videoCoords = dojo.coords("uploadVideo", true);
	var photoCoords = dojo.coords("uploadPhoto", true);
	var emoCoords = dojo.coords("uploadEmotions", true);
	
	dojo.addClass(dojo.body(), "tundra");
	
	dojo.connect(dojo.byId("uploadVideo"), "onclick", function(e){
		e.preventDefault();
	});
	
	dojo.connect(dojo.byId("uploadPhoto"), "onclick", function(e){
		e.preventDefault();
	});
	
	dojo.connect(dojo.byId("uploadEvents"), "onclick", function(e){
		e.preventDefault();
	});
	
	dojo.connect(dojo.byId("uploadEmotions"), "onclick", function(e){
		e.preventDefault();
	});
	
	dojo.connect(dojo.body(), "onclick", function(e){
		if(e.target.id == "uploadEmotions" || dojo.isDescendant(e.target, "shoutboxUploadEmotions")){
			dojo.style("shoutboxUploadEmotions", {
				"left": emoCoords.x + 'px',
				"top": (emoCoords.y + 20) + 'px',
				"display": "block"
			});
		}else{
			dojo.byId("shoutboxUploadEmotions").style.display = "none";
		}
		
		if(e.target.id == "uploadVideo" || dojo.isDescendant(e.target, "shoutboxUploadVideo")){
			dojo.style("shoutboxUploadVideo", {
				"left": videoCoords.x + 'px',
				"top": (videoCoords.y + 20) + 'px',
				"display": "block"
			});
		}else{
			dojo.byId("shoutboxUploadVideo").style.display = "none";
		}
		
		if(e.target.id == "uploadPhoto" || dojo.isDescendant(e.target, "shoutboxUploadPhoto")){
			dojo.style("shoutboxUploadPhoto", {
				"left": photoCoords.x + 'px',
				"top": (photoCoords.y + 20) + 'px',
				"display": "block"
			});
		}else{
			dojo.byId("shoutboxUploadPhoto").style.display = "none";
		}
	});
});
