<?php
/**
 * YOOLayout setup
 *
 * @version		1.0.0 (06.05.2007)
 * @author		yootheme.com
 * @copyright	Copyright (C) 2007 YOOtheme Ltd & Co. KG. All rights reserved.
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

$yTools = &YOOTools::getInstance();

// set css-class for topbox
$topmodules = 0;
if($this->countModules('top1')) $topmodules += 1;
if($this->countModules('top2')) $topmodules += 1;
if($this->countModules('top3')) $topmodules += 1;
if($this->countModules('top4')) $topmodules += 1;
switch ($topmodules) {
	case 1:
		$topboxwidth = "width100";
		break;
	case 2:
		$topboxwidth = "width50";
		break;
	case 3:
		$topboxwidth = "width33";
		break;
	case 4:
		$topboxwidth = "width25";
		break;
	default:
		$topboxwidth = "";
}

// set css-class for maintopbox
$maintopmodules = 0;
if($this->countModules('user1')) $maintopmodules += 1;
if($this->countModules('user2')) $maintopmodules += 1;
switch ($maintopmodules) {
	case 1:
		$maintopboxwidth = "width100";
		break;
	case 2:
		$maintopboxwidth = "width50";
		break;
	default:
		$maintopboxwidth = "";
}

// set css-class for contenttopbox
$contenttopmodules = 0;
if($this->countModules('advert1')) $contenttopmodules += 1;
if($this->countModules('advert2')) $contenttopmodules += 1;
switch ($contenttopmodules) {
	case 1:
		$contenttopboxwidth = "width100";
		break;
	case 2:
		$contenttopboxwidth = "width50";
		break;
	default:
		$contenttopboxwidth = "";
}

// set css-class for contentbottombox
$contentbottommodules = 0;
if($this->countModules('advert3')) $contentbottommodules += 1;
if($this->countModules('advert4')) $contentbottommodules += 1;
switch ($contentbottommodules) {
	case 1:
		$contentbottomboxwidth = "width100";
		break;
	case 2:
		$contentbottomboxwidth = "width50";
		break;
	default:
		$contentbottomboxwidth = "";
}

// set css-class for mainbottombox
$mainbottommodules = 0;
if($this->countModules('user3')) $mainbottommodules += 1;
if($this->countModules('user4')) $mainbottommodules += 1;
switch ($mainbottommodules) {
	case 1:
		$mainbottomboxwidth = "width100";
		break;
	case 2:
		$mainbottomboxwidth = "width50";
		break;
	default:
		$mainbottomboxwidth = "";
}

// set css-class for bottombox
$bottommodules = 0;
if($this->countModules('bottom1')) $bottommodules += 1;
if($this->countModules('bottom2')) $bottommodules += 1;
if($this->countModules('bottom3')) $bottommodules += 1;
if($this->countModules('bottom4')) $bottommodules += 1;
switch ($bottommodules) {
	case 1:
		$bottomboxwidth = "width100";
		break;
	case 2:
		$bottomboxwidth = "width50";
		break;
	case 3:
		$bottomboxwidth = "width33";
		break;
	case 4:
		$bottomboxwidth = "width25";
		break;
	default:
		$bottomboxwidth = "";
}

// set css-class for topbox seperators
$topbox12seperator = "";
$topbox23seperator = "";
$topbox34seperator = "";
if ($this->countModules('top1') && ($this->countModules('top2') || $this->countModules('top3') || $this->countModules('top4'))) {
	$topbox12seperator = "topboxseperator";
}
if ($this->countModules('top2') && ($this->countModules('top3') || $this->countModules('top4'))) {
	$topbox23seperator = "topboxseperator";
}
if ($this->countModules('top3') && $this->countModules('top4')) {
	$topbox34seperator = "topboxseperator";
}

// set css-class for maintopbox seperators
$maintopbox12seperator = "";
if ($this->countModules('user1') && $this->countModules('user2')) {
	$maintopbox12seperator = "maintopboxseperator";
}

// set css-class for mainbottombox seperators
$mainbottombox12seperator = "";
if ($this->countModules('user3') && $this->countModules('user4')) {
	$mainbottombox12seperator = "mainbottomboxseperator";
}

// set css-class for contenttopbox seperators
$contenttopbox12seperator = "";
if ($this->countModules('advert1') && $this->countModules('advert2')) {
	$contenttopbox12seperator = "contenttopboxseperator";
}

// set css-class for contentbottombox seperators
$contentbottombox12seperator = "";
if ($this->countModules('advert3') && $this->countModules('advert4')) {
	$contentbottombox12seperator = "contentbottomboxseperator";
}

// set css-class for bottombox seperators
$bottombox12seperator = "";
$bottombox23seperator = "";
$bottombox34seperator = "";
if ($this->countModules('bottom1') && ($this->countModules('bottom2') || $this->countModules('bottom3') || $this->countModules('bottom4'))) {
	$bottombox12seperator = "bottomboxseperator";
}
if ($this->countModules('bottom2') && ($this->countModules('bottom3') || $this->countModules('bottom4'))) {
	$bottombox23seperator = "bottomboxseperator";
}
if ($this->countModules('bottom3') && $this->countModules('bottom4')) {
	$bottombox34seperator = "bottomboxseperator";
}

// set css-class for layoutstyle
if($this->countModules('left')) {
	if($this->params->get('layout') == "left") {
		$layoutstyle = "layoutleft";
	} else {
		$layoutstyle = "layoutright";
	}
} else {
	$layoutstyle = "withoutleft";
}

// set css-class for rightbackground
if($this->countModules('right')) {
	$rightbackground = "withright";
} else {
	$rightbackground = "withoutright";
}

// set color
if ($yTools->getCurrentColor() != "default") {
	$yTools->setParam('color', $yTools->getCurrentColor());
}

// set itemcolor (depending on active item)
$itemcolor = "";
if ($itemnum = $yTools->getActiveMenuItemNumber('mainmenu', 0)) {
	$itemcolor = $this->params->get('item' . $itemnum . 'Color');
}

// initialize date
jimport('joomla.utilities.date');
$config =& JFactory::getConfig();
$date = new JDate('now', $config->getValue('config.offset'));

?>