###
### Global header
###
### The uppermost area of each page
### Contains the company logo, links to global actions and the search facility
###

### Header start

#if($isInServletMode) ## Visible only in a page
<div id="telemaheader">
	
	### LOGO BOX
	<div class="box">
		<h1 title="Telema">
		#if ($xcontext.user != 'XWiki.XWikiGuest')
			<a href="$!xwiki.getURL('telema_internal.WebHome')" title="Home" rel="home">
				<img class="logo" alt="Telema" src="/wiki/skins/telema/service-web-views/img/header/telema-logo.gif">
			</a>
		#else 
			<a href="$!xwiki.getURL('Main.WebHome')" title="Home" rel="home">
				<img class="logo" alt="Telema" src="/wiki/skins/telema/service-web-views/img/header/telema-logo.gif">
			</a>
		#end
		</h1>
	</div>## logo end

	### EMPTY SPACE
	<div class="box" style="width:28px;display:block;">&nbsp;</div>
	
	### USER NAME
	<div id="company-info" class="box">
	##
	## User
	##
	#if (!$isGuest)
		#if ($isSuperAdmin)
			<h2 class="profile">$!msg.get('superadmin')</h2>
			### <ul>
			###	<li>
			###		<a href="#">Profile</a>
			###	</li>
			### </ul>
			 
			### #xwikitopmenuentry('#' $!msg.get('superadmin') 'tmUser' 'hasIcon')
		#else
			<h2 class="profile">$!xwiki.getUserName($xcontext.user, false)</h2>
			### #xwikitopmenuentrystart($xwiki.getURL($xcontext.user, 'view') "$!xwiki.getUserName($xcontext.user, false)" 'tmUser' 'hasIcon')
			<ul>
				<li>
					<a href="$xwiki.getURL($xcontext.user, 'view')">$msg.get('core.menu.profile')</a>
				</li>
				<li>|</li>
				<li>
					<a href="$xwiki.getURL($xcontext.user, 'view', 'category=preferences')">$msg.get('core.menu.userPreferences')</a>
				</li>
				<li>|</li>
				#if($hasWatch)
					<li>
						<a href="$xwiki.getURL($xcontext.user, 'view', 'category=watchlist')">$msg.get('core.menu.watchlist.management')</a>
					</li>
				#end
			</ul>
		#end
	#end
	</div>
	
	<div id="attributes" class="box">
	###<div class="signout">
		#if(!$xcontext.action.startsWith('login'))
		#if($isGuest)
			#set($loginurl = $xwiki.getURL('XWiki.XWikiLogin', 'login', "xredirect=$escapetool.url($xwiki.getRequestURL())"))
			<a href="$!loginurl" class="sign-out"><span>$!msg.get('login')</span></a>
			### #xwikitopmenuentry($!loginurl $!msg.get('login') 'tmLogin')
		#else
			#set($logouturl = $xwiki.getURL('XWiki.XWikiLogout', 'logout', "xredirect=$escapetool.url($xwiki.getRequestURL())"))
			<a href="$!logouturl" class="sign-out"><span>$!msg.get('logout')</span></a>
			### #xwikitopmenuentry($!logouturl $!msg.get('logout') 'tmLogout')
		#end
	#end
	#if($isGuest && $xwiki.hasAccessLevel('register', 'XWiki.XWikiPreferences'))
		#set($regurl = $xwiki.getURL('XWiki.Register', 'register'))
		<a href="$!regurl" class="register"><span>$!msg.get('core.register')</span></a>
		### #xwikitopmenuentry($!regurl $!msg.get('core.register') 'tmRegister')
	#end
	##
	##
	###</div>
	
### TODO: Apply Formatting to language links
	<div class="spacer">
	#if($xwiki.isMultiLingual())
		<span class="glink" id="headerlanguages">
			#set($defaultLanguage = "$!{doc.getDefaultLanguage()}")
			#if($defaultLanguage == '')
				#set($defaultLanguage = "$!{doc.getLanguage()}")
			#end
			#if($defaultLanguage == '')
				#set($defaultLanguage = "default")
			#end
			<a href="$!doc.getURL("view", "language=$defaultLanguage")" class="language-default#if($tdoc.realLanguage == $defaultLanguage || ($defaultLanguage == 'default' && $tdoc.realLanguage == '')) language-current#end">$defaultLanguage</a>
			#set($languages = $xwiki.getXWikiPreference('languages').split(','))
			#foreach($lang in $doc.translationList)
				#if($languages.contains($lang))
					/ <a href="$!doc.getURL("view", "language=$lang")" class="language-translation#if($tdoc.realLanguage == $lang) language-current#end">$!lang</a>
				#end
			#end
		</span>
	#end
</div>


	### search box area start
	<div class="options">
		<div class="optionsinline">
			<ul>
				<li>
					<a href="$!xwiki.getURL('Main.WebHome')">
						<img alt="homepage" src="/wiki/skins/telema/service-web-views/img/header/home-icon.gif">
					</a>
				</li>
				<li class="sep"></li>
				<li class="slide selected" style="width: 184px;">
					<a class="icon" href="#">
					<img alt="" src="/wiki/skins/telema/service-web-views/img/header/search-icon.gif" style="width: 37px; height: 33px;">
					</a>
					<form action="#if($xwiki.exists('Main.Search'))$xwiki.getURL('Main.Search')#else$xwiki.getURL('Main.WebSearch')#end">
					<fieldset>
						<ul class="search">
							<li>
								<input class="input example" type="text" name="text" value="$msg.get('panels.search.inputText')">
							</li>
							<li>
								<input class="submit example" type="submit" value="" />
							</li>
						</ul>
					</fieldset>
					</form>
				</li>
			</ul>
		</div> ### optionsinline
	</div> ### options
	
	</div>

	</div> ## header
#end ##servlet mode
### TODO: Format the header for pdf output
