(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(", ");

		var expLimit=new Date();
		//expLimit.setTime(expLimit.getTime()+(1000*60*10));
		expLimit.setTime(expLimit.getTime()+(1000*10));
		var expTime=expLimit.toGMTString();
		document.cookie="hitsTmpWords="+encodeURI(hintsWord)+";+expires="+expTime;
	}
}
)();

var FromSearchEngine = false;
(function(){
	var ref = document.referrer;
	if (/^http:\/\/search\.livedoor\.com\/search/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/sf\.livedoor\.com\/search/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/www\.google\.(co\.jp|com)\/search/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/images\.google\.(co\.jp|com)/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/blogsearch\.google\.co\.jp\/blogsearch/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/search\.yahoo\.co\.jp\/search/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/blog-search\.yahoo\.co\.jp\/search/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/search\.goo\.ne\.jp\/web.jsp/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/blog\.search\.goo\.ne\.jp\/search_goo\/result/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/search\.live\.com\/results\.aspx/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/search\.msn\.co\.jp/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/www\.excite\.co\.jp\/search.gw/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/www\.baidu\.jp/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/blog\.baidu\.jp/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/search\.nifty\.com\/websearch\/search/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/search\.nifty\.com\/blogsearch\/search/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/search\.www\.infoseek\.co\.jp\/Web/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/blogsearch\.fc2\.com/.test(ref)) FromSearchEngine = true;
	if (/^http:\/\/ask\.jp\/web\.asp/.test(ref)) FromSearchEngine = true;
})();

var gadImgFrame = {};
var gadImgTitle = {};
var gadImgDescription = {};
var gadImgUrl = {};
var styleImgObj = {
		generalFrame : {
			background : "#EAEFFF",
			margin : "0 0 5px 0"
		},
	    generalTitle : {
	        color : "#0066CC"
	    },
//	    generalDescription : {},
	    generalUrl : {
	        color : "#0066CC"
	    },
	    mouseoverFrame : {
	    	background : "#FFFFCC",
	    	margin : "0 0 5px 0"
	    },
	    mouseoverTitle : {
	    	color : "#FF3366"
	    },
//	    mouseoverDescription : {},
	    mouseoverUrl : {
	        color : "#FF3366"
	    }
	};

function blockhover(el){
	el.className="adObjOn";
	$(".adObjOn").css(styleImgObj.mouseoverFrame);
	$(".adObjOn .adObjTtl").css(styleImgObj.mouseoverTitle);
//	$(".adObjOn .gadDescription").css(styleImgObj.mouseoverDescription);
	$(".adObjOn .gadDisplayURL").css(styleImgObj.mouseoverUrl);

}

function block(el){
	el.className="adObj";
	$(".adObj").css(styleImgObj.generalFrame);
	$(".adObj .adObjTtl").css(styleImgObj.generalTitle);
//	$(".adObj .gadDescription").css(styleImgObj.generalDescription);
	$(".adObj .gadDisplayURL").css(styleImgObj.generalUrl);
}


function hideArrow(el){
	el.className="adObj";
}
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("general");
			var adReplaseHTML=adSrc.innerHTML;
			var hintsWordsCount=hintsWord.split(", ");
			var hintsHighlight=Array();
			for (j = 0; j < hintsWordsCount.length; j++) {
				hintsHighlight[j]='<span style="background-color:#ffff66;color:#333333;border-bottom:1px dotted #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 style="text-align:right;"><a id="gadLogo" href="'+google_info.feedback_url+'" target="_blank">Ads by Google</a></div>';
		s += '<div id="general" class="gadBox clearFix">';

		for(i=0; i < google_ads.length; ++i) {

			s += '<div class="adObj" onmouseover="blockhover(this)" onmouseout="block(this)" >';
			var gad_title ='<a href="'+google_ads[i].url+'" ><span class="adObjTtl">'+ google_ads[i].line1+'</span></a>';
			var gad_url ='<a href="'+google_ads[i].url+'" ><span class="gadDisplayURL">'+google_ads[i].visible_url+'</span></a>';
			var gad_des ='<span class="gadDescription">' + google_ads[i].line2 + google_ads[i].line3 +'</span>';
			//s += gad_title + gad_des + gad_url;
			s += gad_title + gad_url + gad_des;
			s += '</div>';

		}

		s +='</div>';


	}
    document.write(s);

    if (google_ads[0].type="text" && google_ads.length > 0) {
    	gadImgFrame = $(".adObj");
    	gadImgTitle = $(".adObjTtl");
//    	gadImgDescription = $(".gadDescription"),
    	gadImgUrl = $(".gadDisplayURL");

    	gadImgFrame.css(styleImgObj.generalFrame);
    	gadImgTitle.css(styleImgObj.generalTitle);
//    	gadImgDescription.css(styleImgObj.generalDescription);
    	gadImgUrl.css(styleImgObj.generalUrl);

    }

    if(hintsWord!=""){
		highlight(google_ads.length);
	}
    else if(tmpHintsWord!=""){
		highlight2(google_ads.length);
	}
    return;
}



function google_hints_cookie(){
	var savedHintsWord="";
	var cookieStr=document.cookie+";";
	var cookieName="hitsTmpWords=";
	var start=cookieStr.indexOf(cookieName);
	if(start>-1){
		var end=cookieStr.indexOf(";",start);
		savedHintsWordEn=cookieStr.substring(start+cookieName.length,end);
		savedHintsWord=decodeURI(savedHintsWordEn);
	}

	return savedHintsWord;
}

var tmpHintsWord=google_hints_cookie();


if ( parent==self ){


	if(hintsWord!=""){
		google_hints = hintsWord;
	}else if(tmpHintsWord!=""){
		google_hints = tmpHintsWord;
	}

//	var checkSideAd = document.getElementById("imageExAd");
//	if(checkSideAd){
		//google_skip = '3';
//	}


	google_ad_client='ca-cyberagent-ameblo-image_js';
	google_ad_output='js';
	google_ad_type='text';
	google_language='ja';
	google_encoding ='utf8';
	google_safe='high';
	google_feedback = 'on';
/////
//google_adtest = 'on';
//////


}


function imageCss(){

var cssStart='<style type="text/css">';
var cssEnd='</style>'



var css0='#adArea .adObj{width:100%;clear:both;padding:5px;margin:0;font-size:1.2em !important;cursor:default;border:none;}';
var css1='#adArea .adObjTtl{background:none;padding-right:20px;}';
var css2='#adArea .adObjOn{width:100%;clear:both;padding:5px;margin:0;font-size:1.2em !important;cursor:default;background:#FFFFCC;border:none;}';
var css3='#adArea a span.adObjTtl{font-size:1.2em !important;}';
var css4='#adArea span.gadDescription{display:block;color:#333333;cursor:default}';
var css5='#adArea a span.gadDisplayURL{text-align:right;padding-right:8px;letter-spacing:0.4em;}';
var css6='#adArea .adObjOn a{color:#FF3366;text-decoration:underline}';

document.write(cssStart+css0+css1+css2+css3+css4+css5+css6+cssEnd);




}
imageCss();



