﻿// JScript File

var gmarkers = [];
var htmls = [];
var to_htmls = [];
var from_htmls = [];
var i=0;


function resizeMe(obj)
{ 
    var screenH = 1;
    if (parseInt(navigator.appVersion)>3) {
     screenH = document.body.clientHeight;
    }
    else if (navigator.appName == "Netscape" 
        && parseInt(navigator.appVersion)==3
        && navigator.javaEnabled()
       ) 
    {
     screenH = document.documentElement.clientHeight;
    }

    obj.style.height = (screenH - 220) + "px";
    //obj.style.height = (screenH - 180) + 'px';
}

function moveleft()
{
    var crossobj=document.getElementById("wn");
    var contentwidth=document.getElementById("ctl00_Maincontent_Gallery_bekijken1_DataList1").offsetWidth;

    if (window.moverightvar) clearTimeout(moverightvar)
        if (parseInt(crossobj.scrollLeft)<=(contentwidth))
            crossobj.scrollLeft = crossobj.scrollLeft + 102
    moveleftvar=setTimeout("moveleft()",250)
}

function moveright()
{
    var crossobj=document.getElementById("wn");
    var contentwidth=document.getElementById("ctl00_Maincontent_Gallery_bekijken1_DataList1").offsetWidth;

    if (window.moveleftvar) clearTimeout(moveleftvar)
        if (parseInt(crossobj.scrollLeft)>=0)
            crossobj.scrollLeft = crossobj.scrollLeft - 102
    moverightvar=setTimeout("moveright()",250)
}

function moverightOne()
{
    var crossobj = document.getElementById("wn");
    var contentwidth = document.getElementById("ctl00_Maincontent_Gallery_bekijken1_DataList1").offsetWidth;
    scrollLeftField = document.getElementById("ctl00_Maincontent_Gallery_bekijken1_tbxScrollLeft");

    if (parseInt(scrollLeftField.value) > 102) {
        scrollLeftField.value = parseInt(scrollLeftField.value) - 102;
    } else {
        scrollLeftField.value = contentwidth;
    }
    crossobj.scrollLeft = scrollLeftField.value - 102;
}

function moveleftOne()
{
    var crossobj=document.getElementById("wn");
    var contentwidth = document.getElementById("ctl00_Maincontent_Gallery_bekijken1_DataList1").offsetWidth;
    scrollLeftField = document.getElementById("ctl00_Maincontent_Gallery_bekijken1_tbxScrollLeft");
    
    if (parseInt(scrollLeftField.value) < (contentwidth)){
        scrollLeftField.value = (parseInt(scrollLeftField.value) + 102);
    } else {
       scrollLeftField.value = 102;
    }
    crossobj.scrollLeft = scrollLeftField.value - 102;
}

function ScrollTo()
{
    var crossobj=document.getElementById("wn");
    var contentwidth=document.getElementById("ctl00_Maincontent_Gallery_bekijken1_DataList1").offsetWidth;
    scrollLeftField = document.getElementById("ctl00_Maincontent_Gallery_bekijken1_tbxScrollLeft");
    //scrollLeftField.value = nummer;    
    
    crossobj.scrollLeft = scrollLeftField.value;
    alert(crossobj.scrollLeft);
}

function stopscroll(){
if (window.moverightvar) clearTimeout(moverightvar)
if (window.moveleftvar) clearTimeout(moveleftvar)
}

function Meer(div)
{
    var displayDiv = document.getElementById(div).style.display;
    
    if (document.getElementById("1") != null)
        document.getElementById("1").style.display = "none";
    if (document.getElementById("2") != null)
        document.getElementById("2").style.display = "none";
    if (document.getElementById("3") != null)
        document.getElementById("3").style.display = "none";
    if (document.getElementById("4") != null)
        document.getElementById("4").style.display = "none";
    if (document.getElementById("5") != null)
        document.getElementById("5").style.display = "none";
    
    if (displayDiv == "block")
    {
        document.getElementById(div).style.display = "none";
    }else{
        document.getElementById(div).style.display = "block";
    }
}

function HideShow(hide,show)
{
    document.getElementById(hide).style.display = "none";
    document.getElementById(show).style.display = "block";
}

function GetMap(containerID,latitude,longitude,zoom,titel,html)
{
      if (GBrowserIsCompatible()) {

      var point = new GLatLng(latitude, longitude);
	  var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(point, zoom);
      map.setMapType(G_HYBRID_MAP);

      // Set up markers with info windows 

        var marker = new GMarker(point);

        // The info window version with the "to here" form open
        to_htmls[i] = html + '<br><br>Routebeschrijving: <b>Hier naartoe</b> - <a href="javascript:fromhere(' + i + ')">Hier vandaan</a>' +
           '<br>Vertrekpunt:<form action="http://maps.google.com/maps" method="get" target="_blank">' +
           '<input type="text" SIZE=40 MAXLENGTH=48 name="saddr" id="saddr" value="" /><br>' +
           '<INPUT value="Uitvoeren" TYPE="SUBMIT">' +
           '<input type="hidden" name="daddr" value="' + point.lat() + ',' + point.lng() +
                   "(" + titel  + ")" +
           '"/>';
        // The info window version with the "to here" form open
        from_htmls[i] = html + '<br><br>Directions: <a href="javascript:tohere(' + i + ')">Hier naartoe</a> - <b>Hier vandaan</b>' +
           '<br>Bestemming:<form action="http://maps.google.com/maps" method="get"" target="_blank">' +
           '<input type="text" SIZE=40 MAXLENGTH=48 name="daddr" id="daddr" value="" /><br>' +
           '<INPUT value="Uitvoeren" TYPE="SUBMIT">' +
           '<input type="hidden" name="saddr" value="' + point.lat() + ',' + point.lng() +
                  "(" + titel + ")" +
           '"/>';
        // The inactive version of the direction info
        html = html + '<br><br><a href="javascript:tohere('+i+')">Routebeschrijving</a>';

        GEvent.addListener(marker, "click", function() {
          map.openInfoWindowHtml(point, html);
        });
        gmarkers[i] = marker;
        htmls[i] = html;
        //i++;
      
      //var marker = createMarker(position,titel,info)
      map.addOverlay(marker);
      map.openInfoWindow(point, html);
      }
}

// functions that open the directions forms
function tohere(i) {
    gmarkers[i].openInfoWindowHtml(to_htmls[i]);
}

function fromhere(i) {
    gmarkers[i].openInfoWindowHtml(from_htmls[i]);
}

