<!--[if gte IE 9]>
  <style type="text/css">
    .gradient {
       filter: none;
    }
  </style>
<![endif]-->

<?php
/**
 * @name          : Joomla Social Pinboard
 * @version	  	  : 1.5.0
 * @package       : apptha
 * @since         : Joomla 1.5
 * @author        : Apptha - http://www.apptha.com
 * @copyright     : Copyright (C) 2011 Powered by Apptha
 * @license       : http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
 * @abstract      : Social Pinboard Module header
 * @Creation Date : March 2013
 * @Modified Date : March 2013
 * */
// No direct Access

defined('_JEXEC') or die('Restricted access');
$class_name = '';
$total = ceil(count($result) / 2);
$user = JFactory::getUser();
$show_request = $getcurrencysymbol->setting_show_request;
$show_register_btn = $getcurrencysymbol->setting_user_registration;
$id = $user->id;
$userId = $user->id;
$view_name = JRequest::getVar('view', NULL);

if (JRequest::getVar('wishers', NULL) == 'youfollow') {
    $class_you_follow = 'nav active';
} else {
    $class_you_follow = "nav";
}
if (!empty($googlead)) {
?>
    <div id="headerad" >
        <iframe id="google_ads_frame1" height="<?php echo $googlead[0]->adheight ?>" class="iframeborder"  width="<?php echo $googlead[0]->adwidth; ?>" scrolling="no"
                src="http://googleads.g.doubleclick.net/pagead/ads?client=ca-<?php echo $googlead[0]->adclient; ?>&amp;output=html&amp;h=60&amp;slotname=<?php echo $googlead[0]->adslot; ?>&amp;w=600&amp;lmt=1333622642&amp;flash=11.2.202&amp;url=<?php echo $CurrentURL; ?>&amp;dt=1333622642977&amp;bpp=6&amp;shv=r20120328&amp;jsv=r20110914&amp;correlator=1333622643047&amp;frm=20&amp;adk=2492369040&amp;ga_vid=1889973982.1333622643&amp;ga_sid=1333622643&amp;ga_hid=582102500&amp;ga_fc=0&amp;u_tz=330&amp;u_his=1&amp;u_java=1&amp;u_h=768&amp;u_w=1366&amp;u_ah=738&amp;u_aw=1366&amp;u_cd=24&amp;u_nplug=8&amp;u_nmime=59&amp;dff=helvetica%20neue&amp;dfs=13&amp;adx=437&amp;ady=51&amp;biw=1349&amp;bih=605&amp;oid=3&amp;fu=0&amp;ifi=1&amp;dtd=230&amp;xpc=c7YrckmnJi&amp;p=<?php echo JURI::base(); ?><" name="google_ads_frame1" allowtransparency="true" ><base target="_parent" />
        </iframe>
    </div>
<?php
}
?>
	<script type='text/javascript'>
    var scroll_to_top="<?php echo JTEXT::_('COM_WISHLOGUE_HEADER_SCROLL_TO_TOP'); ?>";
	function formSubmit(frmname)
	{
		var sort_by = document.getElementById('sort_by').value;
		if( sort_by !== 'sortbyDEF' )
		{
			document.getElementById(frmname).submit();
		}
	}
   </script>
	
    <div id="CategoriesBar" class="category_mobile">
        <form name="category_list" class="category_list" action="<?php echo JRoute::_('index.php?option=com_wishlogue&amp;view=home', true); ?>" method="post">
		<input type="button" onclick="window.location='<?php echo JUri::base(); ?>'" value="Home">
        <ul class="catMenu HeaderContainer">
			<!-- rgs. -->
			<li class="top_nav">
				<?php
					$wwya_class_name = "nav";
					if (JRequest::getVar('view', NULL) == 'wwya') {
						$wwya_class_name = "nav active";
					}
				?>
                <a href="<?php echo JRoute::_('index.php?option=com_wishlogue&view=wwya&id='.$LatestArticleID, true); ?>" class="<?php echo $wwya_class_name; ?>">
					<?php echo JTEXT::_('MOD_WISHLOGUE_WWYA'); ?>
				</a>
                <span class="cat_dot">*</span>
            </li>
            <li class="top_nav">
				<?php
					$top10_class_name = "nav";
					if (JRequest::getVar('view', NULL) == 'topten') {
						$top10_class_name = "nav active";
					}
				?>
                <a href="<?php echo JRoute::_('index.php?option=com_wishlogue&amp;view=topten', true); ?>" class="<?php echo $top10_class_name; ?>">
					<?php echo JTEXT::_('MOD_WISHLOGUE_TOPTEN'); ?>
				</a>
                <span class="cat_dot">*</span>
            </li>
			<!-- rgs.. -->

<?php
if ($userId) {
 ?>
            <li class="top_nav follower">
                <a href="<?php echo JRoute::_('index.php?option=com_wishlogue&amp;view=home&amp;wishers=youfollow', true); ?>" class="<?php echo $class_you_follow; ?>"><?php echo JTEXT::_('MOD_PINNERS_YOU_FOLLOW'); ?></a>
                <span class="cat_dot">*</span>
            </li>
<?php
        }
?>
            <li class="submenu top_nav">
<?php
    if ($view_name == 'allcatalogues') {
            $class_everything = 'nav about active';
        } else {
            $class_everything = 'nav about';
        }
?>

                <a href="<?php echo JRoute::_('index.php?option=com_wishlogue&amp;view=allcatalogues', true); ?>" class="<?php echo $class_everything; ?>">
<?php echo JTEXT::_('MOD_WISHLOGUE_HEADER_CATEGORIES'); ?>
                <i class='catalogues_dropdown_i'></i>
				</a>
                    <span class="cat_dot">*</span>
                <ul id="CategoriesDropdown">

                    <li>
<?php
                $i = 0;
				$arrcategory_count = count($result);
                foreach ($result as $arrcategory) {

                    // if ($i == 0)
                        // echo '<span class="SubmenuColumn">';
                    // if ($i == $total)
                        // echo '</span><span class="SubmenuColumn">';

					if ($i%2 == 0) {
                        echo '<span class="SubmenuColumn">';
					}
?>

                        <a style="cursor: pointer" onclick="return getCategories(' <?php echo $arrcategory->category_id; ?>','<?php echo JURI::base() . 'index.php?option=com_wishlogue&amp;view=home&amp;category=' . urlencode($arrcategory->category_name); ?>')"><?php echo strtoupper($arrcategory->category_name . '<font>*</font>' . JText::_('COM_WISHLOGUE_LOGUES')); ?></a>
<?php
                        // if ($i == count($result) - 1)
                            // echo '</span>';
						if ( $arrcategory_count%2 != 0 && $arrcategory_count == $i+1 ) {
							echo '<a></a>';
						}
						if ($i%2 != 0 || $arrcategory_count == $i) {
							echo '</span>';
						}
							
                        $i++;
                    }
?>
                        <input type="hidden" value="<?php echo $arrcategory->category_id ?>" id="cat_id" name="cat_id"/>
                    </li>
                </ul>
            </li>
             <li  class="top_nav">
<?php
                    if (JRequest::getVar('category', NULL) == 'all') {
                        $class_name = "nav active";
                    }
?>
                    <a href="<?php echo JRoute::_('index.php?option=com_wishlogue&amp;view=home&amp;category=all', true); ?>" class="<?php echo $class_name; ?> "><?php echo JTEXT::_('MOD_WISHLOGUE_HEADER_EVERYTHING'); ?></a>
					<span class="cat_dot">*</span>
                </li>
            <!-- <li  class="top_nav">
//<?php
//                        if ($view_name == 'video') {
//                            $class_name = "nav active";
//                        } else {
//                        $class_name = "nav";
//                    }
//                ?>
                            <a href="<?php //echo JRoute::_('index.php?option=com_wishlogue&amp;view=video', true); ?>" class="<?php echo $class_name; ?> "><?php echo JTEXT::_('MOD_WISHLOGUE_HEADER_VIDEOS'); ?></a><span class="cat_dot">*</span>
            </li> -->
                    <li class="top_nav">
                <?php
                        if ($view_name == 'trendingwishes') {
                ?>
                            <a href="<?php echo JRoute::_('index.php?option=com_wishlogue&amp;view=trendingwishes', true); ?>" class="nav active"><?php echo JTEXT::_('MOD_WISHLOGUE_HEADER_POPULAR'); ?></a>
                <?php
                        } else {
                ?>
                            <a href="<?php echo JRoute::_('index.php?option=com_wishlogue&amp;view=trendingwishes', true); ?>" class="nav"><?php echo JTEXT::_('MOD_WISHLOGUE_HEADER_POPULAR'); ?></a>
                <?php
                        }
                ?>
                    </li>
					
					<!--
                    <li class="top_nav gifts">
                <?php
                        // if ($view_name == 'gift') {
                            // $class_name = "nav active";
                        // } else {
                            // $class_name = "nav ";
                        // }
                ?>
                        <a href="<?php //echo JRoute::_('index.php?option=com_wishlogue&amp;view=gift', true); ?>" class="<?php //echo $class_name; ?>"><?php //echo JTEXT::_('MOD_WISHLOGUE_HEADER_GIFTS'); ?></a>
                        <ul id="CategoriesDropdowngift">
                            <li>
                                <span class="SubmenuColumn">
                                    <a style="cursor: pointer" href="<?php //echo JURI::base() . 'index.php?option=com_wishlogue&amp;view=gift&amp;starts=1&amp;ends=20'; ?>"><?php //echo $getcurrencysymbol->setting_currency . '1-20'; ?></a>
                                    <a style="cursor: pointer" href="<?php //echo JURI::base() . 'index.php?option=com_wishlogue&amp;view=gift&amp;starts=20&amp;ends=50'; ?>"><?php //echo $getcurrencysymbol->setting_currency . '20-50'; ?></a>
                                    <a style="cursor: pointer" href="<?php //echo JURI::base() . 'index.php?option=com_wishlogue&amp;view=gift&amp;starts=50&amp;ends=100'; ?>"><?php //echo $getcurrencysymbol->setting_currency . '50-100'; ?></a>
                                    <a style="cursor: pointer" href="<?php //echo JURI::base() . 'index.php?option=com_wishlogue&amp;view=gift&amp;starts=100&amp;ends=200'; ?>"><?php //echo $getcurrencysymbol->setting_currency . '100-200'; ?></a>
                                    <a style="cursor: pointer" href="<?php //echo JURI::base() . 'index.php?option=com_wishlogue&amp;view=gift&amp;starts=200&amp;ends=500'; ?>"><?php //echo $getcurrencysymbol->setting_currency . '200-500'; ?></a>
                                    <a style="cursor: pointer" href="<?php //echo JURI::base() . 'index.php?option=com_wishlogue&amp;view=gift&amp;starts=500'; ?>"><?php //echo $getcurrencysymbol->setting_currency . '500+'; ?></a>
                                </span>
                            </li>
                        </ul>
                    </li>	
					-->


					
                </ul>
            </form>

					<!-- rgs -->
					<?php
						$form_submit = $_SERVER['REQUEST_URI'];
						if ( JRequest::getVar('cat_id') != '' && JRequest::getVar('cat_id') != 0 && JRequest::getVar('cat_id') != null && JRequest::getVar('cat_id') != '0' )
						{
							$form_submit = JUri::base() . 'index.php?option=com_wishlogue&view=home&cat_id=' . JRequest::getVar('cat_id');
						}

						$sort_by = JRequest::getVar('sort_by');
						$session = JFactory::getSession();
						$sortbyASC = '';
						$sortbyDESC = '';
						$sortbyDEF = '';
						if( $sort_by == '' || $sort_by == null )
						{
							$value = $session->get( 'sort_by', 'empty' );
							if($value == 'sortbyASC')
							{
								$sortbyASC = 'selected';
							}
							else if($value == 'sortbyDESC')
							{
								$sortbyDESC = 'selected';
							}
							else
							{
								$sortbyDEF = 'selected';
								$session->set( 'sort_by', 'sortbyDEF' );
							}
						}
						else
						{
							if($sort_by == 'sortbyASC')
							{
								$sortbyASC = 'selected';
								$session->set( 'sort_by', 'sortbyASC' );
							}
							else if($sort_by == 'sortbyDESC')
							{
								$sortbyDESC = 'selected';
								$session->set( 'sort_by', 'sortbyDESC' );
							}
							else
							{
								$sortbyDEF = 'selected';
								$session->set( 'sort_by', 'sortbyDEF' );
							}
						}
						 // file_put_contents("C://ahdf.txt", $sortbyASC . ', ' . $sortbyDESC . ', ' . $sortbyDEF . ',' . $_SERVER['REQUEST_URI'] . ', ' . JUri::root());
						$serachVal = JRequest::getVar('serachVal');
						$serachVal = isset($serachVal) ? $serachVal : '';
						$value = JRequest::getVar('value');
						$session = JFactory::getSession();
						if ($serachVal == '') {
							$searchname = $value;
						} else {
							$searchname = $serachVal;
						}
						//file_put_contents('C://' . rand() . '.txt', $searchname);
					?>
					<?php
						$app = JFactory::getApplication();
						$menu = $app->getMenu();
						if ($menu->getActive() == $menu->getDefault()) {
							$view_name = 'thefrontpage';
						}
					?>
					<?php
						if ( $view_name == 'sectiondisplay' || $view_name == 'thefrontpage' || $view_name == 'video' || $view_name == 'search' || $view_name == 'trendingwishes' || $view_name == 'cataloguepage' || $view_name == 'wishdisplay' || $view_name == 'home' || $view_name == 'likes' || $view_name == 'gift' )
						{
					?>
					<!--
					<form method="POST" id="sortbyform" name="sortbyform" action="<?php echo $form_submit; ?>">
						<span class="cat_dot">*</span>
                        <select onchange="formSubmit('sortbyform')" name='sort_by' id='sort_by'>
							<option value='sortbyDEF' <?php //echo $sortbyDEF; ?>><?php //echo JTEXT::_('MOD_WISHLOGUE_SORT_BY'); ?></option>
							<option value='sortbyASC' <?php //echo $sortbyASC; ?>><?php //echo JTEXT::_('MOD_WISHLOGUE_SORT_BY_PRICE_ASC'); ?></option>
							<option value='sortbyDESC' <?php //echo $sortbyDESC; ?>><?php //echo JTEXT::_('MOD_WISHLOGUE_SORT_BY_PRICE_DESC'); ?></option>
						</select>
						 <input type="hidden" name="serachVal" id="serachVal" value="<?php echo $searchname; ?>" />
					</form> -->

				<span class="cat_dot">*</span>
				<form method="POST" id="sortbyform" name="sortbyform" action="<?php echo $form_submit; ?>">
                <div class='selectBox'>
                    <input type="hidden" value="3" id='sort_by' name='sort_by' class="price_values"/>
                    <span class='selected'></span>
                    <span class='selectArrow'></span>
                    <ul class="selectOptions" >
						<?php if( $sortbyDEF == 'selected') { ?>
                        <li class="selectOption" data-value="sortbyDEF">Sort By</li>
						<?php } ?>
                        <li class="selectOption" data-value="sortbyASC">Price Low to High</li>
                        <li class="selectOption" data-value="sortbyDESC">Price High to Low</li>
                    </ul>
                </div>
				<input type="hidden" name="serachVal" id="serachVal" value="<?php echo $searchname; ?>" />
				</form>

					<?php
						}
					?>

					<!-- rgs -->

		<div class="banner_box">
            <div class="Nag">
                <div class="Sheet1 Sheet">
                    <p><strong><?php echo JText::_('MOD_WISHLOGUE_ONLINE_PINBOARD'); ?></strong><br>
                        <?php echo JText::_('MOD_WISHLOGUE_ORGANIZE_AND_SHARE'); ?></p>

                    <div class="login_register_button">
<?php
                        if (!$user->id && $show_request == 0 && $show_register_btn ==1) {
?>
                            <a href="<?php echo JRoute::_('index.php?option=com_wishlogue&view=register'); ?>" class="nav register_btn">
<?php echo JText::_('MOD_WISHLOGUE_REGISTER'); ?>
                            </a>

                <?php
                        } else {
                            if (!$user->id && $show_request == 1) {
                ?>

                            <a href="<?php echo JRoute::_('index.php?option=com_wishlogue&view=inviterequest'); ?>" class="nav register_btn">
                <?php echo JText::_('MOD_WISHLOGUE_INVITE'); ?>
                                </a>
                <?php
                            }
                        }
                ?>
<?php
                        if ($id == 0) {
                            $uri = JFactory::getURI();
                            $return = $uri->toString();
                            $url = "index.php?option=com_wishlogue&view=people";
                            $url .= '&returnURL=' . base64_encode($return);
                            $linkurl = JRoute::_($url);
?>
                            <a href="<?php echo $linkurl; ?>" class="nav login_btn">Login</a>
                <?php } ?>

                    </div>
                </div>
                <div class="Sheet2 Sheet"></div>
                <div class="Sheet3 Sheet"></div>
            </div>
        </div>
        </div>
        


<?php
                        $user = JFactory::getUser();
                        if ($user->id != 0) {
?>
   <a id="home_invite_frnds" href="<?php echo JRoute::_('index.php?option=com_wishlogue&amp;view=invitefriends', true); ?>"><i></i><?php echo JTEXT::_('MOD_WISHLOGUE_HEADER_INVITE_FRIENDS'); ?></a>
<?php }
else {
		$uri = JFactory::getURI();
		$return = $uri->toString();
		$url = "index.php?option=com_wishlogue&view=people";
		$url .= '&returnURL=' . base64_encode($return);
		$linkurl = JRoute::_($url);
 ?>
   <a id="home_invite_frnds" href="<?php echo $linkurl; ?>"><i></i><?php echo JTEXT::_('MOD_WISHLOGUE_HEADER_INVITE_FRIENDS'); ?></a>
<?php } ?>
<script type="text/javascript">
    function getCategories(cat_id,cat_name)
    {
        document.getElementById('cat_id').value=cat_id;
        document.category_list.submit();
        return true;
    }
</script>
		<!-- rgs. -->
		
		<?php
			if ( $sortbyDEF == 'selected' ) {
				$ertgd = 'Sort By';
			}
			if ( $sortbyASC == 'selected' ) {
				$ertgd = 'Price Low to High';
			}
			if ( $sortbyDESC == 'selected' ) {
				$ertgd = 'Price High to Low';
			}
		?>

		<script type='text/javascript'>
			jQuery(document).ready(function() {
				enableSelectBoxes();
			});
			function enableSelectBoxes(){
				jQuery('div.selectBox').each(function(){
				    jQuery(this).children('span.selected').html("<?php echo $ertgd; ?>");
					jQuery('input.price_values').attr('value',jQuery(this).children('ul.selectOptions').children('li.selectOption:first').attr('data-value'));
					jQuery(this).children('span.selected,span.selectArrow').click(function(){
						if(jQuery(this).parent().children('ul.selectOptions').css('display') == 'none') {
							jQuery(this).parent().children('ul.selectOptions').css('display','block');
						}
						else {
							jQuery(this).parent().children('ul.selectOptions').css('display','none');
						}
					});
					jQuery(this).find('li.selectOption').click(function(){
						jQuery(this).parent().css('display','none');
						jQuery('input.price_values').attr('value',jQuery(this).attr('data-value'));
						formSubmit('sortbyform');
						jQuery(this).parent().siblings('span.selected').html(jQuery(this).html());
					});
				});
			}
		</script>
				<!-- rgs. -->