//<!-- COLORS_AND_MENUS.JS V1.1 aug/2008 -->
// Functions used to build the page layout, including top level banners,
// colors and the left-hand menu.
// The actual values used are defined in the file "tpl/menu.js" which should exist
// at the top level of every branch of the site. In case it is not found, we
// define a generic menu here.
// V1.0 Initial version
// V1.1 Changed build_menu() to allow simple labels to be added for the accordion by not including a link in the menu.js definition

//******** SET DEFAULTS **************

// Set some default values for page layout in case there is no tpl/menu.js file found in the directory

if (typeof b_size == "undefined") {
	b_size = "banner_short";
	b_dir = "/_dotcom_template/images/";
	b_name = "bg_banner_corporate.gif";
	b_h1 = "The world leader";
	b_h2 = "in digital security";
	b_h3 = "";
	c_scheme = "container_corporate";
	div_size = "content_3_3";
};

if (typeof menu == "undefined") {
	var zeRubrique = "Company info";
	var menu = new Array();		/*	les menus et sous-menus 	*/
	menu[0] = new Array();

	menu[0][0] = "Company Home$/companyinfo/index.html";

	menu[0][1] = new Array();
	 menu[0][1][0] = "About Gemalto$/companyinfo/about/index.html";
	 menu[0][1][1] = "Customer Highlights$/companyinfo/about/highlights_public_sector.html";
	 menu[0][1][2] = "Global Alliances$/companyinfo/about/alliance.html";
	 menu[0][1][3] = "Merger of Equals$/companyinfo/about/merger/";
 
	menu[0][2] = "Our vision$/companyinfo/digital_security.html";

	menu[0][3] = new Array();
	 menu[0][3][0] = "Corporate Governance$/companyinfo/gov/index.html";
	 menu[0][3][1] = "Management$/companyinfo/gov/management.html";
	 menu[0][3][2] = "Board$/companyinfo/gov/board.html";
	 menu[0][3][3] = "Remuneration Policy$/companyinfo/gov/remuneration.html";
	 menu[0][3][4] = "Committees$/companyinfo/gov/committees.html";
	 menu[0][3][5] = "Principles$/companyinfo/gov/principles_charters.html";
	 menu[0][3][6] = "Our Values$/companyinfo/gov/values.html";
 
	menu[0][4] = new Array();
	 menu[0][4][0] = "Our Responsibilities$/companyinfo/about/social_responsibility/index.html";
	 menu[0][4][1] = "Environment$/companyinfo/about/social_responsibility/environment.html";
	 menu[0][4][2] = "Corporate citizenship$/companyinfo/about/social_responsibility/corp_citizen.html"; 
	 menu[0][4][3] = "Customers$/companyinfo/about/social_responsibility/customer.html";
	 menu[0][4][4] = "Employees$/companyinfo/about/social_responsibility/employees.html";
  
	menu[0][5] = new Array();
	 menu[0][5][0] = "Production$/companyinfo/about/production/";
	 menu[0][5][1] = "Quality$/companyinfo/about/production/quality.html";
	 menu[0][5][2] = "Security$/companyinfo/about/production/security_standards.html";

	menu[0][6] = new Array();
	 menu[0][6][0] = "Innovation$/companyinfo/r_d.html"; 
	 menu[0][6][1] = "Gemalto Technology$/companyinfo/r_d_techno.html"; 
	 menu[0][6][2] = "About smart cards$/companyinfo/smart_cards_basics/"; 
	 menu[0][6][3] = "Leveraging our <br/>expertise$/companyinfo/r_d_expertise.html"; 

	menu[0][7] = "Investors$/investors/index.html";
	
	menu[0][8] = "Press$/press/index.html";

	menu[0][9] = "Partners$/partners/program.html";

	menu[0][10] = "Worldwide Locations$/php/office_search.php";
 
	menu[0][11]= "Download Brochures$/brochures/";

}

function banner(){
	if (b_size == "min_spark") {
		document.write("<div id='banner_title_container'>");
		document.write("<div id='banner_title_bg' style='background-image:url(" + b_dir + b_name + ");'>");
		document.write("</div> <!-- /banner_title_bg banner couleur seul -->");
		document.write("<div id='banner_title_sparkle'> <!-- /banner_title_sparkle - sparkle flash transparent -->");
		document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='910' height='58'>");
		document.write("<param name='movie' value='/_dotcom_template/images/sparkle910x58.swf'>");
		document.write("<param name='quality' value='high'>");
    	document.write("<param name='wmode' value='transparent'>");
		document.write("<embed src='/_dotcom_template/images/sparkle910x58.swf' quality='high' wmode='transparent' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='910' height='58'></embed>");
		document.write("</object>");
		document.write("</div> <!-- /banner_short_sparkle - sparkle flash transparent -->");
		document.write("<div id='banner_title'>");
		document.write("<h1>" + b_h1 + "</h1>");
		document.write("</div> <!-- /banner_title -->");
		document.write("</div> <!-- /banner_title_container -->");
	}
	else if (b_size == "short_spark") {
		document.write("<div id='banner_short_container'>");
		document.write("<div id='banner_short_bg' style='background-image:url(" + b_dir + b_name + ");'>");
		document.write("</div> <!-- /banner_short_bg banner couleur seul -->");
		document.write("<div id='banner_short_sparkle'> <!-- /banner_title_sparkle - sparkle flash transparent -->");
		document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='910' height='118'>");
		document.write("<param name='movie' value='/_dotcom_template/images/sparkle910x118.swf'>");
		document.write("<param name='quality' value='high'>");
    	document.write("<param name='wmode' value='transparent'>");
		document.write("<embed src='/_dotcom_template/images/sparkle910x118.swf' quality='high' wmode='transparent' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='910' height='118'></embed>");
		document.write("</object>");
		document.write("</div> <!-- /banner_title_sparkle - sparkle flash transparent -->");
		document.write("<div id='banner_short_title'>");
		document.write("<h3>" + b_h3 + "</h3>");
		if (b_h1.length>0) document.write("<h1>" + b_h1 + "</h1>");
		document.write("<h2>" + b_h2 + "</h2>");
		document.write("</div> <!-- /banner_title -->");
		document.write("</div> <!-- /banner_title_container -->");
	}
	else if (b_size == "anim") {
		//alert(b_name.substr(0,b_name.indexOf(".")));
		document.write("<script type='text/javascript'>");
		document.write("AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','910','height','218','src','" + b_dir + b_name.substr(0,b_name.indexOf(".")) +  "','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','" + b_dir + b_name.substr(0,b_name.indexOf(".")) +  "','wmode','transparent' ); //end AC code");
		document.write("</script>");
		document.write("<noscript>");

		document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='910px' height='218px'>");
          document.write("<param name='movie' value='" + b_dir + b_name + "'>");
          document.write("<param name='quality' value='high'>");
          document.write("<param name='wmode' value='transparent'>");
          document.write("<embed src='" + b_dir + b_name +  "' quality='high' wmode='transparent' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='910px' height='218px'></embed>");
	    document.write("</object>");
   		document.write("</noscript>");
	}
	else {		// Possibilities: banner, banner_short, banner_min
		document.write("<div id='" + b_size + "' style='background-image:url(" + b_dir + b_name + ");'>");
		if (b_size=="banner_short") document.write("<h3>" + b_h3 + "</h3>");
		if (b_h1.length>0) document.write("<h1>" + b_h1 + "</h1>");
		if (b_size!="banner_min")document.write("<h2>" + b_h2 + "</h2>");
		if (b_size=="banner") document.write("<h3>" + b_h3 + "</h3>");
		document.write("</div> <!-- /banner -->");
	}
}
	
function color_scheme(scheme_name,hauteur) {
	if (color_scheme.arguments.length == 2) { // when called within an index file
		c_scheme = scheme_name; 
	}
	if (c_scheme.length > 0) { // Set c_scheme to "" in menu.js to stop this div from being created
		document.write("</div> <!-- /head -->"); // close the head div if c_scheme defined
		document.write("<div id='" + c_scheme + "'");
		if (typeof (hauteur) != "undefined") document.write(" style='height:" + hauteur + "px;'");
		document.write(">");
	}
}

function build_menu() {
  if (showLeftMenu) {
	var m_item = new Array;                       // m_item[0] is the text, m_item[1] is the link 
	var tog=0;                                    // Keep track of # of submenus to open the right one
	document.write("<div id='nav_left_container'>");
	if (typeof menu[0] == "object") {             // test that menu exists and is an array
		document.write("<h6>" + zeRubrique + "</h6>");
		document.write("<div id='nav_left_bloc'>");
		document.write("<div id='accordion'>");
		for (i=0; i<menu.length; i++) {        // loop through the whole menu
			if (typeof menu[i] == "object" && menu[i].length > 1) {  // case where there are more than 1 submenus
				for (j=0; j<menu[i].length; j++) {
					if (typeof menu[i][j] == "string") {
						m_item = menu[i][j].split("$"); 
						if (j==0) {               // use the first item in the submenu as the label
							document.write("<h5 class='toggler'>>" + m_item[0] +"</h5>");
							document.write("<div class='element'>");
							if (typeof m_item[1] != "undefined") if (m_item[1].length < 2) continue; // if no link, or only # don't display it as submenu item
						}                         // if the first item (or any item) in the submenu has no link don't display it
						if (typeof m_item[1] != "undefined") document.write("<h4><a href='" + m_item[1] + "?toggler=" + tog + "'>" + m_item[0] +"</a></h4>");
					}
				}
			document.write("</div>");
			tog++; 
			}
			else if (typeof menu[i] == "object" && menu[i].length == 1) {  // case of only one submenu (common in Prod Cat)
				m_item = menu[i][0].split("$");
				if (m_item[1].length >0) document.write("<a href='" + m_item[1] + "'><h5>>" + m_item[0] +"</h5></a>");
				else document.write("<h5 style='cursor: default;'>" + m_item[0] +"</h5>");
			}
			else if (typeof menu[i] == "string") {  // case where there are no submenus
				m_item = menu[i].split("$");
				if (m_item[1].length >0) document.write("<a href='" + m_item[1] + "'><h5>>" + m_item[0] +"</h5></a>");
				else document.write("<h5 style='cursor: default;'>" + m_item[0] +"</h5>");
			}
		}
		document.write("</div> <!-- /accordion -->");
		document.write("</div> <!-- /nav_left_bloc -->");
	}
	else {
	document.write("<h6>Products</h6>");	
	}
	document.write("</div> <!-- /nav_left_container -->");
  }
}

function open_main() {
	if (div_size.length > 0) {
		document.write("<div id='" + div_size + "'>");
	}
	
	if(!noBreadCrumbs) {
		document.write("<div id='breadcrumbs'>");
		breadCrumb(); 
		document.write("</div> <!-- /breadcrumbs -->");
	}
}

// The set_height() function is called to make all the columns of the layout occupy the same space. It measures the biggest
// column, then sets the height for the containing block, forcing a recalculation of the child divs. Tested for Firefox
// IE7 and IE6.
function set_height() {
	var central_div = document.getElementById(div_size);
	var container = document.getElementById(c_scheme);
	var nav = document.getElementById('nav_left_container');
	//alert('central column height= ' + central_div.scrollHeight + " Nav column height= " + nav.scrollHeight);
	if (nav.scrollHeight > central_div.scrollHeight) container.style.height = nav.scrollHeight+"px";
	else container.style.height = central_div.scrollHeight+"px";
	document.getElementById('nav_left_container').style.height="100%"; // Forces IE6 to recalculate the columns
}

/************* BREADCRUMB ***********************/

//
//  BreadCrumps displayer, lets the browser show you the path !!
//  Author: Hubert GREGOIRE, GEMPLUS 2000
//  Free for use, this peace of code is distributed as is and
//  without any support nether any garanty.
//

var bc_symbol =" > ";
//
// return a string with a link on the topic with an upperCase Cap.
//
function buildLink(Title,link)
{
	var aBC =Title.substring(0,1).toUpperCase() + Title.substring(1)  ;
	aBC = aBC.replace("_"," ");
	aBC="<a href='"+link+"'>"+aBC+"</a>";
	aBC= aBC+ bc_symbol;
	return aBC;
}

//
// return a string associated to the link passed
//

function getTopic(theLink)
{
	var thePaths = "/|/companyinfo|/companyinfo/gov";
	var theTopics = "home|Company Info|Governance";
	
	var topicTable = theTopics.split("|");  // transform a string in table
	var pathTable = thePaths.split("|");

	for (var i=0;i<pathTable.length;i++) 	{  // search in the link table
		if ( pathTable[i] == theLink)  
			return  topicTable[i];   // get the topic
	}
	return   theLink.substring(theLink.lastIndexOf("/")+1,theLink.length) ; // the topic is the lk
	
}

//
// return a BreadCrump string  from a link
//

function buildBC (theLink)
{
	if (theLink=="")
		theLink="/";
	theTopic = getTopic(theLink);
	return buildLink(theTopic , theLink)
}

//
// return a BreadCrump string from the current page 
//

function BreadCrump()
{
	var theURI = ""+window.location.pathname;
	var theBreadCrump = "" ;
		
	var start=0;
	var nextSlash = 0;
	
	while(true) {
		nextSlash = theURI.indexOf("/",start);
		if (nextSlash == -1)
			return theBreadCrump;
		toBC = theURI.substring(0,nextSlash);
		
		theBreadCrump = theBreadCrump  + buildBC(toBC);
		start = nextSlash +1 ;
	}
}

//
// display the BreadCrump string @ the current location 
//

function breadCrumb()
{
	document.write(BreadCrump());
}

/********LANGUE DES MENUS DU HAUT****************
On teste si on est dans un site région
et on adapte les menus du haut si c'est le cas
*************************************************/

var dir = document.location.pathname.substring(1,document.location.pathname.indexOf("/",1)) ;
if (document.location.pathname.indexOf("_fr.php")>=0) dir = "france"; // Used for php scripts
if (document.location.pathname.indexOf("_po.php")>=0) dir = "brasil";
if (document.location.pathname.indexOf("_es.php")>=0) dir = "latam";


top_menu =new Array();

switch (dir) {

	case "france" :
		top_menu[0]='Accueil$/france/index.html';
		
		top_menu[1]=new Array();
		top_menu[1][0]='Notre Compagnie$/france/apropos/index.html';
		top_menu[1][1]='Management$/france/apropos/management.html';
		top_menu[1][2]='Notre vision$/france/apropos/securite_numerique.html';
		top_menu[1][3]='Investisseurs$/france/investisseurs/index.html';
		top_menu[1][4]='Bureaux Gemalto France$/php/office_result.php?fRegion=0&fCountry=1';
		
		top_menu[2]=new Array();
		top_menu[2][0]='Produits &amp; Solutions$/france/pss/index.html';
		top_menu[2][1]='T&eacute;l&eacute;communications$/france/telecom/index.html';
		top_menu[2][2]='Services Financiers & Distribution$/france/banque/index.html';
		top_menu[2][3]='Entreprise$/france/entreprise/';
		top_menu[2][4]='Internet$/france/internet/index.html';
		top_menu[2][5]='Secteur Public$/france/secteur_public/index.html';
		top_menu[2][6]='Transport$/france/transport/index.html';
		top_menu[2][7]='Training (en anglais)$/training/index.html';
		
		top_menu[3]=new Array();
		top_menu[3][0]='Nous Contacter$/php/contactus_fr.php';
		top_menu[3][1]='Jobs/Carri&#232res$/companyinfo/careers/index.html';
		top_menu[3][2]='Support Technique (en anglais)$http://support.gemalto.com/';
		top_menu[3][3]='Ventes/Autres$/php/contactus_fr.php';
		
		top_menu[4]='Acheter$http://store.gemalto.com/is-bin/INTERSHOP.enfinity/eCS/Store';
		break;
	case "brasil" :
		top_menu[0]='Home$/brasil/index.html';
		
		top_menu[1]=new Array();
		top_menu[1][0]='Sobre a Gemalto$/brasil/sobre_gemalto/index.html';
		top_menu[1][1]='Management$/brasil/sobre_gemalto/management.html';
		top_menu[1][2]='Seguran&#231a digital$/brasil/sobre_gemalto/seguranca_digital.html';
		top_menu[1][3]='Escrit&#243rios Locais da Gemalto$/php/office_result.php?fRegion=11&fCountry=0';	
			
		top_menu[2]=new Array();
		top_menu[2][0]='Produtos/Solu&#231&#245es$/brasil/pss/index.html';
		top_menu[2][1]='Telecomunica&#231&#245es$/brasil/telecom/index.html';
		top_menu[2][2]='Servi&#231os Financeiros<br/>e Varejo$/brasil/servicos_financeiros/index.html';
		top_menu[2][3]='Empresa$/brasil/empresa/';
		top_menu[2][4]='Internet$/brasil/internet/index.html';
		top_menu[2][5]='Setor P&#250blico$/brasil/setor_publico/';
		top_menu[2][6]='Transporte (em ingl&#234s)$/brasil/transporte/index.html';
		top_menu[2][7]='Training (em ingl&#234s)$/training/index.html';
		
		top_menu[3]=new Array();
		top_menu[3][0]='Fale conosco$/php/contactus_po.php';
		top_menu[3][1]='Cadastre seu curriculo$http://www.vagas.com.br/gemalto';
		top_menu[3][2]='Technical Support (em ingl&#234s)$http://support.gemalto.com/';
		top_menu[3][3]='Sales/Others$/php/contactus_po.php';
		
		top_menu[4]='Compras$http://www.gemplusdobrasil.com.br/';
		break;
	case "latam" :
		top_menu[0]='Home$/latam/index.html';
		
		top_menu[1]=new Array();
		top_menu[1][0]='Acerca de Gemalto$/latam/acerca/index.html';
		top_menu[1][1]='Gerencia$/latam/acerca/management.html';
		top_menu[1][2]='Seguridad Digital$/latam/acerca/seguridad_digital.html';
		top_menu[1][3]='Oficinas locales de Gemalto$/php/office_result.php?fRegion=11&fCountry=0';	
			
		top_menu[2]=new Array();
		top_menu[2][0]='Productos y soluciones$/latam/pss/index.html';
		top_menu[2][1]='Telecomunicaciones$/latam/telecom/index.html';
		top_menu[2][2]='Servicios financieros$/latam/servicios_financieros/index.html';
		top_menu[2][3]='Empresa$/latam/empresa/index.html';
		top_menu[2][4]='Internet$/latam/internet/index.html';
		top_menu[2][5]='Sector p&#250blico$/latam/sector_publico/index.html';
		top_menu[2][6]='Transporte (en ingl&#235s)$/latam/transporte/index.html';
		top_menu[2][7]='Training (en ingl&#235s)$/training/index.html';
		
		top_menu[3]=new Array();
		top_menu[3][0]='Contacto$/php/contactus_es.php';
		top_menu[3][1]='Jobs/Careers$/companyinfo/careers/index.html';
		top_menu[3][2]='Technical Support (en ingl&#237s)$http://support.gemalto.com/';
		top_menu[3][3]='Sales/Others$/php/contactus_es.php';
		
		top_menu[4]='Tienda$http://store.gemalto.com/is-bin/INTERSHOP.enfinity/eCS/Store';

		break;
	default :
		top_menu[0]='Home$/index.html';
		
		top_menu[1]=new Array();
		top_menu[1][0]='About Gemalto$/companyinfo/index.html';
		top_menu[1][1]='Our Company$/companyinfo/about/index.html?toggler=0';
		top_menu[1][2]='Corporate Governance$/companyinfo/gov/index.html?toggler=1';
		top_menu[1][3]='Investors$/investors/index.html';
		top_menu[1][4]='Press$/press/index.html';
		top_menu[1][5]='Partners$/partners/index.html';
		top_menu[1][6]='Worldwide Locations$/php/office_search.php';
		
		top_menu[2]=new Array();
		top_menu[2][0]='Products &amp; Solutions$/pss/index.html';
		top_menu[2][1]='Telecommunications$/telecom';
		top_menu[2][2]='Financial Services & Retail$/financial/index.html';
		top_menu[2][3]='Enterprise$/enterprise/index.html';
		top_menu[2][4]='Internet$/internet/index.html';
		top_menu[2][5]='Public Sector$/public_sector/index.html';
		top_menu[2][6]='Transport$/transport/index.html';
		top_menu[2][7]='Training$/training/index.html';
		
		top_menu[3]=new Array();
		top_menu[3][0]='Contact Us$/php/contactus.php';
		top_menu[3][1]='Jobs/Careers$/companyinfo/careers/index.html';
		top_menu[3][2]='Tech Support$http://support.gemalto.com/';
		top_menu[3][3]='Sales/Other$/php/contactus.php';
		
		top_menu[4]='Buy On-Line$http://store.gemalto.com/is-bin/INTERSHOP.enfinity/eCS/Store';
};

function write_li(title_url,state) {	// Called by build_menu_hor
	var m_item = new Array;
	m_item = title_url.split("$");
	if (typeof m_item[1] != "undefined") {    // if submenu has no link, don't display it
		document.write("<li><a href='" + m_item[1] + "' title='" + m_item[0] + "'>" + m_item[0] +"</a>");
	}
	else {
		document.write("<li>" + m_item[0]); 
	}
	if (state == 0) document.write("</li>");
	else if (state == 1) document.write("<ul>");
}


function build_menu_hor(){				// Builds top menu on each page
	document.write("<div id='logo'><a href='/index.html' title='Home'></a></div>");	// link over logo. Dimensions controlled by style sheet.
	document.write("<ul id='nav'>");
	for (i=0; i<top_menu.length; i++) {    		// loop through the whole menu
		if (typeof top_menu[i] == "object") {   // test that menu exists and has submenus
			for (j=0; j<top_menu[i].length; j++) {	//loop through submenus
				if (typeof top_menu[i][j] == "string") {
					if (j==0) write_li(top_menu[i][j],1);   // use first item in submenu as main header
					else write_li(top_menu[i][j],0);
				}
			}
		document.write("</ul></li>");
		}
		else if (typeof top_menu[i] == "string") write_li(top_menu[i],0);  // case where there are no submenus, only a single link
	}
	document.write("</ul>");
}

function Extract_Page_Name()	// Called by Change_siteName()
{
	var nom_fic = document.location.pathname;
	nom_fic = nom_fic.substring(nom_fic.lastIndexOf("/"),nom_fic.length);
	if (nom_fic.length < 2) 
		nom_fic = "index";
	else 
		nom_fic = nom_fic.substring(1,nom_fic.indexOf("."));
	return nom_fic;
}



function Change_siteName ()		// Used in footer to set page name for Nedstat stats
{
	path_=document.location.pathname;
	path_ = path_.substring(0,path_.lastIndexOf("/"));
	path_= (path_.split("/")).join("."); 
	if (path_.substr(0, 1)==".")	
	   path_ = path_.substring(1,path_.length);	   
	if (path_.substr(path_.length-1, path_.length)==".")	
	   path_ = path_.substring(0,path_.length-1);  
	path_ = path_+"."+Extract_Page_Name();
	if (document.location.hostname != "www.gemalto.com")
		path_ = document.location.hostname+"."+path_;
	// Add local search query measurement for Google Custom Search
	if (path_ == "search.results") {
		path_ += "&amp;ns_search_term="+document.location.search.match(/&q=(.*)&/)[1].replace(/\W/g,"_");
		path_ += "&amp;ns_search_result=1"; // Have to set this to some value. 
		}
	return path_;
}

//***********************************************
