//redirect from CommunitySportsDesk to OurSportsCommunity
var redirectUrl = location.href.replace(/\bcommunitysportsdesk.com\b/i, "oursportscommunity.com");
redirectUrl = location.href.replace("csd/CSD/CSD.html", "csd/CSD.html");
if (redirectUrl != location.href)
	location.replace(redirectUrl);

// fix old typo in some links
if (location.search.indexOf("origin=") > 0)
	location.search = location.search.replace(/origin=/i, "orgid=");

// If there are query parameters in the URL other than orgid, move
// them to hash portion of url. This requires redirect.
var query = location.search;
if (query) {
	queryTokens = query.substring(1).split('&');
	var hashTokens = [];
	for ( var i = 0; i < queryTokens.length; i++) {
		if (queryTokens[i].substring(0, 6) != "orgid="
				&& queryTokens[i].substring(0, 7) != "origin="
				&& queryTokens[i].substring(0, 12) != "gwt.codesvr=") {
			hashTokens.push(queryTokens[i]);
			queryTokens.splice(i, 1);
			i--;
		}
	}
	if (hashTokens.length > 0) {
		var url = location.href;
		url = url.substring(0, url.indexOf('?'));
		if (queryTokens.length > 0)
			url += '?' + queryTokens.join('&');
		url += '#' + hashTokens.join('&');
		location.replace(url);
	}
}

function showPhoto(photoUrl) {
	document.getElementById('wallTabContent').style.display = 'none';
	document.getElementById('wallTabPhoto').style.display = '';
	document.getElementById('wallTabPhoto').innerHTML = "<div onClick='showWall();' class='cursor hyperlinknormal' style='text-align:right'>Back</div><img title='"
			+ photoUrl + "' src='" + photoUrl + "' />";
}

function showWall() {
	document.getElementById('wallTabContent').style.display = '';
	document.getElementById('wallTabPhoto').style.display = 'none';
	document.getElementById('wallTabPhoto').innerHTML = '';
}
