$(function() {
	gs24content($('#menu_gs24_title'));
	copyright();
});

/* gs24menu */
function gs24content(gstar){
var gs = gs24content;
gs.tpl = ''; gs.tpl_gs24 = []; gs.tpl_vector = [];
gs._title = $("#menu_gs24_title");
gs._btn = $("#menu_gs24_btn");
gs._boxid = "gsAllContentMenu";
gs.pos = $("#menu_gs24_btn").offset();
gs._btn.flag = false;
$.getJSON('/js/gscontent.json',function(data){
  $("head").append('<link rel="stylesheet" type="text/css" href="'+data.css+'" />');
  $.each(data.item,function(i,item){
      gs["tpl_"+item.category].push('<li><a target="'+item.target+'" href="'+item.link+'"><img src="'+item.img+'" alt="'+item.title+'" /></a></li>');
  });
  //template html
  gs.tpl = '<div class="ipf" id="'+gs._boxid+'">\
              <div id="'+gs._boxid+'_gs24">\
                <ul>'
                  +gs.tpl_gs24.join('')+
                '</ul>\
              </div>\
              <div id="'+gs._boxid+'_vector">\
                <ul>'
                  +gs.tpl_vector.join('')+
                '</ul>\
              </div>\
           </div>';
//  $(gstar).append(gs.tpl);
  $(gstar).append(gs.tpl);
  $("#"+gs._boxid).hide();
  //boxPosition
  $("#"+gs._boxid)
    .css({"left":gs.pos.left+'px'})
      .mouseover(function(){
        gs._btn.addClass("select");
        $(this).show();
        gs._btn.flag = true;
      })
      .mouseout(function(){
        gs._btn.removeClass("select");
        $(this).hide();
        gs._btn.flag = false;
      });
});
//Click Event
gs._btn.bind("click",function(e){
  e.preventDefault();
  if(gs._btn.flag == false){
    $("#"+gs._boxid).show();
    gs._btn.addClass("select");
    gs._btn.flag = true;
  }else{
    $("#"+gs._boxid).hide();
    gs._btn.removeClass("select");
    gs._btn.flag = false;
  }
}).bind("dblclick",function(e){
  e.preventDefault();
  window.open("http://gamespace24.net/");
});
};

function copyright() {
	var d = new Date();
	$('#copyRight span').html(d.getFullYear());
}
