function YSliderControl() { }
YSliderControl.prototype = new GControl();
var YSLIDERLENGTH = 100;
var MAXZOOM = 18;
var INVERT_SLIDER = true;
var STEP = Math.round(YSLIDERLENGTH/MAXZOOM);
YSliderControl.prototype.setSlider = function(zoom) {
if (INVERT_SLIDER)
var zoom = MAXZOOM-zoom;
var top = Math.round((YSLIDERLENGTH/MAXZOOM*zoom));
this.slide.top = top;
this.knob.style.top = top+"px";
}

YSliderControl.prototype.setZoom = function() {
var z=Math.round(this.slide.top*MAXZOOM/YSLIDERLENGTH);
if (INVERT_SLIDER)
var z = MAXZOOM-z;
this.map.setZoom(z);
}

YSliderControl.prototype.initialize = function(map) {
var that=this;
this.map = map;
var container = document.createElement("div");
container.style.width="24px";
container.style.height="90px";
this.knob = document.createElement("img"); 
this.knob.src = "google_control/slider.png";
container.appendChild(this.knob);
this.slide=new GDraggableObject(this.knob, {container:container});
map.getContainer().appendChild(container);
GEvent.addListener(map, "zoomend", function(a,b) {that.setSlider(b)});
GEvent.addListener(this.slide, "dragend", function() {that.setZoom()});
return container;
}

YSliderControl.prototype.getDefaultPosition = function() {
return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(28, 80));
}

function CustomZoomControl() {
}
CustomZoomControl.prototype = new GControl();
CustomZoomControl.prototype.initialize = function(map) {
var container = document.createElement("div");
container.style.width = "45px";
container.style.height = "233px";
container.style.background = "url(/google_control/background_zoom.png)";
var upButton = document.createElement("img");
container.appendChild(upButton);
upButton.src = "/google_control/sm_button_up.png";
upButton.style.marginLeft = "14px";
upButton.style.marginTop = "5px";	
upButton.style.cursor = "pointer";	
GEvent.addDomListener(upButton, "click", function() {
map.panDirection(0, +1);
});

var leftButton = document.createElement("img");
container.appendChild(leftButton);
leftButton.src = "/google_control/sm_button_left.png";
leftButton.style.marginLeft = "4px";
leftButton.style.marginTop = "0px";	
leftButton.style.marginBottom = "0px";
leftButton.style.display = "inline";	
leftButton.style.cursor = "pointer";	
GEvent.addDomListener(leftButton, "click", function() {
map.panDirection(+1, 0);
});	

var rightButton = document.createElement("img");
container.appendChild(rightButton);
rightButton.src = "/google_control/sm_button_right.png";
rightButton.style.marginLeft = "2px";
rightButton.style.marginTop = "0px";
rightButton.style.marginBottom = "0px";
rightButton.style.display = "inline";	
rightButton.style.cursor = "pointer";	
GEvent.addDomListener(rightButton, "click", function() {
map.panDirection(-1, 0);
});	

var downButton = document.createElement("img");
container.appendChild(downButton);
downButton.src = "/google_control/sm_button_down.png";
downButton.style.marginLeft = "14px";
downButton.style.marginBottom = "10px";
downButton.style.cursor = "pointer";	
GEvent.addDomListener(downButton, "click", function() {
map.panDirection(0, -1);
});	

var zoomInButton = document.createElement("img");
container.appendChild(zoomInButton);
zoomInButton.src = "/google_control/sm_button_plus.png";
zoomInButton.style.marginLeft = "14px";
zoomInButton.style.cursor = "pointer";	
GEvent.addDomListener(zoomInButton, "click", function() {
map.zoomIn();
});

var zoomBox = document.createElement("div");
container.appendChild(zoomBox);
zoomBox.style.height = "114px"
zoomBox.style.width = "24px";
zoomBox.style.marginLeft = "10px";
var zoomOutButton = document.createElement("img");
container.appendChild(zoomOutButton);
zoomOutButton.src = "/google_control/sm_button_minus.png";
zoomOutButton.style.marginLeft = "14px";
zoomOutButton.style.marginTop = "15px";
zoomOutButton.style.cursor = "pointer";	
GEvent.addDomListener(zoomOutButton, "click", function() {
map.zoomOut();
});	

map.getContainer().appendChild(container);
return container;
}
// By default, the control will appear in the top left corner of the
// map with 7 pixels of padding.
CustomZoomControl.prototype.getDefaultPosition = function() {
return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(19, 30));
}	
function CustomMapControl() {
}
CustomMapControl.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.
CustomMapControl.prototype.initialize = function(map) {
var container = document.createElement("div");
var mapButton = document.createElement("img");
this.setButtonStyle_(mapButton);
container.appendChild(mapButton);
mapButton.src = "/google_control/button_map.png";
GEvent.addDomListener(mapButton, "click", function() {
map.setMapType(G_NORMAL_MAP);
});
var satButton = document.createElement("img");
this.setButtonStyle_(satButton);
container.appendChild(satButton);
satButton.src = "/google_control/button_sat.png";	
GEvent.addDomListener(satButton, "click", function() {
map.setMapType(G_SATELLITE_MAP);
});
var hybridButton = document.createElement("img");
this.setButtonStyle_(hybridButton);
container.appendChild(hybridButton);
hybridButton.src = "/google_control/button_both.png";	
GEvent.addDomListener(hybridButton, "click", function() {
map.setMapType(G_HYBRID_MAP);
});	
map.getContainer().appendChild(container);
return container;
}

function CustomPanel() {
}
CustomPanel.prototype = new GControl();
CustomPanel.prototype.initialize = function(map) 
{
var container = document.createElement("div");
container.style.width = "390px";
container.style.height = "315px";
container.style.background = "url(/google_control/background_te.png)";

map.getContainer().appendChild(container);
return container;
}
CustomPanel.prototype.getDefaultPosition = function() {
return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(0, 0));
}


function CustomList() {
}
CustomList.prototype = new GControl();
CustomList.prototype.initialize = function(map) 
{
var container = document.createElement("div");
container.style.width = "210px";
container.style.height = "730px";
container.style.background = "url(/google_control/background_liste.png)";

map.getContainer().appendChild(container);
return container;
}
CustomList.prototype.getDefaultPosition = function() {
return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(-230, -34));
}

// By default, the control will appear in the top left corner of the
// map with 7 pixels of padding.
CustomMapControl.prototype.getDefaultPosition = function() {
return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(25, 30));
}
CustomMapControl.prototype.setButtonStyle_ = function(button) {
var loader = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://www.traveldodo.com/yknob.png', sizingMethod='scale');";
button.style.width = "62px";
button.style.height = "18px";	
button.style.cursor = "pointer";
button.style.display = "inline";
button.style.filter= loader;
}
