var contentWin;
function load(cur) {
    centerToWaitWin();

    return;
}

function selArea(obj) {
    if ($(obj).value == "") {
        $(obj).focus();
        return;
    }
    if (inheritParam == undefined) {
        var params = new Object();
    } else {
        if (inheritParam) {
            var loc = location.search.substring(1);
            var params = loc.parseQuery();
        } else {
            var params = new Object();
        }
    }
    params["area"] = $(obj).value;
    if (params["st"] != undefined) params["st"] = 0;
    location.href = "./?"+$H(params).toQueryString();
}
function goto(key, value) {
    if (inheritParam == undefined) {
        var params = new Object();
    } else {
        if (inheritParam) {
            var loc = location.search.substring(1);
            var params = loc.parseQuery();
        } else {
            var params = new Object();
        }
    }
    params[key] = value;
    location.href = "./?"+$H(params).toQueryString();
}
function setNoImg(obj, size) {
    if (arguments.length == 1) size = "m";
    if ($(obj).src.indexOf("noimage"+size+".gif") != -1) return;
    var img = new Image();
    img.src = "./images/noimage"+size+".gif";
    $(obj).src = img.src;
}
function addFavorite() {
    var ua = navigator.userAgent;
    if (window.sidebar) {
        window.sidebar.addPanel('◆お昼ドコイク？','http://www,hirudoko.net/','');
    } else if (ua.indexOf("Opera") > -1) {
    } else if (ua.indexOf("MSIE") > -1) {
        window.external.AddFavorite('http://www,hirudoko.net/','◆お昼ドコイク？');
    }
    new Ajax.Request("./addfav.php", {method:"post", parameters:"a="+ua, asynchronous:true, onSuccess:__addFavorite});
    return false;
}
function __addFavorite(resultRequest) {
    return;
}
function histBack(errback){
    var bs = false;
    Event.observe(window,"unload",function(){bs=true});
    Event.observe(window,"beforeunload",function(){bs=true});
    history.back();
    switch(typeof errback){
        case "function": setTimeout(function(){if(!bs) errback()},100);break;
        case "string"  : setTimeout(function(){if(!bs) location.href=errback},100);break;
    }
    return bs;
}
function showMenu(id, kind, menunum){
    showSubWinFromUrl("?action_MenuInfo=true&id="+id+"&kind="+kind+"&num="+menunum, "今日のランチメニュー", 470, 520);
    return false;
}
function showSubWinFromUrl(winUrl, winTitle, winWidth, winHeight) {
    var winSize = __getWindowSize();
    if (winHeight == undefined) winHeight = winSize.Height-80;
    if (winHeight >= (winSize.Height-80)) winHeight = winSize.Height - 80;

    if (contentWin != null) {
        //contentWin.setURL(winUrl);
        //contentWin.refresh();
    } else {
        var winLeft = ((winSize.Width - winWidth) / 2);
        var winTop = document.body.scrollTop + ((winSize.Height-winHeight) / 2) - 0;

        contentWin = new Window("content_win",
                                {className: "clearlooks2",
                                 title: winTitle,
                                 url: winUrl,
                                 resizable: true,
                                 showEffect: Element.show,
                                 hideEffect: Effect.Fade,
                                 minWidth: 10})
        contentWin.toFront();
        contentWin.setDestroyOnClose();
        contentWin.setSize(winWidth, winHeight);
        //contentWin.setLocation(winTop, winLeft);
        //contentWin.show(false);
        contentWin.showCenter(false);
        myObserver = {
          onDestroy: function(eventName, win) {
              if (win == contentWin) {
                  contentWin = null;
                  Windows.removeObserver(this);
              }
              debug(eventName + " on " + win.getId())
          }
        }
        Windows.addObserver(myObserver);
    }
}
function beforeClose() {
    this.canClose = function() {
        return true;
    }
}
function show_tweet(id, w, h) {
    if (!id) id = 'hirudoko';
    if (!w) w = 250;
    if (!h) h = 300;
    new TWTR.Widget({
      version: 2,
      type: 'profile',
      rpp: 20,
      interval: 6000,
      width: w,
      height: h,
      theme: {
        shell: {
          background: '#c0deed',
          color: '#333333'
        },
        tweets: {
          background: '#ddeef6',
          color: '#333333',
          links: '#0084b4'
        }
      },
      features: {
        scrollbar: true,
        loop: false,
        live: true,
        hashtags: false,
        timestamp: true,
        avatars: false,
        behavior: 'all'
      }
    }).render().setUser(id).start();
}
