// JavaScript Document

function Projects(root)
{
	this.Directory = new Array();
	this.ProjectList = new Array();
	this.DefaultIndex = 0 ;
	this.ProjectMap = new Array();//new Object();
	
    if (root.nodeName == "projects")
    {
        var elems = ChildElements (root, "project");
        for (var i = 0; i < elems.length; i++)
        {
            this.ProjectList[i] = new Project (elems[i]);
						this.Directory[i] =this.ProjectList[i].Title;
						this.ProjectMap[this.ProjectList[i].Title]=i;
						if(ElementAttribute (elems[i], "default")=="true"){
							this.DefaultIndex = i ;
						}
        }
    }
}
Projects.prototype.Directory;
Projects.prototype.ProjectList;
Projects.prototype.ProjectMap;
Projects.prototype.DefaultIndex;


function Project (projectNode)
{
    if (projectNode.nodeName == "project")
    {
        // Called with a xmlNode argument.
    
        this.Title   = ElementAttribute (projectNode, "title");
		
        this.Displays = new Array ();
        
        var elem = ChildElements (arguments[0], "display");
        for (var i = 0; i < elem.length; i++)
        {
            this.Displays[i] = new Display (elem[i]);
        }
    }
}
Project.prototype.Title;
Project.prototype.Displays;


function Display()
{
    
    if (arguments.length == 1) {
        this.Type = ElementAttribute(arguments[0], "type");
        
        // Incase this.Type == "movie" we should get values for MovieSRC and MoviePreviewIMG here.
        
        this.MovieSRC = ChildElementAttribute(arguments[0], "movie", "stream");
        this.MoviePreviewIMG = ChildElementAttribute(arguments[0], "movie", "previewIMG");
        
        // Incase this.Type == "image" we should get values for ImageSRC
        
        this.ImageSRC = ChildElementAttribute(arguments[0], "image", "src");
        this.ImageSRCBig = ChildElementAttribute(arguments[0], "imageBig", "src");
//        this.Labels = new Array();
//        
//        var elem = ChildElements(arguments[0], "label");
//        
//        for (var i = 0; i < elem.length; i++) {
//            this.Labels[i] = new Label(elem[i]);
//        }
    }
}
Display.prototype.Type;
Display.prototype.MovieSRC;
Display.prototype.MoviePreviewIMG;
Display.prototype.ImageSRC;
Display.prototype.ImageSRCBig;
Display.prototype.Labels;

function Label()
{    
    if (arguments.length == 1) {
        this.Title = ElementAttribute(arguments[0], "title");
        this.Label = ElementAttribute(arguments[0], "label");
		this.Text =	 ElementAttribute(arguments[0],"text");
    }
}
Label.prototype.Title;
Label.prototype.Label;
Label.prototype.Text;



