//
//
//	shopping overture
//
//	必要用件：
//
//		overture 配信先ページの表示箇所に <div id="ovtrDIV"></div> の記述
//		onload イベントの際に指定のjavascript関数の実行
//		http://allabout.co.jp/pts/js/util/aa.js のロード
//
//


aa.namespace("shopOVTR");

aa.shopOVTR={

	// init valuables
	list        : ""
	,pid        : 'about_jp_cat_ctxt'	// 配信のIDになります リリース時には変更が入ります
	,listcount  : 5
	,count_col  : 6
	,header     : '<div id="adsense" class="cf"><div id="space"><h3 class="vari21">PR（<a href="http://www.content.overture.com/d/JPm/legal/disc.jhtml">詳細<\/a>）<\/h3>'
	,footer     : '<\/div><\/div>'

	// function
	,writeListings : function()
	{
		var html="";
		var i=aa.shopOVTR.count_col;
		while(i<aa.shopOVTR.list.length){
			var d=aa.shopOVTR.list[i++];
			var x=aa.shopOVTR.list[i++];
			var u=aa.shopOVTR.list[i++];
			var t=aa.shopOVTR.list[i++];
			var s=aa.shopOVTR.list[i++];
			var y=aa.shopOVTR.list[i++];
			html+='<p class="ad21"><a href="'+u+'">'+t+'<\/a>&nbsp;<span class="vari12 Yellowgreen01">'+d+'<\/span><br>'+s+'<\/p>\n';
		}
		if(html)aa.u.sv("ovtrDIV",aa.shopOVTR.header+html+aa.shopOVTR.footer);
	}

	,getResult : function()
	{
		var kw=arguments[0];
		var pid=aa.shopOVTR.pid;
		if(pid.match(/_test/)){alert('test Overture partner ID :' + pid + '|| kw ：'+ kw);}
		var u='http://cm.jp.about.overture.com/js_flat_1_0/?config=2841970080&source='+pid+'&mkt=jp&maxCount='+aa.shopOVTR.listcount+'&ctxtUrl='+aa.u.encodeURL(location.href)+'&ctxtKeywords='+aa.u.encodeURL(kw);
		var h='<html><head><script type="text/javascript" charset="UTF-8" src="'+u+'"></scr'+'ipt></head><body '+'onload="top.aa.shopOVTR.list=zSr;top.aa.shopOVTR.writeListings();"></body></html>';
		var it=document.createElement('iframe');
		it.id="iframeHidden";
		it.height=1;
		it.width=1;
		it.style.display="none";
		document.body.appendChild(it);
		var cd=it.contentDocument;
		if(cd==undefined)cd=top.iframeHidden.document;
		cd.open("text/html","replace");
		cd.write(h);
		cd.close();
	}
};

