
// steppy
var steppy = new Object();
steppy.showSw = true;

/*lib*/
//ID
steppy.$ = function(i){
	if(document.getElementById(i) != null){
		return document.getElementById(i);
	}else{
		return null;
	}
}
steppy.ads = steppy.$('steppy_ads_cA72faoon9r6im57');
steppy.btn = steppy.$('steppy_btn_cA72faoon9r6im57');
steppy.foot = steppy.$('steppy_foot_cA72faoon9r6im57');

steppy.getTopOffset = function() {
    if(document.all) {
	if(document.compatMode == "CSS1Compat")
	    return document.body.parentNode.scrollTop;
	else if(document.body.scrollTop)
	    return document.body.scrollTop;
	else
	    return 0;
    }
    else {
		return window.pageYOffset;
    }
}

steppy.getWindowHeight = function() {
    if(window.innerHeight)
		return window.innerHeight;
    if(document.compatMode == "CSS1Compat")
		return document.body.parentNode.clientHeight;
    if(document.body.clientHeight)
		return document.body.clientHeight;	
}
steppy.getWindowWidth = function() {
    if(window.innerWidth)
		return window.innerWidth;
    if(document.compatMode == "CSS1Compat")
		return document.body.parentNode.clientWidth;
    if(document.body.clientWidth)
		return document.body.clientWidth;
}

steppy.adoff = function(){
	steppy.ads.style.display = "none";
	steppy.foot.style.display = "none";
}

/*license check*/
if(steppy.btn.style.display == "none") steppy.showSw = false;
if(steppy.btn.rel == 'nofollow') steppy.showSw = false;

steppy.sticky = function(){
	if(steppy.btn != null){
		var foot = steppy.foot;
		var ad = steppy.ads;
		foot.style.position = "fixed";
		steppy.btn.style.fontSize = 12 + 'px';
		steppy.btn.style.position = 'relative';
		steppy.btn.style.top = -3 + 'px';
		
		ad.style.position = "fixed";
		var left = steppy.getWindowWidth();
		if(document.all) {
			foot.style.pixelLeft = left -160;
			foot.style.pixelTop = 600;
			ad.style.pixelLeft = left -160;
			ad.style.pixelTop = 0;
		}else {
			foot.style.left = left -160 + "px";
			foot.style.top = 600 + "px";
			ad.style.left = left -160 + "px";
			ad.style.top = 0 + "px";
		}
	}
}


steppy.sticky();
window.onscroll = steppy.sticky;
window.onresize = steppy.sticky;

steppy.showFlash = function(){
	//alert(arguments[0]);
	if(steppy.showSw && arguments[0]){
		var swf = steppy.$('steppy_cA72faoon9r6im57');
		var obj = "<embed src='http://www.steppy.jp/swf/steppypro.swf?u_key=cA72faoon9r6im57' quality='high' luginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' FlashVars='u_key=cA72faoon9r6im57' width='500' height='250'></embed>";
		swf.innerHTML += obj;
	}
}


steppy.url = "http://www.steppy.jp/showpro.php?";
steppy.url += "u_key=cA72faoon9r6im57";
steppy.url += "&tag="+steppy.ads.innerHTML;
steppy.show = document.createElement('script');
steppy.show.setAttribute("type","text/javascript");
steppy.show.setAttribute("src", encodeURI(steppy.url));
steppy.$('steppy_cA72faoon9r6im57').appendChild(steppy.show);

steppy.thumb = document.createElement('span');
steppy.foot.appendChild(steppy.thumb);
steppy.thumb.onclick = function(){steppy.adoff();}
steppy.thumb.innerHTML += "&nbsp;<img src='http://www.steppy.jp/img/delete_explain2.jpg' style='margin-top: 6px'>";
steppy.thumb.style.cursor = "pointer";
steppy.ads_a = steppy.ads.getElementsByTagName('a');
for(var i=0;i<steppy.ads_a.length;i++){
	steppy.ads_img = steppy.ads_a.item(i).getElementsByTagName('img');
	steppy.ads_img.item(0).style.border = "none";
}
steppy.foot.style.textAlign = "center";
steppy.foot.style.width = "160px";

steppy.ads.style.width = "160px";
steppy.ads.style.height = "600px";

