﻿$(document).ready(function(){
    $("ul.topnav li").hover(
        function() {$(this).find("ul.subnav").slideDown('').show();},
        function() {$(this).parent().find("ul.subnav").slideUp('slow');}
    );
    
    jQuery.fn.extend({
       findPos : function() {
           obj = jQuery(this).get(0);
           var curleft = obj.offsetLeft || 0;
           var curtop = obj.offsetTop || 0;
           while (obj = obj.offsetParent) {
                    curleft += obj.offsetLeft
                    curtop += obj.offsetTop
           }
           return {x:curleft,y:curtop};
       }       
    });    
});

function open_simul(x,y){
    window.open("simul.aspx","","width=520px,top="+y+",left="+x+",height=440px");
}

function show_div(div){
   $(".div_data").hide();
   $("#"+div).show(); 
}

function show_mentions(ag,obj){
    pos = $("#"+obj).findPos();
    window.open("mentions_legales_agence.aspx?ag="+ag,"","width=520px,top="+(pos.y-300)+",left="+(pos.x-250)+",height=440px");
}

function is_numeric(variable)
{
   var exp = new RegExp("^[0-9]+$","g");
   return exp.test(variable);
}

