<?
$wb->H1TagPage = '';
$wb->H1TagIdx = 0;
function VtdPrint($s)
{
// do nothing in Sentra
}
function GetHomeIcon($default)
{
global $wb;
if ($wb->PAGES['n0']['icon'] == "")
return $default;
$MyImages = $wb->SYS_PROJECT."/image_pool/";	
$img = RegPluginImage($MyImages .$wb->PAGES['n0']['icon']);
return 'images/'.$img ;
}
function getH1Tag()
{
global $wb;
if ($wb->H1TagPage != $wb->ACTIVE_PAGE)
{
$wb->H1TagPage = $wb->ACTIVE_PAGE;
$wb->H1TagIdx = 0;
return ('h1');
}
else
{
if ($wb->H1TagIdx == 0)
{
$wb->H1TagIdx = 1;
return ('h1');
}
return 'div';
}
}
function get_addtext($id)
{
global $wb;	
return $wb->PAGES[$wb->ACTIVE_PAGE]["addtext"];
}
function get_shorttext($id)
{
global $wb;	
return $wb->PAGES[$wb->ACTIVE_PAGE]["ShortText"];
}
function get_projecttitle()
{
global $wb;	
return ($wb->PROJECT['ProjectName']);
}
function GetAweIcon($id)
{
if (isset($id['ShowAwe']) && $id['ShowAwe'] == "True")
{
return $id['AweName'];
}
return '';
}
function GetHorAweIcon($id)
{
if (!isset($id['abslink'])) {
	$t = explode('|',$id['linkdata']);
	if ($t[0] == 'image')
		return '<i class="fa fa-photo"></i> ';
	if ($t[0] == 'extern')
		return '<i class="fa fa-external-link"></i> ';
	if ($t[0] == 'email')
		return '<i class="fa fa-envelope-o"></i> ';
	if ($t[0] == 'download')
		return '<i class="fa fa-download"></i> ';
}
if (isset($id['ShowAwe']) && $id['ShowAwe'] == "True")
{
return '<i class="fa '.$id['AweName'].'"></i> ';
}
return '';
}
function CheckInternLink($id) {
	if (!isset($id['linkdata']))
		return true;
	$c = explode('|',$id['linkdata']);
	if ($c[0] == 'intern')
		return true;
	return false;
}
function GetHref($i)
{
$l = LINK::GenerateLink($i);
preg_match('/^<a.*?href=(["\'])(.*?)\1.*$/', '<a '.$l, $m);
if (isset($m[2]))
	return $m[2];
else
	return '#';
}
function RenderModalDialog($html) {
	$button = 'primary';
	$ani = '';
	if (file_exists(DESIGNREGCSS.'modal-btn.dat')) {
		$tmp = file(DESIGNREGCSS.'modal-btn.dat');	
		if (!empty($tmp))
			$button = trim($tmp[0]);
	}
	if (file_exists(DESIGNREGCSS.'modal-ani.dat')) {
		$tmp = file(DESIGNREGCSS.'modal-ani.dat');
		if (!empty($tmp))
			$ani = trim($tmp[0]);
	}
	if (file_exists(DESIGNREGCSS.'modal-closeicon.dat')) {
		$tmp = file(DESIGNREGCSS.'modal-closeicon.dat');
		if (!empty($tmp))
			$icon = trim($tmp[0]);
	}
	$html = str_replace('[[Design-Animation]]',$ani,$html);
	$html = str_replace('[[Design-Button]]','btn btn-'.$button,$html);
	$html = str_replace('[[CloseIcon]]',$icon,$html);
	RegisterButton($button);
preg_match_all('/btn btn-(.*?)[ |\"|\']/i',$html, $result);	
	if (!empty($result)) {
		for ($x = 0;$x < count($result[1]);$x++) {
			if ($result[1][$x] != 'lg' && $result[1][$x] != 'sm' ) {
				RegisterButton($result[1][$x]);
			}
		}
	}	
	return $html;
}
function RegisterSearchResult()
{
global $Design;		
if (file_exists(DESIGNREGCSS.'searchresult.dat'))
{		
$buttons = file(DESIGNREGCSS.'searchresult.dat');
foreach ($buttons as $b)
RegisterButton(trim($b));
}
else
{
$Design->RegCss['button']['basics'] = true;
}
}
function RegisterTab()
{
global $Design;		
if (file_exists(DESIGNREGCSS.'tab.dat'))
{		
$buttons = file(DESIGNREGCSS.'tab.dat');
foreach ($buttons as $b)
RegisterButton(trim($b));
}
else
{
$Design->RegCss['button']['basics'] = true;
}
//$Design->RegCss['searchresult']['css'] = true;
}
function RegisterAccordion()
{
global $Design;		
if (file_exists(DESIGNREGCSS.'accordion.dat'))
{		
$buttons = file(DESIGNREGCSS.'accordion.dat');
foreach ($buttons as $b)
RegisterButton(trim($b));
}
else
{
$Design->RegCss['button']['basics'] = true;
}
}
function RegisterPaginationButton()
{
global $Design;	
VTDReg::RegisterCss('pagination','css');
if (file_exists(DESIGNREGCSS.'pagination.dat'))
{
$buttons = file(DESIGNREGCSS.'pagination.dat');
foreach ($buttons as $b)
RegisterButton(trim($b));
}
}
function RegisterButton($type)
{
global $Design;
$typeMode = array('btn','-');
$type = trim(str_replace($typeMode,"",$type));
if (isset($Design->RegCss['button'][$type]))
{
$Design->RegCss['button'][$type] = true;
$Design->RegCss['button']['basics'] = true;
}
}
function RegisterWells($type)
{
global $Design;
if (isset($Design->RegCss['wells'][$type]))
{
$Design->RegCss['wells'][$type] = true;
$Design->RegCss['wells']['basics'] = true;
}
}
function RegisterCommon($modul,$type)
{
global $Design;
if (isset($Design->RegCss[$modul][$type]))
{
$Design->RegCss[$modul][$type] = true;	
}
}
?>