/**
 * 検定詳細画面用JavaScript
 *
 * @author Takeyoshi Tanaka <t-tanaka@e-coms.co.jp>
 * @since  2008/01/16
 */

/**
 * URLコピーボタン用
 */
function CopyUrl()
{
  return window.location.href;
}

/**
 * URLパラメータ取得
 *
 */
function getRequest(){
  if(location.search.length > 1) {
    var get = new Object();
    var ret = location.search.substr(1).split("&");
    for(var i = 0; i < ret.length; i++) {
      var r = ret[i].split("=");
      get[r[0]] = r[1];
    }
    return get;
  } else {
    return false;
  }
}
var get = getRequest();


//-- 読込み自動ロード
Event.observe(window,'load',load_graph);
var myajax;

/**
 * 自動ロード用メソッド
 *
 */
function load_graph() {
  view_piegraph();
  bar_piegraph();
}

/**
 * パイグラフ
 *
 */
function view_piegraph() {
  new Ajax.Request(
  "/ajax/exam_info/pie_graph.php?exam_id="+get['exam_id'],
  {
    method     : "post",
    onComplete: function(httpObject) {
      $('pie_graph').innerHTML = httpObject.responseText;
    },
    onFailure: function() {}
  }
  );
}
/**
 * 棒グラフ
 *
 */
function bar_piegraph() {

  new Ajax.Request(
  "/ajax/exam_info/bar_graph.php?exam_id="+get['exam_id'],
  {
    method     : "post",
    parameters : "p=dummy",
    onComplete: function(httpObject) {
      $('bar_graph').innerHTML = httpObject.responseText;
    },
    onFailure: function() {}
  }
  );
}

/**
 * マイリスト追加ポップアップ
 *
 */
var newWin=0; 
function addMyList(exam_id) { 
  window.open('/mypage/examInfo/exam_info.php?do_mylist&exam_id='+exam_id,
              '_blank',
              'width=550,height=180,menubar=no,toolbar=no,scrollbars=yes');
}
/**
 * リンクタグ貼り付けヘルプポップアップ
 *
 */
var newWin=0; 
function help1() { 
  window.open('/mypage/examInfo/help1.html',
              '_blank',
              'width=550,height=440,menubar=no,toolbar=no,scrollbars=yes');
}
