//var ccrw_installed_template = new Object();

//var ccrw_objCategory = new Array;
function ccrw_loadWidgetScriptBase2(){
	ccrw_objCategory = new Array;
	var url = "http://www.coneco.net/widget/coneco_club_widget_base.js";
	var objScript = document.createElement("script");
	objScript.setAttribute("type", "text/javascript");
	objScript.setAttribute("charset", "utf-8");
	objScript.setAttribute("src", url);
	objScript.setAttribute("id", "ccrw_widget_script_base");
	objScript.setAttribute("class", "ccrw_widget_script");
	document.getElementsByTagName("head").item(0).appendChild(objScript);
}
function ccrw_loadWidgetScriptBase(){
	if(document.getElementById("ccrw_widget_script_base")){
		try{
			generateConecoClubWidget();
		} catch(e) {
			ccrw_loadWidgetScriptBase2();
		}
	} else {
		ccrw_loadWidgetScriptBase2();
	}
}
function ccrw_setTemplate(ccrw_base){
	var baseStyle = new Object();
	baseStyle["black"] = "color:#000000;background-color:#ffffff;line-height:100%;";
	baseStyle["gray"] = "color:#000000;background-color:#ffffff";
	baseStyle["pink"] = "color:#000000;background-color:#ffffff";
	baseStyle[""] = "color:#000000;background-color:#ffffff";
	var optionColor = new Object();
	optionColor["black"] = "#FF5B5B";
	optionColor["gray"] = "#ffffff";
	optionColor["pink"] = "pink";
	optionColor[""] = "orange";
	var linkStyle = new Object();
	linkStyle["black"] = "color:#FF5B5B;background-color:#ffffff";
	linkStyle["gray"] = "color:blue;background-color:#ffffff";
	linkStyle["pink"] = "color:#ff8888;background-color:#ffffff";
	linkStyle[""] = "color:blue;background-color:#ffffff";


	ccrw_base.frameTemplate = function(){
		var arrTmpl = new Array();
		var strImgColor = (ccrw_base.templateColor)?"_"+ccrw_base.templateColor:'';
		arrTmpl.push('<div style="width:' + ccrw_base.partsWidth + 'px; height:50px;">');
		arrTmpl.push('<a href="' + ccrw_base.topUrl + '" target="_blank"><img src="http://club.coneco.net/img/blogparts/bp-head01'+strImgColor+'.png" border="0" alt="商品レビューサイト「conecoクラブ」" style="height:50px;width:' + ccrw_base.partsWidth + 'px;margin:0;border-style:none;" /></a>');
		arrTmpl.push('</div>');

		arrTmpl.push('<div style="width:' + ccrw_base.partsWidth + 'px; height:19px;background-image:url(' + ccrw_base.imgDir + 'bp-middle'+strImgColor+'.png)">');
		arrTmpl.push('<a id="'+ccrw_base.boxId+'_subject_anchor" href="' + ccrw_base.topUrl + '" target="_blank"><img src="http://club.coneco.net/img/blogparts/bp-head02'+strImgColor+'.png" border="0" alt="最近投稿したレビュー" style="height:19px;width:' + ccrw_base.partsWidth + 'px;margin:0;border-style:none;" /></a>');
		arrTmpl.push('</div>');

		arrTmpl.push('<div style="padding:0;margin:0;'+baseStyle[ccrw_base.templateColor]+'" class="coneco_review_widget_body">');

/*
		arrTmpl.push('<div style="width:' + ccrw_base.partsWidth + 'px; background-image:url(' + ccrw_base.imgDir + 'bp-middle'+strImgColor+'.png); padding-top:4px; text-align:center;">\n');
		arrTmpl.push('<p style="background-image:url('+ccrw_base.imgDir+'cate_bg'+strImgColor+'.png);background-repeat:repeat-x;width:' + (ccrw_base.partsWidth-10) + 'px;text-align:center;margin:0px auto;padding:2px 0;font-size:11px;">');
		arrTmpl.push('最近投稿したレビュー');
		arrTmpl.push('</p>');
		arrTmpl.push('</div>\n');
*/

		arrTmpl.push('%error%\n');

		arrTmpl.push('<div style="width:' + ccrw_base.partsWidth + 'px; background-image:url(' + ccrw_base.imgDir + 'bp-middle'+strImgColor+'.png); padding-top:4px; text-align:center;overflow-x:hidden">\n');
		arrTmpl.push('<div style="width:90%;text-align:left;margin-left:auto;margin-right:auto;padding:3px 0;overflow-x:hidden" id="'+ccrw_base.boxId+'_items">\n');
		arrTmpl.push('<div id="'+ccrw_base.boxId+'_list">\n');
		arrTmpl.push('</div>\n');
		arrTmpl.push(ccrw_base.tmplSep);
		arrTmpl.push('<div><iframe border=0 frameborder=0 scrolling="no" style="margin:0;padding:0;width:100%;height:60px;" src="'+ccrw_base.adUrl+'"></iframe></div>\n');
//		arrTmpl.push(ccrw_base.tmplSep);
//		arrTmpl.push('<p style="margin:4px 0 0;text-align:center;padding:0;font-family:\'sans-serif\';"><a href="'+ccrw_base.widgetUrl+'" style="font-size:9.5px;font-weight:normal;'+linkStyle[ccrw_base.templateColor]+'" target="_blank">このブログパーツをGet!</a></p>\n');
		arrTmpl.push('</div>\n');
		arrTmpl.push('</div>\n');

		arrTmpl.push('</div>\n');

		arrTmpl.push('<div style="padding:0;margin:0;clear:left;width:' + ccrw_base.partsWidth + 'px; height:40px;"><a href="'+ccrw_url_top+'" target="_blank"><img src="http://club.coneco.net/img/blogparts/bp-foot'+strImgColor+'.png" border="0" alt="coneco.net Web Services" style="width:' + ccrw_base.partsWidth + 'px;height:40px;margin:0;border-style:none;" /></a></div>\n');
		arrTmpl.push('</div>\n');
		return arrTmpl.join('');
	}

	ccrw_base.itemTemplate = function(){
		var arrItem = new Array();
		arrItem.push("<div class='ccrw_review-item' style='margin:0;width:100%;'>");
		arrItem.push("	<p class='review_title' style='margin:4px 0px 0px ;font-size:12px;padding:0;'>");
		arrItem.push("	<a href='%review_url%' target='_blank' title='%com_name%のレビュー' class='no-price'><img src='%s_img_url%' style='margin:0 2px 0 2px;%s_img_style%;"+linkStyle[ccrw_base.templateColor]+"' align='left' border='0'></a>");
		arrItem.push("	<a href='%review_url%' target='_blank' class='no-price' style='+linkStyle[ccrw_base.templateColor]+;font-weight:bold;'>%review_summary%</a>");
		arrItem.push("	</p>\n");
		arrItem.push("	<p style='clear:left;margin:1px auto 0px auto;padding:0;font-size:12px;'><a href='%review_url%' target='_blank' style='%rating_style%;"+linkStyle[ccrw_base.templateColor]+"'><img src='" + ccrw_base.clubImgDir + "star_s%rating%.gif' alt='%review_count%件の平均満足度：%rating%' border='0' height='12' /></a></p>");
		arrItem.push("	<div style='margin:4px 4px 0;'>");
		arrItem.push("		<p style='clear:left;margin:1px 0 1px 4px;color:#FF0000; font-size:10px;%buy_price_style%'>&yen;%buy_price%で購入</p>");
		arrItem.push("		<p style='margin:0;padding:0;font-size:10px;color:#444;'>%description% <a href='%review_url%' target='_blank'>read more</a></p>");
		arrItem.push("	</div>");
		arrItem.push("</div>\n");
		return arrItem.join('');
	}
	
}
function ccrw_addRule( selector, property, sheetindex, ruleindex ) {
	if( sheetindex == undefined ) sheetindex = 0;
	var sheet = document.styleSheets[ sheetindex ];
	if(!sheet){return;}
	if( sheet.addRule ) { //IE
		if( ruleindex == undefined ) ruleindex = sheet.rules.length;
		sheet.addRule( selector, "{" + property + "}", ruleindex );
		return ruleindex;
	}
	else if( sheet.insertRule ) { //Mozilla
		if( ruleindex == undefined ) ruleindex = sheet.cssRules.length;
		return sheet.insertRule( selector + "{" + property + "}", ruleindex );
	}

	return null;
}

(function(){
	try{
		ccrw_addRule("div.coneco_review_widget_body *","color:#000000;background-color:#ffffff;padding:0;margin:0;");
		ccrw_addRule("div.coneco_review_widget_body img","border-style:none;");
//		ccrw_addRule("div.coneco_review_widget_body option","background-color:transparent");
		ccrw_addRule("div.coneco_review_widget_body a","color:blue;background-color:#ffffff;");
		ccrw_addRule("div.coneco_review_widget_body a:link","text-decoration:none;");
		ccrw_addRule("div.coneco_review_widget_body a:visited","color:#800080;text-decoration:none;");
		ccrw_addRule("div.coneco_review_widget_body a:hover","background-color:#c6ddec;text-decoration:underline;");
//		ccrw_addRule("div.coneco_review_widget_body a.ccrw_buy_price","color:red;text-decoration:none;");
		ccrw_addRule("div.coneco_club_review_widget_footer","text-align:center;font-size:10px;width:160px;margin-left:auto;margin-right:auto;");
	} catch(e){
	}
	ccrw_loadWidgetScriptBase();
})();
