//create the wrapper object for the namespace (with version number and other key defaults)
var NYX = {}

/* this apparently fixes the horrid IE Operation Aborted error pretty simply;
 * based on a trick by Diego Perini -- http://javascript.nwbox.com/IEContentLoaded/
 * (it's an object instance in order to handle objects parameters sent to the action function)
 */

NYX.ieSafeExecution = function() {
	//store this in a closure, in case we do asynchronous operation
	var This = this;
	
	//a setting
	this.timeoutLength = 200;	//millis
	
	//the first argument must be the function to call; any remaining arguments get passed to that function
	if (typeof arguments[0] != "function") {
		throw("First parameter to NYX.ieSafeExecution is required and must be a function");
	} else {
		this.functionToCall = arguments[0];
	}
	
	this.execute = function() {
		//on the first call, we need to cache the arguments
		if (typeof This.arguments == "undefined") This.arguments = arguments;
		
		if ( typeof document.all == "object" && (document.readyState != "loaded" && document.readyState != "complete") ) {
			//document.title += "[IE]"; //for visual debugging
			//if (typeof console == "object") console.log("in the IE block");
			try {
				//document.title += "^trying^"; //for visual debugging
				document.documentElement.doScroll("left");
				This.functionToCall.apply(This.functionToCall, This.arguments);
			} catch(error) {
				setTimeout(This.execute, This.timeoutLength);
			}
		} else {
			//if (typeof console == "object") console.log("executing immediately");
			This.functionToCall.apply(This.functionToCall, This.arguments);
		}
	}
}

// allows us to insert a div after an existing div
		function insertAfter(new_node, existing_node) {
			if (existing_node.nextSibling) {
				existing_node.parentNode.insertBefore(new_node, existing_node.nextSibling);
			} else {
				existing_node.parentNode.appendChild(new_node);
				}
		};
		
		// create the DIV with the jumpline
		function jumpLine(msg) {
			var storyGraf1 = document.getElementById("storyGraf1");
			var messageDiv = document.createElement("div");
			messageDiv.setAttribute('id','storyJumpMessage');
			messageDiv.setAttribute('class','storyJumpMessage');
			messageDiv.innerHTML = msg;
			insertAfter(messageDiv, storyGraf1);
		};