//**********************************************************************
// ORIX : linkjoint.js
//
// 07.03.16
//**********************************************************************
//---------------------------------------------
// id 媒体コード取得
//---------------------------------------------
var idnum = 11; //取得するバイト数
var atai = "";
var idflg = 0;

function getFlg(){
  URL=location.href;
  get=URL.split(/\?/);
  if(get[1]){
    get2 = get[1].split(/\&/);
    get3 = get2[0].split(/\=/);
    if(get3[0]=="id"){
      atai = get3[1].substr(0,idnum);
      idflg=1;
    }else{
      for(i=1; get2[i]!=null; i++){
        get3 = get2[i].split(/\=/);
        if(get3[0]=="id"){
          atai = get3[1].substr(0,idnum);
          idflg=1;
          break;
        }
      }
    }
  }
}

function link(nexthtml){
 var getmaint = "";

  getmaint=nexthtml.split(/\#/);

window.onLoad = getFlg();
  if(idflg==0){
    location.href=nexthtml;
    return;
  }
  if(getmaint[1] != "" && getmaint[1] != undefined){
    location.href=getmaint[0]+'?id='+atai+'#'+getmaint[1];
  }else{
    location.href=nexthtml+'?id='+atai;
  }
}

//********************************************************************
