// (c) Bright Interactive 2007, Eric Clack, eric@bright-interactive.com


function url_param(p) {
	// Retrieve an url param specified by p=value
	var re = new RegExp( p + "=([^&]+)" );
	var matches = document.location.href.match(re);
	if (matches) {
		return unescape(matches[1]);
	}
	else {
		return '';
	}
}


function query_string() {
	// Retrieve the domain name from the current page
	var re = new RegExp( "\\?(.*)" );
	var matches = document.location.href.match(re);
	if (matches) {
		return matches[1];
	}
	else {
		return '';
	}
}


function domain_name() {
	// Retrieve the domain name from the current page
	var re = new RegExp( "(http|https)://([^/]+)/" );
	var matches = document.location.href.match(re);
	if (matches) {
		return matches[2];
	}
	else {
		return '';
	}
}


function protocol() {
	// Retrieve the domain name from the current page
	var re = new RegExp( "(http|https)://" );
	var matches = document.location.href.match(re);
	if (matches) {
		return matches[1];
	}
	else {
		return '';
	}
}