function eatCookie(key){
 var dc, cs, i, p;
 dc = document.cookie;
 cs = dc.split(/; ?/);
 for(i=0; i<cs.length; i++){
  p = cs[i].indexOf(key + '=');
  if (p == 0){
   return(cs[i].substr(key.length + 1));
  }
 }
 return('');
}

function popupIM(){
    dispUrl=window.document.URL;
    dispTitle=window.document.title;
    dispTitle=encodeURI(dispTitle);
    mailkicker="mailto:?body="+dispTitle+"%0d%0a"+dispUrl;
    linkobj= window.document.getElementById("popup-mail");
    linkobj.setAttribute('href', mailkicker );

    if( eatCookie('IM-POPUP')=='no' ) {
         return;
    }
    window.open("/common/tool/infomail.html","newsub","width=500, height=380, menubar=no, toolbar=no, scrollbars=yes, status=no");
}


// for Tab Menu
function changeTab(TGT){
    if(TGT =="C1"){
        document.getElementById("menu01").style.display = 'block';
        document.getElementById("menu02").style.display = 'none';
        document.getElementById("menu03").style.display = 'none';
        document.getElementById("menu04").style.display = 'none';
        document.getElementById("menu05").style.display = 'none';
    }else if(TGT =="C2"){
        document.getElementById("menu01").style.display = 'none';
        document.getElementById("menu02").style.display = 'block';
        document.getElementById("menu03").style.display = 'none';
        document.getElementById("menu04").style.display = 'none';
        document.getElementById("menu05").style.display = 'none';
    }else if(TGT =="C3"){
        document.getElementById("menu01").style.display = 'none';
        document.getElementById("menu02").style.display = 'none';
        document.getElementById("menu03").style.display = 'block';
        document.getElementById("menu04").style.display = 'none';
        document.getElementById("menu05").style.display = 'none';
    }else if(TGT =="C4"){
        document.getElementById("menu01").style.display = 'none';
        document.getElementById("menu02").style.display = 'none';
        document.getElementById("menu03").style.display = 'none';
        document.getElementById("menu04").style.display = 'block';
        document.getElementById("menu05").style.display = 'none';
    }else if(TGT =="C5"){
        document.getElementById("menu01").style.display = 'none';
        document.getElementById("menu02").style.display = 'none';
        document.getElementById("menu03").style.display = 'none';
        document.getElementById("menu04").style.display = 'none';
        document.getElementById("menu05").style.display = 'block';
    }
}


//

navigator.getVersion = function(){
 if(navigator.appName == 'Microsoft Internet Explorer'){
 if (navigator.appVersion.match(/MSIE (\d)/)){
 return(RegExp.$1);
 }else{
 return(0);
 }
 }else{
 if (navigator.appVersion.match(/^(\d)/)){
 return(RegExp.$1);
 }else{
 return(0);
 }
 }
 return(0);
}

//



//add 2009/02/04 nnakazw@itpro
function getBody(iname){
 if(document.all){
  return(document.all(iname))
 } else if(document.getElementById){
  return(document.getElementById(iname))
 }
}

function callJSONP(Url, code){
 var c = (code) ? code : 'euc-jp';
 var script = document.createElement('script');
 script.src = Url;
 script.charset = c;
 document.body.appendChild(script);
}

function addOnload2(){
 if (typeof(document.onload2) == 'undefined'){
  document.onload2 = {};
  document.onload2.add = function(f){
   if (document.onload2.load)
    return(f());
   if(typeof(document.onload2.funcs) == 'undefined' || document.onload2.funcs.length == 0){
    document.onload2.funcs = [f];
   }else{
    document.onload2.funcs.push(f);
   }
    if (document.onload2.running){
    return;
   }else{
    document.onload2.running = function(){
     document.onload2.load = true;
     while(document.onload2.funcs.length > 0){
      document.onload2.funcs[0]();
      document.onload2.funcs.shift();
     }
     document.onload2.running = null;
    }
   }
    //mac safari
   if(/WebKit/i.test(navigator.userAgent)){
    setInterval(function(){
     if (/loaded|complete/.test(document.readyState)) {
      document.onload2.running();
     }
    }, 10);
   //Firefox
   }else if (window.addEventListener){
    document.addEventListener("DOMContentLoaded", document.onload2.running, false);
   //MSIE
   }else if(document.readyState && !!(window.attachEvent && !window.opera)){
    document.write('<script defer src="javascript:void(0)" onreadystatechange="if (this.readyState == \'complete\')  document.onload2.running();"><\/script>');
   // other
   }else{
    if (window.onload){
     if (window.attachEvent){
      window.attachEvent('onload', document.onload2.running);
     }else if (window.addEventListener){
      window.addEventListener('load', document.onload2.running, true);
     }else{
      window.onload = document.onload2.running;
     }
    }else{
     window.onload = document.onload2.running;
    }
   }
  }
 }
}
addOnload2();
