function ajaxUpdater(id,url) {
	new Ajax.Updater(id,url,{asynchronous:true});
}

//Copyright 2006 Bontrager Connection, LLC
var cX = 0; var cY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}

if(document.all) {
	document.onmousemove = UpdateCursorPositionDocAll;
} else {
	document.onmousemove = UpdateCursorPosition;
}

function AssignPosition2(d,objectWidth) {
	var displayX = cX;
	var winW = 0;
	if (objectWidth > 0) {
		if(document.all) {
			winW = document.body.offsetWidth-20;
		} else {
			winW = document.body.clientWidth-20;
		}
		if ((winW - cX) < objectWidth) {
			displayX = winW - objectWidth;
		}
	}
	d.style.left = displayX + "px";
	d.style.top = (cY+10) + "px";
}

function AssignPosition(d,objectWidth) {
	var posx = 0;
	var posy = 0;
	if (window.event) {
		var e = window.event;
		if (e.pageX || e.pageY) 	{
			posx = e.pageX;
			posy = e.pageY;
		}
		else if (e.clientX || e.clientY) 	{
			posx = e.clientX + document.body.scrollLeft
				+ document.documentElement.scrollLeft;
			posy = e.clientY + document.body.scrollTop
				+ document.documentElement.scrollTop;
		}
		// posx and posy contain the mouse position relative to the document
		// Do something with this information
		d.style.left = posx + "px";
		d.style.top = (posy+10) + "px";
	}
}

function AssignPositionCenter(d,objectWidth,objectHeight) {

	var scrolledX, scrolledY;
	if( self.pageYoffset ) {
		scrolledX = self.pageXoffset;
		scrolledY = self.pageYoffset;
	} else if( document.documentElement && document.documentElement.scrollTop ) {
		scrolledX = document.documentElement.scrollLeft;
		scrolledY = document.documentElement.scrollTop;
	} else if( document.body ) {
		scrolledX = document.body.scrollLeft;
		scrolledY = document.body.scrollTop;
	}

	var centerX, centerY;
	if( self.innerHeight ) {
		centerX = self.innerWidth;
		centerY = self.innerHeight;
	} else if( document.documentElement && document.documentElement.clientHeight ) {
		centerX = document.documentElement.clientWidth;
		centerY = document.documentElement.clientHeight;
	} else if( document.body ) {
		centerX = document.body.clientWidth;
		centerY = document.body.clientHeight;
	}

	var leftoffset = scrolledX + (centerX - objectWidth) / 2;
	var topoffset = scrolledY + (centerY - objectHeight) / 2;
	// The initial width and height of the div can be set in the
	// style sheet with display:none; divid is passed as an argument to // the function
	var r=d.style;
	r.position='absolute';
	r.top = topoffset + 'px';
	r.left = leftoffset + 'px';
	r.display = "block";
}

function HideContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}

function showRiderText(rider_id) {

	var rider_name = document.getElementById('rider_name');
	if (rider_id == "-1") {
		rider_name.style.display = '';
	}
	else {
		rider_name.style.display = 'none';
	}
}

function image_popup(url) {
	var w = window.open(url, 'image_upload', 'scrollbars=yes,menubar=no,height=350,width=350,resizable=yes,toolbar=no,location=no,status=no');
	return w;
}

function show_movie(id) {
	var w = window.open('/vids/show_movie?id=' + id, 'mid', 'scrollbars=no,menubar=no,height=380,width=505,resizable=no,toolbar=no,location=no,status=no');
	return w;
}