function jSiteMap (id, expandLinkID, collapseLinkID, urls) {

	this.tree = new YAHOO.widget.TreeView(id);
    this.expandLinkID = expandLinkID;
    this.collapseLinkID = collapseLinkID;
        
    this.buildBranch = function(parentNode, urlList){
    	for(var i = 0; i < urlList.length; i++){
    		var newNode = new YAHOO.widget.TextNode(urlList[i].title, parentNode, false);	
    		newNode.url = urlList[i].url;
    		
    		if(undefined != urlList[i].subnav){
    			this.buildBranch(newNode, urlList[i].subnav);
    		}
    		
    	}
    };
    
    this.expandTree = function(evt){
    	this.tree.expandAll();
    	YAHOO.util.Event.preventDefault(evt);
    };
    
    this.collapseTree = function(evt){
    	this.tree.collapseAll();
    	YAHOO.util.Event.preventDefault(evt);
    };
    
    this.registerEvents = function(){
    	YAHOO.util.Event.on(this.expandLinkID, "click", this.expandTree, {}, this);
    	YAHOO.util.Event.on(this.collapseLinkID, "click", this.collapseTree, {}, this);
    };
    
    for(var property in urls){
		
		var branch = urls[property];
		
		var tmpNode = new YAHOO.widget.TextNode(urls[property], this.tree.getRoot(), false);
		tmpNode.url = null;
		
		if(branch['urls'].length > 0){
			this.buildBranch(tmpNode, branch['urls']);
		}
	}
    
    this.tree.draw();
    this.registerEvents();
       
    this.tree.subscribe("labelClick",function(node) {
    	var url = node.url;
    	if(null != url){
    		window.location = url;
    	}
    });
};