/**
 *
 * Copyright (c) 2002-2004 Bluetetra Software.  All rights reserved.
 *
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL BLUETETRA SOFTWARE BE LIABLE FOR 
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *  
 * http://www.bluetetra.com
 *
 */

var target = "content";
var tiFileName = "typeTreeIndex.htm";
var nsFilterFileName = "nsFilter.htm";

function TN (href, prefix, ns, name, relation, simpletypeflag, children) {
	this.href = href;
	this.prefix = prefix;
	this.namespace = ns;
	this.name = name;
	this.relation = relation;
	this.simpletypeflag = simpletypeflag;
	this.children = children;

	this.hasChild = (children != null) && (children.length>0);	
}

function T (typeTree)
{
	this.typeTree = typeTree;
}

function typetree_showAllTypes() {
	parent._nsFilter = null;
	parent.componentIndex.location.href= tiFileName;
}

function typetree_filterTypes () {
	parent._href = tiFileName;
	window.open(nsFilterFileName, "_blank", 
		"height=200,width=400,location=no,menubar=no,scrollbars=yes,status=yes,resizable=yes,toolbar=no");
}

function typetree_showTypes() {
	if (parent._nsFilter == null) {
		typetree_setFilterToAll();
	}

	var nsList = parent._nsFilter;
	var typetrees = new Array();
	var nss = new Array();

	for (var i=0; i<nsList.length; i++) {
		typetrees [i] = typetreeDB [nsList[i]];	
		nss[i] = nsList[i];
	}		
	
	typetree_showTree (nss, typetrees); 
}

function typetree_setFilterToAll() {
	var nsList = new Array();
	var i = 0;

	for (var ns in typetreeDB) {
		nsList[i] = ns; 		
		i++;
	}

	parent._nsFilter = nsList;
}


function typetree_showTree (nsList, typetrees) {
	for (var i=0; i<nsList.length; i++) {
		var fpath = typetreeNSMap[nsList[i]];
		
		var str = '<div class="nsBox"><div class="itemNS">'+
			'<nobr><img style="cursor: pointer" src="img/minus.gif" hspace="2" align="middle" onclick="IClick(this)">'+
			'<a class="chref" href="'+fpath+
			'" title="'+encodeURI(nsList[i])+
			'" target="'+target+'">'+encodeURI(nsList[i])+'</a></nobr></div>'+
			'<div style="margin-left: 0.5em">';		

		document.write (str);

		typetree_outputList (typetrees[i].typeTree);
		

		document.write ('</div></div>');
	}
} 

function typetree_outputList (list) {
	for (var i=0; i<list.length; i++) {
		typetree_outputTree (list[i]);
	}
}

function typetree_outputTree (node) {
	if (node.hasChild == false) {
		typetree_outputLeaf (node);
	} else {
		typetree_outputNonLeaf (node);
	}
}


function typetree_outputLeaf (node) {
	var str = null;
	var nodeStr = null;

	if (node.prefix.length>0) {
		nodeStr = prefixedAnchorString(node)
	} else {
		nodeStr = anchorString (node)
	}

	str = '<span class="leaf"><nobr>' +
		  '<img src="img/leaf.gif" hspace="2" align="middle">' + 
		  nodeStr + '</nobr></span><br />';

	document.write (str);
}

function prefixedAnchorString (node) {
	return  '<a class="chref" href="'+node.href+
			'" target="'+target+ '"'+
			' title="ns=' + encodeURI(node.namespace)+'">'+
			node.prefix+':'+'</a>'+
			'<a class="chref" href="'+node.href+'" target="'+target+ '"'+
			' title="ns=' + encodeURI(node.namespace)+'">'+ node.name +
			'</a>'+typetree_getNodeIcon(node);
}

function anchorString (node) {
	return 	'<a class="chref" href="'+node.href+'" target="'+target+'"'+
			' title="ns=' + encodeURI(node.namespace)+'">'+ node.name +
			'</a>'+typetree_getNodeIcon(node);

}

function typetree_outputNonLeaf (node) {
	var str = null;
	var nodeStr = null;

	if (node.prefix.length>0) {
		nodeStr = prefixedAnchorString(node);
	} else {
		nodeStr = anchorString (node);
	}
		
	str = '<div><div class="nonleaf">'+
			'<nobr><img style="cursor: pointer" src="img/minus.gif" hspace="2" align="middle" onclick="IClick(this)">'+
			nodeStr +
			'</nobr></div>'+
			'<div style="margin-left: 0.8em">';

	document.write (str);

	var childs = node.children;
	for (var i=0; i<childs.length; i++) {
		typetree_outputTree (childs[i]);
	}					

	document.write ('</div></div>');
}

function typetree_getNodeIcon(node) {
	var rStr = null;
	if (node.relation == "none") {
		rStr = "";
	} else if (node.relation == "extension") {
		rStr = '<img alt="derived by extension" border="0" hspace="2" align="middle" src="img/extension.gif">';
	
	} else if (node.relation == "restriction") {
		rStr = '<img alt="derived by restriction" border="0" hspace="2" align="middle" src="img/restriction.gif">';
	
	} else if (node.relation == "list") {
		rStr = '<img alt="derived by list" border="0" hspace="2" align="middle" src="img/list.gif">';
	
	} else if (node.relation == "union") {
		rStr = '<img alt="derived by union" border="0" hspace="2" align="middle" src="img/union.gif">';
	
	}
	
	var typeStr = null;
	
	if (node.simpletypeflag) {
		typeStr = '<img alt="simple type" border="0" hspace="2" align="middle" src="img/simple.gif">'; 
	} else {
		typeStr = '<img alt="complex type" border="0" hspace="2" align="middle" src="img/complex.gif">';	
	} 

	return typeStr + rStr;
}

var typetreeDB = new Array();
var typetreeNSMap = new Array();

typetreeDB ["http://www.w3.org/2003/06/wsdl"] =  new T (new Array (new TN("http___www_w3_org_2003_06_wsdl/complextype/Documentation.htm#complexTypeDefinition_Documentation","","http://www.w3.org/2003/06/wsdl","Documentation","none",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/Documented.htm#complexTypeDefinition_Documented","wsdl","http://www.w3.org/2003/06/wsdl","Documented","none",false,new Array(new TN("http___www_w3_org_2003_06_wsdl/complextype/ExtensibleDocumented.htm#complexTypeDefinition_ExtensibleDocumented","wsdl","http://www.w3.org/2003/06/wsdl","ExtensibleDocumented","restriction",false,new Array(new TN("http___www_w3_org_2003_06_wsdl/complextype/Binding.htm#complexTypeDefinition_Binding","","http://www.w3.org/2003/06/wsdl","Binding","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/BindingOperation.htm#complexTypeDefinition_BindingOperation","","http://www.w3.org/2003/06/wsdl","BindingOperation","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/BindingOperationFault.htm#complexTypeDefinition_BindingOperationFault","","http://www.w3.org/2003/06/wsdl","BindingOperationFault","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/BindingOperationMessage.htm#complexTypeDefinition_BindingOperationMessage","","http://www.w3.org/2003/06/wsdl","BindingOperationMessage","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/Definitions.htm#complexTypeDefinition_Definitions","","http://www.w3.org/2003/06/wsdl","Definitions","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/Endpoint.htm#complexTypeDefinition_Endpoint","","http://www.w3.org/2003/06/wsdl","Endpoint","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/Feature.htm#complexTypeDefinition_Feature","","http://www.w3.org/2003/06/wsdl","Feature","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/Import.htm#complexTypeDefinition_Import","","http://www.w3.org/2003/06/wsdl","Import","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/Include.htm#complexTypeDefinition_Include","","http://www.w3.org/2003/06/wsdl","Include","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/Interface.htm#complexTypeDefinition_Interface","","http://www.w3.org/2003/06/wsdl","Interface","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/InterfaceOperation.htm#complexTypeDefinition_InterfaceOperation","","http://www.w3.org/2003/06/wsdl","InterfaceOperation","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/Message.htm#complexTypeDefinition_Message","","http://www.w3.org/2003/06/wsdl","Message","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/MessageRef.htm#complexTypeDefinition_MessageRef","","http://www.w3.org/2003/06/wsdl","MessageRef","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/MessageRefFault.htm#complexTypeDefinition_MessageRefFault","","http://www.w3.org/2003/06/wsdl","MessageRefFault","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/Part.htm#complexTypeDefinition_Part","","http://www.w3.org/2003/06/wsdl","Part","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/Property.htm#complexTypeDefinition_Property","","http://www.w3.org/2003/06/wsdl","Property","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/Service.htm#complexTypeDefinition_Service","","http://www.w3.org/2003/06/wsdl","Service","extension",false,null),new TN("http___www_w3_org_2003_06_wsdl/complextype/Types.htm#complexTypeDefinition_Types","","http://www.w3.org/2003/06/wsdl","Types","extension",false,null))))),new TN("http___www_w3_org_2003_06_wsdl/complextype/ExtensibilityElement.htm#complexTypeDefinition_ExtensibilityElement","","http://www.w3.org/2003/06/wsdl","ExtensibilityElement","none",false,null)));
typetreeNSMap ["http://www.w3.org/2003/06/wsdl"] = "http___www_w3_org_2003_06_wsdl/index.htm";
typetreeDB ["http://www.w3.org/2003/06/wsdl/soap12"] =  new T (new Array (new TN("http___www_w3_org_2003_06_wsdl_soap12/complextype/addressType.htm#complexTypeDefinition_addressType","","http://www.w3.org/2003/06/wsdl/soap12","addressType","none",false,null),new TN("http___www_w3_org_2003_06_wsdl_soap12/complextype/bindingType.htm#complexTypeDefinition_bindingType","","http://www.w3.org/2003/06/wsdl/soap12","bindingType","none",false,null),new TN("http___www_w3_org_2003_06_wsdl_soap12/complextype/bodyType.htm#complexTypeDefinition_bodyType","","http://www.w3.org/2003/06/wsdl/soap12","bodyType","none",false,null),new TN("http___www_w3_org_2003_06_wsdl_soap12/complextype/faultType.htm#complexTypeDefinition_faultType","","http://www.w3.org/2003/06/wsdl/soap12","faultType","none",false,null),new TN("http___www_w3_org_2003_06_wsdl_soap12/complextype/headerfaultType.htm#complexTypeDefinition_headerfaultType","","http://www.w3.org/2003/06/wsdl/soap12","headerfaultType","none",false,null),new TN("http___www_w3_org_2003_06_wsdl_soap12/complextype/headerType.htm#complexTypeDefinition_headerType","","http://www.w3.org/2003/06/wsdl/soap12","headerType","none",false,null),new TN("http___www_w3_org_2003_06_wsdl_soap12/complextype/moduleType.htm#complexTypeDefinition_moduleType","","http://www.w3.org/2003/06/wsdl/soap12","moduleType","none",false,null),new TN("http___www_w3_org_2003_06_wsdl_soap12/complextype/operationType.htm#complexTypeDefinition_operationType","","http://www.w3.org/2003/06/wsdl/soap12","operationType","none",false,null),new TN("http___www_w3_org_2003_06_wsdl_soap12/complextype/propertyConstraintType.htm#complexTypeDefinition_propertyConstraintType","","http://www.w3.org/2003/06/wsdl/soap12","propertyConstraintType","none",false,null),new TN("http://www.w3.org/TR/xmlschema-2/#string","xs","http://www.w3.org/2001/XMLSchema","string","none",true,new Array(new TN("http___www_w3_org_2003_06_wsdl_soap12/simpletype/styleChoice.htm#simpleTypeDefinition_styleChoice","","http://www.w3.org/2003/06/wsdl/soap12","styleChoice","restriction",true,null)))));
typetreeNSMap ["http://www.w3.org/2003/06/wsdl/soap12"] = "http___www_w3_org_2003_06_wsdl_soap12/index.htm";
								   



