function getHTTPObject() {
	var xhr = false;
	if (window.XMLHttpRequest) {
		xhr = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		try {
			xhr = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				xhr = false;
			}
		}
	}
	return xhr;
}

function fishing(settings) {
	this.request = getHTTPObject();
	if (this.request) {
		this.request.onreadystatechange = function () {
			if (request.readyState == 4) {
				if (request.status == 200 || request.status == 304) {
					if (typeof settings.onready == "function") {
						settings.onready(request);
					}
				}
				else {
					if (typeof settings.onfail == "function") {
						settings.onfail(request);
					}
				}
			}
		}
		this.request.open(settings.method, settings.url, true);
		this.request.send(null);
	}
}

var navLoc = 85;
var navHeight = 0;
var navDir = null;
var navTopped = 0;
var navDownDel = null;
function navSetUp () {
	getElement("nav").onmouseover = function () {
		if (navDownDel) {
			navDownDel = null;
		}
		navEffect("up");
	};
	getElement("nav").onmouseout = function () {
		if (navTopped) {
			navDownDel = setTimeout("navEffect('down')",1500);
		}
		else {
			navEffect("down");
		}
	};
}
function navEffect (what) {
	if (what == "up") {
		navDir = "up";
		navAnim();
	}
	else {
		navDir = "down";
		navAnim();
	}
}
function navAnim () {
	if (navDir == "up") {
		if (navLoc != 65) {
			navLoc--;
			navLoc--;
			navHeight++;
			navHeight++;
			getElement("nav").style.top = navLoc+"px";
			getElement("nav").getElementsByTagName("ul")[0].style.height = navHeight+"px";
			setTimeout("navAnim()",100);
		}
		else {
			navTopped = 1;
		}
	}
	else if (navDir == "down") {
		if (navLoc != 85) {
			navLoc++;
			navLoc++;
			navHeight--;
			navHeight--;
			getElement("nav").style.top = navLoc+"px";
			getElement("nav").getElementsByTagName("ul")[0].style.height = navHeight+"px";
			setTimeout("navAnim()",100);
			
			navTopped = 0;
		}
	}
}
var bookmarkOpacity = 1;
function fadeBookmark () {
	bookmarkOpacity -= .05;
	if (bookmarkOpacity >= 0) {
		getElement("bookmark").getElementsByTagName("a")[0].style.opacity = bookmarkOpacity;
		setTimeout("fadeBookmark()",50);
	}
}
var bookmarkHeight = 0;
function animBookmark () {
	bookmarkHeight += 5;
	if (bookmarkHeight <= 50) {
		getElement("bookmarked").style.height = bookmarkHeight+"px";
		setTimeout("animBookmark()",25);
	}
}

function bookmarkShowUserMore (user) {
	if (user.getElementsByTagName("h2").length) {
		user.className = "user userMore";
		user.getElementsByTagName("h2")[0].style.display = "block";
		user.getElementsByTagName("ul")[0].style.display = "block";
	}
}
function bookmarkShowUserLess (user) {
	if (user.getElementsByTagName("h2").length) {
		user.className = "user";
		user.getElementsByTagName("h2")[0].style.display = "none";
		user.getElementsByTagName("ul")[0].style.display = "none";
	}
}

function getSelectedText(id) {
	return getForm(id).substring(getElement(id).selectionStart,getElement(id).selectionEnd);
}
function getForm(id) {
	this.element = document.getElementById(id);
	return this.element.value;
}
function getElement(id) {
	this.element = document.getElementById(id);
	return this.element;
}
function createH1(text) {
	this.element = document.createElement("h1");
	this.newText = document.createTextNode(text);
	this.element.appendChild(this.newText);
	return this.element
}
function createH2(text) {
	this.element = document.createElement("h2");
	this.newText = document.createTextNode(text);
	this.element.appendChild(this.newText);
	return this.element
}
function isdefined (variable) {
	return (typeof(window[variable]) == "undefined")?  false: true;
}


		
function failedSmallFish() {
	this.newDiv = document.createElement("div");
	this.newDiv.style.width      = 300+"px";
	this.newDiv.style.height     = 100+"px";
	this.newDiv.style.padding    = "10px";
	this.newDiv.style.background = "#ff9";
	this.newDiv.style.border     = "1px solid #BFBF73";
	this.newDiv.style.fontFamily = "Trebuchet MS";
	this.newDiv.style.fontSize   = "14px";
	
	this.close = document.createElement("a");
	this.close.setAttribute("class","close");
	this.close.setAttribute("href","javascript:effects.closePop()");
	this.close.style.position   = "absolute";
	this.close.style.top        = "-15px";
	this.close.style.right      = "-15px";
	this.close.style.display    = "block";
	this.close.style.width      = "32px";
	this.close.style.height     = "32px";
	this.close.style.background = "url(http://elohimnotes.com/images/close.png) no-repeat";
	this.close.style.textIndent = "-9000px";
	this.close.style.cursor     = "pointer";
	
	this.close.appendChild(document.createTextNode("close"));
	this.newDiv.appendChild(this.close);
	
	this.newH2 = createH2("Error");
	this.newH2.style.fontFamily = "Georgia";
	this.newH2.style.fontSize   = "18px";
	this.newH2.style.textAlign  = "center";
	this.newH2.style.margin     = "0 0 5px";
	this.newH2.style.padding    = "0";
	this.newDiv.appendChild(this.newH2);
	
	this.newDiv.appendChild(document.createTextNode("There has been an error in processing. Sorry."));
	effects.createPop("failedPop",this.newDiv);
}