var page = document.URL;
var genreCount = 8;
var genreID = Math.floor(Math.random()*genreCount)+1;

overtureURL = "http://cm.jp.overture.com/js_flat_1_0/?";
overtureURL += "config=22061893926";
//ステージング用source
//overtureURL += "&source=partner_test";
//本番用source
overtureURL += "&source=cyberagent_jp_img_cat_ctxt";
//ステージング用ctxtId
//overtureURL += "&ctxtId=test";
//本番用ctxtId
overtureURL += "&ctxtId=image0" + genreID;
overtureURL += "&mkt=jp";
overtureURL += "&type=site1";
overtureURL += "&maxCount=3";
overtureURL += "&ctxtUrl=" + encodeURIComponent(page);

//----------------------------------------------------------------- 広告用
function ShowListings() {
	
	var viewAdCount = 3;
	
	var i=6;
	var adCount = 0;
	while (i < zSr.length && adCount < viewAdCount) {
		var descr 		= zSr[i++]; 	// リスティング説明文
		var unused1 	= zSr[i++]; //
		var clickURL 	= zSr[i++]; // リスティング・リンク
		var title 		= zSr[i++]; // リスティング・タイトル
		var sitehost 	= zSr[i++]; // 広告主のドメイン名
		var unused2 	= zSr[i++]; //
		//document.write('<div class="ad">');
		//document.write('<a target="_new" href="'+ clickURL +'">');
		//document.write('<span>' + title + '</span>');
		//document.write('<p>' + descr + '</p>');
		//document.write('<span class="host">' + sitehost + '<span>');
		//document.write('</a>');
		//document.write('</div>');
		
		document.write('<div class="ad" onmouseover="blockhover(this);" onmouseout="block(this);" onclick="jumpAd(\'' + clickURL + '\');"><span class="adTitle">');
		document.write('<a target="_new" href="javascript:void(0)">');
		document.write(title + '</a></span>');
		//document.write(title + '</span>');
		document.write('<p>' + descr + '</p>');
		document.write('<span class="host">' + sitehost + '</span></div>');
		adCount++;
	}
}


//----------------------------------------------------------------- 画像のID取得
function view(imageId){
	frm = document.forms[0];
	frm.viewImageId.value=imageId;
	frm.submit();
}


function jumpAd(url){
	window.location.href=url;
}

function blockhover(el){
	el.className="adhover";
}

function block(el){
	el.className="ad";
}
