function include(filename)
{
	var head = document.getElementsByTagName('head')[0];

	script = document.createElement('script');
	script.src = filename;
	script.type = 'text/javascript';

	head.appendChild(script)
}

function trim( str )
{
    if(str == undefined) return '';
	return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}  // trim

function trimFields( form )
{
	for (e=0;e<form.elements.length;e++) {
		clearError(form.elements[e]);
		form.elements[e].value = trim(form.elements[e].value);
	}
}  // trimFields

function putErrorFocus( object )
{

	object.style.backgroundColor="#FFFF88";
	object.focus();

}  // putErrorFocus

function clearError( object )
{

	object.style.backgroundColor="#FFFFFF";

}  // clearError

function getURLVar( name ) {
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	if( results == null )
		return "";
	else
		return results[1];
}

function makeButton( imgObj )
{
	imgObj.hover(function() {
			if ($(this).attr('src').indexOf('_ro.') < 0) $(this).attr('src', $(this).attr('src').replace(/(\.\w+)$/, '_ro$1'));
		}, function() {
			if ($(this).attr('src').indexOf('_ro.') >=0) $(this).attr('src', $(this).attr('src').replace('_ro.', '.'));
		});
	imgObj.mousedown(function() {
			if ($(this).attr('src').indexOf('_ro.') >=0) $(this).attr('src', $(this).attr('src').replace('_ro.', '.'));
		});
	imgObj.mouseup(function() {
			if ($(this).attr('src').indexOf('_ro.') < 0) $(this).attr('src', $(this).attr('src').replace(/(\.\w+)$/, '_ro$1'));
		})
}  // makeButton

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


