	var PREVIEW_BOXES = 4;
           
	var request = new JsonRequest()
	var binder = new DataBinder();
	var markers = new Object();
	var map = null;

	var geocoder;
	var iconCube;
	
	var loadQuestsHandle;
	var cachecenter = null;
	var cacherange = null;
	var cachezoom = null;
	var cachebounds = null;
	
	
	function FancyMapButtons() {
    }
    FancyMapButtons.prototype = new GControl();

    // Creates a one DIV for each of the buttons and places them in a container
    // DIV which is returned as our control element. We add the control to
    // to the map container and return the element for the map class to
    // position properly.
    FancyMapButtons.prototype.initialize = function(map) {
      var container = document.createElement("div");

      var mapButtonDiv = document.createElement("div");
      this.setButtonStyle_(mapButtonDiv);
      mapButtonDiv.setAttribute('id','mapButton');
      container.appendChild(mapButtonDiv);
      mapButtonDiv.appendChild(document.createTextNode("Map"));
      GEvent.addDomListener(mapButtonDiv, "click", function() {
        map.setMapType(G_NORMAL_MAP);
     	var allButtons = mapButtonDiv.parentNode.childNodes;
     	for (var i = 0, len = allButtons.length; i < len; i++)
	     	allButtons[i].className = "mapbutton";
	    mapButtonDiv.className = "mapbutton_on";
      });
      
      

      var satteliteButtonDiv = document.createElement("div");
      this.setButtonStyle_(satteliteButtonDiv);
      satteliteButtonDiv.setAttribute('id','satelliteButton');
      container.appendChild(satteliteButtonDiv);
      satteliteButtonDiv.appendChild(document.createTextNode("Satellite"));
      GEvent.addDomListener(satteliteButtonDiv, "click", function() {
        map.setMapType(G_SATELLITE_MAP);
     	var allButtons = satteliteButtonDiv.parentNode.childNodes;
     	for (var i = 0, len = allButtons.length; i < len; i++)
	     	allButtons[i].className = "mapbutton";
	    satteliteButtonDiv.className = "mapbutton_on";
      });

      var hybridButtonDiv = document.createElement("div");
      this.setButtonStyle_(hybridButtonDiv);
      hybridButtonDiv.setAttribute('id','hybridButton');
      container.appendChild(hybridButtonDiv);
      hybridButtonDiv.appendChild(document.createTextNode("Hybrid"));
      GEvent.addDomListener(hybridButtonDiv, "click", function() {
        map.setMapType(G_HYBRID_MAP);
     	var allButtons = hybridButtonDiv.parentNode.childNodes;
     	for (var i = 0, len = allButtons.length; i < len; i++)
	     	allButtons[i].className = "mapbutton";
	    hybridButtonDiv.className = "mapbutton_on";
      });

      var TerrainButtonDiv = document.createElement("div");
      this.setButtonStyle_(TerrainButtonDiv);
      TerrainButtonDiv.setAttribute('id','terrainButton');
      container.appendChild(TerrainButtonDiv);
      TerrainButtonDiv.appendChild(document.createTextNode("Terrain"));
      GEvent.addDomListener(TerrainButtonDiv, "click", function() {
        map.setMapType(G_PHYSICAL_MAP);
     	var allButtons = TerrainButtonDiv.parentNode.childNodes;
     	for (var i = 0, len = allButtons.length; i < len; i++)
	     	allButtons[i].className = "mapbutton";
	    TerrainButtonDiv.className = "mapbutton_on";
      });

      map.getContainer().appendChild(container);
      return container;
    }

    FancyMapButtons.prototype.getDefaultPosition = function() {
      return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
    }


    // Sets the proper CSS for the given button element.
    FancyMapButtons.prototype.setButtonStyle_ = function(button) {
      button.className = "mapbutton";
    }
    FancyMapButtons.prototype.setButtonStyleOn_ = function(button) {
      button.className = "mapbutton_on";
    }





	
    function load() {

      binder['rating'] = new IconListRenderer('${base}/image/rating_on.png',
      										  '${base}/image/rating_off.png',5);

      binder['difficulty'] = new IconListRenderer('${base}/image/difficulty_on.png',
      										      '${base}/image/difficulty_off.png',5);

      binder['geocache'] = new RadioButtonRenderer('${base}/image/radio_on.png',
      										  	   '${base}/image/radio_off.png');

      binder['imageId'] = new ImageSrcRenderer('${base}/media/203.png?maxWidth=186&maxHeight=117&pad=eeeeee');
      
      binder['language'] = new ImageSrcRenderer('${base}/image','','?');
      
      binder['prettyQuestId'] = new QuestDetailLinkRenderer('${base}/');
      
      binder['authorName'] = new LinkRenderer('${base}/user/','/profile');
      
      
      if (GBrowserIsCompatible()) {
      
      	// load icons
      	//loadIcons();
            		
        // create map
        map = new GMap2(document.getElementById("map"));
		map.addMapType(G_PHYSICAL_MAP);
		map.setCenter(new GLatLng(userLat,userLon), userZoom);
		map.setMapType(G_SATELLITE_MAP);
		
		var mapControl = new GHierarchicalMapTypeControl();
		mapControl.clearRelationships();
		
		mapControl.addRelationship(G_SATELLITE_MAP, G_HYBRID_MAP, "Labels", false);
		// map.addControl(mapControl);		
    	map.addControl(new GSmallMapControl());
    	
    	// map.addControl(new MapTypeControl());
    	 map.addControl(new FancyMapButtons());
    	
		map.enableScrollWheelZoom(false);
		// register event handlers
		loadQuestsHandle = GEvent.addListener(map,'moveend',loadQuests);
		
	 	//GEvent.addListener(map, "click", globalMapClickHandler);

      	geocoder = new GClientGeocoder();
		
 		// restrict zoom levels
 		var mapTypes = G_DEFAULT_MAP_TYPES;
		for(var i = 0; i < mapTypes.length; i++){
			mapTypes[i].getMinimumResolution = function(latlng){ return 2;};
		}
    	
    	// load quests
		loadQuests();
	  	return map;
	  } else {
	    return null;
	  }

	}

	function findAddress(inputFormId) {
		var inputForm = document.getElementById(inputFormId);
		geocoder.getLatLng(
			inputForm.value, 
			function(pos) {
				if(pos) {
					map.setCenter(pos, 13);
					loadQuests();
				}
			}
		);
	}

	function catchEnterKey(e,callBack){ //e is event object passed from function invocation
		var characterCode // literal character code will be stored in this variable
		if(e && e.which){ //if which property of event object is supported (NN4)
			e = e
			characterCode = e.which //character code is contained in NN4's which property
		} else {
			e = event
			characterCode = e.keyCode //character code is contained in IE's keyCode property
		}
		if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
			callBack();
			return false;
		} else {
			return true;
		}
	}

	function findQuestByID(list, qid)
	{
		for (var midx in list)
		{
			var m  = list[midx];
			if (m.id == qid)
				return m;
		}	
	}

	function SubGPoints(a,b)
	{
		return new GPoint(a.x-b.x,a.y-b.y);
	}

	function isIncluded(qid)
	{
		for (var midx in markers)
		{
			var m = markers[midx];
			if (m.questlist != null)
			{
				for (var qidx in m.questlist)
				{
					var q = m.questlist[qidx];
					if (q == qid)
						return true;
				}
			}
		}
		return false;
	}

	function updateQuestBoxes(list)
	{
	 	// update quest boxes
	 	for(var i=0;i<PREVIEW_BOXES;i++) 
	 	{
	 		var e = document.getElementById('qbox' + i);
	 		if(list.length > i) 
	 		{
	 			binder.bindData(e,list[i]);
	 			e.style.visibility = 'visible';
	 			e.style.display = 'inline';
	 		} 
	 		else 
	 		{
	 			e.style.visibility = 'hidden';
	 			e.style.display = 'none';
	 		}
	 	}
	}

	function shrinkText(str, len)
	{
		var output = "";
		if (str.length <= len)
			output = str;
		else 
			output =  str.substring(0,len-3) + "...";
		return output;
	}

	var createdCounter;
    var deletedCounter;
	var processedFlag = 0;

	// generate quest markers from list
	 function updateQuests(resp,theme,zIndex, processedFlag) 
	 {
	 	if(map.getZoom() != resp.zoomlevel)
	 		return;
	 	var list = resp.data;
	 	//console.log(theme);
	 	//console.log("updateQuest called");
	 	var counter = 0;


	 	//console.log("all markers marked:"+counter);
	 	createdCounter = 0;
	 	deletedCounter = 0;
	 	for (var i = 0; i < list.length;i++)
	 	{
	 		//console.log("processing marker "+i);
	 		var entry = list[i];
	 		if (entry.type == "Quest")
	 			createQuestMarker(entry,theme,processedFlag,zIndex);
	 		else if (entry.type == "QuestCluster")
	 			createQuestClusterMarker(entry,theme,processedFlag,zIndex);
	 	}
	 	//console.log("done all markers. created:"+createdCounter+ " deleted:"+deletedCounter);
	 	cleanupQuests();
	 	//mapChanged();
	 }
	 
	 var cleancounter = 0;
	 function cleanupQuests()
	 {
	 	cleancounter++;
	 	if (cleancounter < 2)
	 		return;
	 	cleancounter = 0;
	 	
	 	counter = 0;
	 	counterall = 0;
	 	nullcounter = 0;
	 	for (var midx in markers)
	 	{
	 		counterall++;
	 		if (markers[midx] == null)
	 			nullcounter++;
	 		if (markers[midx] != null && markers[midx].processed != processedFlag)
	 		{
	 			counter++;
		 		map.removeOverlay(markers[midx]);
		 		markers[midx] = null;
	 		}
	 	}
	 	//console.log("removed not needed: "+counter);
	 	mapChanged();
	 }
	 
	 function createQuestMarker(entry, theme, processedF,zIndex)
	 {
	 	//console.log("creating quest");
		var marker = markers[entry.id];
		//if(marker != null)
		//	console.log("found quest: "+entry.name);
		var pos = new GLatLng(entry.latitude,entry.longitude);
		var iconnr = (entry.id % 9)+1;
		var usedIcon;
		if (theme == 'wappen')
			usedIcon = getIcon(theme+entry.region,'home',iconnr);
		else
			usedIcon = getIcon(theme,'home',iconnr);
		//if (marker != null)
		//	console.log("type:"+marker.questtype+" == "+entry.type);
		if (marker != null && marker.questtype != entry.type)
		{
			map.removeOverlay(marker);
			marker = null;
			deletedCounter++;
		}
		if (marker == null)
		{
			//console.log("creating marker for "+entry.name);
			marker = new GMarker(pos, {"icon":usedIcon, "zIndexProcess": function(lat) { return zIndex; }});
			markers[entry.id] = marker;
			//map.addOverlay(marker);
			createdCounter++;
		}
		marker.setLatLng(pos);
		marker.questid = entry.id;
		marker.questtype = entry.type;
		setMarkerCallback(entry.id);
        var infoBoxOptions = { 
			"content": "", 
			"title": "<b style='font-size:small'>"+entry.name+"</b>", 
			"imgurl": "${base}/media/"+entry.imageId+"?maxWidth=100&maxHeight=75&pad=e5e5e5", 
			"link": "${base}/mission/"+entry.id, 
			"text": shrinkText(entry.description,140), 
			"offsetHorizontal": 23, 
			"offsetVertical": 23 , 
			"imgWidth": 100, 
			"imgHeight": 75 
			}; 
		if (marker.infoBox == null)
		{
			marker.infoBox = new InfoBox(pos,infoBoxOptions);
		}
		else 
			marker.infoBox.setContent(infoBoxOptions);
		marker.processed = processedF;
	 }

	function createQuestClusterMarker(entry, theme,processedF,zIndex)
	{
	 	//console.log("creating questcluster "+entry.id);
		var marker = markers[entry.id];
		var pos = new GLatLng(entry.latitude,entry.longitude);
		var iconnr = (entry.id % 9)+1;
		var usedIcon;
		if (theme == 'wappen')
			usedIcon = getIcon(theme+entry.region,'agg',iconnr);
		else
			usedIcon = getIcon(theme,'agg',iconnr);
		//if (marker != null)
			//console.log("found marker");		
		if (marker != null && marker.questtype != entry.type)
		{
			map.removeOverlay(marker);
			marker = null;
			deletedCounter++;
		}
		if (marker == null)
		{
			//console.log("creating marker!");
			marker = new GMarker(pos, {"icon": usedIcon, "zIndexProcess": function(lat) { return zIndex; }});
			markers[entry.id] = marker;
			//map.addOverlay(marker);
			createdCounter++;
		}
		marker.setLatLng(pos);
		marker.questid = entry.id;
		marker.questtype = entry.type;
		var sw = new GLatLng(entry.southwest.latitude,entry.southwest.longitude);
		var ne = new GLatLng(entry.northeast.latitude,entry.northeast.longitude);
		var latlngs = [];
		//latlngs.push(pos);
		var first = null;
		for (var idx in entry.border)
		{	
			if (first == null)
				first = idx;
			var bp = entry.border[idx];
			latlngs.push(new GLatLng(bp.lat,bp.lng));
		}
		latlngs.push(new GLatLng(entry.border[first].lat,entry.border[first].lng));
		marker.polyline = new GPolygon(latlngs,'#FF7E00',2,1.0,'#FFB368',0.5);
		setMarkerCallback(entry.id);
		//console.log("before ");
		var innerQuests = entry.quests;
		var count = 0;
		var liststring = "${lab.quest_aggregation} <br/><b>";
		for(var idx in innerQuests)
		{
			count += 1;
			var quest = innerQuests[idx];
			//console.log(quest.name);
			liststring += "<a href='${base}/mission/"+quest.id+"'>"+quest.name+"</a><br/>";
		}
		if (entry.count > 4)
			liststring += "...";
		//console.log("done");

        var infoBoxOptions = { 
			"content": "", 
			"title": "<b style='font-size:small;'>"+entry.count + " Missions</b>", 
			"imgurl": "", 
			"link": "", 
			"text": liststring, 
			"offsetHorizontal": 23, 
			"offsetVertical": 23, 
			"imgWidth": 0, 
			"imgHeight": 0 
			}; 
		if (marker.infoBox == null)
			marker.infoBox = new InfoBox(pos,infoBoxOptions);
		else
		    marker.infoBox.setContent(infoBoxOptions);
		marker.infoBox.questbounds = new GLatLngBounds(sw,ne);
		marker.processed = processedF;
	 	//console.log("created  questcluster "+entry.id);
	 }

	 
	 function setMarkerCallback(qid)
	 {
	 	var marker = markers[qid];
	 	if (marker != null)
	 	{
			marker.eventhandle = GEvent.addListener(marker, "click", function() {clickHandler(qid);});
			if (marker.questtype == "QuestCluster")
			{
				GEvent.addListener(marker, "mouseover", function()
				{
					if (map.borderpoly)
						map.removeOverlay(map.borderpoly);
					map.borderpoly = marker.polyline
					map.addOverlay(map.borderpoly);
					});
				GEvent.addListener(marker, "mouseout", function()
				{
					map.removeOverlay(marker.polyline);
					if (map.borderpoly == marker.polyline)
						map.borderpoly = null;
					});
				
			}
	 	}
	 }
	 
	 function zoomIntoMarker()
	 {
	 	if (map.infoBox != null && map.infoBox.questbounds != null)
	 	{
	 		if (map.borderpoly != null)
	 			map.removeOverlay(map.borderpoly);
	 		if (loadQuestsHandle != null)
	 		{
	 			GEvent.removeListener(loadQuestsHandle);
	 			loadQuestsHandle = null;
	 		}
	 		map.removeOverlay(map.infoBox);
	 		map.setCenter(map.infoBox.questbounds.getCenter());
	 		map.setZoom(map.getBoundsZoomLevel(map.infoBox.questbounds));
			// align map
			// check if all points have enough space to borders
			var mapbounds = map.getBounds();
			var msw = mapbounds.getSouthWest();
			var mne = mapbounds.getNorthEast();
			var bounds = map.infoBox.questbounds;
			var bsw = bounds.getSouthWest();
			var bne = bounds.getNorthEast();
			var mapsw = map.fromLatLngToDivPixel(msw);
			var mapne = map.fromLatLngToDivPixel(mne);
			var markersw = map.fromLatLngToDivPixel(bsw);
			var markerne = map.fromLatLngToDivPixel(bne);
			var swdiff = Math.min(Math.abs(mapsw.x - markersw.x),Math.abs(mapsw.y - markersw.y));
			var nediff = Math.min(Math.abs(mapne.x - markerne.x),Math.abs(mapne.y - markerne.y));
			// if not: zoom out
			if (swdiff < 40 || nediff < 40)
			{
		 		map.zoomOut();
			}
			if (loadQuestsHandle == null)
				loadQuestsHandle = GEvent.addListener(map,'moveend',loadQuests);
			loadQuests();
	 	}
	 }
	 
	 //function globalMapClickHandler(m,point)
	 function clickHandler(qid)
	 {
	 	var m = markers[qid];
//	 	alert("marker handler "+qid+" "+m);
	 	// check if clicked on marker
		if(m != null && m.infoBox != null)
		{
		  	if (map.infoBox) 
		  	{
	    		map.removeOverlay(map.infoBox);
	  		}
	  		map.infoBox = m.infoBox;
	  		map.addOverlay(map.infoBox);
	  		GEvent.addDomListener(document.getElementById("closebutton"),"click",function() 
	  			{
	  				if (map.infoBox)
	  				{
	  					map.removeOverlay(map.infoBox);
	  				}
	  			});	 
	 	}
	 }
	 
	 function loadQuests() {
	 	// reset questboxes
 		if (map.borderpoly != null)
 			map.removeOverlay(map.borderpoly);
	 	for (var i=0; i < PREVIEW_BOXES; i++)
	 	{
	 		var qbox = document.getElementById('qbox' + i);
	 		qbox.firstChild.innerHTML = 'Loading...';
	 		var picelem = qbox.getElementsByTagName('img');
	 		for (var j = 0; j <qbox.childNodes.length; j++)
	 		{
	 			var node = qbox.childNodes[j];
	 			if (node.id == 'prettyQuestId')
	 			{
	 				node.firstChild.src = '${base}/image/loading.png?maxWidth=186&maxHeight=117&pad=eeeeee';
	 			}
	 			if (node.id == 'name')
	 			{
	 				node.innerHTML = 'Loading...';
	 			}
	 		}
	 	}
	 	// clear markers
		if (map.getZoom() != cachezoom)
		{
			for (var midx in markers)
		 	{
		 		if (markers[midx] != null)
		 		{
		 			//counter++;
	//		 		markers[midx].processed = false;
					if(markers[midx].visible != null && markers[midx].visible == true)
					{
			 			map.removeOverlay(markers[midx]);
			 			markers[midx].visible = false;
			 		}
		 		}
		 	}
		}	 	
		var lat = map.getCenter().lat();
	 	var lon = map.getCenter().lng();
	 	
	 	var questSearchRange = 0.5*map.getBounds().getSouthWest().distanceFrom(map.getBounds().getNorthEast());

	 	var url2 = '${base}/QueryQuests?lat=' + lat + '&lon=' + lon + '&range=' +questSearchRange+'&max=3&zoom='+map.getZoom();
	 	if ($.browser.version >= 6 && $.browser.version < 7)
	 	{
	 		url2 += '&ie6=true';
	 	}
	 	request.send(url2,updateQuestBoxes);
		var mid = map.fromLatLngToDivPixel(map.getCenter());
		var sw = map.fromDivPixelToLatLng(new GPoint(mid.x,mid.y));
		var ne = map.fromDivPixelToLatLng(new GPoint(mid.x+50,mid.y+50));
	 	// load new data
         if (map.getZoom() == cachezoom) 
        {
         	if (cachebounds != null && cachebounds.containsBounds(map.getBounds()))
         	{
         		mapChanged();
				return;
			}
		}

		cleancounter = 0;
 		cachecenter = map.fromLatLngToDivPixel(map.getCenter());
        var maprange = questSearchRange;
        var range = maprange * 2;
        cacherange = range - maprange;
        cachezoom = map.getZoom();
        var mapsize = map.getSize();
        var cachefac = 1;
        var offsetx = 100+(mapsize.width/2);
        var offsety = 100+(mapsize.height/2); 
		if ($.browser.version >= 6 && $.browser.version < 7)
		{
			offsetx = mapsize.width/2;
			offsety = mapsize.height/2;
		}
		var p0 = map.fromDivPixelToLatLng(new GPoint(cachecenter.x,cachecenter.y));
		var p1 = map.fromDivPixelToLatLng(new GPoint(cachecenter.x-offsetx,cachecenter.y+offsety));
		var p2 = map.fromDivPixelToLatLng(new GPoint(cachecenter.x+offsetx,cachecenter.y+offsety));
		var p3 = map.fromDivPixelToLatLng(new GPoint(cachecenter.x+offsetx,cachecenter.y-offsety));
		var p4 = map.fromDivPixelToLatLng(new GPoint(cachecenter.x-offsetx,cachecenter.y-offsety)); 
		cachebounds = new GLatLngBounds();
		cachebounds.extend(p1);
		cachebounds.extend(p2);
		cachebounds.extend(p3);
		cachebounds.extend(p4);
		cachebounds.extend(map.getCenter());

		// new bounds calc
		var mapbounds = map.getBounds();
		if (!cachebounds.containsBounds(mapbounds))
		{
			cachebounds = mapbounds;	
			offsetx = mapsize.width/2;
			offsety = mapsize.height/2;
			p1 = map.fromDivPixelToLatLng(new GPoint(cachecenter.x-offsetx,cachecenter.y+offsety));
			p2 = map.fromDivPixelToLatLng(new GPoint(cachecenter.x+offsetx,cachecenter.y+offsety));
			p3 = map.fromDivPixelToLatLng(new GPoint(cachecenter.x+offsetx,cachecenter.y-offsety));
			p4 = map.fromDivPixelToLatLng(new GPoint(cachecenter.x-offsetx,cachecenter.y-offsety));
			if(cachebounds.isFullLng() == true)
			{
				p1 = new GLatLng(p1.lat(),180);
				p2 = new GLatLng(p2.lat(),-180);
				p3 = new GLatLng(p3.lat(),-180);
				p4 = new GLatLng(p4.lat(),180);
				
			} 
		}
		

	 	pf = (processedFlag+1)%100;
	 	processedFlag = pf;
		var url = '${base}/QueryQuests?zoom='+map.getZoom()+'&lat=' + lat + '&lon=' + lon +'&type=user&region='+p0.lat()+' '+p0.lng()+","+p1.lat()+' '+p1.lng()+","+p2.lat()+' '+p2.lng()+","+p3.lat()+' '+p3.lng()+","+p4.lat()+' '+p4.lng();
	 	request.send(url,updateUserQuests);
		var url3 = '${base}/QueryQuests?zoom='+map.getZoom()+'&lat=' + lat + '&lon=' + lon +'&type=wappen&region='+p0.lat()+' '+p0.lng()+","+p1.lat()+' '+p1.lng()+","+p2.lat()+' '+p2.lng()+","+p3.lat()+' '+p3.lng()+","+p4.lat()+' '+p4.lng();
	 	if ($.browser.version >= 6 && $.browser.version < 7)
	 	{
	 	url3 += '&ie6=true';
	 	}
	 	request.send(url3,updateWappenQuests);
	 }
	 var pf = 0;
	 
	 function updateUserQuests(list)
	 {
	 	updateQuests(list,'cubes',2000,pf);
	 }
	 
	 function updateWappenQuests(list)
	 {
	 	updateQuests(list,'wappen',1000,pf);
	 }
	 
	 function mapChanged()
	 {
	 	var bounds = map.getBounds();
	 	var mapsize = map.getSize();
		var ne = map.fromContainerPixelToLatLng(new GPoint(Math.round(mapsize.width*1.5),Math.round(mapsize.height*1.5)));
		var sw = map.fromContainerPixelToLatLng(new GPoint(Math.round(mapsize.width*-0.5),Math.round(mapsize.height*-0.5)));
		bounds.extend(ne);
		bounds.extend(sw);
	 	var inside = 0;
	 	var outside = 0;
	 	for (var midx in markers)
	 	{
	 		if (markers[midx] != null)
	 		{
	 			var marker = markers[midx];
	 			if (bounds.containsLatLng(marker.getLatLng()))
	 			{
	 				inside++;
	 				if (marker.visible == null || marker.visible == false)
	 				{
	 					marker.visible = true;
	 					map.addOverlay(marker);
	 				}
	 			}
	 			else
	 			{
	 				outside++;
	 				if (marker.visible != null && marker.visible == true)
	 				{
	 					marker.visible = false;
	 					map.removeOverlay(marker);
	 				}
	 			}
	 		}
	 	}
	 	//console.log("in:"+inside+" out:"+outside);
	 }



