
/* Clic down */
function mouseDownSIG(evt) {

      // pour IE, il faut faire cela  
    if (!evt) {
        evt = window.event;
    }
    
//    if (!(evt.x < 0 || evt.x > 580 || evt.y < 0 || evt.y > 500)) {
        if (requeteEnCours == true || isClicMiniature == true) {
        // on ne fait rien  
        } else {
            if (activeTool == OUTIL_DEPLACEMENT) {
                mouseDownDep(evt);
            } else {
                if (activeTool == OUTIL_ZOOM_PLUS || activeTool == OUTIL_ZOOM_MOINS ) {
                    mouseDownZoom(evt);
                } else {
                    if (activeTool == OUTIL_IDENTIFICATION) {
                        top.getMapFrame().identifier(evt.clientX, evt.clientY);
                    }else{
	                    if (activeTool == OUTIL_IDENTIFICATION_DPT) {                        
	                        top.getMapFrame().identifierLieu(evt.clientX, evt.clientY, "departement");                                   
                        }else{
	                    	if (activeTool == OUTIL_IDENTIFICATION_COM) {                        
	                        	top.getMapFrame().identifierLieu(evt.clientX, evt.clientY, "commune");    
	                        	         
                        /*if (activeToolTheme == OUTIL_IDENTIFICATION_THEME_SIMU_MANU) {
                            window.open("../popups/identifierSimpannes_manuelle.jsp?x1=" + evt.clientX + "&y1=" + evt.clientY, "Identification", "top=50, left=50, width=700, height=500, modal=no, resizable=yes, statusbars=no, menubars=no");
                        } else {
                            if (activeToolTheme == OUTIL_IDENTIFICATION_THEME_SIMU_EXCEL) {
                                window.open("../popups/identifierSimpannes_excel.jsp?x1=" + evt.clientX + "&y1=" + evt.clientY, "Identification", "top=50, left=50, width=700, height=500, modal=no, resizable=yes, statusbars=no, menubars=no");
                            } else {
                                if (activeToolTheme == OUTIL_IDENTIFICATION_THEME_COUV) {
                                    window.open("../popups/identifierCouvertures.jsp?x1=" + evt.clientX + "&y1=" + evt.clientY, "Identification", "top=50, left=50, width=700, height=500, modal=no, resizable=yes, statusbars=no, menubars=no");
                                } else {
                                    if (activeToolTheme == OUTIL_IDENTIFICATION_THEME_SGSN) {
                                        window.open("../popups/identifierSgsn.jsp?x1=" + evt.clientX + "&y1=" + evt.clientY, "Identification", "top=50, left=50, width=700, height=500, modal=no, resizable=yes, statusbars=no, menubars=no");
                                    }
                                }
                            }
                        }*/
		                    } else {
		                        if (activeTool == "mesure") {
		                            mouseDownMesure(evt);
		                        }
	                        }
                        }
                    }
                }
            }
        }
//    }
}
/* Déplacement de la souris */
function mouseMoveSIG(evt) {
  // pour IE, il faut faire cela  
    if (!evt) {
        evt = window.event;
    }
    /*
    if (isNavIE == false || isWait == false) {
*/
//    if (!(evt.x < 0 || evt.x > 580 || evt.y < 0 || evt.y > 500)) {
        //positionSouris(evt);
        isWait = true;
        // solution pour éviter l'effet saccadé sous IE   
        if (requeteEnCours == true) {
            // on ne fait rien  
        } else {
            if (activeTool == OUTIL_DEPLACEMENT) {
                mouseMoveDep(evt);
            } else {
                if (activeTool == OUTIL_ZOOM_PLUS || activeTool == OUTIL_ZOOM_MOINS) {
                    mouseMoveZoom(evt);
                } else {
                    if (activeTool == OUTIL_MESURE) {
                        mouseMoveMesure(evt);
                    } else {
	                    if (activeTool == OUTIL_IDENTIFICATION) {
	                        mouseMoveInfoBulle(evt);
	                    }
	                }
                }
            }
        }
//    }
    /*
        if (isNavIE == true) {
            setTimeout("isWait = false", 200);
        } else {
            isWait = false;
        }
    }
*/
}
/* Clic Up */
function mouseUpSIG(evt) {

  // pour IE, il faut faire cela  
    if (!evt) {
        evt = window.event;
    }
//    if (!(evt.x < 0 || evt.x > 580 || evt.y < 0 || evt.y > 500)) {
        if (isClicMiniature == true) {
            isClicMiniature = false;
        } else {
            if (requeteEnCours == true) {
        // on ne fait rien
  //          alert("requeteEnCours == true ...");
            } else {
                if (activeTool == OUTIL_DEPLACEMENT) {
                    mouseUpDep(evt);
                } else {
                    if (activeTool == OUTIL_ZOOM_PLUS || activeTool == OUTIL_ZOOM_MOINS) {
                        mouseUpZoom(evt);
//                    alert("activeTool == OUTIL_ZOOM / mouseUpZoom(evt) ...");
                    }
                }
            }
        }
//    }
}
/* Double clic */
function dblClickSIG(evt) {
  // pour IE, il faut faire cela  
    if (!evt) {
        evt = window.event;
    }
//    if (!(evt.x < 0 || evt.x > 580 || evt.y < 0 || evt.y > 500)) {
        if (requeteEnCours == true) {
        // on ne fait rien 
        } else {
            if (activeTool == OUTIL_MESURE) {
                dblClickMesure(evt);
            }
        }
        if (evt) {
            evt = false;
        }
//    }
}
/*
* Gere le clic sur la carte miniature
*/
function mouseDownMiniature(evt) {
    if (requeteEnCours == false) {
        isClicMiniature = true;
        if (!evt) {
            evt = window.event;
        }
//        if (!(evt.x < 0 || evt.x > 580 || evt.y < 0 || evt.y > 500)) {
            var ovXincre = widthCarteMiniature / widthPixelMiniature;
            var ovYincre = heightCarteMiniature / heightPixelMiniature;
            var ovX = evt.clientX;
            var ovY = heightPixelMiniature - evt.clientY;
            var ovmapX = ovX * ovXincre + hgXMiniature;
            var ovmapY = ovY * ovYincre + bdYMiniature;
            top.getMapFrame().rafraichirCarte("zoomXY&x1=" + Math.round(ovmapX) + "&y1=" + Math.round(ovmapY));
//        }
    }
}


