var DHTML=0,DOM=0,MS=0,NS=0,OP=0;function initializeGMAP(id,iLat,iLng){if(GBrowserIsCompatible()){map=new GMap2($(id));point=new GLatLng(47.15984,2.988281);map.setCenter(point,5);geocoder=new GClientGeocoder();map.addMapType(G_PHYSICAL_MAP);map.addControl(new GSmallMapControl());map.enableDoubleClickZoom();map.enableContinuousZoom();new GKeyboardHandler(map);icon=new GIcon();icon.image="img/lightblue.png";icon.shadow="img/mm_20_shadow.png";icon.iconSize=new GSize(12,20);icon.shadowSize=new GSize(22,20);icon.iconAnchor=new GPoint(6,20);icon.infoWindowAnchor=new GPoint(8,1);if(iLat.value!=""&&iLng.value!=""){point=new GLatLng(iLat.value,iLng.value);map.setCenter(point,16);}else{if($('mapContainer'))$('mapContainer').hide();}
marker=new GMarker(point,{draggable:true,icon:icon,dragCrossMove:true});map.addOverlay(marker);GEvent.addListener(marker,"drag",function(){pointAdd=marker.getLatLng();iLat.value=pointAdd.y;iLng.value=pointAdd.x;});}}
function searchAddressGMAP(address,iLat,iLng){if(geocoder&&map){geocoder.getLatLng(address,function(point){map.clearOverlays();if(!point){if(address!='')
alert("L'adresse est introuvable");point=new GLatLng(47.15984,2.988281);map.setCenter(point,5);}else{map.setCenter(point,16);}
var marker=new GMarker(point,{draggable:true,icon:icon,dragCrossMove:true});map.addOverlay(marker);iLat.value=point.y;iLng.value=point.x;GEvent.addListener(marker,"drag",function(){pointAdd=marker.getLatLng();iLat.value=pointAdd.y;iLng.value=pointAdd.x;});});}}
function doubleOnly(input){tmp='';value=input.value;for(i=0;i<value.length;i++){if(value==','||value=='.')tmp='';else if(value.charAt(i)==','&&value.indexOf('.')==-1)tmp+='.';else if(!isNaN(value.charAt(i))&&value.charAt(i)!=' '||value.charAt(i)=='.'&&value.substr(0,i).indexOf('.')==-1||i==0&&value.charAt(i)=='-')tmp+=value.charAt(i);}
input.value=tmp;}
function intOnly(input){tmp='';value=input.value;for(i=0;i<value.length;i++){if(!isNaN(value.charAt(i))&&value.charAt(i)!=' ')tmp+=value.charAt(i);}
input.value=tmp;}
function trim(string){return string.replace(/^\s+/,'').replace(/\s+$/,'');}
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 resizeTradPopup(){if(document.getElementById){var taille=document.getElementById('cont_popup').offsetHeight+0;taille=(document.getElementById('body').offsetHeight>taille)?document.getElementById('body').offsetHeight:taille;taille=(getWindowHeight()>taille)?getWindowHeight():taille;document.getElementById('cache').style.height=taille+0+"px";}else if(document.all){var taille=document.all['popup'].offsetHeight;taille=(document.all['body'].offsetHeight>taille)?document.all['body'].offsetHeight:taille;taille=(getWindowHeight()>taille)?getWindowHeight():taille;document.all['cache'].style.height=taille+0+"px";}else if(document.layers){var taille=document.layers['popup'].offsetHeight;taille=(document.layers['body'].offsetHeight>taille)?document.layers['body'].offsetHeight:taille;taille=(getWindowHeight()>taille)?getWindowHeight():taille;document.layers['cache'].style.height=taille+0+"px";}}
function _popup_erreur(myLink,html,title,width,height,draggable,close,top,left,borderColor,titleBackgroundColor,titleFontColor,cache){_popup(myLink,html,title,width,height,draggable,close,top,left,'#FF0000','#FF6666','#000000',cache);}
function DHTML_init(){if(window.opera){OP=1;}
if(document.getElementById){DHTML=1;DOM=1;}
if(document.all&&!OP){DHTML=1;MS=1;}
if(document.layers&&!OP){DHTML=1;NS=1;}}
function effect_show(id){show('loading');if(document.getElementById&&document.getElementById(id).style.display=="none"){new Effect.Appear(id,{duration:1,afterFinish:function(){if(document.getElementById('loading'))mask('loading');}});}}
function effect_show(id){show('loading');if(document.getElementById&&(document.getElementById(id).style.display==""||document.getElementById(id).style.display=="block")){new Effect.Fade(id,{duration:1,afterFinish:function(){if(document.getElementById('loading'))mask('loading');}});}}
function show(id){document.getElementById(id).style.display="block";}
function mask(id){document.getElementById(id).style.display="none";}
function popupWin(pop,ySize,xSize){var gauche=(screen.width-xSize)/2
var haut=(screen.height-ySize)/2
var fenetre=window.open(pop,"","HEIGHT="+ySize+",WIDTH="+xSize+", left="+gauche+", top="+haut+",scrollbars=yes, status=no, toolbar=no, menubar=no, resizable=yes, title=Fichier, dependent=yes");}
function getElem(p1,p2,p3){var Elem;DHTML_init();if(DOM){if(p1.toLowerCase()=="id"){if(typeof document.getElementById(p2)=="object")
Elem=document.getElementById(p2);else Elem=void(0);return(Elem);}else if(p1.toLowerCase()=="name"){if(typeof document.getElementsByName(p2)=="object")
Elem=document.getElementsByName(p2)[p3];else Elem=void(0);return(Elem);}else if(p1.toLowerCase()=="tagname"){if(typeof document.getElementsByTagName(p2)=="object"||(OP&&typeof document.getElementsByTagName(p2)=="function"))
Elem=document.getElementsByTagName(p2)[p3];else Elem=void(0);return(Elem);}else return void(0);}
else if(MS){if(p1.toLowerCase()=="id"){if(typeof document.all[p2]=="object")
Elem=document.all[p2];else Elem=void(0);return(Elem);}else if(p1.toLowerCase()=="tagname"){if(typeof document.all.tags(p2)=="object")
Elem=document.all.tags(p2)[p3];else Elem=void(0);return(Elem);}else if(p1.toLowerCase()=="name"){if(typeof document[p2]=="object")
Elem=document[p2];else Elem=void(0);return(Elem);}else return void(0);}
else if(NS){if(p1.toLowerCase()=="id"||p1.toLowerCase()=="name"){if(typeof document[p2]=="object")
Elem=document[p2];else Elem=void(0);return(Elem);}else if(p1.toLowerCase()=="index"){if(typeof document.layers[p2]=="object")
Elem=document.layers[p2];else Elem=void(0);return(Elem);}else return void(0);}}
