<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted index access' );
define( 'YOURBASEPATH', dirname(__FILE__) );
require( YOURBASEPATH.DS."rt_styleswitcher.php");

$old = JURI::base() .'media/system/js/mootools.js';
$new = 'templates/'.$this->template.'/js/mootools.js';
$a = array();
foreach ($this->_scripts as $k => $v)
{
	if ($k == $old) {
		$a[$new] = $v;
	} else {
		$a[$k] = $v;
	}
}
$this->_scripts = $a;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<jdoc:include type="head" />
<?php
	$live_site        = $mainframe->getCfg('live_site');
	$default_style    = $this->params->get("defaultStyle", "style3");
	$sidebar_side     = $this->params->get("sidebarSide", "right");
	$sidebar_width		= $this->params->get("sidebarWidth", "25%");
	$width_style      = $this->params->get("templateWidthStyle", "fixed"); 
	$template_width   = $this->params->get("templateWidth", "990"); 
	$menu_name        = $this->params->get("menuName", "mainmenu");
	$menu_type        = $this->params->get("menuType", "moomenu");
	$default_font     = $this->params->get("defaultFont", "default");
	$show_breadcrumbs = ($this->params->get("showBreadcrumbs", 1)  == 0)?"false":"true";

	// moomenu options
	$moo_bgiframe     = ($this->params->get("moo_bgiframe'","0") == 0)?"false":"true";
	$moo_delay        = $this->params->get("moo_delay", "500");
	$moo_duration     = $this->params->get("moo_duration", "400");
	$moo_fps          = $this->params->get("moo_fps", "100");
	$moo_transition   = $this->params->get("moo_transition", "Expo.easeOut");	

	// rokzoom options
	$enable_rokzoom   = ($this->params->get("enableRokzoom", 1)  == 0)?"false":"true";
	$zoom_resize_duration     = $this->params->get("zoom_resize_duration", "700");
	$zoom_opacity_duration     = $this->params->get("zoom_opacity_duration", "500");
	$zoom_transition   			  = $this->params->get("zoom_transition", "Cubic.easeOut");

	require(YOURBASEPATH .DS."rt_styleloader.php");

	global $Itemid;

	// menu code
	$document	= &JFactory::getDocument();
	$renderer	= $document->loadRenderer( 'module' );
	$options	 = array( 'style' => "raw" );
	$module	 = JModuleHelper::getModule( 'mod_mainmenu' );
	$mainnav = false; $subnav = false;
	if($mtype == "splitmenu") : 
		$module->params	= "menutype=$menu_name\nstartLevel=0\nendLevel=1";
		$mainnav = $renderer->render( $module, $options );
		$module	 = JModuleHelper::getModule( 'mod_mainmenu' );
		$module->params	= "menutype=$menu_name\nstartLevel=1\nendLevel=9";
		$options	 = array( 'style' => "submenu");
		$subnav = $renderer->render( $module, $options );
	elseif($mtype == "moomenu" or $mtype == "suckerfish") : 								      	
		$module->params	= "menutype=$menu_name\nshowAllChildren=1";
		$mainnav = $renderer->render( $module, $options );
	endif;
	if (!$this->countModules('user1') and !$subnav) $sidebar_side = false;
	
	if ($width_style=="fluid") { 
		$template_width = 'width: 100%;';
	} else {
		$template_width = 'margin: 0 auto; width: ' . $template_width . 'px;';
	}

	// make sure subnav is empty
	if (strlen($subnav) < 10) $subnav = false;
	//Are we in edit mode
	$editmode = false;
	if (JRequest::getCmd('task') == 'edit' ) :
		$editmode = true;
	endif;

	?>
	<link rel="shortcut icon" href="images/favicon.ico" />
	<?php if($mtype=="moomenu" or $mtype=="suckerfish") :?>
	<link href="templates/<?php echo $this->template?>/css/rokmoomenu.css" rel="stylesheet" type="text/css" />
	<?php endif; ?>
	<link href="templates/<?php echo $this->template?>/css/template_css.css" rel="stylesheet" type="text/css" />
	<link href="templates/<?php echo $this->template?>/css/<?php echo $tstyle; ?>.css" rel="stylesheet" type="text/css" />
	<?php if($enable_rokzoom=="true") :?>
	<link href="templates/<?php echo $this->template?>/rokzoom/rokzoom.css" rel="stylesheet" type="text/css" />
	<?php endif; ?>
	<link href="templates/<?php echo $this->template?>/css/rokslidestrip.css" rel="stylesheet" type="text/css" />
	<!--[if IE 7]>
	<link href="templates/<?php echo $this->template?>/css/template_ie7.css" rel="stylesheet" type="text/css" />
	<![endif]-->
	<!--[if lte IE 6]>
	<link href="templates/<?php echo $this->template?>/css/template_ie6.css" rel="stylesheet" type="text/css" />
	<style type="text/css">
	img { behavior: url(templates/<?php echo $this->template?>/css/iepngfix.htc); } 
	</style>
	<![endif]-->
	<style type="text/css">
		div.wrapper { <?php echo $template_width; ?>}
		td.sidebar { width: <?php echo $sidebar_width; ?>; }
	</style>	
	<?php if($enable_rokzoom=="true") :?>
	<script type="text/javascript" src="templates/<?php echo $this->template?>/rokzoom/rokzoom.js"></script>
	<?php endif; ?>
	<?php if($mtype=="moomenu") :?>
	<script type="text/javascript" src="templates/<?php echo $this->template?>/js/mootools.bgiframe.js"></script>
	<script type="text/javascript" src="templates/<?php echo $this->template?>/js/rokmoomenu.js"></script>
	<script type="text/javascript">
	window.addEvent('domready', function() {
		new Rokmoomenu($E('ul.menu'), {
			bgiframe: <?php echo $moo_bgiframe; ?>,
			delay: <?php echo $moo_delay; ?>,
			animate: {
				props: ['opacity', 'width', 'height'],
				opts: {
					duration:<?php echo $moo_duration; ?>,
					fps: <?php echo $moo_fps; ?>,
					transition: Fx.Transitions.<?php echo $moo_transition; ?>
				}
			}
		});
	});
	</script>
	<?php endif; ?>	
	<?php if($mtype=="suckerfish" or $mtype=="splitmenu") :
		echo "<!--[if IE]>\n";		
	  include_once( "templates/". $this->template . "/js/ie_suckerfish.js" );
	  echo "<![endif]-->\n";
	endif; ?>	
	<?php if($enable_rokzoom=="true") :?>
	<script type="text/javascript">
		window.addEvent('load', function() {
			RokZoom.init({
				imageDir: 'templates/<?php echo $this->template?>/rokzoom/images/',
				resizeFX: {
					duration: <?php echo $zoom_resize_duration; ?>,
					transition: Fx.Transitions.<?php echo $zoom_transition; ?>,
					wait: true
				},
				opacityFX: {
					duration: <?php echo $zoom_opacity_duration; ?>,
					wait: false	
				}
			});
		});
	</script>
	<?php endif; ?>
	</head>
	<body class="<?php echo $fontstyle; ?>">
		<div id="body-b">
			<div id="body-t">
				<!-- start wrapper -->
				<div class="wrapper">
					<!-- start frame -->
<br><br><br><br>
					<div id="frame-1">
						<div id="frame-2">
							<div id="frame-3">
								<div id="frame-4">
									<div id="masthead">
										<a href="<?php echo JURI::base(); ?>" class="nounder"><img src="templates/<?php echo $this->template; ?>/images/blank.gif" style="border:0;" alt="" id="logo" /></a>
						<!--				<div id="mod-banner">
											<jdoc:include type="modules" name="banner" style="none" />
										</div>
										<div id="mod-top">
											<div class="top-padding">
												<jdoc:include type="modules" name="top" style="none" />
											</div>
										</div>
						-->			</div>
									<div id="horiz-menu" class="<?php echo $mtype; ?>">
										<?php if($mtype != "module") :
											echo $mainnav;
										else: ?>
										<jdoc:include type="modules" name="toolbar"     style="none" />
						                    	         <?php endif; ?>	
						<!--			<div class="clr"></div>    -->     
									</div>
									<!-- start mainbody -->
									<div id="mainbody-1">
										<div id="mainbody-2">
											<div id="mainbody-3">
												<div id="mainbody-4">
													<div id="mainbody-5">
														<div id="mainbody-6">
															<!-- start component area -->
						<!--									<div    d="pathway">
																<?php if ($show_breadcrumbs == "true") : ?>
																<jdoc:include type="module" name="breadcrumbs" style="none" />
																<?php endif; ?>
															</div>   <-->
															<div class="mainbody-padding">
																<table id="mainframe">
																	<tr valign="top">
																		<?php if (($subnav or $this->countModules('user1')>0) and $sidebar_side=="left") : ?>
																		<td class="sidebar left">
																			<?php if($subnav) : ?>
																			<div id="sub-menu">
																				<div class="module"><div><div><div>
																					<h3><?php echo $subnav_title; ?> Menu</h3>
																					<?php echo $subnav; ?>
																				</div></div></div></div>
																			</div>
																			<?php endif; ?>
																			<jdoc:include type="modules" name="user1" style="rounded" />
																		</td>
																		<?php endif; ?>
																		<td class="component">
																			<div class="component-padding">
																							<div class="body-padding">
																					<jdoc:include type="component" />
																			  </div>

<!--       Sections go here    -->
				<?php $section1count = ($this->countModules('user2')>0) + ($this->countModules('user3')>0) + ($this->countModules('user4')>0); ?>
																				<?php if($section1count) : ?>
																				<?php $section1width = ' w' . floor(99 / $section1count); ?>
																				<table class="sections">
																					<tr>
																						<?php if ($this->countModules('user2')) : ?>
																						<td class="section<?php echo getModuleState($sidebar_side,$this->countModules('user2'), $section1count, $sidebar_side=="left"?true:false);?><?php echo $section1width ?>">
																							<jdoc:include type="modules" name="user2" style="rounded" />
																						</td>
																						<?php endif; ?>
																						<?php if($this->countModules('user2') and $this->countModules('user3')) : ?>
																						<td class="spacer"><img src="templates/<?php echo $this->template; ?>/images/blank.gif" alt=""  /></td>
																						<?php endif; ?>
																						<?php if ($this->countModules('user3')) : ?>
																						<td class="section<?php echo getModuleState($sidebar_side,$this->countModules('user3'), $section1count, $sidebar_side=="right"?true:false);?><?php echo $section1width ?>">
																							<jdoc:include type="modules" name="user3" style="rounded" />
																						</td>
																						<?php endif; ?>
																
						<?php if($this->countModules('user2') and $this->countModules('user3') and $this->countModules('user4')) : ?>
																						<td class="spacer"><img src="templates/<?php echo $this->template; ?>/images/blank.gif" alt=""  /></td>
																						<?php endif; ?>
																						<?php if ($this->countModules('user4')) : ?>
																						<td class="section<?php echo getModuleState($sidebar_side,$this->countModules('user3'), $section1count, $sidebar_side=="right"?true:false);?><?php echo $section1width ?>">
																							<jdoc:include type="modules" name="user4" style="rounded" />
																						</td>
																						<?php endif; ?>

					</tr>				</table>
																				<?php endif; ?>
<!--   End Insert Section   -->																			</div>

				<?php $section1count = ($this->countModules('user5')>0) + ($this->countModules('user6')>0) + ($this->countModules('user7')>0); ?>
																				<?php if($section1count) : ?>
																				<?php $section1width = ' w' . floor(99 / $section1count); ?>
																				<table class="sections">
																					<tr>
																						<?php if ($this->countModules('user5')) : ?>
																						<td class="section<?php echo getModuleState($sidebar_side,$this->countModules('user2'), $section1count, $sidebar_side=="left"?true:false);?><?php echo $section1width ?>">
																							<jdoc:include type="modules" name="user5" style="rounded" />
																						</td>
																						<?php endif; ?>
																						<?php if($this->countModules('user2') and $this->countModules('user3')) : ?>
																						<td class="spacer"><img src="templates/<?php echo $this->template; ?>/images/blank.gif" alt=""  /></td>
																						<?php endif; ?>
																						<?php if ($this->countModules('user6')) : ?>
																						<td class="section<?php echo getModuleState($sidebar_side,$this->countModules('user3'), $section1count, $sidebar_side=="right"?true:false);?><?php echo $section1width ?>">
																							<jdoc:include type="modules" name="user6" style="rounded" />
																						</td>
																						<?php endif; ?>
																
						<?php if($this->countModules('user5') and $this->countModules('user6') and $this->countModules('user7')) : ?>
																						<td class="spacer"><img src="templates/<?php echo $this->template; ?>/images/blank.gif" alt=""  /></td>
																						<?php endif; ?>
																						<?php if ($this->countModules('user7')) : ?>
																						<td class="section<?php echo getModuleState($sidebar_side,$this->countModules('user3'), $section1count, $sidebar_side=="right"?true:false);?><?php echo $section1width ?>">
																							<jdoc:include type="modules" name="user7" style="rounded" />
																						</td>
																						<?php endif; ?>

					</tr>				</table>
																				<?php endif; ?>
<!--   End Insert Section   -->																															</td>
																		<?php if (($subnav or $this->countModules('user1')>0) and $sidebar_side=="right") : ?>
																		<td class="sidebar right">
																			<?php if($subnav) : ?>
																			<div id="sub-menu">
																					<?php echo $subnav; ?>
																			</div>
																			<?php endif; ?>
																			<jdoc:include type="modules" name="user1" style="rounded" />
																		</td>
																		<?php endif; ?>
																	</tr>
																</table>
															</div>
															<!-- end component area -->
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>
									<!-- end body -->
									<!-- start footer -->
									<div id="footer-1">
										<div id="footer-2">
											<div id="footer-3">
												<div id="footer-4">
													<div id="footer-5">
														<div id="footer-padding">
	
																													</div>
													</div>
												</div>
											</div>
										</div>
									</div>
									<!-- end footer -->
									<!-- start rocket bottom -->
									<!--  <div id="rocket-1">
										<div id="rocket-2">
											<div id="rocket-3">
												Copyright 2007 Janet Kohl Group, Inc.
											</div>
										</div>
									</div>    -->
									<!-- end rocket bottom -->
								</div>
							</div>
						</div>
					</div>
					<!-- end frame -->
				</div>
				<!-- end wrapper -->
			</div>
		</div>
	</body>	
</html>