function createElem(opt_className,opt_html,opt_tagName){var tag=opt_tagName||"div";var elem=document.createElement(tag);if(opt_html)elem.innerHTML=opt_html;if(opt_className)elem.className=opt_className;return elem;}
function sideBlockControl(opt_options){this.opts=opt_options||{};}
sideBlockControl.prototype=new GControl();sideBlockControl.prototype.initialize=function(_map){var openText=this.opts.openText||"Sidebar";var opener=createElem("sideblock-open",openText);opener.style.border="1px solid black";opener.style.textAlign="center";opener.style.fontSize="12px";opener.style.fontFamily="Arial";opener.style.backgroundColor="#fff";opener.style.width="65px";opener.style.position="relative";opener.style.top="7px";opener.style.left="63px";opener.style.cursor="pointer";_map.getContainer().appendChild(opener);var header=createElem("sideblock-header");header.style.textAlign="right";var closeText=this.opts.closeText||"Close[x] ";var close=createElem("sideblock-close",closeText,"span");close.style.cursor="pointer";header.appendChild(close);var leftBar=createElem("sideblock");leftBar.appendChild(header);_map.getContainer().appendChild(leftBar);leftBar.style.width=this.opts.sideBlockWidth||"200px";leftBar.style.height="100%";var contents=createElem("sideblock-container");leftBar.appendChild(contents);contents.style.height="90%";contents.style.overflow="auto";var me=this;me.container=contents;me.isVisible=true;function openEvent(){me.isVisible=true;GEvent.trigger(me,'open',true)};function closeEvent(){me.isVisible=false;GEvent.trigger(me,'close',false)};me.show=function(){leftBar.style.display="block";openEvent()};me.hide=function(){leftBar.style.display="none";closeEvent()};close.onclick=function(){me.hide()};opener.onclick=function(){me.show()};return leftBar;}
sideBlockControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(0,0));}
