function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//textad 5-125
function getBody(iname){
 if(document.all){
  return(document.all(iname))
 } else if(document.getElementById){
  return(document.getElementById(iname))
 }
}

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)){
    var tid = setInterval(function(){
     if (/loaded|complete/.test(document.readyState)) {
      clearInterval(tid);
      document.onload2.running();
     }
    }, 10);
   }else if (window.addEventListener){
    document.addEventListener("DOMContentLoaded", document.onload2.running, false);
   }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>');
   }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();

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 ad_topics(){
 if (getBody('textad1') || getBody('textad2'))
  callJSONP('http://bizad.nikkeibp.co.jp/NBP_AD/ecomom/parts/ecomom_topics.js?' + (new Date()).getTime(), 'utf-8');
}

//callback ad_topics
function cb_ad_topics(d){
 var targ, i, html;
 d.item.pop();
 if (d.item.length == 0)
  return;
 if (getBody('textad1')){
  targ = getBody('textad1');
  html = '<img src="http://www.nikkeibp.co.jp/ecomom/image/textad_title.jpg" width="655" height="14" alt="Topics" />\n';
 }else{
  targ = getBody('textad2');
  html = '<img src="http://www.nikkeibp.co.jp/ecomom/image/textad_title.jpg" width="655" height="14" alt="Topics" />\n';
 }
 html += '<ul>\n';
 for(i=0; i<d.item.length; i++){
  html += '<li><a href="' + d.item[i].url + '" target="_blank">' + d.item[i].text + '</a></li>\n';
 }
 html += '</ul>\n';
 targ.innerHTML = html;
 targ.style.display = 'block';
}


function ad_closeup(){
 if (getBody('textad_closeup'))
  callJSONP('http://bizad.nikkeibp.co.jp/NBP_AD/ecomom/parts/ecomom_closeup.js?' + (new Date()).getTime(), 'utf-8');
}

function cb_ad_closeup(d){
 var targ, i, html;
 d.item.pop();
 if (d.item.length == 0)
  return;
 html = '<img src="http://www.nikkeibp.co.jp/ecomom/image/textad_closeup.jpg" width="298" height="14" alt="Close up" />\n';
 html += '<ul>\n';
 for(i=0; i<d.item.length; i++){
  html += '<li><a href="' + d.item[i].url + '" target="_blank">' + d.item[i].text + '</a></li>\n';
 }
 html += '</ul>\n';
 getBody('textad_closeup').innerHTML = html;
 getBody('textad_closeup').style.display = 'block';
}

function ad_visualbox(){
 if (getBody('visualbox'))
  callJSONP('http://bizad.nikkeibp.co.jp/NBP_AD/ecomom/parts/ecomom_visualbox.js?' + (new Date()).getTime(), 'utf-8');
}

function cb_ad_visualbox(d){
 var html, i;
 d.item.pop();
 html = '';
 if (d.item.length == 0) return;
 for(i=0; i<d.item.length; i++){
  html += '<div class="visualbox">';
  html += '<div class="vbimage"><a href="' + d.item[i].url + '" target="_blank"><img src="' + d.item[i].image + '" width="70" height="70" alt="" /></a></div>';
  html += '<div class="vbtext"><a href="' + d.item[i].url + '" target="_blank">' + d.item[i].title + '</a></div>';
  html += '<div class="clear">clear</div>';
  html += '</div>';
 }
 getBody('visualbox').innerHTML = html;
 getBody('visualbox').style.display = 'block';
}

document.onload2.add(ad_topics);
document.onload2.add(ad_closeup);
document.onload2.add(ad_visualbox);
