YUI().use("io-base", "node", function(Y) {
    

    // Define a function to handle the response data.
    function complete(id, o, args) {
        var id = id; // Transaction ID.
        var data = o.responseText; // Response data.
        var args = args[1]; // 'ipsum'.
        Y.one('#content1').set("innerHTML", data);
        //Y.on("click", getJodDateils, "div.uutinen h1 a");
    };

    // Subscribe to event "io:complete", and pass an array
    // as an argument to the event handler "complete", since
    // "complete" is global.   At this point in the transaction
    // lifecycle, success or failure is not yet known.
    Y.on('io:complete', complete, this, ['lorem', 'ipsum']);
    function getList(){
      //alert("mopo");
      var phpId = getCookie('PHPSESSID');
      var gmenu = Y.one('#gmenu').get('value');
      var jmenu = Y.one('#jmenu').get('value');
      var keys = Y.one('#keys').get('value');
      var uri = 'mg-ajax.php?ac=jobShc&' + 'PHPSESSID=' + phpId;
      uri += '&gmenu=' + gmenu;
      uri += '&jmenu=' + jmenu;
      uri += '&keys=' + keys;
      var request = Y.io(uri);
    }
    
    function getCookie(c_name)
    {
    if (document.cookie.length>0)
      {
      c_start=document.cookie.indexOf(c_name + "=")
      if (c_start!=-1)
        {
        c_start=c_start + c_name.length+1
        c_end=document.cookie.indexOf(";",c_start)
        if (c_end==-1) c_end=document.cookie.length
        return unescape(document.cookie.substring(c_start,c_end))
        }
      }
    return ""
    }
    function getJodDateils(e){
       Y.log("obj id : ----------- " + this.get("id"));
       Y.log("obj name : ----------- " + this.get("name"));
        var phpId = getCookie('PHPSESSID');
        var uri = 'mg-ajax.php?ac=jobShc&' + 'PHPSESSID=' + phpId;
        uri += '&jobAc=getDateil';
        uri += '&jobDi=' + this.get("name");
        var request = Y.io(uri);


    }
    Y.on("click", getList, "#haku");
    Y.on("click", getJodDateils, "div.uutinen h1 a");
});

