<!--
var request_set;
var default_ctxt_ad_height =240;
var default_ctxt_ad_width = 120;
var default_ad_newwin  = '0';
var default_ab_bc = '000000';
var default_ab_cc = 'FFFFFF';
var default_ab_lc = '000099';
var default_ab_tc = '000000';
var default_ab_uc = 'CC0000';
var default_ad_tflg = 0;
var interface = "http://im.ov.yahoo.co.jp/js_ads/";
var frameborder = '0';
var w = window;


request_set = interface + "?";
if (w.ctxt_ad_source){
  request_set += 'source=' + ctxt_ad_source ;
}

if (w.ctxt_ad_height == null){
  ctxt_ad_height = default_ctxt_ad_height;
}

if (w.ctxt_ad_width == null){
  ctxt_ad_width = default_ctxt_ad_width;
}

if (w.ctxt_ad_url == null){
  ctxt_ad_url = document.referrer;

  if (top.location == document.location){
    ctxt_ad_url = document.location;
  }
}

if (w.ctxt_ad_bc == null){
  ctxt_ad_bc = default_ab_bc;        
}
if (w.ctxt_ad_cc == null){
  ctxt_ad_cc = default_ab_cc;        
}
if (w.ctxt_ad_lc == null){
  ctxt_ad_lc = default_ab_lc;        
}
if (w.ctxt_ad_tc == null){
  ctxt_ad_tc = default_ab_tc;        
}
if (w.ctxt_ad_uc == null){
  ctxt_ad_uc = default_ab_uc;        
}
if (w.ctxt_ad_newwin == null){
  ctxt_ad_newwin = default_ad_newwin;        
}
if (w.ctxt_ad_tflg == null){
  ctxt_ad_tflg = default_ad_tflg;        
}


request_set += '&amp;height=' + ctxt_ad_height;
request_set += '&amp;width=' + ctxt_ad_width;

if (w.ctxt_ad_id){
  request_set += '&amp;ctxtId=' + encodeURI(ctxt_ad_id);
}

if (w.ctxt_ad_keywords){
  request_set += '&amp;ctxtKeywords=' + encodeURI(ctxt_ad_keywords);
}

if (w.ctxt_ad_url){
  ctxt_ad_url_encoded = encodeURI(ctxt_ad_url);
  ctxt_ad_url_encoded = ctxt_ad_url_encoded.substring(0,2083);
  ctxt_ad_url_encoded = ctxt_ad_url_encoded.replace(/%[0-9]?$/, '');
  request_set += '&amp;ctxtUrl=' + ctxt_ad_url_encoded;
}

if (w.ctxt_ad_url_cat){
  request_set += '&amp;ctxtCat=' + encodeURI(ctxt_ad_url_cat);
}

if (w.ctxt_ad_type){
  request_set += '&amp;type=' + ctxt_ad_type;
}

if (w.ctxt_ad_age){
  request_set += '&amp;age=' + ctxt_ad_age;
}

if (w.ctxt_ad_gen){
  request_set += '&amp;gen=' + ctxt_ad_gen;
}

if (w.ctxt_ad_area){
  request_set += '&amp;area=' + ctxt_ad_area;
}

if (w.ctxt_ad_market){
  request_set += '&amp;mkt=' + ctxt_ad_market;
}

if (w.ctxt_ad_ie){
  //request_set += '&amp;keywordCharEnc=' + ctxt_ad_ie;
}

if (w.ctxt_ad_oe){
  request_set += '&amp;outputCharEnc=' + ctxt_ad_oe;
}

if (w.ctxt_ad_start){
  request_set += '&amp;start=' + ctxt_ad_start;
}

if (w.ctxt_ad_newwin){
  request_set += '&amp;ad_newwin=' + ctxt_ad_newwin;
}

if (w.ctxt_ad_bc){
  request_set += '&amp;ad_bc=' + ctxt_ad_bc;
}

if (w.ctxt_ad_cc){
  request_set += '&amp;ad_cc=' + ctxt_ad_cc;
}

if (w.ctxt_ad_lc){
  request_set += '&amp;ad_lc=' + ctxt_ad_lc;
}

if (w.ctxt_ad_tc){
  request_set += '&amp;ad_tc=' + ctxt_ad_tc;
}

if (w.ctxt_ad_uc){
  request_set += '&amp;ad_uc=' + ctxt_ad_uc;
}

if (w.ctxt_ad_css){
  request_set += '&amp;css_url=' + encodeURI(ctxt_ad_css);
} else if (w.ctxt_css_url){
  request_set += '&amp;css_url=' + encodeURI(ctxt_css_url);
}

if (w.ctxt_ad_tflg){
  request_set += '&amp;tflg=' + ctxt_ad_tflg;
}

if (w.ctxt_ad_brdno){
  request_set += '&amp;ad_brdno=' + ctxt_ad_brdno;
}

if (w.ctxt_ad_brdcno){
  request_set += '&amp;ad_brdcno=' + ctxt_ad_brdcno;
}

// DEBUG
/*
debug = request_set;
debug += '<br>';
document.write(debug);
*/
// DEBUG

document.write('<ifr' + 'ame' +
  ' src=' + request_set +
  ' width=' + ctxt_ad_width +
  ' height=' + ctxt_ad_height +
  ' frameborder=' + frameborder +
  ' hspace=0' +
  ' vspace=0' +
  ' scrolling=no' +
  ' marginwidth=0' +
  ' marginheight=0' +
  ' allowtransparency=true' +
  ' name=iframe0></ifr' + 'ame>');

// zeroing out for next call
ctxt_ad_source = null;
ctxt_ad_height = null;
ctxt_ad_width = null;
ctxt_ad_id = null;
ctxt_ad_keywords = null;
ctxt_ad_url = null;
ctxt_ad_url_cat = null;
ctxt_ad_type = null;
ctxt_ad_age = null;
ctxt_ad_gen = null;
ctxt_ad_area = null;
ctxt_ad_market = null;
ctxt_ad_ie = null;
ctxt_ad_oe = null;
ctxt_ad_start = null;
ctxt_ad_newwin = null;
ctxt_ad_bc = null;
ctxt_ad_cc = null;
ctxt_ad_lc = null;
ctxt_ad_tc = null;
ctxt_ad_uc = null;
ctxt_ad_css = null;
ctxt_css_url = null;
ctxt_ad_tflg = null;
ctxt_ad_brdno = null;
ctxt_ad_brdcno = null;
