function addEvent(obj,type,fn){
	if(obj.attachEvent){
		obj['e'+type+fn]=fn;
		obj[type+fn]=function(){obj['e'+type+fn]( window.event );}
		obj.attachEvent('on'+type,obj[type+fn]);
	}else{
		obj.addEventListener(type,fn,false);
	}
}
function getPageScroll(){
	if (!document.getElementById("theid")) return false;
	var theid = document.getElementById("theid");
	var theanchor = document.getElementById("theanchor");
	var thetop =document.documentElement.scrollTop + document.body.scrollTop;	
	
	if(thetop > theanchor.offsetTop+30){
		if(theid.className == "fixed-top"){ return false;}
		theid.className = "fixed-top";
	}else{
		if(theid.className == ""){ return false;}
		theid.className = "";
	}
}
function float_box(){
	addEvent(window,"scroll",getPageScroll);
}
if(!document.getElementById("theid")){
	addEvent(window,"load",float_box);
}
