All pastes #765218 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-11-07 21:46 UTC
rendered paste body
function random_ADA(){
  var myimages=new Array()
  myimages[1]="img/ada01_1.jpg"
  myimages[2]="img/ada01_2.jpg"

  var ry=Math.floor(Math.random()*myimages.length)

  if (ry==0)
     ry=1
     document.write('<img src="'+myimages[ry]+'">')
}
function random_MAN(){
  var myimages=new Array()
  myimages[1]="img/man01_1.jpg"
  myimages[2]="img/man01_2.jpg"

  var ry=Math.floor(Math.random()*myimages.length)

  if (ry==0)
     ry=1
     document.write('<img src="'+myimages[ry]+'">')
}
function random_WHY(){
  var myimages=new Array()
  myimages[1]="img/why01_1.jpg"
  myimages[2]="img/why01_2.jpg"

  var ry=Math.floor(Math.random()*myimages.length)

  if (ry==0)
     ry=1
     document.write('<img src="'+myimages[ry]+'">')
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// scrolling down to anchor links
Event.observe(window, 'load', function() {
  $$('a.anchorlink').each(function(element) {
    element.observe('click', function(event) {
      new Effect.ScrollTo(this.hash.substr(1), {duration: .2});
	  //new Effect.Highlight(this.hash.substr(1), {startcolor:'#ff99ff', endcolor:'#999999', restorecolor:'#ff99ff'})
      Event.stop(event);
    }.bindAsEventListener(element))
  })
});

// highlighting anchor links
Event.observe(window, 'load', function() {
		myhighlighter = new AnchorHighlighter('a.anchorlink', 'div.anchor', '#ffffff', '#93c630', '#000000', '#ffffff');
	}
);

AnchorHighlighter = Class.create();
AnchorHighlighter.prototype = {
	lastAnchor: null,
				
	initialize: function(linkclass, anchorclass, startcolor, endcolor, startfont, endfont) {
		this.anchors = $$(anchorclass);
		this.startcolor = startcolor;
		this.endcolor = endcolor;
		this.startfont = startfont;
		this.endfont = endfont;
		
		$$(linkclass).each(function(e) {
			Event.observe(e, 'click', this.highlight.bindAsEventListener(this));
		}.bind(this));				
	},
	
	highlight: function(event) {
		var element = $(Event.element(event));
		var name = element.href.substr(element.href.indexOf('#')+1);
		this.anchors.each(function(e) {
			if(e.id == name)
			{
				if(this.lastAnchor != null && this.lastAnchor.id != e.id)
				{
					this.lastAnchor.setStyle({color: this.startfont});							
					var oldchange = new Effect.Highlight(this.lastAnchor, {startcolor: this.endcolor, endcolor: this.startcolor, restorecolor: this.startcolor});
				}
				
				e.setStyle({color: this.endfont});
				var newchange = new Effect.Highlight(e, {startcolor: this.startcolor, endcolor: this.endcolor, restorecolor: this.endcolor});
									
				this.lastAnchor = e;
				delete newchange;
				delete oldchange;
				throw $break;
			}
		}.bind(this));
	}			
};