<?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"/>

<!-- START VARIABLES -->
	
	<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>



<!-- END VARIABLES -->	
	
	<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>
				<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 href="prc_th2_css/universal.css" rel="stylesheet" media="screen" type="text/css"/-->
				<!--link href="css/aos.css" rel="stylesheet" media="screen" type="text/css"/-->
				<!--link href="prc_th2_css/universal_contentstyle.css" rel="stylesheet" media="screen" type="text/css"/>
				<link href="prc_th2_css/{document(concat('sit_xml.php?id=', @siteid))/site/prc/@theme}.css" rel="stylesheet" media="screen" type="text/css"/>
				<link href="prc_th2_css/universal.css" rel="stylesheet" media="print" type="text/css"/>
				<link href="prc_th2_css/universal_contentstyle.css" rel="stylesheet" media="print" type="text/css"/>
				<link href="prc_th2_css/print.css" rel="stylesheet" media="print" type="text/css"/-->				
				<!--xsl:element name="script"><xsl:attribute name="type">text/JavaScript</xsl:attribute><xsl:attribute name="src">js/dhtml.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">js/mouse_over.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">js/mm.js</xsl:attribute><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></xsl:element-->
				
				<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", 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", sFlashVars:"offsetTop=-4"}));
						};
					//]]>
				</script>
			</xsl:element>
		</html>
	</xsl:template>
	
	<!--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>
				<title><xsl:value-of select="document(concat('sit_xml.php?id=', $parentsite))/site/name"/></title>
				<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
				<link href="prc_css/universal.css" rel="stylesheet" media="screen" type="text/css"/>
				<link href="css/aos.css" rel="stylesheet" media="screen" type="text/css"/>
				<link href="prc_css/universal_contentstyle.css" rel="stylesheet" media="screen" type="text/css"/>
				<link href="prc_css/{document(concat('sit_xml.php?id=', $parentsite))/site/prc/@theme}.css" rel="stylesheet" media="screen" type="text/css"/>
				<link href="prc_css/universal.css" rel="stylesheet" media="print" type="text/css"/>
				<link href="prc_css/universal_contentstyle.css" rel="stylesheet" media="print" type="text/css"/>
				<link href="prc_css/print.css" rel="stylesheet" media="print" type="text/css"/>				
				<xsl:element name="script"><xsl:attribute name="type">text/JavaScript</xsl:attribute><xsl:attribute name="src">js/dhtml.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">js/mouse_over.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">js/mm.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:choose>
			<xsl:when test="$currentpage = $homepage"><xsl:text>global</xsl:text></xsl:when>
			<xsl:otherwise><xsl:text>global</xsl:text></xsl:otherwise>
			</xsl:choose>
			</xsl:attribute>			
				<div id="wrapper">
					<ul id="globalnav" class="clearfix">
						<xsl:apply-templates select="document(concat('sit_xml.php?id=', $parentsite))/site/prc/navigation/globalnav"/>
					</ul>	
					<div id="header" style="background-image: url({document(concat('sit_xml.php?id=', $parentsite))/site/prc/image/@filename})">
						<div id="logo-holder">
							<xsl:element name="img">
							<xsl:choose>
							<xsl:when test="document(concat('sit_xml.php?id=', @siteid))/site/prc/logo/@filename">
							<xsl:attribute name="src"><value-of select="document(concat('sit_xml.php?id=', @siteid))/site/prc/logo/@filename"/></xsl:attribute>
							</xsl:when>
							<xsl:otherwise>
							<xsl:attribute name="src">images/default_prc_logo.gif</xsl:attribute>
							</xsl:otherwise>
							</xsl:choose>
							<xsl:attribute name="id"><xsl:text>prc-logo</xsl:text></xsl:attribute>
							<xsl:attribute name="alt"><xsl:text>Public Resource Center Logo</xsl:text></xsl:attribute>
							</xsl:element>
						</div>
						<h1><xsl:value-of select="document(concat('sit_xml.php?id=', $parentsite))/site/name"/></h1>
					</div>	
					<xsl:element name="div">
						<xsl:attribute name="id">subnav</xsl:attribute>
						<xsl:attribute name="class"><xsl:if test="$navtype = 'sitenav'">t<xsl:value-of select="$pos"/></xsl:if><xsl:text> clearfix</xsl:text></xsl:attribute>
						<h2 class=""><a href="page.php?id={$homepage}">&lt; Home</a><br/><br/>
						<xsl:value-of select="$primaryname"/></h2>
						<ul class="secondary">
							<xsl:call-template name="sidenav"/>
						</ul>
						<div id="sub-quicknav">
						<form action="search.php" method="post">
							<input type="hidden" name="site" value="{@siteid}" />
							<input type="hidden" name="type" value="prc" />
							<xsl:apply-templates select="document(concat('sit_xml.php?id=', @siteid))/site/prc/navigation/quicknav"/>	
							<fieldset>
								<h3><label for="search">Search by keyword</label></h3>
								<input type="text" name="searchtxt" id="search"/><button type="submit" title="Search"><img src="images/icon_search.gif" alt="Search"/></button>
							</fieldset>
						</form>		
						</div>	
					</xsl:element>
					<div id="shadow">
					</div>	
					<div id="content">&#160;											
						<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>
					<div id="footer">
						<xsl:apply-templates select="document(concat('sit_xml.php?id=', $parentsite))/site/prc/navigation/utilitynav"/>
					</div><br/>
					<span id="copyright">Copyright &#169; JHU CTE Online Learning Management System 2005</span>				
				</div>				
			</xsl:element>
		</html>
	</xsl:template-->
	
</xsl:stylesheet>

