// Kelvin Owers - WBO  //

// content of 'header' written to the page (not including divs) //
function writeOrangeHeader(pIsLandingPage) {
    str = orangeLogo(pIsLandingPage);
    document.write(str);
}

// Orange logo
function orangeLogo(pIsLandingPage) {
	// pIsLandingPage should pass either 0 (zero) or 1 (one). This value dictates if the containing page is a landing page or not.
	// Landing pages do not link through to anything other than registration, so we remove the click-through to orange.co.uk from
	// the header logo graphic.

    var str = '';
	var isLandingPage = 0;
		isLandingPage = (pIsLandingPage == "" ? 0 : pIsLandingPage);

		//set up styles
		str+='<style type="text/css">';
		str+='#home_link   { float:left; position:relative; margin-top:-1em; left:40px; font-weight:normal; font-size: 0.9em; margin-left:20px; }';
	if (!isLandingPage) {
		str+='#time_banner { padding-left:120px; float:left; margin-top:-63px; }';
	} else {
		str+='#time_banner_landing { padding-left:175px; float:right; margin-bottom:-73px; }';
		str+='#time_banner_landing img { position:relative; top:-45px; }';
	}
		str+='</style>';

		// Styles for all IE
		str+='<!--[if IE]>';
		str+='<style type="text/css">';
	if (!isLandingPage) {		
		str+='#time_banner { padding-left:175px; float:left; margin-bottom:-20px; }';
	} else {
		str+='#time_banner_landing { padding-left:175px; float:right; margin-bottom:-73px; }';
		str+='#time_banner_landing img { position:relative; top:-43px; }';
	}
		str+='#home_link   { margin-bottom:-20px; }';
		str+='</style>';
		str+='<![endif]-->';
		// styles for IE 6 and below
		str+='<!--[if lt IE 7]>';
		str+='<style type="text/css">#home_link{margin-top:-.34em; font-size:0.25em; }';
		str+='#container { margin-top:0px; }';
		str+='#container #orange_logo { margin-top:20px; }';
	if (!isLandingPage) {		
		str+='#time_banner         { padding-left:175px; float:left; margin-top:-63px; }</style>';
	} else {
		str+='#time_banner_landing { padding-left:175px; float:right; margin-top:-57px; }';
		str+='#time_banner_landing img { position:relative; top:13px; }</style>';
	}
		str+='<![endif]-->';

	if (!isLandingPage) {
		// Write orange logo and 'home' link
		str+='<a href="http://www.orange.co.uk"><img id="orange_logo" src="/images/shared/decoration/orange_box.gif" alt="Orange" height="40px"/></a>';
		str+='<div class="copy"><span id="home_link" class="links2"><a href="http://www.orange.co.uk">home</a></span></div>';
		str+='<div id="time_banner" style="display:none;"><img id="ctaImg" src="/images/shared/illustrations/buy_online_0.gif" alt="buy online or call 0800 072 5563" /></div>';
	} else {
		str +='<img id="orange_logo" src="/images/shared/decoration/orange_box.gif" alt="Orange" height="40px" />';
		str+='<div id="time_banner_landing" style="display:none;"><img id="ctaImg" src="/images/shared/illustrations/buy_online_0.gif" alt="buy online or call 0800 072 5563" /></div>';
	}
    return str;
}

// Write out headers for global and local orange horizontal navigation (incuding divs) //
function writeTimeHeader(pIsLandingPage) {
	// pIsLandingPage should pass either 0 (zero) or 1 (one). This value dictates if the containing page is a landing page or not.
	// Landing pages do not display the portal-style header, instead retaining the previous edition of the header which shows just
	// the Orange logo and a narrow orange line separating it from the main page content.
	// 0 indicates the page is NOT a landing page, so should show the full portal-style header; 1 indicats the page IS a landing
	// page and should show the alternative header accordingly.

    var str = globalNav(pIsLandingPage); // + localNav()
    document.write(str);
}

function globalNav(pIsLandingPage) {
	var isLandingPage = 0;
		isLandingPage = (pIsLandingPage == "" ? 0 : pIsLandingPage);

	if (!isLandingPage) {
		str = '';
		str +='<div id="time_global_nav" class="ttabs">';
		str +='<div class="ttab1_left">&nbsp;</div>';
		str +='<div class="ttab1"><span class="invisibletitle">current tab: </span><a href="http://shop.orange.co.uk/shop/index?linkfrom=time&amp;link=header_orange_shop">Orange shop</a></div>';
		str +='<div class="ttab1_right">&nbsp;</div>';
		str +='<div class="ttab2_left">&nbsp;</div>';
		str +='<div class="ttab2"><a href="http://www.orange.co.uk/news/?linkfrom=time&amp;link=header_news">news</a></div>';
		str +='<div class="ttab2_right">&nbsp;</div>';
		str +='<div class="ttab3_left">&nbsp;</div>';
		str +='<div class="ttab3"><a href="http://www.orange.co.uk/sport/?linkfrom=time&amp;link=header_sport">sport</a></div>';
		str +='<div class="ttab3_right">&nbsp;</div>';
		str +='<div class="ttab4_left">&nbsp;</div>';
		str +='<div class="ttab4"><a href="http://www.orange.co.uk/entertainment/?linkfrom=time&amp;link=header_entertainment">entertainment</a></div>';
		str +='<div class="ttab4_right">&nbsp;</div>';
		str +='<div class="ttab5_left">&nbsp;</div>';
		str +='<div class="ttab5"><a href="http://www.orange.co.uk/lifestyle/?linkfrom=time&amp;link=header_lifestyle">lifestyle</a></div>';
		str +='<div class="ttab5_right">&nbsp;</div>';
		str +='<div class="ttab6_left">&nbsp;</div>';
		str +='<div class="ttab6"><a href="http://www.orange.co.uk/emailandcommunicate/?linkfrom=time&amp;link=header_email_and_communicate">email &amp; communicate</a></div>';
		str +='<div class="ttab6_right">&nbsp;</div>';
		str +='<div class="ttab7_left">&nbsp;</div>';
		str +='<div class="ttab7"><a href="http://www.orange.co.uk/helpandsupport/?linkfrom=time&amp;link=header_help_and_support">help &amp; support</a></div>';
		str +='<div class="ttab7_right">&nbsp;</div>';
		str +='<div class="ttab8_left">&nbsp;</div>';
		str +='<div class="ttab8"><a href="http://www.orange.co.uk/youraccount/?linkfrom=time&amp;link=header_your_account">your account</a></div>';
		str +='<div class="ttab_close">&nbsp;</div>';
		str +='</div>';
	} else {
		// Legacy globalNav function now used on landing pages only
		// height of orange bar scales with text size
    	var str  ='<div class="divider_2b"></div>'; //id="global_nav_landing"></div>';
	}

	if (!isLandingPage && isMac && isIE) {
		str +='<div style="clear:both;"></div>';
	}

	return str;
}