function brpRouteWidget(opts, container){
	
	// properties
	var me=this;
	var UsingRouteDB = true;
	try {
		if (frpgetRouteListUrl == null) {
			UsingRouteDB = false;
		}
	}
	catch(e) {
		UsingRouteDB = false;
	}
	me.opts = cpyObj(opts, {buttonBasePath: brpBaseUrl + 'images/buttons',printPageUrl:'print1.html', iconPath: brpIconPath + 'lists/'});

    // temp override iconpath
    me.opts.iconPath = 'images/icons/lists/';    
    
	me.container = $(container);
	me.locations = [];
	me.route = null;
	me.roundTrip = false;
	me.barIndex = 0;

	// event methods
	me.onLocationsChanged = null;
	me.onLocationClicked = null;
	me.onRouteChanged = null;
	me.onPlanRoute = null;
        
	// create tabs
	//TWISTED CHANGE
	$('ul.locationlist,ol.locationlist').sortable({
		update: function(event, ui) {
			
			var item = ui.item[0];
			var from = ui.item.attr('idx');
			var to = 0;
			
			while(item){
				if(item.nodeName=='LI') to+= 1;
				item= item.previousSibling;
			}
			to--;
			var el = me.locations.splice(from, 1)[0];
			me.locations.splice(to, 0, el);
			
			me.renderLocList();	
			me.computeRoute();
			event.stopPropagation();
		},
		axis: 'y',
		handle: '.handle'
	});
	
	// attach handlers
	$('.locations-clear',	container).click(function(){me.clearLocations();});
	
	$('input:checkbox.roundtrip', container).change(function(event){me.checkRoundtrip();});
	
	$('.print', container).click(function(event){me.printRoute();});
	$('.routeto', container).click(function(event){me.transport('to');});
	$('.routefrom', container).click(function(event){me.transport('from');});
	$('#step1_head a', container).click(function(event){me.SetBar(1);});
	$('#step1_head a', container).click(function(event){me.HideWebshopProduct();});
  $('#step2_head a', container).click(function(event){me.SetBar(2);});
  $('#step2_head a', container).click(function(event){me.HideWebshopProduct();});
  $('#step3_head a', container).click(function(event){me.SetBar(3);});
  $('#step3_head a', container).click(function(event){me.HideWebshopProduct();});
  $('#step4_head a', container).click(function(event){me.SetBar(4);});
  $('#step4_head a', container).click(function(event){me.ShowWebshopProduct(me);});
  $('#next1', container).click(function(event){me.SetBar(2);});
  $('#next2', container).click(function(event){me.SetBar(3);});
  $('#next3', container).click(function(event){me.SetBar(4);});
  $('#next3', container).click(function(event){me.ShowWebshopProduct(me);});
  $('#prev2',	container).click(function(event){me.SetBar(1);});
  $('#prev3',	container).click(function(event){me.SetBar(2);});
  $('#prev4',	container).click(function(event){me.SetBar(3);});
  $('#prev4',	container).click(function(event){me.HideWebshopProduct();});
  $('#poi1_head a',	container).click(function(event){me.SetPoi(1);});
  $('#poi2_head a',	container).click(function(event){me.SetPoi(2);});
  $('#poi3_head a',	container).click(function(event){me.SetPoi(3);});
  $('.step1_list',	container).click(function(event){me.SetBar(5);});
  $('#step1_list',	container).click(function(event){me.SetBar(5);});
  $('#step1_manual',	container).click(function(event){me.NewRoute();});
  $('#step5_manual',	container).click(function(event){me.SetBar(1);});
  $('#step5_manual',	container).click(function(event){me.NewRoute();});
  $('#route1_head a',	container).click(function(event){me.SetRouteBar(1);});
  $('#route2_head a',	container).click(function(event){me.SetRouteBar(2);});

  if (UsingRouteDB)
  { 			
  	$('#routename-email',	container).click(function(event){me.setRoute();});
	$('#routename-save',	container).click(function(event){me.setSaveRoute();});
  	$('#mailWindow .close').click(function(event){$('#mailWindow').hide();});
  	$('#mailSended .close').click(function(event){$('#mailSended').hide();});
  	$('#mailWindow #sendcancel').click(function(event){$('#mailWindow').hide();});
  	$('#mailWindow #sendtoemail').click(function(event){me.mailRoute();});
  
  	$('#saveWindow .close').click(function(event){$('#saveWindow').hide();});
  	$('#routeSaved .close').click(function(event){$('#routeSaved').hide();});
  	$('#saveWindow #savecancel').click(function(event){$('#saveWindow').hide();});
  	$('#saveWindow #saveroute').click(function(event){me.saveRoute();});
  }
  
  
  
	// get state
	this.checkRoundtrip();
	this.SetBar(1);
	this.SetPoi(1);
	this.SetRouteBar(1);
	// Get Route
	if (UsingRouteDB){ 
		this.getRouteList();
		this.getRoute(getHttpParam('RouteID'));
	}

	//E.B. Falkplan:  Aanpassing voor Form submit
	$(container).append('<form method=post action="" id="FrmSend" name="FrmSend" target="mailresponse" style="display:none; width:0px; height:0px;"><input type=hidden id="RouteInfo" name="RouteInfo" value=""/></form>');
    	$(container).append('<iframe id="mailresponse" name="mailresponse" src="about:blank" style="display:none; width:0px; height:0pxl"></iframe>'); 
    	// 
};

brpRouteWidget.prototype.checkRoundtrip = function(){
 	this.roundtrip = $('.roundtrip', this.container).is(':checked');
	this.computeRoute();
}

brpRouteWidget.prototype.transport = function(fromto){
	if (fromto=='to'){
		var loc = this.locations[0];
		var url = 'http://routeplanner.falk.nl/rp/?action=0&lat2=' + loc.lat + '&lon2=' + loc.lon + '&name2=' + loc.name;
	}
	else {
		var loc = this.locations[this.locations.length-1];
		var url = 'http://routeplanner.falk.nl/rp/?action=0&lat1=' + loc.lat + '&lon1=' + loc.lon + '&name1=' + loc.name;
	}
	window.open(url);
}

brpRouteWidget.prototype.addLocation = function(loc){
	if ((this.locations.length==0)||(this.locations[this.locations.length-1]!=loc)){
		this.locations.push(loc);
		this.renderLocList();
		this.computeRoute();
	}
}

brpRouteWidget.prototype.createLocRowClickHandler = function(idx){
	var me = this;
	return function(event){me.locRowClicked(event, idx);}; 
};

brpRouteWidget.prototype.createRouteRowClickHandler = function(idx){
	var me = this;
	return function(event){me.RouteRowClicked(event, idx);}; 
};

brpRouteWidget.prototype.RouteRowClicked = function(event, idx){
    this.getRoute(idx);
	event.stopPropagation();    
};

brpRouteWidget.prototype.locRowClicked = function(event, idx){
	var row = $('.locationlist li:eq(' + idx +  ')', this.container);
	if ( $(event.target).hasClass('locicon')
       || $(event.target).hasClass('locname')) {
		this.locationClicked(idx);
	}
	else {
		if ( $(event.target).hasClass('locdelete') ){
			this.locations.splice(idx, 1);
		}
		else if ( $(event.target).hasClass('locmovedown') ){
			var el = this.locations.splice(idx, 1)[0];
			this.locations.splice(idx + 1, 0, el);
		}
		else if ( $(event.target).hasClass('locmoveup') ){
			var el = this.locations.splice(idx, 1)[0];
			this.locations.splice(idx - 1, 0, el);
		}
		this.renderLocList();	
		this.computeRoute();	
	}
	event.stopPropagation();
};

brpRouteWidget.prototype.getRoute = function(RouteID) {
    if (RouteID) { 
        this.clearLocations();
        var me = this;
        $.getJSON(frpgetRouteUrl + '&callback=?', {'RouteID': RouteID}, function(data, textStatus) { me.afterGetRoute(data, textStatus) });
    }
};

brpRouteWidget.prototype.setRoute = function(){
	var len = this.locations.length;
    if (len >= 2 || (len == 1 && this.roundtrip)) {
    
        $('#mailname').val($('#routename').val())
        $('#mailWindow').show();
    }
};

brpRouteWidget.prototype.setSaveRoute = function(){
	var len = this.locations.length;
    if (len >= 2 || (len == 1 && this.roundtrip)) {
    
        $('#routename').val($('#routename').val())
        $('#saveWindow').show();
    }
};

brpRouteWidget.prototype.saveRoute = function(){
    function routeInfo(n,r,l) {
        var me =this;
        me.RoundTrip = r;
        me.RouteName = n;
        me.Locations = l;
    }

    if ($('#routenamesave').val() == 'Geef uw fietsroute een eigen naam')
    {
        alert('Geef eerst uw fietsroute een eigen naam.');
        return;
    }

    $('#saveWindow').hide();
    var sendername = $('#sendernamesave').val();
    var additional = $('#additionalsave').val();
    var toname = '';
    var data = new routeInfo($('#routenamesave').val(), this.roundtrip, this.locations);
    var me = this;
    
    //E.B. Falkplan Toevoeging via Form submit
    var newUrl =  frpsetRouteUrl +
                      '&additional="'+additional+
                      '"&toname="'+toname+
                      '"&sendername="'+sendername;
    $("#FrmSend").attr("action",newUrl);                      
    $("#RouteInfo").val($.toJSON(data));
    $("#FrmSend").submit();
    this.afterSetRoute();
    //Einde toevoeging
    
    me.ShowWebshopProductLink(me);
	
    $('#routeSaved').show();
};

brpRouteWidget.prototype.mailRoute = function(){
    function routeInfo(n,r,l) {
        var me =this;
        me.RoundTrip = r;
        me.RouteName = n;
        me.Locations = l;
    }

    if ($('#mailname').val() == 'Geef uw fietsroute een eigen naam')
    {
        alert('Geef eerst uw fietsroute een eigen naam.');
        return;
    }
    if ($('#senderemail').val() == 'vul hier het email adres in.')
    {
        alert('vul hier het email adres in.');
        return;
    }
    if ($('#toname').val() == 'vul hier de naam in.')
    {
        alert('vul de naam van de geadresseerde in.');
        return;
    }
    $('#mailWindow').hide();
    var email = $('#senderemail').val();
    var sendername = $('#sendername').val();
    var additional = $('#additional').val();
    var toname = $('#toname').val();
    var data = new routeInfo($('#mailname').val(), this.roundtrip, this.locations);
    var me = this;
    //E.B. Falkplan Toevoeging via Form submit
    var newUrl =  frpsetRouteUrl +
                      '&additional="'+additional+
                      '"&toname="'+toname+
                      '"&sendername="'+sendername+
                      '"&email='+ email;
                      
    $("#FrmSend").attr("action",newUrl);                      
    $("#RouteInfo").val($.toJSON(data));
    $("#FrmSend").submit();
    this.afterSetRoute();
    //Einde toevoeging
    
   	me.ShowWebshopProductLink(me);
	
    $('#sendedto').html($('#sendername').val());
    $('#sendedemail').html($('#senderemail').val());
    $('#mailSended').show();
};

brpRouteWidget.prototype.getRouteList = function() {
    var me = this;
    $.getJSON(frpgetRouteListUrl + '&callback=?', {}, function(data, textStatus) { me.afterGetRouteList(data, textStatus) });
};

brpRouteWidget.prototype.afterGetRouteList = function(data, textStatus) {

  	function textLink(text){
		return '<a href="javascript:void(0);">' + text + '</a>'
	}

    
    $('.routelist', this.container).empty();
    var me = this;
    for(var I=0; I < data.length;I++) {
        var n = data[I].RouteID;
        var row = $('<li class="userrouterow"></li>').click(me.createRouteRowClickHandler(n));
        row.attr('idx',n);
        row.append(textLink(data[I].RouteName));
        if(data[I].Static) {
            $('#systemroutes').append(row);
        }
        else {
            $('#userroutes').append(row);
        }
    }
    $('.userrouterow').click(function(event){$('#step1_manual').show();});
};

brpRouteWidget.prototype.afterGetRoute = function(data, textStatus) {
    
    this.roundtrip = data.RoundTrip;
    $('.roundtrip', this.container).attr('checked', this.roundtrip);
    $('#routename').val(data.RouteName);
    $('#routenametitle').html(data.RouteName);
    $('#routenametitle2').html(data.RouteName);
    
    if (getHttpParam('RouteID') != data.RouteID  || ('' == getHttpParam('toname') || '' == getHttpParam('sendername')))
    {
    	$('.welcomefrommail').hide();
    }
    else
    {
    	$('#emailtoname').html(getHttpParam('toname'));
	    $('#emailfromname').html(getHttpParam('sendername'));
	    $('#routewrapper').addClass('routewrapper_small');
	    $('.welcomefrommail').show();
    }
    this.locations = data['Locations'];
   	this.renderLocList();
	this.computeRoute();
	if (this.onShowCategorie)
	    this.onShowCategorie();
    if (this.onLocationClicked) this.onLocationClicked(this.locations[0])	    
};
brpRouteWidget.prototype.afterSetRoute = function(data, textStatus) {
    this.getRouteList();
};

brpRouteWidget.prototype.computeRoute = function() {
	var len = this.locations.length;
    if (len >= 2 || (len == 1 && this.roundtrip)) {
		if (this.onPlanRoute) this.onPlanRoute();
        var me = this, prms = this.serializeLocationsUrl({});
        $.getJSON(brpPlanRouteUrl + '&format=json&callback=?', prms, function(data, textStatus) { me.routeLoaded(data, textStatus) });
    } else if (this.route) {
		this.route = null;
		this.routeChanged();
    }
}

brpRouteWidget.prototype.routeLoaded = function(data, textStatus){
	if (data != this.route){
		this.route = data;
		this.routeChanged();
	}
}

brpRouteWidget.prototype.clearLocations = function(){
	this.locations.length = 0;
    if ($('.roundtrip', this.container))
	    $('.roundtrip', this.container).attr('checked', false);
	this.roundTrip = false;
	this.renderLocList();
	this.computeRoute();
}

brpRouteWidget.iconStrDef = '<img id="%0" src="%1" alt="%2" width="27" height="27" />';
brpRouteWidget.iconStrUsr = '<img id="%0" src="%1" alt="%2" width="27" height="27" />';

brpRouteWidget.prototype.crtListIconTag = function(idx, loc){
	var path = this.opts.iconPath;
	var sIconNr = (loc.iconnr ? loc.iconnr.toLength(2) : '00');
	if (loc.category == BRP_CAT_JUNCTIONS) {
		return brpRouteWidget.iconStrDef.format('icon' + loc.id, brpBaseUrl+'images/icons/map/junction%0.png'.format(sIconNr), loc.name);
  }
	if (loc.category == BRP_CAT_ADDRESS) {
		return brpRouteWidget.iconStrDef.format('icon' + loc.id, '%0address%1.png'.format(path, sIconNr ), loc.name);
	}
	if (loc.category){
		var icn = (brpCategories[loc.category] || {})['listIcon'];
		if (icn) {
      return brpRouteWidget.iconStrUsr.format('icon' + idx, icn['url'], loc['name']);
    }
	}
	if (loc.advicecode) {
		if (loc.advicecode == 'ToBicycleJunction')
			return brpRouteWidget.iconStrDef.format('icon' + idx, '%0junction%1.png'.format(path, sIconNr ), loc.advice);
		if (loc.advicecode == 'UserLocation')
			return brpRouteWidget.iconStrDef.format('icon' + idx, '%0&type=icon&id=%1.png'.format(brpUserIconPath, sIconNr ), loc.advice);
		return brpRouteWidget.iconStrDef.format('icon' + idx, '%0%1.png'.format(path, loc.advicecode.toLowerCase()), loc.advice)
	}
	return ''
}

brpRouteWidget.prototype.renderLocList = function(){

	function textLink(sClass, text){
		return '<a class="'+sClass+'" href="javascript:void(0);">' + text + '</a>'
	}

	function imageLink(sClass, src, alt){
		return '<a class="%0" href="javascript:void(0);">'.format(sClass)
      + '<img class="%0" src="%1" alt="%2" width="24" height="24" />'.format(sClass, src, alt)
      + '</a>';
	}
	
	var me = this;
	$('.locationlist', this.container).empty();
	for (var n=0; n<this.locations.length; n++){
		var row = $('<li></li>').click(me.createLocRowClickHandler(n)), loc = this.locations[n];
		row.attr('idx',n);

    var oLeftDiv = $('<div class="pointleft"></div');
    $(this.crtListIconTag(n, loc))
       .addClass('locicon mappoint')
       .appendTo($('<a href="javascript:void(0);"></a>'))
       .appendTo($('<span class="icon"></span>'))
       .appendTo(oLeftDiv);       
    oLeftDiv.append(textLink('locname', loc['name']));
    row.append(oLeftDiv);

    var oRightDiv = $('<div class="pointright"></div');
		oRightDiv.append('<span class="button">' + imageLink('locmovedown', $('body').data('sUiImageDirUrl')+'/mappoint-down.png',   'Omlaag')    + '</span>');
		oRightDiv.append('<span class="button">' + imageLink('locmoveup',   $('body').data('sUiImageDirUrl')+'/mappoint-up.png',     'Omhoog')    + '</span>');
		oRightDiv.append('<span class="button">' + imageLink('locdelete',   $('body').data('sUiImageDirUrl')+'/mappoint-delete.png', 'Verwijder') + '</span>');
    row.append(oRightDiv);

    row.append('<div class="clearfix">&nbsp;</div>');

    $('ul.locationlist', this.container).append(row);

		if (n==0)
		  $('#routestartpoint').html(loc['name']);

		if (n==this.locations.length-1)
		  $('#routedestination').html(loc['name']);
		    
	} 
	if (this.onLocationsChanged) this.onLocationsChanged(this.locations)
}

// callbacks
brpRouteWidget.prototype.locationClicked = function(idx){
	if (this.onLocationClicked) this.onLocationClicked(this.locations[idx])
}

brpRouteWidget.prototype.routeChanged = function(){
	this.renderItinerary();
}

brpRouteWidget.prototype.renderItinerary = function(){
	var me = this, linenr = 1;
	$('.itinerarylist', this.container).empty();
	
	if (this.route){
		$(this.route.sections).each(function(){
		
			var row = $('<li></li>');
			row.append('<div class="distance">' + this.start.distance + ' km</div>');
			row.append('<div class="icon">' + me.crtListIconTag(linenr, this.start) + '</div>');
			row.append('<div class="text">' + this.start.advice + '</div>');
			
			
			$('ul.itinerarylist', this.container).append(row);	
			linenr++;
		
			$(this.description).each(function(){
				var row = $('<li></li>');
				row.append('<div class="distance">' + this.distance + ' km</div>');
				row.append('<div class="icon">' + me.crtListIconTag(linenr, this) + '</div>');
				row.append('<div class="text">' + this.advice + '</div>');
				$('ul.itinerarylist', this.container).append(row);	
				linenr++;
			});
		});
		
		var row = $('<li></li>'), lst = this.route.sections[this.route.sections.length - 1];
		row.append('<div class="distance">' + lst.destination.distance + ' km</div>');
		row.append('<div class="icon">' + me.crtListIconTag(linenr, lst.destination) + '</div>');
		row.append('<div class="text">' + lst.destination.advice + '</div>');
		$('ul.itinerarylist', this.container).append(row);
					
	}
	if (this.onRouteChanged) this.onRouteChanged(this.route);
}

brpRouteWidget.serializeAddLoc = function(p, loc){
	if (loc.category == BRP_CAT_ADDRESS){
		p.push('p');
		p.push(loc.x);
		p.push(',');
		p.push(loc.y)
	} else {
		if (loc.category == BRP_CAT_JUNCTIONS)
			p.push('j');
		else
			p.push('u');
		p.push(loc.id)
	}
}
brpRouteWidget.prototype.serializeLocationsUrl = function(a){
	var p = [], len = this.locations.length;
	for (var i = 0; i < len; i++) brpRouteWidget.serializeAddLoc(p, this.locations[i]);
	if (this.locations[len-1] != this.locations[0] && $('input:checkbox.roundtrip', this.container).is(':checked'))
		brpRouteWidget.serializeAddLoc(p, this.locations[0])
	a.p = p.join('');
	return a
}

brpRouteWidget.prototype.serializeRoute = function(){
	var line = 0;
	var s = '';
	if (this.route){
		$(this.route.sections).each(function(){
			$(this.description).each(function(){
				if (line>0) s += '|';
				s += this.distance + '|';
				s += this.advice + '|';
				s += this.advicecode + '|';
				s += this.x + '|';
				s += this.y + '|';
				s += this.icon;
				line++;
			});
		});
	}
	return s;
}

brpRouteWidget.prototype.printRoute = function() {
	window.open(this.opts.printPageUrl);
}

//SideBar Functions
brpRouteWidget.prototype.SetBar = function(n) {  
    function MakeHidden(p) {
         $('#step'+p+'_head').removeClass('active');
         $('#step'+p+'_content').hide();
         if (p != 4)
         {
         	$("#productContainer").hide();
         }
    }
    if (n != 1) MakeHidden(1);
    if (n != 2) MakeHidden(2);
    if (n != 3) MakeHidden(3);
    if (n != 4) MakeHidden(4);
    if (n != 5) MakeHidden(5);
    
    $('#step'+n+'_head').addClass('active');
    $('#step'+n+'_content').show();
}

brpRouteWidget.prototype.SetPoi = function(n) {
    function MakeHidden1(p) {
         $('#poi'+p+'_head').removeClass('active');
         $('#poi'+p+'_content').hide();
    }
    if (n != 1) MakeHidden1(1);
    if (n != 2) MakeHidden1(2);
    if (n != 3) MakeHidden1(3);
    $('#poi'+n+'_head').addClass('active');
    $('#poi'+n+'_content').show();
}

brpRouteWidget.prototype.SetRouteBar = function(n) {
    function MakeHidden1(p) {
         $('#route'+p+'_head').removeClass('active');
         $('#route'+p+'_content').hide();
    }
    if (n != 1) MakeHidden1(1);
    if (n != 2) MakeHidden1(2);
    $('#route'+n+'_head').addClass('active');
    $('#route'+n+'_content').show();
}

brpRouteWidget.prototype.NewRoute = function() {
	this.clearLocations();
	$('#step1_manual').hide();
	
	$('#routenametitle').html('Uw eigen fietsroute');
  $('#routenametitle2').html('Uw geselecteerde fietsroute');
  
  $('#routename').val('Geef hier uw fietsroute een eigen naam');
  $('#routestartpoint').html('Klik in de kaart om een route te maken');
  $('.routedisttime').html('');
  $('#routedestination').html('');
  
	if ('' != getHttpParam('toname') ||  '' != getHttpParam('sendername'))
  {
  	$('#splash').show();
  }
}


//Webshop Functions

brpRouteWidget.prototype.CenterPointRoute = function(me)
{
	var iTopX 		= 0;
	var iTopY 		= 0;
	var iBottomX 	= 0;
	var iBottomY 	= 0;
	var iCentralX = 0;
	var iCentralY	= 0; 
	if ('undefined' != typeof(me.locations[0]) )
	{
		iTopX 		= me.locations[0].x;
		iTopY 		= me.locations[0].y;
		iBottomX 	= me.locations[0].x;
		iBottomY 	= me.locations[0].y;
		iCentralX = me.locations[0].x;
		iCentralY	= me.locations[0].y; 
	}
	
	//calculate topleft and bottomright coordinates from route locations
	for (var n=0; n<me.locations.length; n++)
	{
		var loc = me.locations[n];
		
	  iTopX = Math.min(iTopX, loc.x);
	  iTopY = Math.min(iTopY, loc.y);
	  
	  iBottomX = Math.max(iBottomX, loc.x);
	  iBottomY = Math.max(iBottomY, loc.y);
	}
	
	var iCentralX = ((iBottomX - iTopX) / 2) + iTopX;
	var iCentralY = ((iBottomY - iTopY) / 2) + iTopY;
	
	var aResult = [];
	aResult['centerX'] = iCentralX;
	aResult['centerY'] = iCentralY;
	
	return aResult;
}

brpRouteWidget.prototype.ShowWebshopProduct = function(me, pagetype)
{
	var aCenterPoints = [];
	aCenterPoints = me.CenterPointRoute(me);
	
	var iCentralX = aCenterPoints['centerX'];
	var iCentralY = aCenterPoints['centerY'];
	
	var url = "http://"+window.location.host+"/proxy.php?url=http%3A%2F%2Fwww.falk.nl%2Frouteplannerproduct.php%3Froutecx%3D"+iCentralX+"%26routecy%3D"+iCentralY;

	$.get(url, {routecx:iCentralX, routecy:iCentralY}, function(data)
	{	
		$("#routeplanner_overlay").html(data);
		if ("" != data)
		{
			$("#productcontainer").show();
			$("#routeplanner_overlay").show();
		}		
		$('#closeProductBlock').click(function(event){me.HideWebshopProduct();});
	});
}
brpRouteWidget.prototype.HideWebshopProduct = function()
{
	$("#routeplanner_overlay").hide();
	$("#productcontainer").hide();
}

brpRouteWidget.prototype.ShowWebshopProductLink = function(me)
{
	var aCenterPoints = [];
	aCenterPoints = me.CenterPointRoute(me);
	
	var iCentralX = aCenterPoints['centerX'];
	var iCentralY = aCenterPoints['centerY'];
	
	var url = "http://"+window.location.host+"/proxy.php?url=http%3A%2F%2Fwww.falk.nl%2Frouteplannerproduct.php%3Froutecx%3D"+iCentralX+"%26routecy%3D"+iCentralY+"%26type%3Dlink";
	
	$.get(url, {routecx:iCentralX, routecy:iCentralY, type:"link"}, function(data)
	{	
		$(".sendtomyfriendproductlink").html(data);
	});
}