if (!Utils) {
	var Utils = {};
}
// pass params through window.setTimeout
var wait = function (method, ms_delay) {
	if (typeof(method) == "function") {
		var args = Array.prototype.slice.call(arguments, 2);
		var bound_method = (
			function () {
				method.apply(null, args);
			}
		); 
		return window.setTimeout(
			bound_method, 
			ms_delay
		);
	}
	return window.setTimeout(
		method, 
		mDelay
	);
};
// write debug output to the page
var log = function (text) {
	if (DEBUG_MODE_ON) {
	    if (Prototype.Browser.IE) {
	        new Insertion.Bottom(document.body, '<p>' + text + '</p>');
	    }
	    else {
	        try {
    			console.log(text);
    		}
    		catch (e) {
    			// pass
    		}
	    }
	}
};
// debug objects using $H(obj)
var log_object = function (obj) {
	if (DEBUG_MODE_ON) {
		$H(obj).each(
			function (item) {
				try {
					log(item.key + ' = ' + item.value);
				}
				catch (e) {
					log('error logging ' + item + ': ' + e);
				}
			} 
		);
	}
};
// get uid from current time
var get_timestamp = function () {
	var d = new Date();
	return d.getTime().toString();
};
// make sure url has a trailing slash
var append_trailing_slash = function (s) {
	if (s.length > 0) {
		return s.replace(/\/?$/, "/");
	}
};
// make sure url doesn't have a trailing slash
var remove_initial_slash = function (s) {
	if (s.length > 0) {
		return s.replace(/^\/?/, "");
	}
};
// parse a url into its myriad parts
var parse_url = function (src_url) {
	var uri_part_names = ['source','protocol','authority','domain','port','path','directory_path','file_name','query','anchor'];
	var uri_parts = new RegExp("^(?:([^:/?#.]+):)?(?://)?(([^:/?#]*)(?::(\\d*))?)?((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[\\?#]|$)))*/?)?([^?#/]*))?(?:\\?([^#]*))?(?:#(.*))?").exec(src_url);
	var uri = {};
	for(var i = 0; i < 10; i++){
		uri[uri_part_names[i]] = (uri_parts[i] ? uri_parts[i] : "");
    }
	uri.directory_path = append_trailing_slash(uri.directory_path);
	return uri;
};
// parse a url into its myriad parts
var validate_url = function (src_url) {
	try {
		var test = parse_url(src_url);
		if (test['protocol'].length > 1 && test['domain'].indexOf('.') && test['path'].indexOf('/') > -1) {
			return true;
		}
		return false; 
	}
	catch (e) {
		return false;
	}
};
// update the src of an iframe
var set_iframe_src = function (iframe, src, replace) {
	try {
		if (!replace) {
			if (Prototype.Browser.WebKit) {
				iframe.location = src;
			}
			else {
				iframe.location.href = src;
			}
		}
		else {
			var idoc;
			if (Prototype.Browser.IE) {
				idoc = iframe.contentWindow.document;
			}
			else {
				if (Prototype.Browser.WebKit) {
					idoc = iframe.document;
				}
				else {
					idoc = iframe.contentWindow;
				}
			}
			if (!idoc) {
				iframe.location = src;
				return;
			}
			else {
				idoc.location.replace(src);
			}
		}
	}
	catch (e) {}
};
/* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code*/
var bookmark = function (title, url) {
	if (Prototype.Browser.IE) { // ie
		window.external.AddFavorite(url, title);
	}
	else {
	  var elem = document.createElement('a');
		elem.setAttribute('href', url);
		elem.setAttribute('title', title);
		elem.setAttribute('rel', 'sidebar');
		elem.click();
	}
}