(function(){
	if(wordsFromReferrer&&wordsFromReferrer!=""){
		var word= wordsFromReferrer.replace(/%e3%80%80/g,"\+");
		word= word.replace(/%E3%80%80/g,"\+");
		word= word.replace(/%e3%80%81/g,"\+");
		word= word.replace(/%E3%80%81/g,"\+");
		word= word.replace(/%81%40/g,"\+");
		word= word.replace(/%20/g,"\+");
		word= word.replace(/%2C/g,"\+");
		word= word.replace(/%2B/g,"\+");
		if(word.slice(-1)=="+"){
			word=word.slice(0, -1); 
		}
		word=decodeURI(word);
		while (word.search(/\+\+/i) != -1) {
			word= word.replace(/\+\+/g,"\+");
		}
		if(word.slice(-1)=="+"){
			word=word.slice(0, -1); 
		}
		if(word.slice(0,1)=="+"){
			word=word.slice(1); 
		}
		hintsWord=word.split("+").join(", ");
	}
}
)();


function showArrow(el){
	var iconRnd = Math.floor(Math.random() * 5);
		el.className = "showAdsArrow"+iconRnd;
}


function blockhover(el){
	//el.className="blockhover";
	el.className="blockhoverTarent";
	//el.style.backgroundColor = "#eee";
	//el.style.backgroundImage = "url(http://stat.ameba.jp/common_style/img/common/icon/amebaicon.gif) no-repeat";
}
function block(el){
	el.className="blockTarent";
//el.style.backgroundColor="";
//el.style.backgroundImage="none";
}


function hideArrow(el){
	el.className="hideAdsArrow";
}
function jumpAd(url){
	window.location.href=url;
}

function highlight(adCount){
	var replaceTags=Array();
	for (i = 0; i < adCount; i++) {
		replaceTags.push("gAdTitle"+i);
		replaceTags.push("gAdDesc"+i);
	}
	if(replaceTags.length>0){
		for (i = 0; i < replaceTags.length; i++) {
			var gAdUnit=replaceTags[i];
			var adSrc=document.getElementById(gAdUnit);
			var adReplaseHTML=adSrc.innerHTML;
			var hintsWordsCount=hintsWord.split(", ");
			var hintsHighlight=Array();
			for (j = 0; j < hintsWordsCount.length; j++) {
				hintsHighlight[j]='<span style="background-color:#FFFF00;color:#333333;">'+hintsWordsCount[j]+'</span>';
				var Replasetag=adReplaseHTML.split(hintsWordsCount[j]);
				var tag="";
				for (k = 0; k < Replasetag.length; k++) {
						if (hintsHighlight[j] !=null) {
							tag = Replasetag.join(hintsHighlight[j]);
						}
					
				}
				adReplaseHTML=tag;
			}
		adSrc.innerHTML=adReplaseHTML;
		}
	}
}

function google_ad_request_done(google_ads) {
	var s = '';
	var i;

	if (google_ads.length == 0) {
		return;
	}

	if (google_ads[0].type="text" && google_ads.length > 0) {
		s='';
		s += '<div id="gadBox" class="talent">';
		for(i=0; i < google_ads.length; ++i) {
			s += '<div id="adCount'+i+'" class="hideAdsArrow" onmouseover="blockhover(this);" onmouseout="block(this);" onclick="jumpAd(\''+ google_ads[i].url+'\');"><a class="genAnch" onclick="return false;" href="javascript:void(0)">';
			var gad_title ='<span id="gAdTitle'+i+'" class="gadTitle" onclick="return false;" href="javascript:void(0)">'+ google_ads[i].line1+'</span>';
			var gad_url ='<span class="gadDisplayURL">'+google_ads[i].visible_url+'</span>';
			var gad_des ='<span id="gAdDesc'+i+'" class="gadDescription">' + google_ads[i].line2 + google_ads[i].line3 +'</span>';
			//s += '<span style="display:block;">'+ gad_title + gad_url +'</span>';
			s += gad_title + gad_des + gad_url ;
			s += '</a></div>';

		}
		
		s +='</div>';
		s += '<p id="gadLogo">Ads by Google</p>';	
	}
    document.write(s);
    if(hintsWord!=""){
		//highlight(google_ads.length);
	}
    return;
}
if ( parent==self ){
	if(hintsWord!=""){
	//google_hints = hintsWord;
	}
	
	if(google_ad_amebaID&&google_ad_amebaID=="affection-party"){
	//if(google_ad_amebaID&&google_ad_amebaID=="blog-misono"){
		var spArray=new Array("%e5%ad%90%e8%82%b2%e3%81%a6","%e4%b8%bb%e5%a9%a6","%e3%82%a8%e3%82%b9%e3%83%86","%e3%82%b3%e3%82%b9%e3%83%a1","%e3%83%80%e3%82%a4%e3%82%a8%e3%83%83%e3%83%88","%e4%bf%9d%e8%82%b2%e5%9c%92","%e5%b9%bc%e5%85%90","%e3%81%94%e3%81%af%e3%82%93");
		var Rnd1= Math.floor(Math.random()*spArray.length);
		var Rnd2= Math.floor(Math.random()*spArray.length);
		google_hints = spArray[Rnd1]+", "+spArray[Rnd1];
	}
	//google_ad_client='ca-cyberagent-ameblo_js';
	//google_ad_channel='ameblo';
	google_ad_output='js';
	google_max_num_ads='3';
	google_ad_type='text';
	google_language='ja';
	google_encoding ='utf8';
	google_safe='high';
	google_ad_section='s1 s2';
//google_adtest = 'on';

}
