<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	
	<xsl:output method="xml" indent="no"/>
	
	<xsl:include href="prc_th2_navigation.xsl"/>
	<xsl:include href="prc_th2_item_contentobject.xsl"/>
	<xsl:include href="prc_th2_item_course.xsl"/>
	<xsl:include href="prc_th2_item_resource.xsl"/>
	<xsl:include href="prc_th2_com_shell.xsl"/>

	
	<xsl:variable name="import"><xsl:value-of select="/page/@import"/></xsl:variable>

	<xsl:variable name="state">item</xsl:variable>
	
	<xsl:variable name="currentpage" select="/page/@id"/>
	
	<xsl:variable name="childsite" select="/page/*/@id"/>
	
	<xsl:variable name="parentsite" select="document(concat('pag_xml.php?id=', $currentpage))/page/@siteid"/>
	
	<xsl:variable name="currentpagename" select="document(concat('pag_xml.php?id=', $currentpage))/page/name"/>
	
	<xsl:variable name="contentpage" select="$currentpage"/>
	
	<xsl:variable name="homepage" select="document(concat('sit_xml.php?id=', $parentsite))/site/prc/navigation/utilitynav/page[1]/@id"/>
	
	<xsl:variable name="site" select="/page/@siteid"/>		
	
	<xsl:variable name="level">
		<xsl:for-each select="document(concat('sit_xml.php?id=', $parentsite))/descendant::page[@id=$currentpage]">
			<xsl:value-of select="count(ancestor-or-self::page)"/>
		</xsl:for-each>
	</xsl:variable>
	
	<xsl:variable name="navtype">
		<xsl:for-each select="document(concat('sit_xml.php?id=', $parentsite))/descendant::page[@id=$currentpage]">
			<xsl:value-of select="name(ancestor::*[number($level)])"/>
		</xsl:for-each>
	</xsl:variable>
	
	<xsl:variable name="section">
		<xsl:for-each select="document(concat('sit_xml.php?id=', $parentsite))/descendant::page[@id=$currentpage]">
			<xsl:if test="name(ancestor::*[number($level)]) = 'globalnav'">global</xsl:if>
			<xsl:if test="name(ancestor::*[number($level)]) = 'quicknav'">quick</xsl:if>
			<xsl:if test="name(ancestor::*[number($level)]) = 'utilitynav'">utility</xsl:if>
			<xsl:if test="name(ancestor::*[number($level)]) = 'coursenav'">course</xsl:if>
		</xsl:for-each>
	</xsl:variable>	
	
	<xsl:variable name="primarypage">
		<xsl:for-each select="document(concat('sit_xml.php?id=', $parentsite))/descendant::page[@id=$currentpage]">
			<xsl:choose>
			<xsl:when test="$level = 3">
			<xsl:value-of select="ancestor::page[number(2)]/@id"/>
			</xsl:when>
			<xsl:when test="$level = 2">
			<xsl:value-of select="ancestor::page[number(1)]/@id"/>
			</xsl:when>
			<xsl:otherwise>
			<xsl:value-of select="$currentpage"/>
			</xsl:otherwise>
			</xsl:choose>
		</xsl:for-each>
	</xsl:variable>
	
	<xsl:variable name="pos">
		<xsl:for-each select="document(concat('sit_xml.php?id=', $parentsite))/descendant::page[@id=$primarypage]">
			<xsl:number />
		</xsl:for-each>
	</xsl:variable>
	
	<xsl:variable name="primaryname">
		<xsl:value-of select="document(concat('pag_xml.php?id=', $primarypage))/page/name"/>
	</xsl:variable>
	
	<xsl:variable name="secondarypage">
		<xsl:for-each select="document(concat('sit_xml.php?id=', $parentsite))/descendant::page[@id=$currentpage]">
			<xsl:choose>
			<xsl:when test="$level = 3">
			<xsl:value-of select="ancestor::page[number(1)]/@id"/>
			</xsl:when>
			<xsl:otherwise>
			<xsl:value-of select="$currentpage"/>
			</xsl:otherwise>
			</xsl:choose>
		</xsl:for-each>
	</xsl:variable>
	
	<xsl:variable name="secondaryname">
		<xsl:value-of select="document(concat('pag_xml.php?id=', $secondarypage))/page/name"/>
	</xsl:variable>


	
	<xsl:template match="page">
		<xsl:text disable-output-escaping="yes">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;</xsl:text>
		<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">		
			<head>
                                <xsl:element name="base"><xsl:attribute	name="href"><xsl:value-of select="document(concat('sit_xml.php?id=', @siteid))/site/basehref"/></xsl:attribute></xsl:element>
				<title><xsl:value-of select="document(concat('sit_xml.php?id=', @siteid))/site/title"/></title><meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/><link rel="stylesheet" type="text/css" href="prc_th2_css/screen.css" media="screen" /><link rel="stylesheet" type="text/css" href="prc_th2_css/oldstyles.css" media="screen" /><link rel="stylesheet" href="prc_th2_css/sIFR-screen.css" type="text/css" media="screen" /><link rel="stylesheet" href="prc_th2_css/sIFR-print.css" type="text/css" media="print" />
				<xsl:comment><![CDATA[[if IE]><link rel="stylesheet" type="text/css" media="screen" href="prc_th2_css/screen.ie.css" /><![endif]]]></xsl:comment>
				<xsl:element name="script"><xsl:attribute name="type">text/JavaScript</xsl:attribute><xsl:attribute name="src">prc_th2_js/css_include.js</xsl:attribute><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></xsl:element>
				<xsl:element name="script"><xsl:attribute name="type">text/JavaScript</xsl:attribute><xsl:attribute name="src">prc_th2_js/sifr.js</xsl:attribute><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></xsl:element>
				<xsl:element name="script"><xsl:attribute name="type">text/JavaScript</xsl:attribute><xsl:attribute name="src">prc_th2_js/sifr-addons.js</xsl:attribute><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></xsl:element>
			</head>
			<xsl:element name="body">
				<xsl:attribute name="class">
					<xsl:text>sub_index item</xsl:text>
				</xsl:attribute>
				<div class="wrapper-outer">
					<div class="header">
						<a href="javascript:sIFR.debug.replaceNow();" title="{document(concat('sit_xml.php?id=', $parentsite))/site/name}" class="left"><img src="{document(concat('sit_xml.php?id=', $parentsite))/site/prc/logo/@filename}" alt="{document(concat('sit_xml.php?id=', $parentsite))/site/prc/logo/@filename}" /></a>
						<div class="right">
							<form method="get" action="#">
								<div>
									<label for="search">Search</label><xsl:text> </xsl:text>
									<input type="text" size="10" name="search" id="search" />
									<input type="submit" value="Search" class="submit" />
								</div>
							</form>
						</div>
					</div>
					<div class="content1-wrapper-outer">
						<div class="content1-wrapper" style="background-image: url({document(concat('sit_xml.php?id=', $parentsite))/site/prc/image/@filename})">
							<xsl:element name="div"><xsl:attribute name="class">mask</xsl:attribute><xsl:text> </xsl:text>
								<div class="navigation">
									<xsl:apply-templates select="document(concat('sit_xml.php?id=', $parentsite))/site/prc/navigation/globalnav" mode="sub_index"/>
									<xsl:apply-templates select="document(concat('sit_xml.php?id=', $parentsite))/site/prc/navigation/sitenav"/>
									<div style="clear: both; font-size: 0; line-height: 0; visibility: hidden;"><xsl:text> </xsl:text></div>
								</div>
								
								<div class="content1">									
									<xsl:choose>
										<xsl:when test="name(/page/*) = 'site'">
											<xsl:apply-templates select="document(concat('sit_xml.php?id=', $childsite))/site/contentobject"/>
											<xsl:apply-templates select="document(concat('sit_xml.php?id=', $childsite))/site/course"/>
										</xsl:when>
										<xsl:otherwise>
											<xsl:apply-templates select="document(concat('res_xml.php?id=', $childsite))/resource"/>
										</xsl:otherwise>
									</xsl:choose>	
								</div>
							</xsl:element>
						</div>
					</div>
					<div class="footer">
						<ul class="footer-navigation">
							<li><a href="#" title="">Home</a></li>
							<li><a href="#" title="">Site Map</a></li>
							<li><a href="#" title="">Help</a></li>
						</ul>
						<p class="disclaimer"> Copyright &#169; JHU CTE Online Learning Management System 2005 </p>
					</div>
				</div>		
				<script type="text/javascript">
					//<![CDATA[
						if(typeof sIFR == "function"){
							sIFR.replaceElement(named({sSelector:".sIFR-hasFlash div.wrapper-outer div.content1-wrapper-outer div.content1-wrapper div.content1 div.block h2 span", sFlashSrc:"prc_th2_fonts/30640bc.swf", sColor:"#555555", sLinkColor:"#555555", sBgColor:"#FFFFFF", sWmode:"transparent", sHoverColor:"#555555", sFlashVars:"offsetTop=1"}));/*
							sIFR.replaceElement(named({sSelector:".sIFR-hasFlash div.wrapper-outer div.content1-wrapper div.navigation ul.feature li.color1 span", sFlashSrc:"prc_th2_fonts/30640bc.swf", sLinkColor:"#9e77d2", sColor:"#9e77d2", sBgColor:"#FFFFFF", sWmode:"transparent", sCase:"upper", sFlashVars:"offsetTop=3"}));
							sIFR.replaceElement(named({sSelector:".sIFR-hasFlash div.wrapper-outer div.content1-wrapper div.navigation ul.feature li.color2 span", sFlashSrc:"prc_th2_fonts/30640bc.swf", sLinkColor:"#c63d1e", sColor:"#c63d1e", sBgColor:"#FFFFFF", sWmode:"transparent", sCase:"upper", sFlashVars:"offsetTop=3"}));
							sIFR.replaceElement(named({sSelector:".sIFR-hasFlash div.wrapper-outer div.content1-wrapper div.navigation ul.feature li.color3 span", sFlashSrc:"prc_th2_fonts/30640bc.swf", sLinkColor:"#e2a021", sColor:"#e2a021", sBgColor:"#FFFFFF", sWmode:"transparent", sCase:"upper", sFlashVars:"offsetTop=3"}));
							sIFR.replaceElement(named({sSelector:".sIFR-hasFlash div.wrapper-outer div.content1-wrapper div.navigation ul.feature li.color4 span", sFlashSrc:"prc_th2_fonts/30640bc.swf", sLinkColor:"#428643", sColor:"#428643", sBgColor:"#FFFFFF", sWmode:"transparent", sCase:"upper", sFlashVars:"offsetTop=3"}));
							sIFR.replaceElement(named({sSelector:".sIFR-hasFlash .global ul li span", sFlashSrc:"prc_th2_fonts/30640bc.swf", sColor:"#353535", sLinkColor:"#353535", sHoverColor:"#000000", sBgColor:"#FFFFFF", sWmode:"transparent", sFlashVars:"offsetTop=3"}));*/
							sIFR.replaceElement(named({sSelector:".sIFR-hasFlash .sub_index .content1 h3 span", sFlashSrc:"prc_th2_fonts/30640bc.swf", sColor:"#000000", sLinkColor:"#000000", sHoverColor:"#000000", sBgColor:"#FFFFFF", sWmode:"transparent", sWmode:"transparent", sFlashVars:"offsetTop=-4"}));
						};
					//]]>
				</script>
			</xsl:element>
		</html>
	</xsl:template>
</xsl:stylesheet>
















































