/* Europcar navvigation - nav2005 */

//--- Site Language : adapt the following line for multilingual site, ie '/EN'
var siteLanguage = '';
//----------------------------------------------------------------------------

var serverHost  = window.location.host;
var serverName   = serverHost + siteLanguage;
var activePage   = self.location.href;
var serverRoot   = 'http://'+serverName;
var serverRootS  = 'https://'+serverName;
var offImg       = new Array();
var onImg        = new Array();
var menuTimer    = 0;

var navMenu      = [];

navMenu['POS'] = [];
navMenu['TXT'] = [];
navMenu['URL'] = [];


function addMenu(strMenuName, strMenuText, strTargetUrl, intLeftPosition) {
    navMenu['POS'][strMenuName]=[intLeftPosition];
    navMenu['TXT'][strMenuName]=[strMenuText];
    navMenu['URL'][strMenuName]=[strTargetUrl];
}

function addItem(strParentMenuName, strItemName, strItemText, strTargetUrl, arrayPaterns){
    navMenu['TXT'][strParentMenuName][strItemName]=[strItemText];
    navMenu['URL'][strParentMenuName][strItemName]=[strTargetUrl];
    navMenu['URL'][strParentMenuName][strItemName]['SubCategory']=arrayPaterns;
    // preload submenu images
    offImg[strItemName] = new Image();
    offImg[strItemName].src = siteLanguage + '/images/snav/snav_' + strItemName + '_off.gif';
    onImg[strItemName] = new Image();
    onImg[strItemName].src = siteLanguage + '/images/snav/snav_' + strItemName + '_on.gif';
}

///URLs
//urlRates="http://fr.sitestat.com/europcar/europcar-com/s?nav.clickout.resaweb.rates_and_reservation&ns_type=clickout&ns_url=" + serverRootS + "/tools/frameset.html?https://res.europcar.com/?locale=en"
urlRates="http://fr.sitestat.com/europcar/europcar-com/s?nav.clickout.resaweb.rates_and_reservation&ns_type=clickout&ns_url=" + serverRootS +"/tools/frameset.html?https://res.europcar.com/?locale=en&HEADER=false"
urlRatesBusiness="javascript:BookingOnline()"
urlRatesLeisure="http://fr.sitestat.com/europcar/europcar-com/s?nav.clickout.resaweb.rates_and_reservation&ns_type=clickout&ns_url=" + serverRootS +"/tools/frameset.html?https://res.europcar.com/?locale=en&HEADER=false"
//urlRatesTravelAgents="http://fr.sitestat.com/europcar/europcar-com/s?nav.clickout.resaweb.travel_agents&ns_type=clickout&ns_url=" + serverRootS + "/businesswitheuropcar/trvlpartner_solution.html"
urlRatesTravelAgents= serverRoot + "/businesswitheuropcar/trvlpartner_solution.html"
urlRatesInvoicing="http://fr.sitestat.com/europcar/europcar-com/s?nav.clickout.resaweb.e_invoicing&ns_type=clickout&ns_url=" + serverRootS + "/tools/frameset.html?https://res.europcar.com/bh/?locale=en&HEADER=FALSE&PAGE=search_invoice"
urlEnewsletter="javascript:theNewsletter()"
urlInsideInvestor="javascript:theInvestor()"

var whySubCategory = new Array();
whySubCategory[1] = serverRoot+'/whyeuropcar/morebenefits_citibank.html';
whySubCategory[2] = serverRoot+'/whyeuropcar/morebenefits_euro26.html';

var whyAirlinesSubCategory = new Array();
whyAirlinesSubCategory[1] = serverRoot+'/whyeuropcar/airline_details/xxxxxYYYYyyyywwww.html';

var whyInstantSubCategory = new Array();
whyInstantSubCategory[1] = serverRoot+'/whyeuropcar/index_form_privilege.html';

var whyQuickSubCategory = new Array();
whyQuickSubCategory[1] = serverRoot+'/whyeuropcar/index_form_rental.html';
whyQuickSubCategory[2] = serverRoot+'/whyeuropcar/index_form_ready.html';

var fleetSubCategory = new Array();
fleetSubCategory[1] = serverRoot+'/fleetguide/';

var businessTravelSubcategory = new Array();
businessTravelSubcategory[1]=serverRoot+'/businesswitheuropcar/touroperatorscontact.html';
businessTravelSubcategory[2]=serverRoot+'/businesswitheuropcar/trvlagent_how.html';

var businessFranchiseSubcategory = new Array();
businessFranchiseSubcategory[1]=serverRoot+'/businesswitheuropcar/f_';

//var specialSubCategory = new Array();
//specialSubCategory[1] = serverRoot+'/whyeuropcar/airline_details/xxxxxYYYYyyyywwww.html';

//var businessPartnersSubcategory = new Array();
//businessPartnersSubcategory[1]=serverRoot+'/businesswitheuropcar/touroperatorscontact.html';
//businessPartnersSubcategory[1]=serverRoot+'/businesswitheuropcar/trvlagent_how.html';

//Problems with leisure and Rates. The urls urlRates, urlRatesLeisure aren't the urls of the 
//top of destination page....
//Then
var leisureSubcategory = new Array();
leisureSubcategory[1] =serverRootS +"/tools/frameset.html?https://res.europcar.com/?locale=en";
leisureSubcategory[2] =serverRootS +"/tools/frameset.html?https://res.europcar.com/?locale=en";

//--- Menu database ----------------------------------------------------------
addMenu('Home', 'Home', serverRoot+'/home.html')

addMenu('Rates', 'Rates', urlRates, 10);
    
    addItem('Rates', 'leisurecorporate', 'Leisure Customers',urlRatesLeisure, leisureSubcategory );
    addItem('Rates', 'customers', 'Business Travellers', urlRatesBusiness);
    addItem('Rates', 'travel_partners', 'Travel Agents - Tour Operators', urlRatesTravelAgents );
    addItem('Rates', 'e_invoicing', 'E-Invoicing', urlRatesInvoicing)

addMenu('Special','Special Offers', serverRoot+'/specialoffers/specialoffer.html',10);
    addItem('Special', 'eb', 'Early Bookings', serverRoot+'/specialoffersv2/?base=eb&locale=EN');
    addItem('Special', 'lm_deals', 'Last Minute Deals', serverRoot+'/specialoffersv2/?base=lm&locale=EN');
    addItem('Special', 'more', 'More Offers', serverRoot+'/specialoffers/specialoffer.html', [serverRoot+'/specialoffers/special_offers/']);
    addItem('Special', 'enewsletter', 'E-newsletter', urlEnewsletter);

addMenu('Fleet', 'Fleet Guide', serverRoot+'/fleetguide/index.html',100);
    addItem('Fleet', 'vehicInfos', 'Vehicles Information', serverRoot+'/fleetguide/index.html',fleetSubCategory);
    addItem('Fleet', 'equipInfos', 'Equipment Information', serverRoot+'/fleetguide/carequip.html');

addMenu('World', 'Worldwide Locations', serverRoot+'/tools/framecom.html?http://www.europcar.com/worldwidelocations/home.jsp',200);


addMenu('Why', 'Why Europcar?', serverRoot+'/whyeuropcar/index.html',50);
    addItem('Why', 'quick', 'Quick Check-Out', serverRoot+'/whyeuropcar/quickcheckout.html',whyQuickSubCategory);
    addItem('Why', 'recognition', 'Instant Recognition', serverRoot+'/whyeuropcar/instantrecognition.html',whyInstantSubCategory);
    addItem('Why', 'airline', 'Airline Advantages', serverRoot+'/whyeuropcar/airline.html',whyAirlinesSubCategory);
    addItem('Why', 'hotelbenefits', 'Hotel Benefits', serverRoot+'/whyeuropcar/hotel.html');
    addItem('Why', 'giftvoucher', 'e-Gift Voucher', serverRoot+'/Giftvoucher/redeem.html');
    addItem('Why', 'morebenefits', 'More Benefits', serverRoot+'/whyeuropcar/morebenefits.html', whySubCategory);
    addItem('Why', 'enewsletter', 'E-newsletter', urlEnewsletter);
    
addMenu('Travel', 'Travel Center', serverRoot+'/travelcenter/drivingabroad.html',345);
    addItem('Travel', 'driving', 'Driving Abroad', serverRoot+'/travelcenter/drivingabroad.html');
    addItem('Travel', 'currency', 'Currency Converter', serverRoot+'/travelcenter/currencyconverter/');
    
addMenu('Inside','Inside Europcar',serverRoot+'/insideeuropcar/ourcompany.html',300);
    addItem('Inside', 'ourcompany', 'Our Company', serverRoot+'/insideeuropcar/ourcompany.html');
    addItem('Inside', 'headquarters', 'Our Headquarter', serverRoot+'/insideeuropcar/headquarter.html');
    addItem('Inside', 'investor', 'Investor Relations', urlInsideInvestor);
    addItem('Inside', 'press', 'Press Releases', serverRoot+'/insideeuropcar/pressrelease.html');
    addItem('Inside', 'career', 'Career Opportunities', serverRoot+'/insideeuropcar/career.html');

addMenu('Business', 'Business with Europcar', serverRoot+'/businesswitheuropcar/corporateclients.html', 160);
    addItem('Business', 'corporate', 'Corporate Clients', 'javascript:BookingOnline()');
    addItem('Business', 'chauffeur', 'Chauffeur Service', serverRoot+'/businesswitheuropcar/chauffeurservice.html');
    addItem('Business', 'travel_partners', 'Travel Agents - Tour Operators', serverRoot+'/businesswitheuropcar/trvlpartner_solution.html', businessTravelSubcategory);
    addItem('Business', 'franchise', 'Franchise Opportunities', serverRoot+'/businesswitheuropcar/franchise.html',businessFranchiseSubcategory);
    addItem('Business', 'e_invoicing', 'E-Invoicing', serverRootS+'/tools/frameset.html?https://res.europcar.com/bh/?locale=en&HEADER=FALSE&PAGE=search_invoice')

addMenu('MidTerm', 'Mid Term Drive', serverRoot+'/midtermrentals/midtermrentals_en.html',200);

//----------------------------------------------------------------------------

if(top.location!=self.location) activePage=top.location.href;

function getActivDefault() {
    var found = false;
    for(var i in navMenu['URL'] ){
        for(var ii in navMenu['URL'][i] ){
	    if(activePage.indexOf(navMenu['URL'][i][ii])!=-1) {
	        document.defaultActiveMenu=i;
	        //alert(i)
		navOpenMenu(i, ii);
		found = true;
		break;
            } else {
           	for (var iii in navMenu['URL'][i][ii]['SubCategory']) {
           		if(activePage.indexOf(navMenu['URL'][i][ii]['SubCategory'][iii])!=-1) {
		        	//alert(navMenu['URL'][i][ii]['SubCategory'][iii])
		        	document.defaultActiveMenu=i;
				navOpenMenu(i, ii);
				found = true;
				break;
            		}	
           	}	
           }
           if (found) {break;}
        }
        if (found) {break;}
    }
    
}

function navShowMenu() {
    resetTimer();
    menuTimer = setTimeout("init()", 3000);
}

function resetTimer() {
    clearTimeout(menuTimer);
}

function getObj(id) {
    return document.getElementById(id);
}

function renderLink(url,menuName,strItemName,alt, activeItemName) {
    if (activeItemName == 0) {
    	imgSrc = (activePage.indexOf(url)!=-1) ? onImg[strItemName].src : offImg[strItemName].src;
    } else {
        imgSrc = (strItemName == activeItemName) ? onImg[strItemName].src : offImg[strItemName].src;
    }
    var tmp = "" + url ;
    //check if the nav is in a frameset and if the location is a javascript
    if (tmp.indexOf("javascript:") == 0 &&  top.location != self.document.location) {
    	return '<a target="_self" href="#"><img align=absmiddle src="'+imgSrc+'" name="'+strItemName+'" border="0" alt="'+alt+'" onclick="' + tmp.substring("javascript:".length) + '"></a>&nbsp;';	
    }
    return '<a target="_top" href="' + url + '"><img align=absmiddle src="'+imgSrc+'" name="'+strItemName+'" border="0" alt="'+alt+'" ></a>&nbsp;';
}

function navPrintMenuItems(menuName, activeItemName){
    getObj("menuLeftPosition").width = navMenu['POS'][menuName];
    getObj("menuContent").innerHTML = '';
    counter = 0;
    separator = '<img border=0 align=absmiddle src="'+siteLanguage+'/images/barre_tiret.gif" alt="-">'
    for(var itemName in navMenu['TXT'][menuName]){
        if(itemName!=0) {
            if(counter!=0) {
                getObj("menuContent").innerHTML += separator;
            }
            getObj("menuContent").innerHTML += renderLink(navMenu['URL'][menuName][itemName],menuName,itemName,navMenu['TXT'][menuName][itemName], activeItemName);
        counter++;
        }
    }
}

function navOpenMenu(MenuName, activeItemName) {
    if(document.activMenu) { // turn off last active menu
        ImgSrc=document.images["imgMenu"+document.activMenu].src;
        document.images["imgMenu"+document.activMenu].src=ImgSrc.replace(/_on./g,"_off.");
    }
    if(MenuName) { // turn on new active menu
        ImgSrc=document.images["imgMenu"+MenuName].src;
        document.images["imgMenu"+MenuName].src=ImgSrc.replace(/_off./g,"_on.");
        document.activMenu=MenuName;
        navPrintMenuItems(MenuName, activeItemName);
    } else document.activMenu=false;
}

function BookingOnline(){window.open(serverRoot+"/businesswitheuropcar/popup_booking_online.html","BookingOnline","width=580,height=260,top=250,left=40,location=no,toolbar=no,directories=no,menubar=no,resizable=no");}
function theNewsletter(){window.open(serverRoot+"/tools/onexit/popup_onexit.html","Newsletter","width=524,height=280,top=250,left=40,location=no,toolbar=no,directories=no,menubar=no,resizable=no");}
function theInvestor(){
	var largeurEcran = screen.availWidth
	var hauteurEcran = screen.availHeight
	window.open("http://investor.relations.europcar.com/ ","Investor","width="+largeurEcran+",height="+hauteurEcran+",top=0,left=0,location=no,toolbar=no,directories=no,menubar=no,resizable=yes");
}


// for compatibility...
function clicNav() {};
function init() { getActivDefault(); }

//--- Display ----------------------------------------------------------------
document.write('<table width="758" height="48" background="/images/ban_logo_new.jpg" cellpadding="0" cellspacing="0" border="0">');
document.write('<tr><td width="758" height="48" align="right" valign="bottom"><a href="/americas/home.html"><img src="'+siteLanguage+'/images/bt_nav_americas.gif" border="0"></a><br><a href="javascript:open_window_scroll(\'/other_sites.html\',227,210)"><img src="'+siteLanguage+'/images/bt_nav_otherwebsites.gif" border="0"></a></td></tr>');
document.write('</table>');
document.write('<table width="758" bgcolor="#000000" cellpadding="0" cellspacing="0" border="0">');
document.write('<tr><td width="758" align="left" valign="top"><img src="'+siteLanguage+'/images/lb_slogan_new.gif" width="231" height="18" border=0></td>');
document.write('</table>');
document.write('<table width="758" cellpadding="0" cellspacing="0" border="0">');
document.write('<tr>');
document.write('<td><a target="_top" href="' + serverRoot + '/home.html" onMouseMove=navOpenMenu(\'Home\') onmouseout=navShowMenu() name=menuPosHome><img src="'+siteLanguage+'/images/nav_home_off.gif" name=imgMenuHome border="0"></a></td>');
document.write('<td><a target="_top" href="' + urlRates + '" onMouseMove=navOpenMenu(\'Rates\') onmouseout=navShowMenu() name=menuPosRates><img src="'+siteLanguage+'/images/nav_rates_off.gif" name=imgMenuRates border="0"></a></td>');
document.write('<td><a target="_top" href="' + serverRoot + '/specialoffers/specialoffer.html" onMouseMove=navOpenMenu(\'Special\') onmouseout=navShowMenu() name=menuPosSpecial><img src="'+siteLanguage+'/images/nav_special_off.gif" name=imgMenuSpecial border="0"></a></td>');
document.write('<td><a target="_top" href="' + serverRoot + '/fleetguide/index.html" onMouseMove=navOpenMenu(\'Fleet\') onmouseout=navShowMenu() name=menuPosFleet><img src="'+siteLanguage+'/images/nav_fleet_off.gif" name=imgMenuFleet border="0"></a></td>');
document.write('<td><a target="_top" href="' + serverRoot + '/worldwidelocations/index.jsp?locale=EN" onMouseMove=navOpenMenu(\'World\') onmouseout=navShowMenu() name=menuPosWorld><img src="'+siteLanguage+'/images/nav_world_off.gif" name=imgMenuWorld border="0"></a></td>');
document.write('<td><a target="_top" href="' + serverRoot + '/whyeuropcar/index.html" onMouseMove=navOpenMenu(\'Why\') onmouseout=navShowMenu() name=menuPosWhy><img src="'+siteLanguage+'/images/nav_why_off.gif" name=imgMenuWhy border="0"></a></td>');
document.write('<td><a target="_top" href="' + serverRoot + '/travelcenter/drivingabroad.html" onMouseMove=navOpenMenu(\'Travel\') onmouseout=navShowMenu() name=menuPosTravel><img src="'+siteLanguage+'/images/nav_travel_off.gif" name=imgMenuTravel border="0"></a></td>');
document.write('<td><a target="_top" href="' + serverRoot + '/insideeuropcar/ourcompany.html" onMouseMove=navOpenMenu(\'Inside\') onmouseout=navShowMenu() name=menuPosInside><img src="'+siteLanguage+'/images/nav_inside_off.gif" name=imgMenuInside border="0"></a></td>');
document.write('<td><a target="_top" href="' + serverRoot + '/businesswitheuropcar/corporateclients.html" onMouseMove=navOpenMenu(\'Business\') onmouseout=navShowMenu() name=menuPosBusiness><img src="'+siteLanguage+'/images/nav_business_off.gif" name=imgMenuBusiness border="0"></a></td>');
document.write('<td><a target="_top" href="' + serverRoot + '/midtermrentals/midtermrentals_en.html" onMouseMove=navOpenMenu(\'MidTerm\') onmouseout=navShowMenu() name=menuPosMidTerm><img src="'+siteLanguage+'/images/nav_midterm_off.gif" name=imgMenuMidTerm border="0"></a></td>');
document.write('<td background="/images/nav_fond.gif" width="100%" height="33"></td>');
document.write('</tr>');
document.write('</table>');
document.write('<table onMousemove="navShowMenu()" bgcolor="#000000" width="758" cellpadding="0" cellspacing="0" border="0" height="24">');
document.write('<tr>');
document.write('<td bgcolor="#666666" height="24" id="menuLeftPosition"></td><td bgcolor="#666666" id="menuContent" valign="bottom">&nbsp;</td>');
document.write('</tr>');
document.write('<tr><td bgcolor="#000000" height="1" colspan="20"></td></tr>');
document.write('</table>');
