All pastes #294173 Raw Edit

Someone

public text v1 · immutable
#294173 ·published 2006-12-28 06:18 UTC
rendered paste body
function ypSlideOutMenu(id, dir, left, top, width, height) //this function is in a .js in the same dir.. it works
{
	this.ie  = document.all ? 1 : 0
	this.ns4 = document.layers ? 1 : 0
	this.dom = document.getElementById ? 1 : 0
 
	if (this.ie || this.ns4 || this.dom) {
		this.id			 = id
		this.dir		 = dir
		this.orientation = dir == "left" || dir == "right" ? "h" : "v"
		this.dirType	 = dir == "right" || dir == "down" ? "-" : "+"
		this.dim		 = this.orientation == "h" ? width : height
		this.hideTimer	 = false
		this.aniTimer	 = false
		this.open		 = false
		this.over		 = false
		this.startTime	 = 0
 
		// global reference to this object
		this.gRef = "ypSlideOutMenu_"+id
		eval(this.gRef+"=this")
 
		// add this menu object to an internal list of all menus
		ypSlideOutMenu.Registry[id] = this
 
		var d = document
                      //GET REAL POS OF OBJECT
		if (id == "menu1") {
                FOOBAR=document.getElementById(id);
                BARFOO=findpos(FOOBAR);
                BARFOO_LEFT=BARFOO[0];
}



//left = alert(document.images.livingbiographies.x); //doesnt alert, whats up with this?
		d.write('<style type="text/css">')
		d.write('#' + this.id + 'Container { visibility:hidden; ')
		d.write('left:' + BARFOO[0] + 'px; ')
//d.write('left:' + left + 'px; ')
                d.write('top:' + BARFOO[1] + 'px; ')
//d.write('top:' + top + 'px; ')
		d.write('overflow:hidden; }')
		d.write('#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; ')
		d.write('width:' + width + 'px; ')
		d.write('height:' + height + 'px; ')
		d.write('clip:rect(0 ' + width + ' ' + height + ' 0); ')
		d.write('}')
		d.write('</style>')
 
		this.load()
	}
}
///YOU OWN ME MONEY!!

function findPos(obj) {
	
				var curleft = curtop = 0;
				if (obj.offsetParent) {
					curleft = obj.offsetLeft
					curtop = obj.offsetTop
					while (obj = obj.offsetParent) {
						curleft += obj.offsetLeft
						curtop += obj.offsetTop
					}
				}
				return [curleft,curtop];
	
}