function $(id){return document.getElementById(id);}

function addEvent(el, evname, func){
    try{
        if(el.attachEvent){
            el.attachEvent('on'+evname, func);
        } else if(el.addEventListener){
            el.addEventListener(evname, func, true);
        } else {
            el['on'+evname] = func;
        }
    } catch (error){}
}

function go(url){
    var href = document.getElementsByTagName('base')[0].href;
    window.location = href + url;
}


var map;
function loadMap() {
    if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        $('map').style.display="none";
    }
}
function showOnMap(lat, lng){
    $('map').style.display = "block";
    var loc = new GLatLng(lat, lng);
    var marker = new GMarker(loc);
    map.clearOverlays();
    map.setCenter(loc, 14);
    map.addOverlay(marker);
    
}

function mapPopUp(url){
	url = document.getElementsByTagName('base')[0].href + url;
	window.open(url, "restaurantMap", "status=0, height=245, width=525, resizable=0");
}

var helptimer, hw;
function showHelp(){
    if(navigator.appName == 'Microsoft Internet Explorer'){
        $('helpbox').style.height = (document.body.offsetHeight - 32) + 'px';
    } else {
        $('helpbox').style.height = (window.innerHeight - 4) + 'px';
    }
    $('helpbox').style.right = '-250px';
    $('helpbox').style.overflow = 'hidden';
    $('helpbox').style.display = 'block';
    hw = -250;
    helptimer = window.setInterval(openhelpstep, 37);
}

function hideHelp(){
    hw = 0;
    $('helpbox').style.overflow = 'hidden';
    helptimer = window.setInterval(closehelpstep, 37);
}

function openhelpstep(){
    hw += 40; 
    if(hw >= 0){
        hw = 0;
        window.clearInterval(helptimer);
        $('helpbox').style.overflow = 'auto';
    }
    $('helpbox').style.right = hw +'px';
}

function closehelpstep(){
    hw -= 40;
    if(hw <= -260){
        hw = -260;
        window.clearInterval(helptimer);
        $('helpbox').style.overflow = 'auto';
        $('helpbox').style.display='none';
    }
    $('helpbox').style.right = hw +'px';
    
}