var viewer= null;
function geoportalLoadviewer(idDivMap, mode, territoire, crs, dispcrs, proxy){
var options= new Object();
if(mode) options.mode= mode;
if(territoire) options.territory= territoire;
if(crs) options.projection= crs;
if(dispcrs) options.displayProjection= dispcrs;
if(proxy) options.proxy= proxy;
options.nameInstance= 'viewer';
options.apiKey= '7618588410438912221';
options['7618588410438912221']= {
tokenServer:{url:'http://jeton-api.ign.fr',ttl:600},
tokenTimeOut:600,
bounds: [-180.0,-90.0,180.0,90.0],
allowedGeoportalLayers:[],
resources:{}
};
options['7618588410438912221'].allowedGeoportalLayers.push('ADMINISTRATIVEUNITS.BOUNDARIES:WMSC');
options['7618588410438912221'].resources['ADMINISTRATIVEUNITS.BOUNDARIES:WMSC']= {name:'ADMINISTRATIVEUNITS.BOUNDARIES',type:'WMSC',url:'http://wxs.ign.fr/geoportail/wmsc'};
options['7618588410438912221'].allowedGeoportalLayers.push('TRANSPORTNETWORKS.RUNWAYS:WMSC');
options['7618588410438912221'].resources['TRANSPORTNETWORKS.RUNWAYS:WMSC']= {name:'TRANSPORTNETWORKS.RUNWAYS',type:'WMSC',url:'http://wxs.ign.fr/geoportail/wmsc'};
options['7618588410438912221'].allowedGeoportalLayers.push('TRANSPORTNETWORKS.RAILWAYS:WMSC');
options['7618588410438912221'].resources['TRANSPORTNETWORKS.RAILWAYS:WMSC']= {name:'TRANSPORTNETWORKS.RAILWAYS',type:'WMSC',url:'http://wxs.ign.fr/geoportail/wmsc'};
options['7618588410438912221'].allowedGeoportalLayers.push('HYDROGRAPHY.HYDROGRAPHY:WMSC');
options['7618588410438912221'].resources['HYDROGRAPHY.HYDROGRAPHY:WMSC']= {name:'HYDROGRAPHY.HYDROGRAPHY',type:'WMSC',url:'http://wxs.ign.fr/geoportail/wmsc'};
options['7618588410438912221'].allowedGeoportalLayers.push('TRANSPORTNETWORKS.ROADS:WMSC');
options['7618588410438912221'].resources['TRANSPORTNETWORKS.ROADS:WMSC']= {name:'TRANSPORTNETWORKS.ROADS',type:'WMSC',url:'http://wxs.ign.fr/geoportail/wmsc'};
options['7618588410438912221'].allowedGeoportalLayers.push('ORTHOIMAGERY.ORTHOPHOTOS:WMSC');
options['7618588410438912221'].resources['ORTHOIMAGERY.ORTHOPHOTOS:WMSC']= {name:'ORTHOIMAGERY.ORTHOPHOTOS',type:'WMSC',url:'http://wxs.ign.fr/geoportail/wmsc'};
options['7618588410438912221'].allowedGeoportalLayers.push('GEOGRAPHICALGRIDSYSTEMS.MAPS:WMSC');
options['7618588410438912221'].resources['GEOGRAPHICALGRIDSYSTEMS.MAPS:WMSC']= {name:'GEOGRAPHICALGRIDSYSTEMS.MAPS',type:'WMSC',url:'http://wxs.ign.fr/geoportail/wmsc'};
viewer= new Geoportal.Viewer.Default(idDivMap, options);
return viewer;
}
// Geoportal API version 1.0beta4()
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'http://api.ign.fr/geoportail/api/js/1.0beta4/Geoportal.js';
script.charset='utf-8';
script.defer= true;
script.onload= script.onreadystatechange= function(){
if(script.readyState && script.readyState!=4 && script.readyState!='loaded' && script.readyState!='complete'){return;}
script.onload= script.onreadystatechange= null;
if(typeof(initGeoportalMap)=='function'){initGeoportalMap();}else{
var save_callback= function(){};
if(typeof(window.onload)!='undefined'){save_callback= window.onload;}
window.onload= function() {
if(typeof(initGeoportalMap)=='function'){initGeoportalMap();}
if(save_callback != 'undefined' && save_callback!=null) {save_callback();}
};
}
};
//Useful only on FireFox (to have an error in case of a 404)
script.onerror= function() {throw ('The script ' + this.src + ' has not been found.');};
var nodes= document.getElementsByTagName('head');
var head= nodes.length>0? nodes[0]: document.body;
head.appendChild(script);

