var myDomain = document.domain
myDomain = myDomain.replace("www.", "").replace(".com", "").replace(".net", "").replace(".org", "")
var loc = new String(window.parent.document.location)
if (loc.indexOf("https://")!= -1){
	prefix = "https://bedriy-w.startlogic"
} else {
	prefix = "http://www.bedriy-walton"
}

document.write ('<div style="position:absolute;bottom:0px;right:0px;" id="bedriy-walton_logo"><a href="http://www.bedriy-walton.com/web_design/s/' + myDomain + '/?ref" target="_blank"><img src="' + prefix + '.com/bw_logo.gif" class="hide" alt="Powered by Bedriy-Walton Inc." title="Powered by Bedriy-Walton Inc." border="0" align="right"></a></div>')

if (window.addEventListener){
	window.addEventListener('load', PositionBWLogo, false)
}  else if (window.attachEvent){
	window.attachEvent('onload', PositionBWLogo)
}

function PositionBWLogo(){
	logo = getBWLogoY(document.getElementById('bedriy-walton_logo'))
	height = 0
	if (document.documentElement){
		height = document.documentElement.scrollHeight - 10
	} else if (document.body){
		height = document.body.scrollHeight - 10
	}
	if (logo < height){
		document.getElementById('bedriy-walton_logo').style.top = height + "px"
	}
}

function getBWLogoY(obj) {
	var top;
	top = 0
	while(obj.offsetParent) {
		top+=obj.offsetTop
		obj = obj.offsetParent
	}
	return top
}
