var isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 &&
                  parseFloat(navigator.appVersion) >= 4) ? 1 : 0;
  var isMinIE4 = (document.all) ? 1 : 0;
  var isMinIE5 = (isMinIE4 && navigator.appVersion.indexOf("5.") >= 0) ? 1 : 0;
  var isMinNS6 = (isMinNS4 && navigator.userAgent.indexOf("Netscape6")>=0) ? 1 :0;

  function closeAndReload(url)
  {
    window.opener.location.href=url;
    window.close();
  }
  function openPopup(src,modele)
  	{
  	if (isMinIE4 || isMinNS6)
    if (document.all)
    {
      var xMax = screen.width;
      var yMax = screen.height;
    }
    else
      if (document.layers)
      {
        var xMax = window.outerWidth;
        var yMax = window.outerHeight;
      }
      else
      {
        var xMax = 640;
        var yMax=480;
       }
    switch (modele)
    {
      case 'message' : var xOffset = (xMax - 765)/2;
        var yOffset = (yMax - 410)/2;
        window.open(src,'schema_individuel',
        'width=765,height=410,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'');
        break;

       case 'video' : var xOffset = (xMax - 150)/2;
        var yOffset = (yMax - 150)/2;
        window.open(src,'schema_individuel',
        'width=150,height=150,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'');
        break;

       case 'classic' : var xOffset = (xMax - 350)/2;
        var yOffset = (yMax - 600)/2;
        window.open(src,'schema_individuel',
        'width=350,height=600,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'');
        break;
     }
    }

  function openImagePopup(src,imgwidth,imgheight)
  	{
  	if (isMinIE4 || isMinNS6)
    if (document.all)
    {
      var xMax = screen.width;
      var yMax = screen.height;
    }
    else
      if (document.layers)
      {
        var xMax = window.outerWidth;
        var yMax = window.outerHeight;
      }
      else
      {
        var xMax = 640;
        var yMax=480;
       }

     var popupwidth = imgwidth + 50;
     var popupheight = imgheight + 100;
     var popupscreenX = (xMax - popupwidth)/2;
     var popupscreenY = (yMax - popupheight)/2;
     var popuptop = (yMax - popupheight)/2;
     var popupleft = (xMax - popupwidth)/2;

     window.open(src,'schema_individuel',
      'width='+popupwidth+',height='+popupheight+',screenX='+popupscreenX+',screenY='+popupscreenY+',top='+popuptop+',left='+popupleft+'');
    }
