// alerts other scripts that this library has been included
var jsLibIncluded = true;
var included = new Array


// Set up days of the week and months of the year arrays for date objects
var Days = new Array
	Days[0] = 'Sunday';
	Days[1] = 'Monday';
	Days[2] = 'Tuesday';
	Days[3] = 'Wednesday';
	Days[4] = 'Thursday';
	Days[5] = 'Friday';
	Days[6] = 'Saturday';

var Months = new Array
	Months[0] = 'January';
	Months[1] = 'February';
	Months[2] = 'March';
	Months[3] = 'April';
	Months[4] = 'May';
	Months[5] = 'June';
	Months[6] = 'July';
	Months[7] = 'August';
	Months[8] = 'September';
	Months[9] = 'October';
	Months[10] = 'November';
	Months[11] = 'December';

//identical to the include functions in php
function include(file){
	document.write('<script language="javascript" src="' + file + '"></script>\n');
	if(!in_array(file,included)){ included.push(file); }
	return true;
	}

function include_once(file){
	if(!in_array(file,included)){
		include(file);
		}
	else{
		//alert("you cannot include this file more than once. baka ><");
		return false;
		}
	return true;
	}

// Determines the number of times [needle] appears in the string [haystack]
function numchars(needle,haystack){
	haystackArray = haystack.split('');
	numChars = 0;
	var i;
	for(i = 0; i < haystackArray.length; i++){
		if(haystackArray[i].indexOf(needle) > -1){
			numChars++;
			}
		}
	return numChars;
	}

// converts the first letter of every word (space separated) in [str] to Upper Case
function ucwords(str) {
	//return false;
	if(str.length == 0 || numchars(' ',str) == 0){
		return false;
		}
	words = str.split(' ');
	output = '';
	var cap = new Array
	var word = new Array
	var i;
	for(i = 0; i < words.length; i++){
		cap[i] = words[i].substring(0,1).toUpperCase();
		word[i] = words[i].substring(1,words[i].length);
		output += cap[i] + word[i] + ' ';
		}
	return output;
	}

// checks for the existance of [value] in [array]
function in_array(value,array){
	var i;
	for (i=0; i < array.length; i++){
		if (array[i] === value){
			return true;
			}
		}
	return false;
	}

function getElementByNameAtt(name,node,tag) {
	if ( node == null ){
		node = document;
		}
	if ( tag == null ){
		tag = 'input';
		}
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp('(^|\\s)'+name+'(\\s|$)');
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].name) ) {
			return els[i];
			j++;
			}
		}
	return false;
	}

// use to access external pages and read in the results.
function getXmlHttpRequestObject() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest(); //Not IE
		}
	else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP"); //IE
		}
	else {
		alert("Your browser doesn't support the XmlHttpRequest object. Better upgrade to Firefox.");
		}
	}

function isDefined(variable){
	return (typeof(window[variable]) == "undefined") ? false : true;
	}

function isInt(str){
	var i = parseInt(str);
	if(isNaN(i))
		return false;
	i = i.toString();
	if(i != str)
		return false;
	return true;
	}

function openWindow(url, options){
	if(!url){ return false; }
	if(!options){ options = ''; }
	window.open(url, null, options);
	return false;
	}