<?php

class ISC_INDEX
{
	public function HandlePage(){
		$this->ShowHomePage();
	}

	public function ShowHomePage(){
		if(isset($GLOBALS['PathInfo'][0]) && ($GLOBALS['PathInfo'][0] == 'store' || $GLOBALS['PathInfo'][0] == 'shop')) {
			$GLOBALS['ActivePage'] = 'store';
		}
		else {
			$GLOBALS['ActivePage'] = "home";
		}
		$pagesCache = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('Pages');
		if($GLOBALS['ActivePage'] != 'store' && !empty($pagesCache['defaultPage']['pageid']) &&
			!$GLOBALS['ISC_CLASS_TEMPLATE']->getIsMobileDevice()) {
				$GLOBALS['ISC_CLASS_PAGE'] = new ISC_PAGE($pagesCache['defaultPage']['pageid'], true, $pagesCache['defaultPage']);
				$GLOBALS['ISC_CLASS_PAGE']->ShowPage();
		}
		else {
			if(GetConfig('HomePagePageTitle')) {
				$title = GetConfig('HomePagePageTitle');
			}else {
				$title = GetConfig('StoreName');
			}                             
			$GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle($title);
			$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("default");
			$GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
		}
	}
}