<?php @validInc() or die; ?>
<?php if(!loggedIn())header('Location: '.$CONFIG['webAddress']); ?>
<?php include 'header.tpl.php';

$CATEGORIES = array();
$semCATEGORIES = array();
$activeCat = array();
$activeCatObject = array();
$ITEMS = array();

function hyperlink_encode($text)
{
	return str_replace('%2F','_',rawurlencode($text));
}

function hyperlink_decode($text)
{
	return str_replace('_','/',rawurldecode($text));
}


$activeCat = explode('/', str_replace('Store/', '', linkActive_forSwitch($_GET['page'], false)));
if($activeCat[0]=='Store')$activeCat=array();
for($i = 0;$i<count($activeCat);$i++)
{
	$activeCat[$i] = hyperlink_decode($activeCat[$i]);
}
//print_r($activeCat);


function loadCats()
{
	global $CATEGORIES, $CONFIG;
	sqlChooseDB($CONFIG['db_itemmallDB']);
	$rs = sqlsrv_query($CONFIG['db_conn'], 'SELECT * FROM tCats WHERE nEnabled = 1 ORDER BY nID');
	if(sqlsrv_has_rows($rs))
	{
		$count = 0;
		$cats = array();
		while($rs2 = sqlsrv_fetch_array($rs, SQLSRV_FETCH_ASSOC))
		{
			$cat = array();
			foreach($rs2 as $key => $value)
			{
				$cat[$key] = $value;
			}
			$cats[] = $cat;
		}
	}

	$CATEGORIES = $cats;
}

function loadItems()
{
	/************************
		nID
		nGoodsNo
		sName
		nLot
		nIsPackage
		sPackagedItems
		nPrice
		dSaleStart
		nSaleTime
		nSaleType
		nSaleAmount
		nSaleEnabled
		nGiftable
		nCat
		sDescript
		nEnabled
		nCanBonusPoints
		nIsMiniGameReward
		nMiniGamePercent
		sSubCatArray
		sContents
		sImg
	*************************/
	global $activeCatObject, $CONFIG, $ITEMS;
	sqlChooseDB($CONFIG['db_itemmallDB']);
	$rs = sqlsrv_query($CONFIG['db_conn'], 'SELECT * FROM tItems WHERE nEnabled = 1 ORDER BY nID');
	if(sqlsrv_has_rows($rs))
	{
		$count = 0;
		$items = array();
		while($rs2 = sqlsrv_fetch_array($rs, SQLSRV_FETCH_ASSOC))
		{
			$item = array();
			foreach($rs2 as $key => $value)
			{
				$item[$key] = $value;
			}
			$items[] = $item;
		}
	}
	$ITEMS = $items;
}

function showItems()
{
	global $ITEMS, $activeCatObject;
	$reihe = 0;
	$spalte = 0;
	//print_r($ITEMS);
	
	$ITEMScat = array();
	
	foreach($ITEMS as $item)
	{
		foreach(explode(',', $item['sSubCatArray']) as $cat)
		{
			if(intval($cat)==$activeCatObject['nCat'])
			{
				$ITEMScat[] = $item;
				break;
			}
		}
	}
	
	if(count($ITEMScat)>0)
	for($i=0;$i<count($ITEMScat);$i++)
	{
		if($spalte>3)
		{
			$reihe++;
			$spalte = 0;
		}
		
		if($spalte==0)echo '<div id="'. $reihe .'">';
		
		echo '<div class="item-container'.(($spalte==3)?' last':'').'">
		<div class="item-title">'.str_replace('\n','<br>',$ITEMScat[$i]['sName']).'</div>
		<div class="image-placeholder"><img src="'.getLink('assets/itemicons/'.$ITEMScat[$i]['sImg']).'"></div>
		<div class="item-price"><span>'.$ITEMScat[$i]['nPrice'].'</span> Coins</div>
		<div class="item-button">
		<button type="button" class="btn btn-store-buy">Buy</button>
            <div class="btn-group">
              <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
                Details
                <span class="caret"></span>
              </a>
              <ul class="dropdown-menu">
			  <li>'.$ITEMScat[$i]['sDescript'].(($ITEMScat[$i]['nIsPackage']==1)?'</br></br>Contents:</br>'.$ITEMScat[$i]['nContents']:'').'</li>
			  </ul>
            </div>
          </div>
        </div>';
		
		
		if($spalte==3 || $i == (count($ITEMScat)-1))echo '</div>';
		$spalte++;
	}
	else echo 'There are no items in this category yet.';
	
	/*<div id="1">
        <div class="item-container">
          <div class="item-title">Witch Hat (30 Days)</div>
          <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
          <div class="item-price"><span>280</span> Coins</div>
          <div class="item-button">
            <button type="button" class="btn btn-store-buy">Buy</button>
            <div class="btn-group">
              <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
                Details
                <span class="caret"></span>
              </a>
              <ul class="dropdown-menu">
                <!-- dropdown menu links -->
              </ul>
            </div>
          </div>
        </div>*/
}

function getAllCats($specificCat = 0)
{
	global $CATEGORIES;
	$tmp = array();
	foreach($CATEGORIES as $cat)
	{
		if($cat['nSubCat'] == $specificCat)
		$tmp[$cat['sName']] = array('nCat' => $cat['nCat'], 'sName' => $cat['sName'], 'subCats' => getAllCats($cat['nCat']));
	}
	return $tmp;
}


function showCat($loadCat = 0, $level = 0)
{
	global $CATEGORIES, $activeCat, $activeCatObject;
	$returnstring = '';
	
	$nCat = array();
	$nSubCats = array();
	
	
	foreach($CATEGORIES as $catVar)
	{
		if($catVar['nCat'] == $loadCat)$nCat = $catVar;
		if($catVar['nSubCat'] == $loadCat)$nSubCats[] = $catVar;
	}
		
	if($level == 0)
	{
		$returnstring.= '<ul class="navmenu">'."\n";
		foreach($nSubCats as $subCat)
		{
			$returnstring.= '<li>'."\n";
			$returnstring.= '<div class="menutop"><a style="padding:5px 5px 4px 5px;'.(($activeCat[0]==$subCat['sName'])?'color: #ff6e00;':'').'" href="'.getLink('Store/' . hyperlink_encode($subCat['sName'])).'">'.htmlentities(strtoupper($subCat['sName'])).'</a><div class="toggle">'.(($activeCat[0]==$subCat['sName'])?'-':'+').'</div></div>'."\n";
			if($activeCat[0]==$subCat['sName'])$returnstring.= showCat($subCat['nCat'], $level+1);
			$returnstring.= '</li>'."\n";
			if(count($activeCat)==1 && $activeCat[0]==$subCat['sName'])$activeCatObject=$subCat;
		}
		$returnstring.= '</ul>'."\n";
	}
	elseif($level == 1)
	{
		$returnstring.= '<ul class="submenu">'."\n";
		
		$lastCat = count($nSubCats)-1;
		$i = 0;
		foreach($nSubCats as $subCat)
		{
			//nur lastCat wenn keine Children
			$returnstring.= '<li style="'.(($i!=0)?'margin-top: -1px;':'').'"'.(($lastCat==$i&&!CatHasChildren($subCat['nCat']))?' class="last-category icon"':'').'><a'.(($lastCat!=$i)?' class="icon"':'').' style="'.(($activeCat[1]==$subCat['sName'])?'color: #ff6e00;':'').(($i!=0)?'margin-top: 1px;"':'').'" href="'.getLink('Store/'.hyperlink_encode($nCat['sName']).'/' . hyperlink_encode($subCat['sName'])).'">'.htmlentities(strtoupper($subCat['sName'])).'</a></li>'."\n";
			$returnstring.= showCat($subCat['nCat'], $level+1);
			$i++;
			if(count($activeCat)==2 && $activeCat[1]==$subCat['sName'])$activeCatObject=$subCat;
		}
		$returnstring.= '</ul>'."\n";
	}
	elseif($level == 2)
	{
		$lastCat = count($nSubCats)-1;
		$i = 0;
		foreach($nSubCats as $subCat)
		{
			$returnstring.= '<li'.(($lastCat==$i)?' class="last-category icon"':'').' style="padding-left:15px; width:165px;"><a style="'.(($activeCat[2]==$subCat['sName'])?'color: #ff6e00;':'').'"'.(($lastCat!=$i)?' class="icon"':'').' href="'.getLink('Store/'.hyperlink_encode(getParentCat($subCat['nSubCat'])['sName']).'/'.hyperlink_encode($nCat['sName']).'/' . hyperlink_encode($subCat['sName'])).'">'.htmlentities(strtoupper($subCat['sName'])).'</a></li>'."\n";
			$i++;
			if(count($activeCat)==3 && $activeCat[2]==$subCat['sName'])$activeCatObject=$subCat;
		}
	}
	
	return $returnstring;
}

function getParentCat($nCat)
{
	global $CATEGORIES;
	$parentID = 0;
	
	//echo '$nCat: '.$nCat . "<br>";
	foreach($CATEGORIES as $catVar)
	{
		if($catVar['nCat']==$nCat)
		{
			//echo '$nCat: '.$nCat . "<br>";
			$parentID = $catVar['nSubCat'];
			break;
		}
	}
	
	foreach($CATEGORIES as $catVar)
	{
		if($catVar['nCat']==$parentID)
		{
			
			return $catVar;
		}
	}
	return array();
}

function CatHasChildren($nCat)
{
	global $CATEGORIES;
	foreach($CATEGORIES as $catVar)
	{
		if($catVar['nSubCat']==$nCat)
		return true;
	}
	return false;
}



function parsedCatExists($tmp = false, $level = 0)
{
	global $semCATEGORIES, $activeCat;
	if($tmp == false)$tmp = $semCATEGORIES;
	
	if(isset($activeCat[$level]))
	{
		//echo '$activeCat['.$level.'] exists<br>';
		if(isset($tmp[$activeCat[$level]]))
		{
			//echo '$semCATEGORIES['.$activeCat[$level] . '] exists<br>';
			//print_r($tmp[$activeCat[$level]]);
			return parsedCatExists($tmp[$activeCat[$level]]['subCats'], ++$level);
		}
		else
		{
			//echo '$semCATEGORIES['.$activeCat[$level] . '] does not exist<br>';
			
			return false;
		}
	}
	else
	{
		//echo '$activeCat['.$level.'] does not exist<br>';
		return array($level);
	}
}

loadCats();
loadItems();
$semCATEGORIES = getAllCats();
if(parsedCatExists() === false)header('Location: '.$CONFIG['webAddress'].'/Store');


//echo parsedCatExists();
//print_r($semCATEGORIES);

//echo $activeCat[0];



?>
<!-- SUBNAV -->
<div id="subNav">
	<div class="placeholder"><span class="account-title">Store<?php for($i=0;$i<count($activeCat);$i++)echo ' » '.$activeCat[$i];?></span></div>
  <?php /*<!--<div class="placeholder">
    <div class="sub-logo"><img src="<?=getLink('images/victus.png')?>" alt="Logo"></div>
    <ul>
      <li><a href="<?=getLink('Account/Donate')?>">DONATE</a></li>
      <li><a href="<?=getLink('Account/TransactionHistory')?>">TRANSACTION HISTORY</a></li>
    </ul>
  </div>-->*/ ?>
</div>
<!-- end SUBNAV -->

<!-- WRAPPER -->
<div id="bodyArea">

  <div class="left">
	<div class="title"><span>Featured</span></div>
    <div class="title"><span>CATEGORIES</span></div>
    <div id="menu">
		
	<?php echo showCat();
	
		//print_r($activeCatObject);
	?>
	
		<?php /*
      <ul class="navmenu">
       <li><div class="menutop"><a href="<?=getLink('Store/Categories/Apparel')?>">APPAREL</a><div class="toggle">+</div></div>
         <ul class="submenu">
           <li><a class="icon" href="<?=getLink('Store/Categories/Apparel/Head')?>">HEAD</a></li>
           <li><a class="icon" href="<?=getLink('Store/Categories/Apparel/Back')?>">BACK</a></li>
           <li><a class="icon" href="<?=getLink('Store/Categories/Apparel/Costume')?>">COSTUME</a></li>
           <li class="last-category icon"><a href="<?=getLink('Store/Categories/Apparel/Tail')?>">TAIL</a></li>
         </ul>
       </li>
       <li><div class="menutop"><a href="<?=getLink('Store/Categories/Consumables')?>">CONSUMABLES</a><div class="toggle">+</div></div>
         <ul class="submenu">
           <li><a href="#">Add New</a></li>
           <li class="last-category"><a href="#">Edit</a></li>
         </ul>
       </li>
       <li><div class="menutop"><a href="#">ESSENTIALS</a><div class="toggle">+</div></div>
         <ul class="submenu">
           <li><a href="#">Manage</a></li>
           <li><a href="#">Add New</a></li>
           <li class="last-category"><a href="#">Profile</a></li>
         </ul>
       </li>
       <li><div class="menutop"><a href="#">ENHANCEMENT</a><div class="toggle">+</div></div>
         <ul class="submenu">
           <li><a href="#">Manage</a></li>
				<li style="padding-left:15px; width:165px;"><a style="" href="#">Manage</a></li>
			
           <li><a href="#">Add New</a></li>
           <li class="last-category"><a href="#">Profile</a></li>
         </ul>
       </li>
       <li><div class="menutop"><a href="#">SPECIAL PACKS</a><div class="toggle">+</div></div>
         <ul class="submenu">
           <li><a href="#">Manage</a></li>
           <li><a href="#">Add New</a></li>
           <li class="last-category"><a href="#">Profile</a></li>
         </ul>
       </li>
      </ul>*/
	  ?>
	  
    </div>
  </div>

  <div class="right">
    <!--<div class="category-title">
      <div class="title-text"><span><?//=$activeCatObject['sName']?></span></div>
    </div>-->
    <div class="placeholder">
		<?php showItems(); ?>
		
		  <?php /*<!-- First Row -->
		  <div id="1">
			<div class="item-container">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>

			<div class="item-container">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>

			<div class="item-container">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>

			<div class="item-container last">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>
		  </div>
		  <!-- end First Row -->
		  
		  <!-- Second Row -->
		  <div id="1">
			<div class="item-container">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>

			<div class="item-container">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>

			<div class="item-container">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>

			<div class="item-container last">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>
		  </div>
		  <!-- end Second Row -->

		  <!-- Third Row -->
		  <div id="1">
			<div class="item-container">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>

			<div class="item-container">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>

			<div class="item-container">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>

			<div class="item-container last">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>
		  </div>
		  </div>
		  <!-- end Third Row -->&nbsp;
			<div class="category-title">
				<div class="title-text"><span>TEST</span></div>
			</div>
		<div class="placeholder"></div>
		  <!-- Fourth Row -->
		  <div id="1">
			<div class="item-container">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>

			<div class="item-container">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>

			<div class="item-container">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>

			<div class="item-container last">
			  <div class="item-title">Witch Hat (30 Days)</div>
			  <div class="image-placeholder"><img src="<?=getLink('assets/itemicons/demo.png')?>" alt="Logo"></div>
			  <div class="item-price"><span>280</span> Coins</div>
			  <div class="item-button">
				<button type="button" class="btn btn-store-buy">Buy</button>
				<div class="btn-group">
				  <a class="btn dropdown-toggle store-details" data-toggle="dropdown" href="#">
					Details
					<span class="caret"></span>
				  </a>
				  <ul class="dropdown-menu">
					<!-- dropdown menu links -->
				  </ul>
				</div>
			  </div>
			</div>
		  </div>*/ ?>
		  <!-- end Fourth Row -->
		
		<!-- end placeholder div -->
    
	
		<!--<div class="pagination">
		  <ul>
			<li><a href="#">Prev</a></li>
			<li><a href="#">1</a></li>
			<li><a href="#">2</a></li>
			<li><a href="#">3</a></li>
			<li><a href="#">4</a></li>
			<li><a href="#">5</a></li>
			<li><a href="#">Next</a></li>
		  </ul>
		</div>-->
	</div>
  </div>
  <!-- end right div -->
  <div class="clearfix"></div>
</div>

<!-- end WRAPPER -->
<!-- JS OnLoad -->
<script>
    if ($.browser.msie){
     $('#menu ul.navmenu li:last-child .menutop').css('border-width','0 1px 1px;')
   }

   $('.toggle:not(.toggle-open)') .addClass('toggle-closed') .parents('li') .children('ul') .hide();    

   $('.toggle') .click(function(){
     if ($(this) .hasClass('toggle-open')) {
       $(this) .removeClass('toggle-open') .addClass('toggle-closed') .empty('') .append('+') .parents('li') .children('ul') .slideUp(250);
       $(this) .parent('.menutop') .removeClass('menutop-open') .addClass('menutop-closed');
     }else{
       $(this) .parent('.menutop') .removeClass('menutop-closed') .addClass('menutop-open');
       $(this) .removeClass('toggle-closed') .addClass('toggle-open') .empty('') .append('&ndash;') .parents('li') .children('ul') .slideDown(250);
   }
   })
</script>
<?php
 include 'footer.tpl.php';
 //echo "Time:  " . number_format(( microtime(true) - $startTime), 4) . " Seconds\n";
 ?>