function trackClick(url) {
	if ( typeof(urchinTracker) != 'undefined' )
	{
		urchinTracker(url);
	}
}

function setCookie(name,value,expire,path){
	document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString())) + ((path) ? "; path=" + path : "");
}

function getCookie(name){
	var search = name + "=";
	if (document.cookie.length > 0){
		offset = document.cookie.indexOf(search); 
		if (offset != -1){
			offset += search.length; 
			end = document.cookie.indexOf(";", offset); 
			if (end == -1)
				end = document.cookie.length;

			return unescape(document.cookie.substring(offset, end));
		} 
	}
}

function killCookie(name,path){
	theValue = getCookie(name);
	if (theValue)
		document.cookie = name + '=' + theValue + '; expires=Fri, 13-Apr-1970 00:00:00 GMT' + ((path) ? '; path=' + path : '');
}

function Profile(memberID, profileUrl){
	var chasm = screen.availWidth;
	var mount = screen.availHeight;

	var w = 500;
	var h = 400;

	profileWindowHandle = null;
	profileWindowHandle = window.open(profileUrl + '?mid=' + memberID,'Profile','resizable,width=' + w + ',height=' + h + ',left=' + ((chasm - w - 10) * .5) + ',top=' + ((mount - h - 30) * .5) + ',scrollbars=yes');
	if (profileWindowHandle.blur) profileWindowHandle.focus();
}

function filter(filterParam){
	document.location.href = filterParam;
}

function resort(cookieName, sortOrder, reloadUrl){
	setCookie(cookieName, sortOrder, null, "/");
	document.location.href = reloadUrl;
}

function setlist(eventID){
	var chasm = screen.availWidth;
	var mount = screen.availHeight;

	var w = 500;
	var h = 400;

	setlistsWindowHandle = null;
	setlistsWindowHandle = window.open('/setlists.aspx?eid=' + eventID,'SetList','resizable,width=' + w + ',height=' + h + ',left=' + ((chasm - w - 10) * .5) + ',top=' + ((mount - h - 30) * .5) + ',scrollbars=yes');
	if (setlistsWindowHandle.blur) setlistsWindowHandle.focus();
}

function lyrics(productID, trackID){
	var chasm = screen.availWidth;
	var mount = screen.availHeight;

	var w = 500;
	var h = 400;

	lyricsWindowHandle = null;
	lyricsWindowHandle = window.open('/lyrics.aspx?pid=' + productID + '&tid=' + trackID,'Lyrics','resizable,width=' + w + ',height=' + h + ',left=' + ((chasm - w - 10) * .5) + ',top=' + ((mount - h - 30) * .5) + ',scrollbars=yes');
	if (lyricsWindowHandle.blur) lyricsWindowHandle.focus();
}

function gallery(galleryID, photoID, folderID){
	var chasm = screen.availWidth;
	var mount = screen.availHeight;

	var w = 550;
	var h = 550;

	galleryWindowHandle = null;
	galleryWindowHandle = window.open('/photos.aspx?gid=' + galleryID + '&pid=' + photoID + '&fid=' + folderID,'Gallery','resizable,width=' + w + ',height=' + h + ',left=' + ((chasm - w - 10) * .5) + ',top=' + ((mount - h - 30) * .5) + ',scrollbars=yes');
	if (galleryWindowHandle.blur) galleryWindowHandle.focus();
}

function paramaterFrom(param,argument)
{
	argument = '=' + argument + '&';
	if (argument.indexOf(param) != -1)
	{
		locStart = argument.indexOf(param) + param.length + 1;
		locEnd = argument.indexOf('&',locStart);
		if (locEnd < locStart)
			locEnd = argument.length;

		return argument.substring(locStart,locEnd);
	}
	else
		return null;
}