/**
 * objects specific to animatography.
 */
var Animatography; if (!Animatography) Animatography = {};
if (!Animatography.Utils) Animatography.Utils = {};
if (!Animatography.Uploads) Animatography.Uploads = {};

if (!Animatography.Events) Animatography.Events = {};
Animatography.Events.SelectShow = PhotoClans.Events.defineEvent("onSelectShow", null, false);



Animatography.Events.ExpandMember = PhotoClans.Events.defineEvent("onExpandMember", {"currentExpanded" : ""}, false);
Animatography.Events.ExpandMember.expandMemberList = function(memberListId) {
	if (this.staticData.currentExpanded.length > 0) {
		Spry.$$("#" + this.staticData.currentExpanded).removeClassName("ShowMemberList-expanded");
	}
	this.staticData.currentExpanded = memberListId;
	Spry.$$("#" + memberListId).addClassName("ShowMemberList-expanded");
	this.fire(memberListId);
}

Animatography.Show = function() {
	
};

Animatography.Utils.runShow = function (divContentId, frmContentId, w,h, showId, showTitle) {
	// "contentDiv","contentFrame",',$showPageWidth,',',$showPageHeight,',"',@xml:id,'"
	var divContent = document.getElementById(divContentId);
	var frmContent = document.getElementById(frmContentId);
	cW = w + "px";
	cH = h + "px";
	if (divContent) {
		divContent.style.width = cW;
		divContent.style.height = cH;
	} else alert("no div?");
	if (frmContent) {
		frmContent.style.width = cW;
		frmContent.style.height = cH;
	}
	else alert("no frame?");

	Animatography.Events.SelectShow.fire({"showId": showId, "title" : showTitle});
	return true;
}

Animatography.Utils.selectShow = function (divContentId, frmContentId, w,h) {
	// set direct link
	var linkdiv = document.getElementById("linkDiv");
	if (linkdiv) {
		linkdiv.innerHTML
	}
	// size the frame for viewing
	return Animatography.Utils.runShow(divContentId, frmContentId, w,h);
}

Animatography.Uploads.validateUpload = function(theForm) {
	var formValid = true;
	var errStr = "";
	
	var title    = theForm.elements["showtitle"].value;
	var showlink    = theForm.elements["showlink"].value;
	var showdesc    = theForm.elements["showdescription"].value;
	var showtype    = theForm.elements["showtype"].value;
	var showaspect    = theForm.elements["showaspect"].value;
	var downloadType    = theForm.elements["downloadType"].value;
	
	if (showlink.length < 5) {
		errStr += "You need a link of some sort so the system can download your show.\n";
		formValid = false;
	}
	
	if (downloadType == "") {
		errStr += "You need to indicate where the system will find your file (download type).\n";
		formValid = false;
	}
	
	if (title.length < 5) {
		errStr += "Your show needs a title.\n";
		formValid = false;
	}
	
	if (showdesc.length < 5) {
		errStr += "You should tells us a little about your show, fill out the show description field\n";
		formValid = false;
	}
	
	if (showaspect == "") {
		errStr += "You need to set the aspect (frame ratio) of your show.\n";
		formValid = false;
	}
	
	if (showtype == "") {
		errStr += "You need to indicate what type of file you are using for your show video (Show Type).\n";
		formValid = false;
	}
	
	if (errStr.length > 0) {
		alert("There are some issues with your information:\n" + errStr);
	}
	return formValid;
}

