/*
---------------------------------------------------------
	bundle.js ver 1.0 [2008/8/20] 
	*http://higash.net/20080820/bundljs.html
---------------------------------------------------------
*/

jQuery.noConflict();

/*
---------------------------------------------------------
	smartRollover
	*Modify smartRollover.js
	*http://css-happylife.com/log/javascript/000157.shtml
---------------------------------------------------------
*/
function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");
	        var preImages = new Array();

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_off.")) {
				var preImage = new Image();
				preImage.src = images[i].getAttribute("src").replace("_off.", "_on.");
				preImages.push(preImage);
				images[i].onmouseover = function() {
				this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
				}
				images[i].onmouseout = function() {
				this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
				}
			}
		}
	}
}

/*
---------------------------------------------------------
	inputColorInit
	*Modify colorful.js
	*http://espion.just-size.jp/archives/05/231211111.html
---------------------------------------------------------
*/
var colorful = new ColorfulInput;
var inputColorInit = function() {
   colorful.set();
}
function ColorfulInput() {
  this.skip  = ['button','checkbox','radio','search','submit'];
  this.skip_id = ['s'];
  this.color = { 'blur': '', 'focus': '#fffbcc' };
  this.set = function() {
    var i;
    for (i = 0; i < document.forms.length; i++) {
      for (var f = 0; f < document.forms[i].length; f++) {
        var elm = document.forms[i][f];
        if(!this._checkSkip(elm)) continue;
        this._setColor(elm, 'focus');
        this._setColor(elm, 'blur');
      }     
    }
  };
  this._checkSkip = function(elm) {
    var i;
    for(i in this.skip) {
      if(elm.type == this.skip[i]) return false;
    }
    for(i in this.skip_id) {
      if(elm.id == this.skip_id[i]) return false;
    }
    return true;
  };
  this._setColor = function(elm, type) { 
    var i;
    var color = this.color[type];
    var event = function() { elm.style.backgroundColor = color; };

    if(elm.addEventListener) {
      elm.addEventListener(type, event, false); 
    } else if(elm.attachEvent) {
      elm.attachEvent('on'+type, event); 
    } else {
      elm['on'+type] = event;
    }
  };
}

/*
---------------------------------------------------------
	Auto-striped table
	*Modify http://www.wellstyled.com/files/css-striped-tables/example02.html
	*http://www.wellstyled.com/css-striped-tables.html
---------------------------------------------------------
*/
function init() {
	stripeAllTables();
//	stripeTableById('#');
	}
function stripeTable(t) {
	var i, odd = true;
	for (i=0; i<t.rows.length; i++) {
		t.rows[i].className += odd ? ' odd' : ' even';
		odd = !odd;
		}
	}
function stripeTableById(id) {
	var t = document.getElementById(id);
	if (t) stripeTable(t);
	}
function stripeAllTables() {
	var t = document.getElementsByTagName('TABLE');
	for (var i=0; i<t.length; i++) stripeTable(t[i])
	}

/*
---------------------------------------------------------
	Smooth scrolling
	*Changes links that link to other parts of this page to scroll
	*smoothly to those links rather than jump to them directly, which
	*can be a little disorienting.
	
	*sil, http://www.kryogenix.org/
	
	*v1.0 2003-11-11
	*v1.1 2005-06-16 wrap it up in an object
---------------------------------------------------------
*/
var ss = {
  fixAllLinks: function() {
    // Get a list of all links in the page
    var allLinks = document.getElementsByTagName('a');
    // Walk through the list
    for (var i=0;i<allLinks.length;i++) {
      var lnk = allLinks[i];
      if ((lnk.href && lnk.href.indexOf('#') != -1) && 
          ( (lnk.pathname == location.pathname) ||
	    ('/'+lnk.pathname == location.pathname) ) && 
          (lnk.search == location.search)) {
        // If the link is internal to the page (begins in #)
        // then attach the smoothScroll function as an onclick
        // event handler
        ss.addEvent(lnk,'click',ss.smoothScroll);
      }
    }
  },
  smoothScroll: function(e) {
    // This is an event handler; get the clicked on element,
    // in a cross-browser fashion
    if (window.event) {
      target = window.event.srcElement;
    } else if (e) {
      target = e.target;
    } else return;
    // Make sure that the target is an element, not a text node
    // within an element
    if (target.nodeName.toLowerCase() != 'a') {
      target = target.parentNode;
    }
    // Paranoia; check this is an A tag
    if (target.nodeName.toLowerCase() != 'a') return;
    // Find the <a name> tag corresponding to this href
    // First strip off the hash (first character)
    anchor = target.hash.substr(1);
    // Now loop all A tags until we find one with that name
    var allLinks = document.getElementsByTagName('a');
    var destinationLink = null;
    for (var i=0;i<allLinks.length;i++) {
      var lnk = allLinks[i];
      if (lnk.name && (lnk.name == anchor)) {
        destinationLink = lnk;
        break;
      }
    }
    if (!destinationLink) destinationLink = document.getElementById(anchor);
    // If we didn't find a destination, give up and let the browser do
    // its thing
    if (!destinationLink) return true;
    // Find the destination's position
    var destx = destinationLink.offsetLeft; 
    var desty = destinationLink.offsetTop;
    var thisNode = destinationLink;
    while (thisNode.offsetParent && 
          (thisNode.offsetParent != document.body)) {
      thisNode = thisNode.offsetParent;
      destx += thisNode.offsetLeft;
      desty += thisNode.offsetTop;
    }
    // Stop any current scrolling
    clearInterval(ss.INTERVAL);
    cypos = ss.getCurrentYPos();
    ss_stepsize = parseInt((desty-cypos)/ss.STEPS);
    ss.INTERVAL =
setInterval('ss.scrollWindow('+ss_stepsize+','+desty+',"'+anchor+'")',10);
    // And stop the actual click happening
    if (window.event) {
      window.event.cancelBubble = true;
      window.event.returnValue = false;
    }
    if (e && e.preventDefault && e.stopPropagation) {
      e.preventDefault();
      e.stopPropagation();
    }
  },
  scrollWindow: function(scramount,dest,anchor) {
    wascypos = ss.getCurrentYPos();
    isAbove = (wascypos < dest);
    window.scrollTo(0,wascypos + scramount);
    iscypos = ss.getCurrentYPos();
    isAboveNow = (iscypos < dest);
    if ((isAbove != isAboveNow) || (wascypos == iscypos)) {
      // if we've just scrolled past the destination, or
      // we haven't moved from the last scroll (i.e., we're at the
      // bottom of the page) then scroll exactly to the link
      window.scrollTo(0,dest);
      // cancel the repeating timer
      clearInterval(ss.INTERVAL);
      // and jump to the link directly so the URL's right
      location.hash = anchor;
    }
  },
  getCurrentYPos: function() {
    if (document.body && document.body.scrollTop)
      return document.body.scrollTop;
    if (document.documentElement && document.documentElement.scrollTop)
      return document.documentElement.scrollTop;
    if (window.pageYOffset)
      return window.pageYOffset;
    return 0;
  },
  addEvent: function(elm, evType, fn, useCapture) {
    // addEvent and removeEvent
    // cross-browser event handling for IE5+,  NS6 and Mozilla
    // By Scott Andrew
    if (elm.addEventListener){
      elm.addEventListener(evType, fn, useCapture);
      return true;
    } else if (elm.attachEvent){
      var r = elm.attachEvent("on"+evType, fn);
      return r;
    } else {
      alert("Handler could not be removed");
    }
  } 
}
ss.STEPS = 25;

/*
	Offspring.js -- adds the following classes as needed:

		.first-child
		.last-child
		.only-child
		.nth-child-odd
		.nth-child-even
		.nth-child-##
		
	Configuration:
	
	Offspring can be configured by defining an "offspringConfiguration" 
	object before referencing offspring.js. That object can contain
	one or more of these parameters. (If any parameter is omitted -- which
	is fine -- it gets the default value as described below.) 
	
	offspringConfiguration = 
	{
		runningMode: 'full',                        <-- valid values are 'full' and 'light' (default: 'full')
		autoStart: true,                            <-- valid values are true and false (default: true)
		shouldRemoveOldOffspringClassesFirst: false <-- valid values are true and false (default: false)
	}
	
	* runningMode: 
		'full' -- Offspring applies all of its classes (as listed at the very top) [default]
		'light' -- Offspring only applies 'first-child', 'last-child', and 'only-child',
					omitting 'nth-child-odd', 'nth-child-even', and 'nth-child-##'.
					(This may allow for faster page-processing in certain scenarios.)
					
	* autoStart:
		true -- Offspring runs automatically as soon as the DOM is ready [default]
		false -- Offspring must be run manually. This can be done by calling Offspring.start();
		
	* shouldRemoveOldOffspringClassesFirst:
		true --Offspring first removes any old Offspring classes before applying the new ones.
				(This might be of use if Offspring is to be called on a page that has already
				been processed, such as if a table has been sorted or content has been loaded
				via Ajax.)
		false -- Offspring applies its classes without first removing old Offspring classes that
				might be there. Unless you're doing fancy DOM updates, this is probably the
				better option in most cases. [default]

	================================================================== */


var offspring = {
	firstChildClass: "first-child",
	lastChildClass:  "last-child",
	oddChildClass:   "nth-child-odd",
	evenChildClass:  "nth-child-even",
	onlyChildClass:  "only-child",
	nthChildClassPrefix:   "nth-child-",

	classNamesArray: [],
	classNameSubstringsArray: [],

	cacheLevel: 0, // current size of the classNames cache

	nthChildren: [],

	regularHashTable: [],
	regularHashTableArray: [],

	lastChildHashTable: [],
	lastChildHashTableArray: [],

	/* Configuration defaults */
	configuration:
	{
		runningMode: 'full', /* Possible values: 'full' / 'light' */
		autoStart: true, /* If Offspring is configured in autoStart mode (which it is by default),
		 					it runs as soon as the DOM is ready */
		shouldRemoveOldOffspringClassesFirst: false /* If this is set to 'true', Offspring first
														removes any old Offspring-related classes
														before applying the new ones */
	},

	// Initialize
	init: function() {

		/*
			Offspring's configuration is stored in Offspring.configuration, but
			that con be overridden by users by defining an "offspringConfiguratin"
			object.
		*/
		if (typeof offspringConfiguration != "undefined")
		{
			for (var configParameter in offspringConfiguration)
			{
				this.configuration[configParameter] = offspringConfiguration[configParameter];
			}

			// Make sure this option is stored in lowercase
			this.configuration.runningMode = this.configuration.runningMode.toLowerCase();
		}


		/* Set the values for classNamesArray & classNameSubstringArray */

		switch (this.configuration.runningMode)
		{
			case 'full':
				// this represents all possible offspring-related classnames
				this.classNamesArray = [this.firstChildClass, this.lastChildClass, this.oddChildClass, this.evenChildClass, this.onlyChildClass];

				// this represents a list of substrings to match such as for removing classNames
				this.classNameSubstringsArray = [this.nthChildClassPrefix];
				break;

			case 'light':
				// this represents all possible offspring-related classnames
				this.classNamesArray = [this.firstChildClass, this.lastChildClass, this.onlyChildClass];

				// this represents a list of substrings to match such as for removing classNames
				this.classNameSubstringsArray = [];
				break;
		}

		// Define the iterator function on-the-fly depending
		// on the configuration options that were sent in
		this.defineTraverseChildrenFunction();

		// Define the fillCacheTo funtion's iterator on-the-fly
		// depending on the configuration options that were sent in
		this.defineFillCacheToFunction();
		this.fillCacheTo(); // seed the cache with a basic set of values

 
		/* If Offspring is configured in autoStart mode (which it is by default),
		 	it runs as soon as the DOM is ready */
		if (this.configuration.autoStart)
		{
			var _this = this; // Closure

			this.ContentLoaded(window, function() {
				_this.start();
			});			
		}

	},

	// Executed once the page has loaded
	start: function() {
		var startTime = new Date();

		this.traverseChildren(document.getElementsByTagName("body")[0]);

		var endTime = new Date();
		// alert("Offspring Exec time: " + (endTime.getTime() - startTime.getTime()) + "ms");
		// window.status += "Offspring Exec time: " + (endTime.getTime() - startTime.getTime()) + "ms";

	},

	/* Maintenance note for defineTraverseChildrenFunction:
	
		There are several blocks of code that are marked off as "traverseChildren.A"
		or "traverseChildren.B" -- each of these are identical, respectively. (That is,
		all "traverseChildren.A" blocks are the same and all "traverseChildren.B" are 
		the same.) 
		
		So, why not just create a function where the code can be kept in one place? 
		While normally a sensible idea, I decided against that approach only so 
		that the speed hits associated with the creation of the function stack
		could be averted. At the same time, I didn't want to compromise
		the code's maintainability; so, if any block needs to be updated, they
		can all be kept in sync with some basic copy-n-pasting from one 
		block to the next.
	*/


	/* This defines the internal iterator function on-the-fly,
		depending on the configuration options */
	defineTraverseChildrenFunction: function() {

		switch (this.configuration.shouldRemoveOldOffspringClassesFirst)
		{
			case true: // shouldRemoveOldOffspringClassesFirst is true

				switch (this.configuration.runningMode)
				{
					case 'full': // 'full' running mode and shouldRemoveOldOffspringClassesFirst is true
						this.traverseChildren = function(parent)
						{
							/* ============= Begin Code Block "traverseChildren.A" ================ */

								// If the node has no children, exit
								if (!parent.childNodes.length) return;


								/* First, gather up all the element nodes */
								var childElementNodes = [];

								var testNode = parent.childNodes[0]; // initialize

								while (testNode)
								{
									if (testNode.nodeType == 1)
									{
										childElementNodes.push(testNode);
									}
									testNode = testNode.nextSibling;
								}

								/*
									empty this variable to ensure that the JavaScript
									interpreter doesn't have to update the variable's
									nodelist as DOM changes are made
								*/
								testNode = null;

								var childElementNodesLength = childElementNodes.length;

								// If no element nodes were found, exit
								if (!childElementNodesLength) return;

								// Make sure that the CSS-classnames cache has enough entries to cover
								// the number of child nodes
								if (childElementNodesLength > this.cacheLevel)
								{
									this.fillCacheTo(childElementNodesLength);
								}

								var lastIndex = childElementNodesLength - 1; // index of the last element node

							/* ============= /End Code Block "traverseChildren.A" ================ */

							// First, take care of all but the last element
							for (var i = 0; i < lastIndex; i++)
							{
								var currentElement = childElementNodes[i];

								this.removeMultipleClassNames(currentElement, this.classNamesArray, this.classNameSubstringsArray);

								// argument syntax: node to act upon, current index, boolean for whether isLast
								this._addOffspringClassNames(currentElement, i, false);
								this.traverseChildren(currentElement);
							}

							currentElement = null; // prevent memory leaks

							// Then, take care of the last one
							var lastElement = childElementNodes[lastIndex];

							this.removeMultipleClassNames(lastElement, this.classNamesArray, this.classNameSubstringsArray);

							this._addOffspringClassNames(lastElement, lastIndex, true);
							this.traverseChildren(lastElement);

							lastElement = null; // prevent memory leaks

							/* ============= Begin Code Block "traverseChildren.B" ================ */

								// prevent memory leaks
								lastElement = null;
								parent = null;

							/* ============= /End Code Block "traverseChildren.B" ================ */

						}; // end of traverseChildren function definition
						break;

					case 'light': // 'light' running mode and shouldRemoveOldOffspringClassesFirst is true
						this.traverseChildren = function(parent)
						{
							/* ============= Begin Code Block "traverseChildren.A" ================ */

								// If the node has no children, exit
								if (!parent.childNodes.length) return;


								/* First, gather up all the element nodes */
								var childElementNodes = [];

								var testNode = parent.childNodes[0]; // initialize

								while (testNode)
								{
									if (testNode.nodeType == 1)
									{
										childElementNodes.push(testNode);
									}
									testNode = testNode.nextSibling;
								}

								/*
									empty this variable to ensure that the JavaScript
									interpreter doesn't have to update the variable's
									nodelist as DOM changes are made
								*/
								testNode = null;

								var childElementNodesLength = childElementNodes.length;

								// If no element nodes were found, exit
								if (!childElementNodesLength) return;

								// Make sure that the CSS-classnames cache has enough entries to cover
								// the number of child nodes
								if (childElementNodesLength > this.cacheLevel)
								{
									this.fillCacheTo(childElementNodesLength);
								}

								var lastIndex = childElementNodesLength - 1; // index of the last element node

							/* ============= /End Code Block "traverseChildren.A" ================ */

							switch (childElementNodesLength)
							{
								case 0: return;
										break;

								case 1:
									/* Take care of the only element */

									var onlyElement = childElementNodes[0];
									this.removeMultipleClassNames(onlyElement, this.classNamesArray, this.classNameSubstringsArray);

									// argument syntax: node to act upon, current index, boolean for whether isLast
									this._addOffspringClassNames( onlyElement, lastIndex, true );

									onlyElement = null; // prevent memory leaks

									break;

								default:
									/* Take care of the first element */

									var firstElement = childElementNodes[0];
									this.removeMultipleClassNames(firstElement, this.classNamesArray, this.classNameSubstringsArray);

									// argument syntax: node to act upon, current index, boolean for whether isLast
									this._addOffspringClassNames( firstElement, 0, false );

									firstElement = null; // prevent memory leaks

									/* Take care of the last element */

									var lastElement = childElementNodes[lastIndex];
									this.removeMultipleClassNames(lastElement, this.classNamesArray, this.classNameSubstringsArray);

									// argument syntax: node to act upon, current index, boolean for whether isLast
									this._addOffspringClassNames( lastElement , lastIndex, true );

									lastElement = null; // prevent memory leaks

									break;

							} // end of switch statement for childElementNodesLength

							// Lastly, loop over all the childern elements
							for (var i = 0; i < childElementNodesLength; i++)
							{
								this.traverseChildren( childElementNodes[i] );
							}

							/* ============= Begin Code Block "traverseChildren.B" ================ */

								// prevent memory leaks
								lastElement = null;
								parent = null;

							/* ============= /End Code Block "traverseChildren.B" ================ */

						}; // end of traverseChildren function definition

						break;

				} // end of switch-statement for configuration.runningMode

				break;

			case false: // shouldRemoveOldOffspringClassesFirst is false

				switch (this.configuration.runningMode)
				{
					case 'full': // 'full' running mode and shouldRemoveOldOffspringClassesFirst is false
						this.traverseChildren = function(parent)
						{
							/* ============= Begin Code Block "traverseChildren.A" ================ */

								// If the node has no children, exit
								if (!parent.childNodes.length) return;


								/* First, gather up all the element nodes */
								var childElementNodes = [];

								var testNode = parent.childNodes[0]; // initialize

								while (testNode)
								{
									if (testNode.nodeType == 1)
									{
										childElementNodes.push(testNode);
									}
									testNode = testNode.nextSibling;
								}

								/*
									empty this variable to ensure that the JavaScript
									interpreter doesn't have to update the variable's
									nodelist as DOM changes are made
								*/
								testNode = null;

								var childElementNodesLength = childElementNodes.length;

								// If no element nodes were found, exit
								if (!childElementNodesLength) return;

								// Make sure that the CSS-classnames cache has enough entries to cover
								// the number of child nodes
								if (childElementNodesLength > this.cacheLevel)
								{
									this.fillCacheTo(childElementNodesLength);
								}

								var lastIndex = childElementNodesLength - 1; // index of the last element node

							/* ============= /End Code Block "traverseChildren.A" ================ */

							// First, take care of all but the last element
							for (var i = 0; i < lastIndex; i++)
							{
								var currentElement = childElementNodes[i];

								// argument syntax: node to act upon, current index, boolean for whether isLast
								this._addOffspringClassNames(currentElement, i, false);
								this.traverseChildren(currentElement);
							}

							currentElement = null; // prevent memory leaks

							/*
								Then, take care of the last one
								(this set of code isn't integrated into
								the for-loop above so as to avoid having
								an addiitional if-statement inside there)
							*/
							var lastElement = childElementNodes[lastIndex];

							this._addOffspringClassNames(lastElement, lastIndex, true);
							this.traverseChildren(lastElement);
							lastElement = null; // prevent memory leaks

							/* ============= Begin Code Block "traverseChildren.B" ================ */

								// prevent memory leaks
								lastElement = null;
								parent = null;

							/* ============= /End Code Block "traverseChildren.B" ================ */

						}; // end of traverseChildren function definition
						break;

					case 'light': // 'light' running mode and shouldRemoveOldOffspringClassesFirst is false
						this.traverseChildren = function(parent)
						{
							/* ============= Begin Code Block "traverseChildren.A" ================ */

								// If the node has no children, exit
								if (!parent.childNodes.length) return;


								/* First, gather up all the element nodes */
								var childElementNodes = [];

								var testNode = parent.childNodes[0]; // initialize

								while (testNode)
								{
									if (testNode.nodeType == 1)
									{
										childElementNodes.push(testNode);
									}
									testNode = testNode.nextSibling;
								}

								/*
									empty this variable to ensure that the JavaScript
									interpreter doesn't have to update the variable's
									nodelist as DOM changes are made
								*/
								testNode = null;

								var childElementNodesLength = childElementNodes.length;

								// If no element nodes were found, exit
								if (!childElementNodesLength) return;

								// Make sure that the CSS-classnames cache has enough entries to cover
								// the number of child nodes
								if (childElementNodesLength > this.cacheLevel)
								{
									this.fillCacheTo(childElementNodesLength);
								}

								var lastIndex = childElementNodesLength - 1; // index of the last element node

							/* ============= /End Code Block "traverseChildren.A" ================ */

							switch (childElementNodesLength)
							{
								case 0: break;

								case 1:
									/* Take care of the only element */

									// argument syntax: node to act upon, current index, boolean for whether isLast
									this._addOffspringClassNames( childElementNodes[0], lastIndex, true );

									// Lastly, loop over all the childern elements
									for (var i = 0; i < childElementNodesLength; i++)
									{
										this.traverseChildren( childElementNodes[i] );
									}

									break;

								default:
									/* Take care of the first element */

									// argument syntax: node to act upon, current index, boolean for whether isLast
									this._addOffspringClassNames( childElementNodes[0], 0, false );

									/* Take care of the last element */

									// argument syntax: node to act upon, current index, boolean for whether isLast
									this._addOffspringClassNames( childElementNodes[lastIndex] , lastIndex, true );

									// Lastly, loop over all the childern elements
									for (var i = 0; i < childElementNodesLength; i++)
									{
										this.traverseChildren( childElementNodes[i] );
									}

									break;
							}

							/* ============= Begin Code Block "traverseChildren.B" ================ */

								// prevent memory leaks
								lastElement = null;
								parent = null;

							/* ============= /End Code Block "traverseChildren.B" ================ */

						}; // end of traverseChildren function definition

						break;
				} // end of switch-statement for configuration.runningMode

				break;

		} // end of switch-statement for configuration.shouldRemoveOldOffspringClassesFirst

	}, // end of defineTraverseChildrenFunction

	// Recursive

	/*
		If "shouldRemoveOldOffspringClassesFirst" is deined and set to true
	 	(it's optional), traverseChildren will remove old Offspring-related
	 	classes before applying new ones to a node. This could be useful
	 	for reapplying classes if the DOM is rejiggered.
	*/

	traverseChildren: function(parent) {

		/* ============= Begin Code Block "traverseChildren.A" ================ */

			// If the node has no children, exit
			if (!parent.childNodes.length) return;


			/* First, gather up all the element nodes */
			var childElementNodes = [];

			var testNode = parent.childNodes[0]; // initialize

			while (testNode)
			{
				if (testNode.nodeType == 1)
				{
					childElementNodes.push(testNode);
				}
				testNode = testNode.nextSibling;
			}

			/*
				empty this variable to ensure that the JavaScript
				interpreter doesn't have to update the variable's
				nodelist as DOM changes are made
			*/
			testNode = null;

			var childElementNodesLength = childElementNodes.length;

			// If no element nodes were found, exit
			if (!childElementNodesLength) return;

			// Make sure that the CSS-classnames cache has enough entries to cover
			// the number of child nodes
			if (childElementNodesLength > this.cacheLevel)
			{
				this.fillCacheTo(childElementNodesLength);
			}

			var lastIndex = childElementNodesLength - 1; // index of the last element node

		/* ============= /End Code Block "traverseChildren.A" ================ */


		/* ==== Add the classes ====== */

		this._childrenIterator(childElementNodes, childElementNodesLength, lastIndex);


		/* ============= Begin Code Block "traverseChildren.B" ================ */

			// prevent memory leaks
			lastElement = null;
			parent = null;

		/* ============= /End Code Block "traverseChildren.B" ================ */

	},

	/*
		This function adds the Offspring classnames to a given element,
		given its position among it siblings (with zero being "first")
		and whether it's the last element in its set.
	*/
	_addOffspringClassNames: function(element, index, isLastElement) {

		index++; // normalize since the arrays are indexed with a "1" starting point

		// Steps if the element has no existing classnames...

		if ((!element.className) || (!element.className.length))
		{
			switch (isLastElement)
			{
				case false: // it isn't the last element
						element.className = this.regularHashTable[index];
						return;
						break;

				case true: // it is the last element
				 		element.className = this.lastChildHashTable[index];
						return;
						break;

			} // end of isLastElement switch-statement

		} // end of if-statement for checking whether the element has no existing className

		// At this point, the incoming element already has className(s)

		switch (isLastElement)
		{
			case false: // it isn't the last element
					var applicableClassNames = this.regularHashTableArray[index];
					break;

			case true: // it is the last element
					var applicableClassNames = this.lastChildHashTableArray[index];
					break;

		} // end of isLastElement switch-statement

		var originalClassNames = element.className.split(' ');

		var classNamesToAdd = originalClassNames; // initialize

		for (var i = 0, applicableClassNamesLength = applicableClassNames.length; i < applicableClassNamesLength; i++)
		{
			var alreadyThere = false; // boolean for whether a given class name is already assigned to the element

			var testApplicableClassName = applicableClassNames[i];

			for (var j = 0, originalClassNamesLength = originalClassNames.length; j < originalClassNamesLength; j++)
			{
				if (originalClassNames[j] == testApplicableClassName)
				{
					alreadyThere = true;
					break;
				} // end of if-statement for checking if the element already has a given className

			} // end of the originalClassNames for-loop

			if (!alreadyThere)
			{
				classNamesToAdd.push(testApplicableClassName);
			}

		} // end of applicableClassNames for-loop


		// Then, after checking over the element's existing classNames, add the new version
		element.className = classNamesToAdd.join(' ');
		element = null; // prevent memory leaks

		return;

	}, // end of _addOffspringClassNames()

	/* Maintenance note for defineFillCacheToFunction:
	
		[Aside: This is basically conveys the same idea as the comment above 
		defineTraverseChildrenFunction. So, if you're read that one, you 
		probably already have the basic idea of what's going on here.]
	
		There are several blocks of code that are marked off as "fillCacheTo.A"
		or "fillCacheTo.B" -- each of these are identical, respectively. (That is,
		all "fillCacheTo.A" blocks are the same and all "fillCacheTo.B" are 
		the same.) 
		
		So, why not just create a function where the code can be kept in one place? 
		While normally a sensible idea, I decided against that approach only so 
		that the speed hits associated with the creation of the function stack
		could be averted. At the same time, I didn't want to compromise
		the code's maintainability; so, if any block needs to be updated, they
		can all be kept in sync with some basic copy-n-pasting from one 
		block to the next.
	*/


	/* This defines the internal loop function for fillCacheTo,
		depending on how the configuration options are set */
	defineFillCacheToFunction: function() {

		switch (this.configuration.runningMode)
		{
			case 'full': // 'full' running mode
				this.fillCacheTo = function(fillAmount)
				{
					/* ============= Begin Code Block "fillCacheTo.A" ================ */

						var fillAmount = fillAmount || 15; // default value

						if (!this.cacheLevel) this.cacheLevel = 0; // set this to a default value if needed

						// If the cache level is already full enough, exit
						if (this.cacheLevel >= fillAmount) return;

						var startingPoint = this.cacheLevel++;

					/* ============= /End Code Block "fillCacheTo.A" ================ */

					var isOdd = !((startingPoint % 2) == 0); // initialize

					// cache these object name resolutions
					var firstChildClass = this.firstChildClass;
					var lastChildClass = this.lastChildClass;
					var oddChildClass = this.oddChildClass;
					var evenChildClass = this.evenChildClass;
					var onlyChildClass = this.onlyChildClass;
					var nthChildClassPrefix = this.nthChildClassPrefix;

					for (var i = startingPoint; i <= fillAmount; i++)
					{
						this.nthChildren[i] = [nthChildClassPrefix, i].join('');

						var nthChildrenI = this.nthChildren[i]; // cache this look-up

						switch (i)
						{
							case 1:
									this.regularHashTableArray[i] = [firstChildClass, oddChildClass, nthChildrenI];
									this.lastChildHashTableArray[i] = [firstChildClass, oddChildClass, onlyChildClass, nthChildrenI, lastChildClass];
									break;

							default:
									switch (isOdd)
									{
										case true: // "odd" is true
												this.regularHashTableArray[i] = [oddChildClass, nthChildrenI];
												this.lastChildHashTableArray[i] = [oddChildClass, nthChildrenI, lastChildClass];
												break;

										case false: // "odd" is false
												this.regularHashTableArray[i] = [evenChildClass, nthChildrenI];
												this.lastChildHashTableArray[i] = [evenChildClass, nthChildrenI, lastChildClass];
												break;

									} // end of isOdd switch-statement


						} // end of switch-statement for i

						// Now make the joined versions for a given "i"

						this.regularHashTable[i] = this.regularHashTableArray[i].join(' ');
						this.lastChildHashTable[i] = this.lastChildHashTableArray[i].join(' ');

						isOdd = !isOdd; // flip the isOdd flag

					} // end of filling for-loop

					/* ============= Begin Code Block "fillCacheTo.B" ================ */

						// If it got this far, the cacheLevel must made it to the fill amount, so update that
						this.cacheLevel = fillAmount;

					/* ============= /End Code Block "fillCacheTo.B" ================ */

				}; // end of fillCacheTo function definition
				break;

			case 'light': // 'light' running mode
				this.fillCacheTo = function(fillAmount)
				{
					/* ============= Begin Code Block "fillCacheTo.A" ================ */

						var fillAmount = fillAmount || 15; // default value

						if (!this.cacheLevel) this.cacheLevel = 0; // set this to a default value if needed

						// If the cache level is already full enough, exit
						if (this.cacheLevel >= fillAmount) return;

						var startingPoint = this.cacheLevel++;

					/* ============= /End Code Block "fillCacheTo.A" ================ */

					// cache these object name resolutions
					var firstChildClass = this.firstChildClass;
					var lastChildClass = this.lastChildClass;

					var onlyChildClass = this.onlyChildClass;

					for (var i = startingPoint; i <= fillAmount; i++)
					{

						switch (i)
						{
							case 1:
									this.regularHashTableArray[i] = [firstChildClass];
									this.lastChildHashTableArray[i] = [firstChildClass, onlyChildClass, lastChildClass];
									break;

							default:

									this.regularHashTableArray[i] = [];
									this.lastChildHashTableArray[i] = [lastChildClass];

						} // end of switch-statement for i

						// Now make the joined versions for a given "i"

						this.regularHashTable[i] = this.regularHashTableArray[i].join(' ');
						this.lastChildHashTable[i] = this.lastChildHashTableArray[i].join(' ');

					} // end of filling for-loop

					/* ============= Begin Code Block "fillCacheTo.B" ================ */

						// If it got this far, the cacheLevel must made it to the fill amount, so update that
						this.cacheLevel = fillAmount;

					/* ============= /End Code Block "fillCacheTo.B" ================ */

				}; // end of fillCacheTo function definition
				break;

		} // end of switch statement for this.configuration.runningMode

	}, // end of defineFillCacheToFunction

	// This fills the className caches to the specified amount
	fillCacheTo: function(fillAmount) {

		/* ============= Begin Code Block "fillCacheTo.A" ================ */

			var fillAmount = fillAmount || 15; // default value

			if (!this.cacheLevel) this.cacheLevel = 0; // set this to a default value if needed

			// If the cache level is already full enough, exit
			if (this.cacheLevel >= fillAmount) return;

			var startingPoint = this.cacheLevel++;

		/* ============= /End Code Block "fillCacheTo.A" ================ */

		this._fillCacheToIterator(startingPoint, fillAmount);

		/* ============= Begin Code Block "fillCacheTo.B" ================ */

			// If it got this far, the cacheLevel must made it to the fill amount, so update that
			this.cacheLevel = fillAmount;

		/* ============= /End Code Block "fillCacheTo.B" ================ */

	}, // end of fillCacheTo()

	/* Returns true if testString is found in the array,
		or returns false otherwise */
	_checkIfStringFoundInArray: function(testString, testArray) {

		// Loop through all testArray[] and if/when there's a match, return true
		for (var i = 0, len=testArray.length; i < len; i++)
		{
			if (testString == testArray[i]) return true;
		}

		// If it got this far, it must not have found the string in the array
		return false;

	}, // end of _checkIfStringFoundInArray

	/* Returns true if the beginning of testString matches one of the substrings
		in the array. Otherwise, it returns false.

		For example, given the array ['plum', 'orange', 'pine'] and
		the testString 'pineapples', the function would return true. However,
		given the testString 'range', it would return false (since none of
		the strings in the array start with 'range')
	*/
	_checkIfStringMatchInSubstringArray: function(testString, testArray) {

		// Loop through all testArray[] and if/when there's a match, return true
		for (var i = 0, len=testArray.length; i < len; i++)
		{
			var currentArrayItem = testArray[i];

			/* string.substr() accepts two parameters:
				- The starting point of the substring
				- The length of the substring
			*/
			var testSubstring = testString.substr(0, currentArrayItem.length);

			if (testSubstring == currentArrayItem) return true;
		}

		// If it got this far, it must not have found the string in the array
		return false;

	}, // end of _checkIfStringMatchInSubstringArray

	/*
		This removes multiple classnames from an element. It does this by
		checking each of an element's class names against
		classNameStrings[] for an exact match and, if a given class name
		didn't match there, it's then checked to see if it matches
		as a substring against classNAmeSubstrings[].

		Of note, when comparing substrings, this intentionally only compares
		the beginning of the strings for a match. So, for example, "ora" would
		match as a substring of "orange", but "range" would not match as a substring
		of "orange". It was done this way because that was the only type of substring-
		comparison that was needed in this case, and a more thorough substring
		comparison would needlesslly use processor time.
	*/
	removeMultipleClassNames: function(element, classNameStrings, classNameSubstrings) {

		if (!element) return;
		var newClassName = '';
		var classNamesArray = element.className.split(' ');

    	for (var i = 0, len = classNamesArray.length; i < len; i++)
		{
			var currentClassName = classNamesArray[i];

			var isStringInClassNameStrings = this._checkIfStringFoundInArray(currentClassName, classNameStrings);

			if (isStringInClassNameStrings) continue;

			var isStringMatchingClassNameSubstrings = this._checkIfStringMatchInSubstringArray(currentClassName, classNameSubstrings);

			if (isStringMatchingClassNameSubstrings) continue;

			// If it got this far, it must not have matched any of the potential classNameStrings
			// or classNameRegexes, so add the current iteration to the neClassName

			if (i > 0) newClassName = newClassName + ' ';
    		newClassName = newClassName + currentClassName;

    	}
   		element.className = newClassName;

	}, // end of removeMultipleClassNames


	/*
	 *
	 * ContentLoaded.js
	 *
	 * Author: Diego Perini (diego.perini at gmail.com)
	 * Summary: Cross-browser wrapper for DOMContentLoaded
	 * Updated: 05/10/2007
	 * License: GPL/CC
	 * Version: 1.0
	 *
	 * http://javascript.nwbox.com/ContentLoaded/
	 *
	 * Notes:
	 *
	 *  based on code by Dean Edwards and John Resig
	 *  http://dean.edwards.name/weblog/2006/06/again/
	 *
	 *
	 */

	/*
	 * Example call, in this case:

	 	Offspring.ContentLoaded(window,
			function () {
				document.body.style.backgroundColor = 'green';
			}
		);
	*
	*/

	// @w	window reference
	// @f	function reference
	ContentLoaded: function (w, fn) {
		var d = w.document,
			u = w.navigator.userAgent.toLowerCase();

		function init(e) {
			if (!arguments.callee.done) {
				arguments.callee.done = true;
				fn(e);
			}
		}

		// konqueror/safari
		if (/khtml|webkit/.test(u)) {

			(function () {
				if (/complete|loaded/.test(d.readyState)) {
					init('poll');
				} else {
					setTimeout(arguments.callee, 10);
				}
			})();

		// internet explorer all versions
		} else if (/msie/.test(u) && !w.opera) {

			(function () {
				try {
					d.documentElement.doScroll('left');
				} catch (e) {
					setTimeout(arguments.callee, 10);
					return;
				}
				init('poll');
			})();
			d.attachEvent('onreadystatechange',
				function (e) {
					if (d.readyState == 'complete') {
						d.detachEvent('on'+e.type, arguments.callee);
						init(e.type);
					}
				}
			);

		// browsers having native DOMContentLoaded
		} else if (d.addEventListener &&
			(/gecko/.test(u) && parseFloat(u.split('rv:')[1]) >= 1.8) ||
			(/opera/.test(u) && parseFloat(u.split('opera ')[1]) > 9)) {

			d.addEventListener('DOMContentLoaded',
				function (e) {
					this.removeEventListener(e.type, arguments.callee, false);
					init(e.type);
				}, false
			);

		// fallback to last resort
		} else {

			// from Simon Willison
			var oldonload = w.onload;
			w.onload = function (e) {
				if (typeof oldonload == 'function') {
					oldonload(e || w.event);
				}
				init((e || w.event).type);
			};

		}
	} // end of ContentLoaded

}


// Kick off
offspring.init();

/*
 * jQuery.appear
 * http://code.google.com/p/jquery-appear/
 *
 * Copyright (c) 2009 Michael Hixson
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
*/
(function(jQuery) {
  
  jQuery.fn.appear = function(fn, options) {
    
    var settings = jQuery.extend({

      //arbitrary data to pass to fn
      data: undefined,

      //call fn only on the first appear?
      one: true 
      
    }, options);
    
    return this.each(function() {
    
      var t = jQuery(this);
      
      //whether the element is currently visible
      t.appeared = false;
      
      if (!fn) {

        //trigger the custom event
        t.trigger('appear', settings.data);
        return;
      }
      
      var w = jQuery(window);
      
      //fires the appear event when appropriate
      var check = function() {

        //is the element hidden?
        if (!t.is(':visible')) {
          
          //it became hidden
          t.appeared = false;
          return;
        }

        //is the element inside the visible window?
        var a = w.scrollLeft();
        var b = w.scrollTop();
        var o = t.offset();
        var x = o.left;
        var y = o.top;
        
        if (y + t.height() >= b && 
            y <= b + w.height() &&
            x + t.width() >= a && 
            x <= a + w.width()) {

          //trigger the custom event
          if (!t.appeared) t.trigger('appear', settings.data);
          
        } else {

          //it scrolled out of view
          t.appeared = false;
        }
      };

      //create a modified fn with some additional logic
      var modifiedFn = function() {
        
        //mark the element as visible
        t.appeared = true;

        //is this supposed to happen only once?
        if (settings.one) {

          //remove the check
          w.unbind('scroll', check);
          var i = jQuery.inArray(check, jQuery.fn.appear.checks);
          if (i >= 0) jQuery.fn.appear.checks.splice(i, 1);
        }

        //trigger the original fn
        fn.apply(this, arguments);
      };
      
      //bind the modified fn to the element
      if (settings.one) t.one('appear', settings.data, modifiedFn);
      else t.bind('appear', settings.data, modifiedFn);
      
      //check whenever the window scrolls
      w.scroll(check);
      
      //check whenever the dom changes
      jQuery.fn.appear.checks.push(check);
      
      //check now
      (check)();
    });
  };
  
  //keep a queue of appearance checks
  jQuery.extend(jQuery.fn.appear, {
    
    checks: [],
    timeout: null,

    //process the queue
    checkAll: function() {
      var length = jQuery.fn.appear.checks.length;
      if (length > 0) while (length--) (jQuery.fn.appear.checks[length])();
    },

    //check the queue asynchronously
    run: function() {
      if (jQuery.fn.appear.timeout) clearTimeout(jQuery.fn.appear.timeout);
      jQuery.fn.appear.timeout = setTimeout(jQuery.fn.appear.checkAll, 20);
    }
  });
  
  //run checks when these methods are called
  jQuery.each(['append', 'prepend', 'after', 'before', 'attr', 
          'removeAttr', 'addClass', 'removeClass', 'toggleClass', 
          'remove', 'css', 'show', 'hide'], function(i, n) {
    var old = jQuery.fn[n];
    if (old) {
      jQuery.fn[n] = function() {
        var r = old.apply(this, arguments);
        jQuery.fn.appear.run();
        return r;
      }
    }
  });
  
})(jQuery);

/* ==================================================================
 *
 */

function  loadAJAX() {
/*
  setTimeout(function() {  
//    new Ajax.Updater("lastfm_stub", "/ajax/lastfm.html", {method: 'get', asynchronous: true, evalScripts: true});
    jQuery("#lastfm_stub").load("/ajax/lastfm.html");
  }, 1000);
*/

  writeMail();
  writeFollowMe();

  beginLightbox();
}

function writeMail() {
  coded = "duak@8JpPmkJq.oP"
  key = "hkVEswCrM09D1BvgNxU4cliQynfSb3jmZAR6GJdHXuae8t7oLIKWY5qOTpFPz2"
  shift=coded.length
  link=""
  for (i=0; i<coded.length; i++) {
    if (key.indexOf(coded.charAt(i))==-1) {
      ltr = coded.charAt(i)
      link += (ltr)
    }
    else {     
      ltr = (key.indexOf(coded.charAt(i))-shift+key.length) % key.length
      link += (key.charAt(ltr))
    }
  }
//  document.write("<a href='mailto:"+link+"'>"+link+"</a>")
  jQuery("#mail").html("<a href='mailto:"+link+"'>"+link+"</a>");
}

function writeFollowMe() {
tfb.account = 'bluegoldme';
tfb.label = 'follow-me';
tfb.color = '#0054a5';
tfb.side = 'r';
tfb.top = 246;
tfb.showbadge();
}

function beginLightbox() {
jQuery('#gallery a').lightBox({
  imageLoading: '/images/lightbox-ico-loading.gif',
  imageBtnPrev: '/images/lightbox-btn-prev.gif',
  imageBtnNext: '/images/lightbox-btn-next.gif',
  imageBtnClose:'/images/lightbox-btn-close.gif',
  imageBlank:   '/images/lightbox-blank.gif',
  fixedNavigation:true
});
}

/*
---------------------------------------------------------
	FollowMe
---------------------------------------------------------
*/

var tfb={};tfb.allowedLabels=["follow-me","follow-us","follow","my-twitter"];tfb.defaultTop=78;tfb.defaultColor="#35ccff";tfb.isInArray=function(str,ar){if(ar.length<1)return;for(var i=0;i<ar.length;i++){if(ar[i]==str){return true;break;}}
return false;}
tfb.showbadge=function(){if(!window.XMLHttpRequest){return;}
if(document.getElementById('twitterFollowBadge')){document.body.removeChild(document.getElementById('twitterFollowBadge'));}
if(tfb.top<0||tfb.top>1000||isNaN(tfb.top)){tfb.top=tfb.defaultTop;}
if(!tfb.isInArray(tfb.label,tfb.allowedLabels)){tfb.label=tfb.allowedLabels[0];}
var validColorPattern=/^#([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?$/;if(!validColorPattern.test(tfb.color)||(tfb.color.length!=4&&tfb.color.length!=7)){tfb.color=tfb.defaultColor;};if(tfb.side!='l'){tfb.side='r';}
tfb.tabStyleCode='position:fixed;'+'top:'+tfb.top+'px;'+'width:30px;'+'height:119px;'+'z-index:8765;'+'cursor:pointer;'+'background:'+tfb.color+' url(http://www.go2web20.net/twitterfollowbadge/1.0/bg-badge/'+tfb.label+'.png);'+'background-repeat:no-repeat;';tfb.aboutStyleCode='position:absolute;'+'top:'+(parseInt(tfb.top)+107)+'px;'+'width:10px;'+'height:11px;'+'z-index:9876;'+'cursor:pointer;'+'background:url(http://www.go2web20.net/twitterfollowbadge/1.0/icon-about.png);'+'background-repeat:no-repeat;';if(tfb.side=='l'){tfb.tabStyleCode+='left:0; background-position:right top;';tfb.aboutStyleCode+='left:0;';}else{tfb.tabStyleCode+='right:0; background-position:left top;';tfb.aboutStyleCode+='right:0;';}
tfbMainDiv=document.createElement('div');tfbMainDiv.setAttribute('id','twitterFollowBadge');document.body.appendChild(tfbMainDiv);tfbMainDiv.innerHTML='<div id="tfbTab" style="'+tfb.tabStyleCode+'"></div><div id="tfbAbout" style="'+tfb.aboutStyleCode+'"></div>'+'<style>#tfbAbout{visibility:hidden;} #twitterFollowBadge:hover #tfbAbout{visibility:visible;}</style>';document.getElementById('tfbTab').onclick=function(){window.open('http://www.go2web20.net/twitterfollowbadge/redir.htm?'+tfb.account);}
document.getElementById('tfbAbout').onclick=function(){window.open('http://www.go2web20.net/twitterFollowBadge/');}}


/*
---------------------------------------------------------
	Load JSON
---------------------------------------------------------
*/
var getDelicious = function() {
  jQuery.getJSON("http://delicious.com/v2/json/bluegold.me?count=4&callback=?", {scriptCharset:'utf-8'}, function(data) {
    jQuery("#delicious").html("");
    var ul = document.createElement('ul');
    jQuery("#delicious").append(ul);
    for (var i=0, post; post = data[i]; i++) {
      var li = document.createElement('li');
      var a = document.createElement('a');
      var d = document.createTextNode(post.d);
      ul.appendChild(li);
      li.appendChild(a);
      a.appendChild(d);
      a.setAttribute('href', post.u);
      a.setAttribute('rel', 'nofollow');
      a.setAttribute('title', post.d);
      a.setAttribute('target', '_blank');
    }
    jQuery("#delicious p").remove();
    jQuery("#delicious ul").show();
  });
};

var getTwitter = function() {
  jQuery.getJSON("http://twitter.com/statuses/user_timeline/bluegoldme.json?count=8&callback=?", function(data) {
    jQuery("#twitter p").remove();

    var html = "<div id='twitter_content'><a id='twitter_title' href='http://twitter.com/bluegoldme' ref='nofollow'><img src='" + data[0].user.profile_image_url + "' width='32' height='32' /><span>bluegold のタイムライン</span></a><ul>";
    jQuery.each(data, function(i, item) { 
      var t = new Date(item.created_at);
      var tstr;
      if (t.getYear().toString() == "NaN") {
        tstr = item.created_at;
      } else {
        tstr = '' + t.getFullYear() + '/' + ("0" + (t.getMonth() + 1)).slice(-2) + '/' + ("0" + t.getDate()).slice(-2) + " " + ("0" + t.getHours()).slice(-2) + ':' + ("0" + t.getMinutes()).slice(-2) + ':' + ("0" + t.getSeconds()).slice(-2);
      }
      var text = item.text.replace(/\@(\w+)/, '<a href="http://twitter.com/$1" target="_blank" rel="nofollow">@$1</a>');

      html += "<li>" + text +
        '<div><span class="twitter_time">' + tstr + '</span>' +
        '<span class="twitter_by">' + item.source + " から</span></div>" + 
        "</li>";
      if (i == 3) return false;
    });
    html += "</ul></div>";
    jQuery("#twitter").append(html);
  });
};

var getBooklog = function() {
  jQuery.getJSON("http://api.booklog.jp/json/bluegoldme?status=3&sort=read_desc&callback=?", function(data) {
    jQuery("#booklog").html('<div id="booklog_title"><a href="http://booklog.jp/users/' + data.tana.account + '" target="_blank" rel="nofollow">最近読んだ本</a></div>');

    jQuery.each(data.books, function(i, item) {
      var div = '<div class="booklog_item">';
      div += '<a href="' + item.url + '" rel="nofollow"><img src="' + item.image + '" alt="' + item.title + '" title="' + item.title + '" style="margin-right: ' + (56 - item.width) + 'px;" /></a>';
      div += '<div class="book_title"><a href="' +  item.url + '" rel="nofollow">' + item.title + '</a></div>';
//      div += '<a href="http://www.amazon.co.jp/exec/obidos/ASIN/' + item.asin + '/bluegoldme-22/ref=nosim" style="float: right; margin-right: 2px;"><img src="/images/amazon-buy.gif" /></a>';
      div += '<div class="book_author">' + item.author + '</div>';
      div += '<div style="clear: both;"></div>';
      jQuery("#booklog").append(div);
    });
  });
}

/*
---------------------------------------------------------
	addLoadEvent
---------------------------------------------------------
*/
/*
function addOnLoadEvent(func) {
	if (window.attachEvent){
		window.attachEvent('onload', func);
	}
	else {
		window.addEventListener('load', func, false);
	}
}
addOnLoadEvent(smartRollover);
addOnLoadEvent(inputColorInit);
addOnLoadEvent(stripeAllTables);
addOnLoadEvent(ss.fixAllLinks);
addOnLoadEvent(loadAJAX);
*/

jQuery(document).ready( function() {
    smartRollover();
    inputColorInit();
    stripeAllTables();
    ss.fixAllLinks();

    writeMail();
    writeFollowMe();

    beginLightbox();

    jQuery("#twitter").appear(function() {
      getTwitter();
    });
    jQuery("#booklog").appear(function() {
      getBooklog();
    });
    jQuery("#delicious").appear(function() {
      getDelicious();
    });
    
    jQuery("#lastfm_stub").appear(function() {
      jQuery("#lastfm_stub").load("/ajax/lastfm.html");
    });
});


