﻿var objDirections;
var LastSelection = -1;



function printItineraire() {
    if (document.getElementById) { 
        var div = document.getElementById("divItineraireRoute");
        if (div) {
            var WinPrint = window.open('','','left=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
            WinPrint.document.write(div.innerHTML);
            WinPrint.document.close();
            WinPrint.focus();
            WinPrint.print();
            WinPrint.close();
        }
    }
    
}

function showDirections() {
    var ed = document.forms[0].edDirections;
    if (ed) {
        strDirections = ed.value;
        rgDirectionsOnClick();
    }
}

function rgProximiteOnClick() {
    if (!objDirections) {
        objDirections = new google.maps.Directions(map,document.getElementById('divItineraireRoute'));
    }

    hideAllMarkerGroups();

    var ed = document.forms[0].edDirections;

    if (ed) {
        objDirections.loadFromWaypoints([ed.value, coords['coordsClient']]);
        showDiv('divItineraire');
        hideDiv('divProximite');
    }
    
}        
    
function checkRadio(rg, val) {
    if (rg) {
        for (i = 0; i<rg.length; i++) {
            if (rg[i].value == val)
            {
                rg[i].checked = true;
            }
        }
    }
}
//function addLoadEvent(func) {
//  var oldonload = window.onload;
//  if (typeof window.onload != 'function') {
//    window.onload = func;
//  } else {
//    window.onload = function() {
//      if (oldonload) {
//        oldonload();
//      }
//      func();
//    }
//  }
//}

/*function selectItinChezMoi ()
{
    objRadio = document.forms[0].RadioGroup1_5;
    if (objRadio != null)
    {
        objRadio.checked = true;
        rgProximiteOnClick();
    }
}*/

