var winImage = '' ;
var googleMapKey = "ABQIAAAAxSVf3NfVzz1946d_gCwZRRQUskD2g2kYri--r2uKABYiW12D6xRYL0ndB_4EP7bpB9CrpmaqYvXT2Q" ;
var ie = /MSIE/.test(navigator.userAgent);
var moz = !ie && navigator.product == "Gecko";

if (moz) 
{
     HTMLElement.prototype.__defineGetter__("children", function() {
           var arr = new Array(), i = 0, l = this.childNodes.length;
           for ( i = 0; i < l; i++ ) {
               if ( this.childNodes[ i ].nodeType == 1 ) {
                    arr.push( this.childNodes[ i ] );
               }
           }
      return arr;
      });

      HTMLElement.prototype.__defineGetter__("firstChild", function() {
            var node = this.childNodes[ 0 ];
            while (node.nodeType != 1) node = node.nextSibling;
                 return node;
            });

     HTMLElement.prototype.__defineGetter__("lastChild", function() {
     var node = this.childNodes[ this.childNodes.length - 1 ];
     while (node.nodeType != 1) node = node.previousSibling;
           return node;
      });
      
      var _emptyTags = {
		"IMG":   true,
		"BR":    true,
		"INPUT": true,
		"META":  true,
		"LINK":  true,
		"PARAM": true,
		"HR":    true
	};

	HTMLElement.prototype.__defineGetter__("outerHTML", function () 
	{
		var attrs = this.attributes;
		var str = "&lt;" + this.tagName;
		for (var i = 0; i < attrs.length; i++)
		{
			str += " " + attrs[i].name + "=\"" + attrs[i].value + "\"";
		}

		if (_emptyTags[this.tagName])
		{
			return str + "&gt;";
		}

		return str + "&gt;" + this.innerHTML + "&lt;/" + this.tagName + "&gt;";
	});
} 

function getInt(strInt)
{
	var strString = new String(strInt) ;

	var lStart = strString.length -2;
	var strPx = strString.substr(lStart, 2) ;
	
	if (strPx == 'px')
	{
		return (parseInt(strString.substr(0, lStart))) ;
	}
	else
	{
		return (parseInt(strInt)) ;
	}
}

var CartePosTop = 300 ;
var CartePosLeft = 0 ;
var carteWidth = 200 ;
var carteHeight = 150 ;
var leftPos = 0 ;
var yDragRelPos = 0 ;
var xDragRelPos = 0 ;
var curScrollTop = 0 ;

function displayImg(e, Horizontal)
{
	var strParams = "text=" ;
	strParams = strParams + e.alt ;
	strParams = strParams + "&url=" ;
	strParams = strParams + e.src ;
	strParams = strParams + "&Horizontal=" ;
	strParams = strParams + Horizontal ;
	
	if (Horizontal == 1)
	{
		strParams = strParams + "&Width=700&Height=465" ;
	}
	else
	{
		strParams = strParams + "&Width=365&Height=550" ;
	}
	
	var strUrl = "pgeImage.htm?" + strParams ;

	if (!winImage.closed && winImage.location)
	{
		winImage.location.href = strUrl;
	}
	else
	{
		winImage = window.open(strUrl, "", "toolbar=no, directories=0, status=no, menubar=no, width=400, height=300, scrollbars=yes, location=no, resizable=no") ;

	}
	winImage.focus() ;
}

function displayImg2(e, Horizontal, RootJS)
{
	var strParams = "text=" ;
	strParams = strParams + e.alt ;
	strParams = strParams + "&url=" ;
	strParams = strParams + e.src ;
	strParams = strParams + "&Horizontal=" ;
	strParams = strParams + Horizontal ;
	strParams = strParams + "&Root=" ;
	strParams = strParams + RootJS ;
	
	if (Horizontal == 1)
	{
		strParams = strParams + "&Width=700&Height=465" ;
	}
	else
	{
		strParams = strParams + "&Width=365&Height=550" ;
	}
	
	var strUrl = "pgeImagePrevNext.htm?" + strParams ;

	if (!winImage.closed && winImage.location)
	{
		winImage.location.href = strUrl;
	}
	else
	{
		winImage = window.open(strUrl, "", "toolbar=no, directories=0, status=no, menubar=no, width=700, height=720, scrollbars=yes, location=no, resizable=no") ;

	}
	winImage.focus() ;
}

function displayImgSize(e, Horizontal, nWidth, nHeight)
{
	var strParams = "text=" ;
	strParams = strParams + e.alt ;
	strParams = strParams + "&url=" ;
	strParams = strParams + e.src ;
	strParams = strParams + "&Horizontal=" ;
	strParams = strParams + Horizontal ;
	strParams = strParams + "&Width=" ;
	strParams = strParams + nWidth ;
	strParams = strParams + "&Height=" ;
	strParams = strParams + nHeight ;
	
	var strUrl = "pgeImageBig.htm?" + strParams ;

	if (!winImage.closed && winImage.location)
	{
		winImage.location.href = strUrl;
	}
	else
	{
		winImage = window.open(strUrl, "", "toolbar=no, directories=0, status=no, menubar=no, width=400, height=300, scrollbars=yes, location=no, resizable=no") ;

	}
	winImage.focus() ;
}

function redirection(page)
{
  window.location=page;
}

function Init()
{
try
{
	if (bAddCarte == 1)
	{
		CartePosTop = (document.documentElement.clientHeight - carteHeight - 120) ;
		CartePosLeft = (document.documentElement.clientWidth - 250 - carteWidth + 120) ;
		
		document.getElementById('carte').style.top = getInt(CartePosTop) ;			
		document.getElementById('carte').style.left = getInt(CartePosLeft) ;
		
		if (moz)
		{
			document.getElementById('carte').style.display = "none" ;
			document.getElementById('carte').style.visibility = 'hidden' ;
			document.getElementById('toolCarte').style.display = 'none' ;
			document.getElementById('toolCarte').style.visibility = 'hidden' ;
		}
		else
		{
			document.getElementById('carte').style.left = CartePosLeft ;
			document.getElementById('carte').style.top = CartePosTop ;
			document.getElementById('carte').style.display = 'block' ;
			document.getElementById('carte').style.visibility = 'visible' ;
		}
	}

	if(bFirstPage == 1)
	{	
		document.getElementById('aPgePrev').style.visibility = 'hidden' ;
		document.getElementById('toolPagePrecedante').style.display = 'none' ;
	}
	else
	{
		document.getElementById('aPgePrev').style.visibility = 'visible' ;
		document.getElementById('toolPagePrecedante').style.display = 'block' ;
	}
	
	if (bLastPage == 1)
	{
		document.getElementById('aPgeNext').style.visibility = 'hidden' ;
		document.getElementById('toolPageSuivante').style.display = 'none' ;		
	}
	else
	{
		document.getElementById('aPgeNext').style.visibility = 'visible' ;
		document.getElementById('toolPageSuivante').style.display = 'block' ;
	}

	if (bAddCarte == 0)
	{
		if (document.getElementById('carte') != null)
		{
			document.getElementById('carte').style.visibility = 'hidden' ;
		}
		if (document.getElementById('toolCarte') != null)
		{
			document.getElementById('toolCarte').style.display = 'none' ;	
		}	

	}
	else
	{
		if (document.getElementById('carte') != null)
		{
			document.getElementById('carte').style.visibility = 'visible' ;
		}
		if (document.getElementById('toolCarte') != null)
		{
			document.getElementById('toolCarte').style.display = 'block' ;
		}
	}
	
	if (bAddPhotoLink == 0)
	{
		if (document.getElementById('toolPhotoPage') != null)
		{
			document.getElementById('toolPhotoPage').style.display = 'none' ;		
		}
	}
	else
	{
		if (document.getElementById('toolPhotoPage') != null)
		{
			document.getElementById('toolPhotoPage').style.display = 'block' ;
		}
	}

	if (bAddPagePrincipaleLink == 0)
	{
		if (document.getElementById('toolPagePrincipale') != null)
		{
			document.getElementById('toolPagePrincipale').style.display = 'none' ;		
		}
	}
	else
	{
		if (document.getElementById('toolPagePrincipale') != null)
		{
			document.getElementById('toolPagePrincipale').style.display = 'block' ;
		}
	}

	if (bAddCarnetDeMarieLink == 0)
	{
		if (document.getElementById('toolCarnetDeMarie') != null)
		{
			document.getElementById('toolCarnetDeMarie').style.display = 'none' ;		
		}
	}
	else
	{
		if (document.getElementById('toolCarnetDeMarie') != null)
		{
			document.getElementById('toolCarnetDeMarie').style.display = 'block' ;
		}
	}

	if (bAddCoinDesEnfantsLink == 0)
	{
		if (document.getElementById('toolCoinDesEnfants') != null)
		{
			document.getElementById('toolCoinDesEnfants').style.display = 'none' ;		
		}
	}
	else
	{
		if (document.getElementById('toolCoinDesEnfants') != null)
		{
			document.getElementById('toolCoinDesEnfants').style.display = 'block' ;
		}
	}

	// Activate the right menu (case when using prev-next buttons)
	window.parent.frames['menu'].window.document.getElementById('aExpandAll').onclick() ;
	activateRightMenu(strCurPageCorrespondingMenuItemId) ;
	iFrameHeight();
	}
	catch(e)
	{}
}
function iFrameHeight() 
{
	var h = 0;
	if ( !document.all ) 
	{
		h = window.parent.frames['menu'].window.document.body.scrollHeight;
	} 
	else if( document.all ) 
	{
		h = window.parent.frames['menu'].window.document.body.scrollHeight;
	}
	if (h <= 300)
	{
		setTimeOut(1000, "iFrameHeight()") ;
	}
	document.getElementById('menu').height = h ;
}

function initGSearch()
{
	window.parent.frames['menu'].window.document.getElementById('aExpandAll').onclick() ;
	iFrameHeight();
}

function initALaUne()
{
	window.parent.frames['menu'].window.document.getElementById('aExpandAll').onclick() ;
	activateRightMenu('mnupgeALaUne') ;
	iFrameHeight();
}

function onscrollMap()
{
	var e ;
	try
	{
		repositionMap2(e);
	}
	catch(e)
	{
	}
}

function repositionMap2(e)
{	
	document.getElementById('carte').style.top = (document.documentElement.scrollTop) + CartePosTop ;			
	document.getElementById('carte').style.left = getInt(CartePosLeft) ;

	curScrollTop = document.documentElement.scrollTop ;
	
	repositionTool() ;
}

function repositionTool()
{
	var newPos2 = (document.documentElement.scrollTop) + 50 ;
	var newPos = (document.documentElement.scrollTop) + 50 ;
	var newPos1 = newPos ;
	if (newPos < 100)
	{
		newPos = 100 ;
	}
	document.getElementById('tabTools').style.position = "absolute" ;	
	document.getElementById('tabTools').style.top = "" + newPos + "px" ;	
}

function repositionPhotosTool()
{
	curScrollTop = document.body.scrollTop ;
	document.getElementById('tabTools').style.top = curScrollTop + 50 ;	
	
}

function dragStartCarte(e)
{
	document.getElementById('carte').style.cursor = "move" ;
	yDragRelPos = window.event.y - getInt(document.getElementById('carte').style.top) ;
	xDragRelPos = window.event.x - getInt(document.getElementById('carte').style.left) ;
}

function dragCarte(e)
{
	var curY ;
	var curX ;
	
	document.getElementById('carte').style.cursor = "move" ;
	
	curY = window.event.y - yDragRelPos ;
	curX = window.event.x - xDragRelPos ;
	
	document.getElementById('carte').style.top = curY ;
	document.getElementById('carte').style.left = curX ;
	
	window.event.cancelBubble = true ;
}

function dragEndCarte(e)
{
	document.getElementById('carte').style.cursor = "default" ;
	
	CartePosTop = getInt(document.getElementById('carte').style.top) - document.documentElement.scrollTop ;
	CartePosLeft = getInt(document.getElementById('carte').style.left) ;
	
	window.event.cancelBubble = false ;
}

function overCarte(e)
{
	document.getElementById('carte').style.cursor = "move" ;
	window.status = "Vous pouvez faire un drag & drop de la carte." ;
}

function outCarte(e)
{
	document.getElementById('carte').style.cursor = "default" ;
}

function ExpandCollapse(e, bFromExpCollAll, bForceExpand, bForceCollapse)
{
	if (e.nextSibling != null)
	{
		if (e.nextSibling.style.display == "none" || (bForceExpand == 1))
		{
			if ((bFromExpCollAll == 1 && bForceCollapse == 0) ||
				(bFromExpCollAll == 0))
			{
				e.nextSibling.style.display = "block" ;
				e.firstChild.src = "Imgs\\Collapse_grey.png" ;
			}
			
			if (bFromExpCollAll == 0)
			{
				e.firstChild.src = "Imgs\\Collapse_red.png" ;
			}
		}
		else if ((e.nextSibling.style.display == "block" || e.nextSibling.style.display == "") || (bForceExpand == 0))
		{
			e.nextSibling.style.display = "none" ;
			
			if (bFromExpCollAll == 0)
			{
				e.firstChild.src = "Imgs\\Expand_red.png" ;
			}
			else if (bFromExpCollAll == 1)
			{
				e.firstChild.src = "Imgs\\Expand_grey.png" ;
			}
		}
	}
}

function changeImg(imgType, mouseAction, imgName)
{
	if (mouseAction == "over")
	{
		if (imgType == "Expand")
		{
			document.getElementById(imgName).src = "Imgs\\Expand_red.png" ;
		}
		else if (imgType == "Collapse")
		{
			document.getElementById(imgName).src = "Imgs\\Collapse_red.png" ;
		}
	}
	else
	{
		if (imgType == "Expand")
		{
			document.getElementById(imgName).src = "Imgs\\Expand_grey.png" ;
		}
		else if (imgType == "Collapse")
		{
			document.getElementById(imgName).src = "Imgs\\Collapse_grey.png" ;
		}
	}
}

function textMouseOver(e)
{
	var strSrcImg = new String() ;
	
	strSrcImg = e.firstChild.src ;

	if (e.firstChild.src.search("Expand_grey.png") >= 0)
	{
		e.firstChild.src = "Imgs\\Expand_red.png" ;
	}
	else if (e.firstChild.src.search("ExpandAll_grey.png") >= 0)
	{
		e.firstChild.src = "Imgs\\ExpandAll_red.png" ;
	}
	else if (e.firstChild.src.search("Collapse_grey.png") >= 0)
	{
		e.firstChild.src = "Imgs\\Collapse_red.png" ;
	}
	else if (e.firstChild.src.search("CollapseAll_grey.png") >= 0)
	{
		e.firstChild.src = "Imgs\\CollapseAll_red.png" ;
	}

	e.style.cursor = "pointer" ;
}

function textMouseOut(e)
{
	var strSrcImg = new String() ;
	
	strSrcImg = e.firstChild.src ;

	if (e.firstChild.src.search("Expand_red.png") >= 0)
	{
		e.firstChild.src = "Imgs\\Expand_grey.png" ;
	}
	else if (e.firstChild.src.search("ExpandAll_red.png") >= 0)
	{
		e.firstChild.src = "Imgs\\ExpandAll_grey.png" ;
	}
	else if (e.firstChild.src.search("Collapse_red.png") >= 0)
	{
		e.firstChild.src = "Imgs\\Collapse_grey.png" ;
	}
	else if (e.firstChild.src.search("CollapseAll_red.png") >= 0)
	{
		e.firstChild.src = "Imgs\\CollapseAll_grey.png" ;
	}

	e.style.cursor = "default" ;
}

function Out(e)
{
	e.className = "menu" ;
}

function Over(e)
{
	e.className = "menuOver" ;
}

function clickMenu(e, href)
{
	if (href == "LeParcoursEnEntier.htm")
	{
		openPageInWholeDisplay(href) ;
	}
	else
	{
		if (href == "default.htm")
		{
			window.parent.location = "http://www.heureuxquicommeulysse.fr/" ;
		}
		else
		{
			window.parent.location = href ;
		}
		
		var IMGTags = window.parent.frames['menu'].window.document.getElementsByTagName("IMG") ;

		for (var i = 0 ; i < IMGTags.length ; i++)
		{
			if (IMGTags[i].className == "menuItemA")
			{
				IMGTags[i].className = "menuItemD" ;
			}
		}

		e.parentNode.children[0].className = "menuItemA" ;
	}
}

function ExpandCollapseAll(bForceExpand, bForceCollapse)
{
	var len = document.getElementsByTagName("A").length ;
	
	for (i = 0 ; i < len ; i++)
	{
		var curTagName = "A" ;	
		var curType = document.getElementsByTagName("A").item(i).type ;	
		
		if (curTagName == "A" && curType == "menu")
		{
			ExpandCollapse(document.getElementsByTagName("A").item(i), 1, bForceExpand, bForceCollapse) ;
		}
	}
}

var glFontSize = 10 ;

function MouseTools(e, mouseAction)
{
	if (mouseAction == "over")
	{
		if (e.alt == "+")
		{
			e.src = "Imgs\\BiggerText_red.png" ;
		}
		else if (e.alt == "-")
		{
			e.src = "Imgs\\SmallerText_red.png" ;
		}
		else if (e.alt == "displayMap")
		{
			e.src = "Imgs\\displayMap_red.png" ;
			e.title = "Afficher la carte" ;
		}
		else if (e.alt == "hideMap")
		{
			e.src = "Imgs\\hideMap_red.png" ;
			e.title = "Cacher la carte" ;
		}
		else if (e.alt == "pageSuivante")
		{
			e.src = "Imgs\\PageSuivante_red.png" ;
			e.title = "Aller Page Suivante : " + strDescNextPageUrl ;
		}
		else if (e.alt == "pagePrecedante")
		{
			e.src = "Imgs\\PagePrecedante_red.png" ;
			e.title = "Aller Page Précédente : " + strDescPreviousPageUrl ;
		}
		else if (e.alt == "Print")
		{
			e.src = "Imgs\\Print_red.png" ;
		}
		else if (e.alt == "PhotoPage")
		{
			e.src = "Imgs\\PhotoPage_red.png" ;
		}
		else if (e.alt == "CoinDesEnfants")
		{
			e.src = "Imgs\\CdEnfants_red.png" ;
		}
		else if (e.alt == "CarnetDeMarie")
		{
			e.src = "Imgs\\CdMarie_red.png" ;
		}
		else if (e.alt == "PagePrincipale")
		{
			e.src = "Imgs\\PPrincipale_red.png" ;
		}
		else if (e.alt == "GaleriePhotoPage")
		{
			e.src = "Imgs\\GaleriePhotoPage_red.png" ;
		}
	}
	else
	{
		if (e.alt == "+")
		{
			e.src = "Imgs\\BiggerText_grey.png" ;
		}
		else if (e.alt == "-")
		{
			e.src = "Imgs\\SmallerText_grey.png" ;
		}
		else if (e.alt == "displayMap")
		{
			e.src = "Imgs\\displayMap_grey.png" ;
		}
		else if (e.alt == "hideMap")
		{
			e.src = "Imgs\\hideMap_grey.png" ;
		}
		else if (e.alt == "pageSuivante")
		{
			e.src = "Imgs\\PageSuivante_grey.png" ;
		}
		else if (e.alt == "pagePrecedante")
		{
			e.src = "Imgs\\PagePrecedante_grey.png" ;
		}
		else if (e.alt == "Print")
		{
			e.src = "Imgs\\Print_grey.png" ;
		}
		else if (e.alt == "PhotoPage")
		{
			e.src = "Imgs\\PhotoPage_grey.png" ;
		}
		else if (e.alt == "CoinDesEnfants")
		{
			e.src = "Imgs\\CdEnfants_grey.png" ;
		}
		else if (e.alt == "CarnetDeMarie")
		{
			e.src = "Imgs\\CdMarie_grey.png" ;
		}
		else if (e.alt == "PagePrincipale")
		{
			e.src = "Imgs\\PPrincipale_grey.png" ;
		}
		else if (e.alt == "GaleriePhotoPage")
		{
			e.src = "Imgs\\GaleriePhotoPage_grey.png" ;
		}
	}
}

function makeTextBigger(eltId)
{
	glFontSize = glFontSize + 2 ;
	document.getElementById(eltId).style.fontSize = glFontSize + "pt";
}

function makeTextSmaller(eltId)
{
	glFontSize = glFontSize - 2 ;
	document.getElementById(eltId).style.fontSize = glFontSize + "pt";
}

function showHideCarte(e)
{
	if (document.getElementById('carte').style.visibility == "hidden" || document.getElementById('carte').style.visibility == "")
	{
		document.getElementById('carte').style.visibility = 'visible' ;
		e.src = "Imgs\\hideMap_red.png" ;
		e.type = "hideMap" ;
		e.alt = "hideMap" ;
		e.title = "Cache la carte" ;
	}
	else
	{
		document.getElementById('carte').style.visibility = 'hidden' ; 
		e.src = "Imgs\\displayMap_red.png" ;
		e.type = "displayMap" ;
		e.alt = "displayMap" ;
		e.title = "Affiche la carte" ;
	}
}

function gotoNextPage(strUrl, mnuToOpen)
{
	window.location = strUrl ;
	activateRightMenu(mnuToOpen) ;
}

function activateRightMenu(mnuToOpen)
{
try
{	
	var IMGTags = window.parent.frames['menu'].window.document.getElementsByTagName("IMG") ;

	for (var i = 0 ; i < IMGTags.length ; i++)
	{
		if (IMGTags[i].className == "menuItemA")
		{
			IMGTags[i].className = "menuItemD" ;
		}
	}
	// 2. put it to the activated menu indicator
	window.parent.frames['menu'].window.document.getElementById('I' + mnuToOpen).className = "menuItemA" ;
	
	// Open the menus from the current menu to the root.
	var ulToOpen = window.parent.frames['menu'].window.document.getElementById(mnuToOpen) ;

	while (ulToOpen != null)
	{
		if (ulToOpen.tagName == 'UL')
		{
			ulToOpen.display = 'block' ;
			ulToOpen.parentNode.firstChild.firstChild.src = "Imgs\\Collapse_grey.png" ;
		}
		
		// Get the parent 
		ulToOpen = ulToOpen.parentNode ;
	}	
}
catch(ex)
{}
}

function displayDescPreviousPage(e)
{
	e.style.cursor = "pointer" ;
	e.title = strDescPreviousPageUrl ;
}

function displayDescNextPage(e)
{
	e.style.cursor = "pointer" ;
	e.title = strDescNextPageUrl ;
}

function Print(e)
{
	var pgePrint = window.open(e,"","toolbar=0, directories=0, status=0, menubar=0, width=650, height=600, scrollbars=1, location=0, resizable=0");
}

function showHideTech()
{
	if (document.getElementById('divTech').style.display == 'none')
	{
		document.getElementById('divTech').style.display = 'block' ;
		document.images['imgTech'].src = "Imgs\\Collapse_red.png" ;
	}
	else if (document.getElementById('divTech').style.display == 'block' || document.getElementById('divTech').style.display == '')
	{
		document.getElementById('divTech').style.display = 'none' ;
		document.images['imgTech'].src = "Imgs\\Expand_red.png" ;
	}
}

function mouseOverTechImg(e)
{
	var url = new String(e.src) ;
	
	if (url.search("Expand") != -1)
	{
		document.images['imgTech'].src = "Imgs\\Expand_red.png" ;
	}
	else
	{
		document.images['imgTech'].src = "Imgs\\Collapse_red.png" ;
	}
}

function mouseOutTechImg(e)
{
	var url = new String(e.src) ;
	
	if (url.search("Expand") != -1)
	{
		document.images['imgTech'].src = "Imgs\\Expand_grey.png" ;
	}
	else
	{
		document.images['imgTech'].src = "Imgs\\Collapse_grey.png" ;
	}
}

function loadGoogleMap() 
{
try
{
	if (bAddCarte == 1)
	{
		if (GBrowserIsCompatible()) 
		{
			gbigmap = new GMap2(document.getElementById("bigmap"));
			gbigmap.addControl(new GSmallMapControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(2,2))); 
			gbigmap.addControl(new GMapTypeControl(), new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(-65,3))); 
			gbigmap.setCenter(new GLatLng(googleMapLatCenter, googleMapLngCenter), googleMapZoom);
			gbigmap.addMapType(G_PHYSICAL_MAP);
			gbigmap.addMapType(G_HYBRID_MAP)
			gbigmap.addMapType(G_DEFAULT_MAP_TYPES) ;
			gbigmap.setMapType(G_HYBRID_MAP) ;
			gbigmap.enableDragging() ;
			gbigmap.enableDoubleClickZoom() ;
			gbigmap.enableContinuousZoom() ;
			gbigmap.enableScrollWheelZoom() ;
			gmap = new GMap2(document.getElementById("map"));
			gmap.setCenter(new GLatLng(googleMapLatCenter, googleMapLngCenter), googleMapZoom - 1);
			if (SpecificInfoMap == -1)
			{
			}
			else
			{
				if (SpecificInfoMap.length > 0)
				{
					gbigmap.addControl(new MoreInfoControl(gbigmap), new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(275,3)));
				}
			}
		}
	}
}
catch(e)
{}
}

function MoreInfoControl() {}
try
{
	MoreInfoControl.prototype = new GControl();
}
catch(e)
{}

MoreInfoControl.prototype.initialize = function(map) 
{  
	var container = document.createElement("div");  
	var AddSpec = document.createElement("div");  
	this.setButtonStyle_(AddSpec);  
	container.appendChild(AddSpec);  
	AddSpec.appendChild(document.createTextNode("Ajouter nos infos"));  
	
	mgr = new MarkerManager(map, {trackMarkers:true});
	
	GEvent.addDomListener(AddSpec, "click", function() 
	{    
		RemSpec.style.display = "block";
		AddSpec.style.display = "none";
		
		AddSpecificMarkers() ;
		mgr.refresh() ;
	});  
	
	var RemSpec = document.createElement("div");  
	this.setButtonStyle_(RemSpec);  
	container.appendChild(RemSpec);  
	RemSpec.appendChild(document.createTextNode("Supprimer nos infos"));  
	RemSpec.style.display = "none";
	GEvent.addDomListener(RemSpec, "click", function() 
	{
		RemSpec.style.display = "none";
		AddSpec.style.display = "block";
		
		mgr.clearMarkers() ;
	});  
	map.getContainer().appendChild(container);  
	
	return container;
}
		
MoreInfoControl.prototype.getDefaultPosition = function() {  }
MoreInfoControl.prototype.setButtonStyle_ = function(button) 
{  
	button.style.backgroundColor = "white";  
	button.style.font = "12px Arial";  
	button.style.border = "1px solid black";  
	button.style.padding = "0px";  
	button.style.marginBottom = "2px";  
	button.style.textAlign = "center";  
	button.style.width = "10em";  
	button.style.cursor = "pointer";
}

function createSpecificMarkerMap(index) 
{  
	try
	{
		var curMarker = SpecificInfoMap[index] ;
		var point = new GLatLng(SpecificInfoMap[index][0], SpecificInfoMap[index][1]) ;
		
		var icon = new GIcon(baseIcon);  
		icon.image = "http://www.heureuxquicommeulysse.fr/Imgs/GoogleRes/" + SpecificInfoMap[index][2] + ".png" ; 
		baseIcon.shadow = "http://www.heureuxquicommeulysse.fr/Imgs/GoogleRes/" + SpecificInfoMap[index][2] + ".shadow.png" ;
		baseIcon.iconSize = new GSize(32, 32);
		baseIcon.shadowSize = new GSize(59, 32);
		
		var marker = new GMarker(point,  {icon:icon});  

		GEvent.addListener(marker, "mouseover", function() 
		{ 
			var LatLng = marker.getLatLng() ;
			var distance = 0 ;
			
			var strComment = SpecificInfoMap[index][3] ;
			
			var str = "<TABLE style=\"FONT-SIZE: 8pt; FONT-FAMILY: 'Trebuchet MS'; TEXT-ALIGN: left\" WIDTH=\"0\" BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"1\"><TR><TD><img style='position:relative; top:-2px' align='middle' border='0' width='32' height='32' src='" + "http://www.heureuxquicommeulysse.fr/Imgs/GoogleRes/" + SpecificInfoMap[index][2] + ".png" +"'>&nbsp;<b>" + SpecificInfoMap[index][2] ; 
			
			str += "</b><br/>Latitude : " + LatLng.lat() + "<br/>Longitude : " + LatLng.lng() + "<br/>";
			
			if (strComment.length > 0)
			{
				str += "<P>" + strComment + "<br>" ;
			}
				
			str += "</TD>" ;
			str += "</TR></TABLE>" ;
			
			marker.openInfoWindowHtml(str) ;
			var strGACounter = "/Parcours/MouseOver/" + SpecificInfoMap[index][2] ;
			
			pageTracker._trackPageview(strGACounter);
		});
	
	return marker;
	}
	catch(ex)
	{}
}
function AddSpecificMarkers()
{
	try
	{
		var i ;		
		for (i = 0 ; i < SpecificInfoMap.length ; i++)
		{
			mgr.addMarker(createSpecificMarkerMap(i), 0, 17);
		}
	}
	catch(ex)
	{}
}

function loadGoogleMapALaUne() 
{
try
{
	if (GBrowserIsCompatible()) 
	{
		var map = new GMap2(document.getElementById("map1"));
		map.setCenter(new GLatLng(googleMapLatCenter, googleMapLngCenter), googleMapZoom);
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		
		var marker = new GMarker(new GLatLng(googleMapLatCenter, googleMapLngCenter));
        map.addOverlay(marker);
	}
}
catch(e)
{}
}

function uneGoTo(strUrl, mnuToOpen)
{
	gotoNextPage(strUrl, mnuToOpen) ;
}

function loadALaUne()
{
	var today = new Date() ;
	var nDayNo = today.getDate() ;
	var nMonthNo = today.getMonth() ;
	var strImageNumber = "";
	
	nMonthNo++ ;
	
	strImageNumber = nMonthNo.toString() + nDayNo.toString() ;
	
	document.images['imgOftheDay'].src = "ImgDay\\" + strImageNumber + ".jpg" ;
	activateRightMenu(strCurPageCorrespondingMenuItemId) ;
}

function loadThemePhotos()
{
	if(bFirstPage == 1)
	{	
		document.getElementById('aPgePrev').style.visibility = 'hidden' ;
		document.getElementById('toolPagePrecedante').style.display = 'none' ;
	}
	else
	{
		document.getElementById('aPgePrev').style.visibility = 'visible' ;
		document.getElementById('toolPagePrecedante').style.display = 'block' ;
	}
	
	if (bLastPage == 1)
	{
		document.getElementById('aPgeNext').style.visibility = 'hidden' ;
		document.getElementById('toolPageSuivante').style.display = 'none' ;		
	}
	else
	{
		document.getElementById('aPgeNext').style.visibility = 'visible' ;
		document.getElementById('toolPageSuivante').style.display = 'block' ;
	}
	
	var nImgs = window.document.images.length ;

	for (var i = 5 ; i < nImgs ; i++)
	{
		var strDesc = document.images[i].alt ;
		
		if (moz)
		{
			document.images[i].parentNode.children[1].innerHTML = strDesc ;
		}
		else
		{
			document.images[i].parentNode.children[1].innerHTML = strDesc ;
		}
	}
}

function AddGoogleData()
{
	try
	{
		if (bAddCarte == 1)
		{
			DrawRoute() ;
			AddMarkers() ;
		}
	}
	catch (e)
	{}
}

function openPageInWholeDisplay(strUrl)
{
	var width = screen.width ;
	var height = screen.height ;
	var strParamString = "toolbar=no, directories=no, status=no, menubar=no, width=" ;
	strParamString += width - 10 ;
	strParamString += " ,height=" ;
	strParamString += height - 55 ;
	strParamString += " ,left=0, top=0, scrollbars=yes, location=no, resizable=yes" ;
	window.open(strUrl, "", strParamString) ;
}


