// -------------------------------------
// KNOWLEDGE RESOURCE DISPLAY CONTROLLER
// -------------------------------------
// Copyright (c) 2003 The Salamander Organization Ltd.  All Rights Reserved.
//
// THIS WORK IS SUBJECT TO U.K. AND INTERNATIONAL COPYRIGHT LAWS AND TREATIES.
//
// DISCLAIMER:
//
// The Salamander Organization Ltd. (hereto referred as "Salamander") makes no representations or warranties
// with respect to the contents or use of this code, and specifically disclaims any express or implied
// warranties of merchantability or fitness for any particular purpose.  Further, Salamander reserves the right
// to revise this publication and to make changes to its content, at any time, without obligation to notify any
// person or entity of such revisions or changes.
//
// Further, Salamander makes no representations or warranties with respect to any software, and specifically
// disclaims any express or implied warranties of merchantability or fitness for any particular purpose.  Salamander
// reserves the right to make changes to any and all parts of the software, at any time, without obligation to notify
// any person or entity of such changes.
//
// Inclusion of the above notice does not necessarily imply publication.



// layout the entire KR section
function LayoutKnowledgeResourceArea(resourceSection)
{
	var navLinkStructure = resourceSection;
						   
	return navLinkStructure;
}

// layout the category header
// requires:
// Category Name, Category Array ID, Resource Count
function LayoutKnowledgeResourceCategory(categoryText, catCount, resCount)
{
	var categoryOutput  = '<table cellSpacing="0" cellPadding="0" width="100%" align="left" border="0">\n' +
						  '<tr height="19" id="catrow' + catCount + '"\n' +
						  '    title="Click here to hide resources for this category" style="cursor:hand;" valign="top">\n' +
						  '    <a style="cursor:hand" onClick="ToggleCategory(\'' + catCount + '\', \'' + resCount + '\')">\n' +
						  '    <td width="16">\n' +
						  '        <img id="catimg' + catCount + '" name="minus" src="../../Images/minus.gif" />\n' +
						  '    </td>\n' +
						  '    <td id="catcell' + catCount + '" name="opened" width="20"\n' +
						  '        background="../../Images/treeline.gif" style="background-repeat:repeat-y;">\n' +
						  '        <img src="../../Images/catfolder.gif" />\n' +
						  '    </td>\n' +
						  '    <td style="padding-left:3px;">\n' +
						  '        <span class="krCategory">' + categoryText + '</span>\n' +
						  '    </td>\n' +
						  '    </a>\n' +
						  '</tr>\n';

	return categoryOutput;
}

// layout each knowledge resource link
// requires:
// Resource ID, Resource Name, Resource URL, Resource Image Source, Resource Image Description, Resource Tooltip, Type of Branch
function LayoutKnowledgeResourceLinks(resID, resName, resLink, resImageSrc, resImageDescription, resTooltip, branchImageType)
{
	// if this is the last resource, then use the end branch image, else use the mid branch image
	if (branchImageType == "branch")
	{
		var resTreeImage = '<td width="20" style="background-image:url(../../Images/treeline.gif);background-repeat:no-repeat;">\n' +
						   '    <img src="../../Images/' + branchImageType + '.gif" align="middle" style="margin-top:1px;" border="0" />\n' +
						   '</td>\n';
	} 
	else
	{
		var resTreeImage = '<td width="20" style="background-image:url(../../Images/treeline.gif);background-repeat:repeat-y;">\n' +
						   '    <img src="../../Images/' + branchImageType + '.gif" align="middle" border="0" />\n' +
						   '</td>\n';
	}

	// the layout for navigation links
	var resLinkLayout = '            <tr height="22" id="' + resID + '" style="display:block" valign="top">\n' +
						'                <td width="16">\n' +
						'                </td>\n' +
						resTreeImage +
						'                <td width="*">\n' +
						'                    <table width="100%" border="0" cellspacing="0" cellpadding="0">\n' +
						'                        <tr valign="top">\n' +
						'                            <td width="20">\n' +
						'                                <a class="krResource" title="' + resTooltip + '" href="' + resLink + '">\n' +
						'                                <img align="middle" border="0" alt="' + resImageDescription + '" \n' +
						'                                     src="' + resImageSrc + '" />\n' +
						'                                </a>\n' +
						'                            </td>\n' +
						'                            <td style="padding-left:3px;">\n' +
						'                                <a class="krResource" title="' + resTooltip + '" \n' +
						'                                   href="' + resLink + '">' + resName + '</a>\n' +
						'                            </td>\n' +
						'                        </tr>\n' +
						'                    </table>\n' +
						'                </td>\n' +
						'            </tr>\n';

	return resLinkLayout;
}

// layout the header for knowledge resource links section
function LayoutKnowledgeResourceLinksHeader()
{
	var resHeader = '';
	
	return resHeader;
}

// layout the footer for knowledge resource links section (including the end of the category)
function LayoutKnowledgeResourceLinksFooter()
{
	var resFooter = '</table>\n' +
					'<br clear="all" />\n\n';
	
	return resFooter;
}