//Browser Check
var browserType=new checkBrowserType();
var osType=new checkOsType();
function checkBrowserType(){
	this.IE=(navigator.userAgent.indexOf("MSIE")!=-1);
	this.Gecko=(navigator.userAgent.indexOf("Gecko")!=-1);
	this.Firefox=(navigator.userAgent.indexOf("Firefox")!=-1);
	this.IE6=(navigator.userAgent.indexOf("MSIE 6.")!=-1);
	this.IE5=(navigator.userAgent.indexOf("MSIE 5.")!=-1);
	this.IE4=(navigator.userAgent.indexOf("MSIE 4.")!=-1);
	this.Opera=(navigator.userAgent.indexOf("Opera")!=-1);
	this.Safari=(navigator.userAgent.indexOf("Safari")!=-1);
	this.NC71=(navigator.userAgent.indexOf("Netscape/7.1")!=-1);
	this.NC70=(navigator.userAgent.indexOf("Netscape/7.0")!=-1);
	this.NC6=(navigator.userAgent.indexOf("Netscape/6.")!=-1);
	this.NC7=(navigator.userAgent.indexOf("Netscape/7.")!=-1);
	this.NC4=(navigator.appName.indexOf("Netscape")!=-1)&&(navigator.userAgent.indexOf("Mozilla/4.")!=-1);
}

function checkOsType(){
	this.Win=(navigator.appVersion.indexOf("Win")!=-1);
	this.Mac=(navigator.appVersion.indexOf("Mac")!=-1);
	this.Unix=(navigator.appVersion.indexOf("X11")!=-1);
}

//SetCSS
if(document.compatMode!="CSS1Compat" && browserType.IE && !osType.Mac){
	document.write('<style type="text/css">body,div,td{font-size:x-small;}.title{font-size:medium;}.detail-right div.posted{font-size:xx-small;}</style>');
}
// JavaScript Document


//document.write('<script type="text/javascript" src="http://www.cocolog-nifty.com/cocoflash/style.js"></script>');

function renderReaderAd(){
	var tabReader = document.getElementById('tab_reader');
	if(tabReader){
		var reader_url = tabReader.getElementsByTagName('a')[0].href;
		var box = getBox();
		if(box == false){
			return;
		}
		var new_box = document.createElement('div');
		new_box.className = "box";
		new_box.style.textAlign = "center";
		var ad_tag = '<a href="' + reader_url + '"><img src="/cocoflash/images/reader-banner-ad.gif" border="0" /></a>';
		if (location.href.match(/oekaki/)){
			ad_tag = '<img src="/cocoflash/images/oekaki-comment.gif" border="0" /><br><a href="http://cocolog.kaiketsu.nifty.com/faqs/17517/thread">お絵描きツールを使ってお題に参加する方法は？</a>';
		}
		new_box.innerHTML = ad_tag;

		box.parentNode.insertBefore(new_box, box);
	}
}
function getBox(){
        var div_tags = document.getElementsByTagName('div');
        for(var i=0, j=0; i<div_tags.length; i++){
                if(div_tags[i].className == "box"){
                        if(j == 0){
                                j++;
                        }else{
                                return div_tags[i];
                        }
                }
        }
	return false;
}

