Array.prototype.inArray = function ( value ) 
{
	for (var i=0; i < this.length; i++) 
	{
		if (this[i] === value) return true;
	}
	return false;
};


function explode( delimiter, string ) {
	
	// http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: kenneth
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: explode(' ', 'Kevin van Zonneveld');
    // *     returns 1: {0: 'Kevin', 1: 'van', 2: 'Zonneveld'}
 
	var emptyArray = { 0: '' };
 
    if ( arguments.length != 2
        || typeof arguments[0] == 'undefined'
        || typeof arguments[1] == 'undefined' )
    {
        return null;
    }
 
    if ( delimiter === ''
        || delimiter === false
        || delimiter === null )
    {
        return false;
    }
 
    if ( typeof delimiter == 'function'
        || typeof delimiter == 'object'
        || typeof string == 'function'
        || typeof string == 'object' )
    {
        return emptyArray;
    }
 
    if ( delimiter === true ) {
        delimiter = '1';
    }
 
    return string.toString().split ( delimiter.toString() );
}


function getDayOfWeek( dateObject )
{
	var dayNames = new Array( 'Sunday', 'Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
	return dayNames[dateObject.getDay()];
	
}

function attachTrimButton( elID, trimValue)
{
	var el = document.getElementById(elID);

	// get parent element x and y offset
	
   	var elWidth = el.offsetWidth;
	var elHeight = el.offsetHeight;

	var PixelAmtX = el.offsetLeft;
	var PixelAmtY = el.offsetTop;

	while( (el.tagName != 'BODY') && (el.tagName != 'HTML') )
	{
	  el = el.offsetParent;
	  PixelAmtX += el.offsetLeft;
	  PixelAmtY += el.offsetTop;
    }

	// create the trim link
	var trimLink = 'javascript: trimText( \'' + elID + '\', '+ trimValue + ' );';	
	
	//create the trim button div
	document.writeln('<div id="trimButton" class="trimButton"><a href="' + trimLink + '" title="Trim text to ' + trimValue + ' characters">Trim</a></div>');
	
	//position the trim button div
	var trimButton = document.getElementById('trimButton');
	var trimButtonX = PixelAmtX //+ elWidth - trimButton.offsetWidth ;
	var trimButtonY = PixelAmtY //+ elHeight + 4;

	//alert(trimButtonX);
	trimButton.style.left = trimButtonX + 'px';
	trimButton.style.top = trimButtonY + 'px';
	trimButton.style.position = 'absolute';
}

function trimText( elID, trimValue )
{
	var el = document.getElementById(elID);	
	var shortdescText = el.value;
	var charsToCopy = trimValue
	
	if ( shortdescText.length > charsToCopy )
	{
		shortdescText = shortdescText.substring(0, charsToCopy);
		shortdescText = shortdescText.replace(/\w+$/, '');
		el.value = shortdescText + "...";
	}
	else
	{
		alert('Not enough characters to trim.');
	}

}

/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}




function ajaxCall( pageUrl, contentElement, loadingHTML )
{
	$(contentElement).ajaxStart(function(){
	   $(this).html(loadingHTML);
	});
	
	$.ajax({
	  url: pageUrl,
	  dataType:"html",
	  type: "get",
	  cache: false,
	  success: function(html){
		$(contentElement).html(html);
	  }
	});
}


function getSiteRoot()
{
	var theURLPreffix = document.location.href.split( 'riverraft' )[0];
	var theURLSuffix = document.location.href.split( theURLPreffix )[1];
	var theSiteName = theURLSuffix.split( '/' )[0];
	return( theURLPreffix + theSiteName );

}



