<?php

/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*\
<< ******************************************************************** >>
<< * ---------------------------------------------------------------- * >>
<< * Copyright ©2011-2012 Ozzy47                                      * >>
<< * All Rights Reserved. 											  * >>
<< * This file may not be redistributed in whole or significant part. * >>
<< * ---------------------------------------------------------------- * >>
<< * You are not allowed to use this on your server unless the files  * >>
<< * you downloaded were done so with permission.					  * >>
<< * ---------------------------------------------------------------- * >>
<< ******************************************************************** >>
\*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/

if ($vbulletin->options['dbtech_vbnavtabs_active'])
{
	$tabs_datastore = $vbulletin->dbtech_vbnavtabs_tabs;
}

if (count($tabs_datastore))

// ######################## START REGULAR TABS #############################
{
	$tabs_datastore = $vbulletin->dbtech_vbnavtabs_tabs;
 
 
 //print_r($tabs_datastore);
// exit;
 
	if (count($tabs_datastore))
	{
		$tree = array(); 
		foreach ($tabs_datastore AS $tab_id => $tabs)
		{
        	if (is_null($tabs['type']))
    		{
        		$tree[$tabs['tabid']] = $tabs;
    		} else {
        		if ($tabs['type']=='menuitem' or $tabs['type']=='submenu')
    			{
        			$tree[$tabs['tabid']][] = $tabs;
    			}                
  			}
		}
    
		foreach($tree as $tabs)
		{
			$selected="";
			if (!is_array($tabs[0]))
			{
				if ($tabs['type_of_tab']!='dropdown')
				{
					$groups=explode(",",$tabs['allowedusergroup']);
					if (is_member_of($vbulletin->userinfo, $groups) or empty($tabs['allowedusergroup']))
					{
						$groups=explode(",",$tabs['blockedusergroup']);
						if (!is_member_of($vbulletin->userinfo, $groups) or empty($tabs['blockedusergroup']))
						{
							if($tabs['tabmode']=='THIS_SCRIPT')
							{
								$scriptactive=explode(",",$tabs['script']);
								if (in_array(THIS_SCRIPT,$scriptactive))
								{
									$selected='class="selected"';
									clean_tabs();
								} else {
									$selected='';
								}
							} elseif($tabs['tabmode']=='URL') {
								$url1= 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
								$url2= 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
								if ($tabs['url']==$url1 OR $tabs['url']==$url2)
								{
									$selected='class="selected"';
									clean_tabs();
								}
							} elseif($tabs['tabmode']=='URL_PARAMETER') {
								$compare = $tabs['url'];
								$url1= substr('http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'],0,strlen($tabs['url']));
								$url2= substr('https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'],0,(strlen($tabs['url'])+1));
									
		                		if ($url1==$compare OR $url2==$compare)
		            			{
		                			$selected='class="selected"';
		                			clean_tabs();
		            			}
		        			}
                                    if ($vbulletin->stylevars['vbnavtabs_image_padding'])
                                    {                                        
                                        $image_padding = ' padding: ' . $vbulletin->stylevars['vbnavtabs_image_padding']['top'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
                                        $image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['right'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
                                        $image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['bottom'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
                                        $image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['left'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'] . ';';
                                    }                            
                                        if ($tabs['image'])
                                        {
                                            $image = "<img class='inlineimg' src='" . $vbulletin->options['bburl'] . '/' . $vbulletin->stylevars['vbnavtabs_images']['imagedir'] . '/' . $tabs[image] . "' style='margin-bottom:.25em; vertical-align:middle; $image_padding'/>";
                                        } else {
                                            $image = "";
		            		            }
									
		                	                 if ($tabs['vbphrase'])
		            		                {
		                		                $new_title = $vbphrase[$tabs['vbphrase']];
		                		                if ($new_title=='')
                                            {
                                                    $new_title = $tabs['title'];
                                            }
                                            } else {
                                                $new_title = $tabs['title'];
		            		                }
                                                    if ($vbulletin->options['vbnavtabs_nofollow'])
                                                    {
                                                      $regular_tab = "<li " . $selected . "><a class='navtab' href='" . $tabs[url] . "' target='$tabs[target]'rel='". nofollow ."'>" . $image . $new_title . "</a></li>";
                                                    } else {
                                                        $regular_tab = "<li " . $selected . "><a class='navtab' href='" . $tabs[url] . "'target='$tabs[target]' >" . $image . $new_title . "</a></li>";
		            		                        }
		                            
		                	$template_hook[positiontabinnavbar($tabs['position'])] .= $regular_tab;
     					}
	        		}
	    		}
		    //Go to Dropdown & sublinks
			} else {
				if ($tabs[0]['type']=='menuitem')
	            {
	                $template_hook[positiontabinnavbar($tabs[0]['position'])] .= processing_droptab($tabs);
	            } else {
	                $template_hook[positiontabinnavbar($tabs[0]['position'])] .= processing_tab_sublink($tabs);
	            }
	        }
	   }
	   unset($tree);    
	}
unset($result);
}
// ######################## START DROPDOWN TABS ############################
function processing_droptab($dropdown)
{
    global $vbulletin,$vbphrase;
    $groups=explode(",",$dropdown[0]['allowedusergroup']);
    if (is_member_of($vbulletin->userinfo, $groups) or empty($dropdown[0]['allowedusergroup']))
    {
        $groups=explode(",",$dropdown[0]['blockedusergroup']);
        if ((!is_member_of($vbulletin->userinfo, $groups) or empty($dropdown[0]['blockedusergroup'])))
    {
        $imgdir_misc = $vbulletin->stylevars['imgdir_misc']['imagedir'];

        $right = $vbulletin->stylevars['right']['string'];
        $dropdown_menu_width = $vbulletin->stylevars['vbnavtabs_popup_width']['size'];

        $navbar_selected_popup_body_a_Color = $vbulletin->stylevars['navbar_selected_popup_body_a_Color']['color'];
     
        if ($dropdown[0]['vbphrase'])
        {
            $new_title = $vbphrase[$dropdown[0]['vbphrase']];
                if ($new_title=='')
                {
				    $new_title = $dropdown[0]['title'];
                }
                } else {
                     $new_title = $dropdown[0]['title'];
                }
                    if ($vbulletin->stylevars['vbnavtabs_image_padding'])
                    {                                        
                        $image_padding = ' padding: ' . $vbulletin->stylevars['vbnavtabs_image_padding']['top'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
                        $image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['right'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
                        $image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['bottom'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
                        $image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['left'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'] . ';';
                    }                             
                            if ($dropdown[0]['image'])
                            {
                                    $dropdown_image = "<img class='inlineimg' src=". $vbulletin->options['bburl'] . '/' . $vbulletin->stylevars['vbnavtabs_images']['imagedir'] . '/' . $dropdown[0]['image'] . " style='margin-bottom:.25em; vertical-align:middle; $image_padding'/>";
                            } else {
                                $dropdown_image = "";
                            }
                    if ($vbulletin->options['dbtech_vbnavtabs_hover_menu'])
                    {                         
			             $render_dropdowntab ='<li class="popupmenu hovermenu"><a href="javascript://" class="popupctrl navtab" id="tabpopupctrl" style="background:transparent url('.$imgdir_misc.'/arrow.png) no-repeat '.$right.' center; padding-right: 15px;" >'. $dropdown_image . $new_title .'</a><ul class="popupbody popuphover" style="min-width:0px;">';
                    } else {
                         $render_dropdowntab ='<li class="popupmenu"><a href="javascript://" class="popupctrl navtab" id="tabpopupctrl" style="background:transparent url('.$imgdir_misc.'/arrow.png) no-repeat '.$right.' center; padding-right: 15px;" >'. $dropdown_image . $new_title .'</a><ul class="popupbody popuphover" style="min-width:0px;">';
                    }
// ######################## END DROPDOWN TABS ##############################
// ######################## START DROPDOWN ITEMS ###########################       
        	foreach ($dropdown as $id=>$element)
            {
                $groups=explode(",",$element['callowedusergroup']);
                if (is_member_of($vbulletin->userinfo, $groups) or empty($element['callowedusergroup']))
            	{
                	$groups=explode(",",$element['cblockedusergroup']);
                	if ((!is_member_of($vbulletin->userinfo, $groups) or empty($element['cblockedusergroup'])) and $element['cenable']==1)
            		{
                		if ($element['type']=='menuitem')
            			{
							if ($element['cvbphrase'])
            				{	
								$new_ctitle = $vbphrase[$element['cvbphrase']];
								if ($new_ctitle=='')
            					{
				    				$new_ctitle = $element['ctitle'];
            					}
            				} else {
				    			$new_ctitle = $element['ctitle'];
            				}
                                    if ($vbulletin->stylevars['vbnavtabs_image_padding'])
                                    {
                                        $image_padding = ' padding: ' . $vbulletin->stylevars['vbnavtabs_image_padding']['top'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
                                        $image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['right'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
                                        $image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['bottom'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
                                        $image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['left'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'] . ';';
                                    }                            
                                        if ($element['image'])
                                        {
                                         $new_image = "<img class='inlineimg' src=". $vbulletin->options['bburl'] . '/' . $vbulletin->stylevars['vbnavtabs_images']['imagedir'] . '/' . $element['cimage'] . " style='margin-bottom:.25em; vertical-align:middle; $image_padding'/>";
                                        } else {
                                            $new_image = "";
                                        }
                                            if ($vbulletin->stylevars['vbnavtabs_popup_width']['size'])
                                        {
                                            $spacing = ' min-width: ' . $vbulletin->stylevars['vbnavtabs_popup_width']['size'] . 'px;';
                                        }
                                                 if ($vbulletin->options['vbnavtabs_nofollow'])
                                                             {
                                                                 $render_dropdowntab .= '<li style="text-indent: 0px;' . $spacing . '"><a style="color:'.$navbar_selected_popup_body_a_Color.'" href="'.$element['curl'].'" target="'.$element['ctarget'].'" rel="nofollow">'. $new_image  . $new_ctitle .'</a></li>';
                                                             } else {
                                                                 $render_dropdowntab .= '<li style="text-indent: 0px;' . $spacing . '"><a style="color:'.$navbar_selected_popup_body_a_Color.'" href="'.$element['curl'].'" target="'.$element['ctarget'].'" rel="">'. $new_image  . $new_ctitle .'</a></li>';
		                       		                        }
                                        }
                                    }
                                }
                            }

                        $render_dropdowntab.='</ul></li>';
                    }
                }
            return $render_dropdowntab;        
        }
// ######################## END DROPDOWN ITEMS ############################### 
// ######################## START SUB LINK SUB NAVBAR ########################
function processing_tab_sublink($sublink)
{
    global $vbulletin,$vbphrase;
    $groups=explode(",",$sublink[0]['allowedusergroup']);
    if (is_member_of($vbulletin->userinfo, $groups) or empty($sublink[0]['allowedusergroup']))
    {
        $groups=explode(",",$sublink[0]['blockedusergroup']);
        if ((!is_member_of($vbulletin->userinfo, $groups) or empty($sublink[0]['blockedusergroup'])))
    	{    
        	$scriptactive=explode(",",$sublink[0]['script']);
        	if (in_array(THIS_SCRIPT,$scriptactive))
    		{

				$selected='class="selected"';
				$link_submenu = '<ul class="floatcontainer" style="display:block;">';
				clean_tabs();
// ######################## END SUB LINK SUB NAVBAR ##########################
// ######################## START SUB LINK ITEMS #############################                
				foreach ($sublink as $id=>$element)
   			 	{
                        
	   				$groups=explode(",",$element['callowedusergroup']);
      			  	if (is_member_of($vbulletin->userinfo, $groups) or empty($element['callowedusergroup']))
   					{
        				$groups=explode(",",$element['cblockedusergroup']);
       					if ((!is_member_of($vbulletin->userinfo, $groups) or empty($element['cblockedusergroup'])) and $element['cenable']==1)
						{
            			   	if ($element['type']=='submenu')
             			  	{
			   			 	if ($element['cvbphrase'])
								{
			    					$new_ctitle = $vbphrase[$element['cvbphrase']];
       								if ($new_ctitle=='')
									{
                   						$new_ctitle = $element['ctitle'];
									}
								} else {
   									$new_ctitle = $element['ctitle'];
								}
                   if ($vbulletin->stylevars['vbnavtabs_image_padding'])
                                                    {
                                                        $image_padding = ' padding: ' . $vbulletin->stylevars['vbnavtabs_image_padding']['top'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
                                                        $image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['right'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
                                                        $image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['bottom'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
                                                        $image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['left'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'] . ';';
                                                    }                                
                                            if ($element['cimage'])
                                                {
                                                    $sublink_image = "<img class='inlineimg' src=". $vbulletin->options['bburl'] . '/' . $vbulletin->stylevars['vbnavtabs_images']['imagedir'] . '/' . $element['cimage'] ." style='margin-bottom:.25em; vertical-align:middle; $image_padding'/>";
                                                } else {
                                                    $sublink_image = "";
                                                }
                                            } 
                                                if ($vbulletin->stylevars['vbnavtabs_sublink_padding'])
                                                    {
                                                        $padding = ' padding: ' . $vbulletin->stylevars['vbnavtabs_sublink_padding']['top'] . $vbulletin->stylevars['vbnavtabs_sublink_padding']['units'];
                                                        $padding .= ' ' . $vbulletin->stylevars['vbnavtabs_sublink_padding']['right'] . $vbulletin->stylevars['vbnavtabs_sublink_padding']['units'];
                                                        $padding .= ' ' . $vbulletin->stylevars['vbnavtabs_sublink_padding']['bottom'] . $vbulletin->stylevars['vbnavtabs_sublink_padding']['units'];
                                                        $padding .= ' ' . $vbulletin->stylevars['vbnavtabs_sublink_padding']['left'] . $vbulletin->stylevars['vbnavtabs_sublink_padding']['units'] . ';';
                                                    }                
                         if ($vbulletin->options['vbnavtabs_nofollow'])
                                                    {
                                                        $link_submenu .= '<li style="' . $padding . '"><a href="'.$element['curl'].'" target="'.$element['ctarget'].'" rel="nofollow">' . $sublink_image  . $new_ctitle . '</a></li>';
                                                    } else {
                                                        $link_submenu .= '<li style="' . $padding . '"><a href="'.$element['curl'].'" target="'.$element['ctarget'].'" rel="">' . $sublink_image  . $new_ctitle . '</a></li>';
		            		                        }
           				}
       				}
   				}
   			 $link_submenu .= '</ul>';    
			}
		
                    if ($element['vbphrase'])
                        {
                            $new_title = $vbphrase[$sublink[0]['vbphrase']];
                            if ($new_title=='')
				            {
				                $new_title = $sublink[0]['title'];
				            }
                        } else {
				            $new_title = $sublink[0]['title'];
			             }
                                    if ($vbulletin->stylevars['vbnavtabs_image_padding'])
                                    {
                                        $image_padding = ' padding: ' . $vbulletin->stylevars['vbnavtabs_image_padding']['top'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
                                        $image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['right'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
                                        $image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['bottom'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
                                        $image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['left'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'] . ';';
                                    }

			                         if ($sublink[0]['image'])
                                    {
                                            $sublink_image = "<img class='inlineimg' src=". $vbulletin->options['bburl'] . '/' . $vbulletin->stylevars['vbnavtabs_images']['imagedir'] . '/' .  $sublink[0]['image'] ." style='margin-bottom:.25em; vertical-align:middle; $image_padding'/>";
                                    } else {
                                            $sublink_image = "";
                                    } 
                                            if ($vbulletin->options['vbnavtabs_nofollow'])
                                            {
                                                    $render_sublink = "<li ". $selected ." ><a class='navtab' href='" . $sublink[0]['url'] . "' target='" . $sublink[0]['target'] . "' rel=".nofollow.">" . $sublink_image  . $new_title . "</a>" . $link_submenu . "</li>";
                                            } else {
                                                    $render_sublink = "<li ". $selected ." ><a class='navtab' href='" . $sublink[0]['url'] . "' target='" . $sublink[0]['target'] . "' rel=''>" . $sublink_image  . $new_title . "</a>" . $link_submenu . "</li>";
          		                            }           				
		}
	}
	return $render_sublink;                                
}
// ######################## END SUB LINK ITEMS #############################
// ######################## START COMMON FUNCTIONS #########################
function clean_tabs()
{
    global $vbulletin,$vbphrase;
    $vbulletin->options['selectednavtab']='-cleanall-';
    $vbulletin->templatecache['navbar'] = str_replace('class="selected"','',$vbulletin->templatecache['navbar']);
    $vbulletin->templatecache['blog_navbar_link'] = str_replace('class="selected"','',$vbulletin->templatecache['blog_navbar_link']);
    $vbulletin->templatecache['vbcms_navbar_link'] = str_replace('class="selected"','',$vbulletin->templatecache['vbcms_navbar_link']);
}               
        function positiontabinnavbar($position)
        {
        	switch ($position) 
         	{
                case 'left':
                   return 'navtab_start';
                case 'center':
                    return 'navtab_middle';        
                case 'right':
                    return 'navtab_end';
                case 'navbartwo':
                    return 'navtab_two';                 
        	}
        }
// ######################## END COMMON FUNCTIONS ###########################               
// ######################## START HIDE TABS ################################
        if ($vbulletin->options['dbtech_vbnavtabs_hide_search'])
        {
		      $vbulletin->templatecache['navbar'] = str_replace('enablesearches','',$vbulletin->templatecache['navbar']);
        }
                    if ($vbulletin->options['dbtech_vbnavtabs_hide_home'])
                    {
                    	$search[1] = '<a class="navtab" href="\' . $vboptions[\'site_tab_url\'] . \'\' . $session[\'sessionurl_q\'] . \'">\' . vB_Template_Runtime::parsePhrase("site") . \'</a>';
                    	$search[2] = '<li class="selected">';
                    	$vbulletin->templatecache['vbcms_navbar_link']=str_replace($search,array('','<li class="selected" style="padding:0px">'),$vbulletin->templatecache['vbcms_navbar_link']);
                    }
                            if ($vbulletin->options['dbtech_vbnavtabs_hide_forum'])
                            {
                            	$search[1] = '<li class="selected"><a class="navtab" href="\' . vB_Template_Runtime::linkBuild("forumhome") . \'">\' . vB_Template_Runtime::parsePhrase("forum") . \'</a>';
                            	$search[2] = '<li><a class="navtab" href="\' . vB_Template_Runtime::linkBuild("forumhome") . \'">\' . vB_Template_Runtime::parsePhrase("forum") . \'</a></li>';
                            	$search[3] = '<li ><a class="navtab" href="\' . vB_Template_Runtime::linkBuild("forumhome") . \'">\' . vB_Template_Runtime::parsePhrase("forum") . \'</a>';
                            	$vbulletin->templatecache['navbar']=str_replace($search,array('<li class="selected" style="padding:0px">','','<li class="selected" style="padding:0px">'),$vbulletin->templatecache['navbar']);
                            }
                                    if ($vbulletin->options['dbtech_vbnavtabs_hide_blog'])
                                    {
                                    	$search[1] = '<a class="navtab" href="\' . $vboptions[\'vbblog_url\'] . \'\' . (($vboptions[\'vbblog_url\']) ? "/" : "")  . \'blog.php\' . $session[\'sessionurl_q\'] . \'">\' . vB_Template_Runtime::parsePhrase("blogs") . \'</a>';
                                    	$search[2] = '<li class="selected">';
                                    	$vbulletin->templatecache['blog_navbar_link']=str_replace($search,array('','<li class="selected" style="padding:0px">',''),$vbulletin->templatecache['blog_navbar_link']);
                                    }   
                                            if ($vbulletin->options['dbtech_vbnavtabs_hide_whatsnews'])
                                            {
                                            	$vbulletin->templatecache['navbar']= preg_replace(
                                            	$search[1] = '#(<li>|<li\s*class="selected">)*<a\s*class="navtab"\s*href="search\.php\?\'\s*\.\s*\$session\[\'sessionurl\'\]\s*\.\s*\'do=\w+&amp;contenttype=\w+"\s*accesskey="\d">\'\s*\.\s*vB_Template_Runtime::parsePhrase\("\w*"\)\s*\.\s*\'</a>(</li>)*#i','',$vbulletin->templatecache['navbar']);
                                            }

                                    unset($search);
                                        $template_hook['headinclude_css'] .= $GLOBALS['css_tabs'];
// ######################## END HIDE TABS ##################################
// ######################## START DEFAULT TAB IMAGES #######################
		if ($vbulletin->stylevars['vbnavtabs_image_padding'])
		{
			$image_padding = ' padding: ' . $vbulletin->stylevars['vbnavtabs_image_padding']['top'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
			$image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['right'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
			$image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['bottom'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'];
			$image_padding .= ' ' . $vbulletin->stylevars['vbnavtabs_image_padding']['left'] . $vbulletin->stylevars['vbnavtabs_image_padding']['units'] . ';';
		}  

                if ($vbulletin->options['dbtech_vbnavtabs_home_image'])
                {
        			$vbulletin->templatecache['vbcms_navbar_link'] = str_replace('<a class="navtab" href="\' . $vboptions[\'site_tab_url\'] . \'\' . $session[\'sessionurl_q\'] . \'">\' . vB_Template_Runtime::parsePhrase("site") . \'</a>','<a class="navtab" href="\' . $vboptions[\'site_tab_url\'] . \'\' . $session[\'sessionurl_q\'] . \'"><img class="inlineimg" src="dbtech/vbnavtabs/images/home_image/home.png" style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '">\'. vB_Template_Runtime::parsePhrase("site") . \'</a>',$vbulletin->templatecache['vbcms_navbar_link']);
                }
                if ($vbulletin->options['dbtech_vbnavtabs_forum_image'])
                {
                    $vbulletin->templatecache['navbar'] = str_replace('<a class="navtab" href="\' . vB_Template_Runtime::linkBuild("forumhome") . \'">\' . vB_Template_Runtime::parsePhrase("forum") . \'</a>','<a class="navtab" href="\' . vB_Template_Runtime::linkBuild("forumhome") . \'"><img src="dbtech/vbnavtabs/images/forum_image/forum.png"  style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '" >\' . vB_Template_Runtime::parsePhrase("forum") . \'</a>',$vbulletin->templatecache['navbar']); 
                }
                if ($vbulletin->options['dbtech_vbnavtabs_blog_image'])
                {
                    $vbulletin->templatecache['blog_navbar_link'] = str_replace('<a class="navtab" href="\' . $vboptions[\'vbblog_url\'] . \'\' . (($vboptions[\'vbblog_url\']) ? "/" : "")  . \'blog.php\' . $session[\'sessionurl_q\'] . \'">\' . vB_Template_Runtime::parsePhrase("blogs") . \'</a>','<a class="navtab" href="\' . $vboptions[\'vbblog_url\'] . \'\' . (($vboptions[\'vbblog_url\']) ? "/" : "")  . \'blog.php\' . $session[\'sessionurl_q\'] . \'"><img src="dbtech/vbnavtabs/images/blog_image/blog.png"  style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '" >\' . vB_Template_Runtime::parsePhrase("blogs") . \'</a>',$vbulletin->templatecache['blog_navbar_link']); 
                }
                if ($vbulletin->options['dbtech_vbnavtabs_whats_new_image'])
                {
                    $vbulletin->templatecache['navbar'] = str_replace('\' . vB_Template_Runtime::parsePhrase("getnew_tab") . \'','<img src="dbtech/vbnavtabs/images/whats_new_image/whats_new.png"  style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '" >\' . vB_Template_Runtime::parsePhrase("getnew_tab") . \'',$vbulletin->templatecache['navbar']);
                }
// ######################## END DEFAULT TAB IMAGES #########################
// ######################## START DBT TAB IMAGES ###########################
    if ($vbulletin->options['dbtech_vbnavtabs_vbactivity_image'])
    {
        $vbulletin->templatecache['dbtech_vbactivity_navbar_link'] = str_replace('\' . vB_Template_Runtime::parsePhrase("dbtech_vbactivity_vbactivity") . \'','<img src="dbtech/vbnavtabs/images/DBT_images/activity.png"  style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '" >\' . vB_Template_Runtime::parsePhrase("dbtech_vbactivity_vbactivity") . \'',$vbulletin->templatecache['dbtech_vbactivity_navbar_link']);
    }
    if ($vbulletin->options['dbtech_vbnavtabs_arcade_image'])
    {
        $vbulletin->templatecache['dbtech_vbarcade_navtab'] = str_replace('$vbphrase[dbtech_vbarcade_arcade]','<img src=\'dbtech/vbnavtabs/images/DBT_images/arcade.png\'  style=\'margin-bottom:.25em; vertical-align:middle; ' . $image_padding . '\' >$vbphrase[dbtech_vbarcade_arcade]',$vbulletin->templatecache['dbtech_vbarcade_navtab']);
    }  
    if ($vbulletin->options['dbtech_vbnavtabs_credits_image'])
    {
        $vbulletin->templatecache['credits_navtab'] = str_replace('$vbphrase[credits_transactions]','<img src=\'dbtech/vbnavtabs/images/DBT_images/credits.png\'  style=\'margin-bottom:.25em; vertical-align:middle; ' . $image_padding . '\' >$vbphrase[credits_transactions]',$vbulletin->templatecache['credits_navtab']);
    }
    if ($vbulletin->options['dbtech_vbnavtabs_downloads_image'])
    {
        $vbulletin->templatecache['dbtech_downloads_navbar'] = str_replace('\' . vB_Template_Runtime::parsePhrase("dbtech_downloads") . \'','<img src="dbtech/vbnavtabs/images/DBT_images/downloads.png"  style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '" >\' . vB_Template_Runtime::parsePhrase("dbtech_downloads") . \'',$vbulletin->templatecache['dbtech_downloads_navbar']);
    }
    if ($vbulletin->options['dbtech_vbnavtabs_mail_image'])
    {
        $vbulletin->templatecache['dbtech_vbmail_navbar_link'] = str_replace('\' . vB_Template_Runtime::parsePhrase("dbtech_vbmail_mailing_lists") . \'','<img src="dbtech/vbnavtabs/images/DBT_images/mail.png"  style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '" >\' . vB_Template_Runtime::parsePhrase("dbtech_vbmail_mailing_lists") . \'',$vbulletin->templatecache['dbtech_vbmail_navbar_link']);
    }
    if ($vbulletin->options['dbtech_vbnavtabs_quiz_image'])
    {
        $vbulletin->templatecache['dbtech_vbquiz_nav_button'] = str_replace('\' . vB_Template_Runtime::parsePhrase("dbtech_vbquiz_nav") . \'','<img src="dbtech/vbnavtabs/images/DBT_images/quiz.png"  style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '" >\' . vB_Template_Runtime::parsePhrase("dbtech_vbquiz_nav") . \'',$vbulletin->templatecache['dbtech_vbquiz_nav_button']);
    }
    if ($vbulletin->options['dbtech_vbnavtabs_shop_image'])
    {
        $vbulletin->templatecache['dbtech_vbshop_navbar_link'] = str_replace('\' . vB_Template_Runtime::parsePhrase("dbtech_vbshop_vbshop") . \'','<img src="dbtech/vbnavtabs/images/DBT_images/shop.png"  style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '" >\' . vB_Template_Runtime::parsePhrase("dbtech_vbshop_vbshop") . \'',$vbulletin->templatecache['dbtech_vbshop_navbar_link']);
    }
    if ($vbulletin->options['dbtech_vbnavtabs_forumon_image'])
    {
        $vbulletin->templatecache['dbtech_forumon_navbar_link'] = str_replace('\' . vB_Template_Runtime::parsePhrase("dbtech_forumon_forumon") . \'','<img src="dbtech/vbnavtabs/images/DBT_images/forumon.png"  style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '" >\' . vB_Template_Runtime::parsePhrase("dbtech_forumon_forumon") . \'',$vbulletin->templatecache['dbtech_forumon_navbar_link']);
    }
    if ($vbulletin->options['dbtech_vbnavtabs_triple_triad_image'])
    {
        $vbulletin->templatecache['dbt_tt_navbar'] = str_replace('\' . vB_Template_Runtime::parsePhrase("dbt_tt_tripletriad") . \'','<img src="dbtech/vbnavtabs/images/DBT_images/triple_triad.png"  style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '" >\' . vB_Template_Runtime::parsePhrase("dbt_tt_tripletriad") . \'',$vbulletin->templatecache['dbt_tt_navbar']);
    }                                                                                                                                                                                                                                        
// ######################## END DBT TAB IMAGES ############################# 
// ######################## START SEARCH TAB ###############################
//$vbulletin->templatecache['navbar'] = str_replace('<vb:if condition="$vboptions[\'enablesearches\']">',''.$template_hook[navtab_end_two].'<vb:if condition="$vboptions[\'enablesearches\']">',$vbulletin->templatecache['navbar']);
//$vbulletin->templatecache['navbar'] = str_replace('</div><!-- closing div for above_body -->','</div><!-- closing div for above_body -->',$vbulletin->templatecache['navbar']);
if ($vbulletin->options['dbtech_vbnavtabs_search_tab_image'])
{
  if ($vbulletin->options['dbtech_vbnavtabs_search_tab'])
  if ($show['member'] OR $vbulletin->options['dbtech_vbnavtabs_guests_search_tab'])
    {
	global $vbphrase, $vbulletin, $bbuserinfo;
	$sess = $vbulletin->session->vars['sessionurl_q'];
    $template_hook['navtab_end'] .= '
            <li class="popupmenu hovermenu forumsearch menusearch" id="forumsearch">
				<h6><a href="javascript://" class="popupctrl navtab">
                    <img src="dbtech/vbnavtabs/images/search_image/search.png"  style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '" >' . $vbphrase[dbtech_vbnavtabs_search] . '</a></h6>
        				<form action="search.php?do=process" method="get">
        					<ul class="popupbody popuphover">
        						<li><input type="text" class="searchbox" name="query" value="' . $vbphrase[dbtech_vbnavtabs_search_search] . '" tabindex="1" /></li>
            						<li class="formsubmit">
							<input type="submit" class="button" value="' . $vbphrase[dbtech_vbnavtabs_search_button] . '" tabindex="2" />
						</li>
					<li class="formsubmit">
						<div class="submitoptions">
							<label><input type="radio" name="showposts" value="0" checked="checked" /> ' . $vbphrase[dbtech_vbnavtabs_show_threads] . '</label>
							<label><input type="radio" name="showposts" value="1" /> ' . $vbphrase[dbtech_vbnavtabs_show_posts] . '</label>
						</div>
						<div class="advancedsearchlink"><a href="search.php?">' . $vbphrase[dbtech_vbnavtabs_advanced_search] . '</a></div>

					</li>
				</ul>
				<input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
				<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
				<input type="hidden" name="do" value="process" />
				<input type="hidden" name="contenttype" value="vBForum_Post" />
				<input type="hidden" name="exactname" value="1" />
				</form>
			</li>
';
} 
} else{
  if ($vbulletin->options['dbtech_vbnavtabs_search_tab'])
  if ($show['member'] OR $vbulletin->options['dbtech_vbnavtabs_guests_search_tab'])
    {
	global $vbphrase, $vbulletin, $bbuserinfo;
	$sess = $vbulletin->session->vars['sessionurl_q'];  
    $template_hook['navtab_end'] .= '
            <li class="popupmenu hovermenu forumsearch menusearch" id="forumsearch">
				<h6><a href="javascript://" class="popupctrl navtab">' . $vbphrase[dbtech_vbnavtabs_search] . '</a></h6>
        				<form action="search.php?do=process" method="get">
        					<ul class="popupbody popuphover">
        						<li><input type="text" class="searchbox" name="query" value="' . $vbphrase[dbtech_vbnavtabs_search_search] . '" tabindex="1" /></li>
            						<li class="formsubmit">
							<input type="submit" class="button" value="' . $vbphrase[dbtech_vbnavtabs_search_button] . '" tabindex="2" />
						</li>
					<li class="formsubmit">
						<div class="submitoptions">
							<label><input type="radio" name="showposts" value="0" checked="checked" /> ' . $vbphrase[dbtech_vbnavtabs_show_threads] . '</label>
							<label><input type="radio" name="showposts" value="1" /> ' . $vbphrase[dbtech_vbnavtabs_show_posts] . '</label>
						</div>
						<div class="advancedsearchlink"><a href="search.php?">' . $vbphrase[dbtech_vbnavtabs_advanced_search] . '</a></div>

					</li>
				</ul>
				<input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
				<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
				<input type="hidden" name="do" value="process" />
				<input type="hidden" name="contenttype" value="vBForum_Post" />
				<input type="hidden" name="exactname" value="1" />
				</form>
			</li>
';
}     
}
// ######################## END SEARCH TAB #################################
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*\
<< ********************************************************************* >>
<< * Created: 19:30, Fri Nov 25th 2011                                 * >>
<< * VER: 1.0.0                                                        * >>
<< ********************************************************************* >>
\*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/

?>