<!--
function log(s){
window.logString+= "\n" + s;
}
function showLog(){
return window.logString;
}
function clearLog(){
window.logString= "";
}
function dgebId(id){
return document.getElementById(id);
}
function xhrgebtn(xhr,tn){
return xhr.responseXML.getElementsByTagName(tn);
}
function redirectOnError(xhr){
if(xhr){
if(xhr.status!=200 && xhr.status!=0){
document.location= window.errorPagesBaseURL+xhr.status+".html";
}
}
}
function init(type){
clearLog();
var demarrage= new Object();
demarrage.onload= function()
{
window.displayScaleInPixelIfNoHelmert=false;
initMinMap();
initMap();
window.myMenu= new Menu(type);
window.myMode= new Mode();
window.myModeAffichage= new ModeAffichage();
window.myCurseur= new CurseurEchelle(carte);
initMinMapTools();
initMapContext();
vignette.reload();
if(redimensionnerCartoTimeout == null){
redimensionnerCartoTimeout= window.setTimeout(reloadCarteRedimensionnee, 500);
}
}
var _jc="js/carto/";
var _jce=_jc+"Events/";
var _jcu=_jc+"Utils/";
var _jcl=_jc+"Layers/";
var _jcs=_jc+"Shapes/";
var _jct=_jc+"Tools/";
var _jctw=_jct+"Workers/";
var _jctl=_jct+"Listeners/";
var _jci=_jc+"Interface/";
var a= new Array(
_jce+"EventModifiers.js",
_jce+"MapEvent.js",
_jce+"MouseEvent.js",
_jce+"KeyEvent.js",
_jce+"EventsDispatcher.js",
_jcu+"Point.js",
_jcu+"Box.js",
_jcu+"GeoBox.js",
_jcu+"PixelBox.js",
_jcu+"DivPool.js",
_jcu+"Constantes.js",
_jcu+"Cookie.js",
_jcl+"WMSLayer.js",
_jcl+"HTMLLayer.js",
_jcl+"ImageLayer.js",
_jcl+"UserLayer.js",
_jc+"Styles/WMSStyle.js",
_jcs+"Shape.js",
_jcs+"ShapePOI.js",
_jcs+"ShapeCadre.js",
_jcs+"ShapeRectangleSimple.js",
_jcs+"ShapePastilleParcellaire.js",
_jct+"Tool.js",
_jctw+"Worker.js",
_jctw+"WorkerUndoZoom.js",
_jctw+"WorkerMemoZoom.js",
_jctw+"WorkerZoom.js",
_jctl+"Listener.js",
_jctl+"ListenerChargement.js");
if(type==0){
a= a.concat(new Array(
_jctl+"ListenerLocPar.js",
_jctl+"ListenerLocVoi.js",
_jctl+"ListenerLocRep.js"));
}
a= a.concat(new Array(
_jctl+"ListenerCoordinates.js",
_jctl+"ListenerGeoBox.js",
_jctl+"ListenerZoom.js",
_jctl+"ListenerFeuille.js",
_jctl+"ListenerPastillesParcellaire.js",
_jctl+"ListenerParcelle.js",
_jc+"WMSMap.js",
_jc+"WFS.js",
_jc+"WMSMapContext.js",
_jct+"OtherTools/ExporterPDF.js",
_jci+"Instructions.do",
_jci+"API.do",
_jci+"Menu.js",
_jci+"Mode.js",
_jci+"ModeAffichage.js",
_jci+"Erreurs.do",
_jci+"CurseurEchelle.js"));
var c= new Chargement(a,new Array(),	demarrage);
c.charge();
}
function initMinMap()
{
var md= dgebId("mini_carte");
var mdp= new Object();
md.position= mdp;
mdp.top= 56;
mdp.left= 16;
mdp.width= 158;
mdp.height= 112;
var vignette= new WMSMap(dgebId("mini_carte"),
window.geoserverURL+"/wms",
new PixelBox(0,0,mdp.width - 1,mdp.height - 1),
WMSMap.FORMAT_PNG,"",false,WMSMap.EXCEPTION_IMAGE,false);
window.vignette= vignette;
}
function initMap()
{
var cd= dgebId("carte_img");
var am= dgebId("affichage_maximum");
window.curHeight=650;
window.curWidth=700;
var cdmi= new Object();
cd.minposition= cdmi;
cdmi.top= 30;
cdmi.left= 191;
cdmi.width= 484;
cdmi.height= 345;
cdmi.minWidth= 484;
cdmi.minHeight= 345;
if(am){
cdmi.maxWidth= 1000;
cdmi.maxHeight= 650;
}else{
cdmi.maxWidth= 800;
cdmi.maxHeight= 480;
}
var cdma= new Object();
cd.maxposition= cdma;
cdma.top= 10;
cdma.left= 1;
cdma.width=678;
cdma.height= 560;
cdma.minWidth= 678;
cdma.minHeight= 485;
if(am){
cdma.maxWidth= 1100;
cdma.maxHeight= 850;
}else{
cdma.maxWidth= 1000;
cdma.maxHeight= 600;
}
cd.carteMinWidth= cdmi.minWidth;
cd.carteMinHeight= cdmi.minHeight;
cd.carteMaxWidth= cdma.maxWidth;
cd.carteMaxHeight= cdma.maxHeight;
cd.position= cdmi;
var carte= new WMSMap(cd,
window.geoserverURL+"/wms",
new PixelBox(0,0,cd.position.width - 1,cd.position.height - 1),
WMSMap.FORMAT_PNG,"",false,WMSMap.EXCEPTION_IMAGE);
window.carte= carte;
}
function initMinMapTools()
{
var l= new ListenerChargement(window.vignette,dgebId("chargement_petite_carte"));
window.vignette.addListener(l);
window.miniatureListenerGeoBox= new ListenerGeoBox(window.carte,window.vignette);
window.carte.addListener(window.miniatureListenerGeoBox);
}
function initMapTools(typeCarte)
{
var wc= window.carte;
var lcoord= new ListenerCoordinates(wc);
wc.addListener(lcoord);
wc.monListenerCoordinate= lcoord;
var l= new ListenerChargement(wc,dgebId("chargement_grande_carte"));
wc.addListener(l);
window.myZoomListener= new ListenerZoom(wc);
window.myZoomListener.setCurseurEchelle(window.myCurseur);
wc.addListener(window.myZoomListener);
window.myPastillesParcellaireListener= new ListenerPastillesParcelaire(wc);
wc.addListener(window.myPastillesParcellaireListener);
if(typeCarte==WMSMap.TYPE_VECTEUR){
var lp= new ListenerParcelle(wc);
wc.addListener(lp);
}else if(typeCarte==WMSMap.TYPE_RASTEUR)
{
var llp= new ListenerLocPar(wc);
wc.addListener(llp);
var llv= new ListenerLocVoi(wc,wc,window.vignette);
wc.addListener(llv);
var llr= new ListenerLocRep(wc,wc,window.vignette);
wc.addListener(llr);
var lf= new ListenerFeuille(wc);
wc.addListener(lf);
}
window.myZoomPlus= new WorkerZoom(wc,WorkerZoom.PLUS);
window.myZoomMinus= new WorkerZoom(wc,WorkerZoom.MINUS);
window.myMemoZoom= new WorkerMemoZoom(wc);
wc.addListener(window.myMemoZoom);
window.myUndo= new WorkerUndoZoom(wc);
wc.addListener(window.myUndo);
}
window.onunload= function(){
var w= window;
var wc= w.carte;
var wv= w.vignette;
ListenerGeoBox= null;
wc.removeAndDeleteAllListener();
wv.removeAndDeleteAllListener();
w.includedJsFiles=null;
w.includedHtmlFiles=null;
w.logString=null;
w.myMenu.freeMemory();
w.myMenu=null;
w.myMode.freeMemory();
w.myMode=null;
w.myModeAffichage=null;
wc.mesLayers= null;
wv.mesLayers=null;
w.carte=null;
w.vignette=null;
}
function getWindowHeight(){
var windowHeight = 0;
if( typeof(window.innerHeight) == 'number' ){
windowHeight = window.innerHeight;
} else if(document.documentElement && document.documentElement.clientHeight){
windowHeight = document.documentElement.clientHeight;
} else if(document.body && document.body.clientHeight){
windowHeight = document.body.clientHeight;
}
return windowHeight;
}
function getWindowWidth(){
var windowWidth = 0;
if( typeof(window.innerWidth) == 'number' ){
windowWidth = window.innerWidth;
} else if(document.documentElement && document.documentElement.clientWidth){
windowWidth = document.documentElement.clientWidth;
} else if(document.body && document.body.clientWidth){
windowWidth = document.body.clientWidth;
}
return windowWidth;
}
redimensionnerCartoTimeout= null;
function redimensionnerCarto(){
var ci= dgebId("carte_img");
if(Cookie && Cookie.test())
InterfaceAPI.activerSauverAffichage(true);
if(ci && ci.minposition && ci.maxposition){
var deltaHeight=getWindowHeight()-window.curHeight;
var deltaWidth=getWindowWidth()-window.curWidth;
window.curHeight=getWindowHeight();
window.curWidth=getWindowWidth();
ci.minposition.width+=deltaWidth;
ci.minposition.height+=deltaHeight;
ci.maxposition.width+=deltaWidth;
ci.maxposition.height+=deltaHeight;
setCarteSize();
}
}
function setCarteSize(){
var ci= dgebId("carte_img");
if(ci && ci.position)
{
var cc= dgebId("conteneur_carte");
var it= dgebId("infos_texte");
var bp= dgebId("bas_page");
var df= dgebId("div_footer");
var carteWidth= Math.min(ci.position.maxWidth, Math.max(ci.position.minWidth, ci.position.width));
var carteHeight= Math.min(ci.position.maxHeight, Math.max(ci.position.minHeight, ci.position.height));
var itHeight= 225;
if(ci.position==ci.maxposition)
{
itHeight= 30;
}
cc.style.width= carteWidth + 'px';
ci.style.width= carteWidth + 'px';
ci.style.height= carteHeight + 'px';
it.style.width= carteWidth + 'px';
it.style.top= (ci.position.top + carteHeight + 50) + 'px';
bp.style.top= (ci.position.top + carteHeight + itHeight) + 'px';
bp.style.width= (ci.position.left + carteWidth) + 'px';
df.style.width= (ci.position.left + carteWidth) + 'px';
var b= new PixelBox(0,0,carteWidth - 1,carteHeight - 1);
window.carte.setSize(b);
if(window.myModeAffichage){
if(redimensionnerCartoTimeout != null) window.clearTimeout(redimensionnerCartoTimeout);
redimensionnerCartoTimeout= window.setTimeout(reloadCarteRedimensionnee, 150);
}
}
}
function reloadCarteRedimensionnee(){
window.carte.reload();
}
-->
