// flashHelper.js
// 
// JavaScript functions to help in and out of web pages
function replaceContent(url) {
	location.href=url;
}

function replaceContentWithRedirect(url, returnPath) {
	// Strip off the query
	var mySource = location.href.replace(/\?.*/, "");
	var myDestination = url + "?appRedirect=" + mySource + "%3freturnPath="+returnPath;

	location.href=myDestination;
}

// If this finds the return path, it prepends an '&' for ease of use with
// adding this to a flashVars string
function getReturnPath() {
	var uriPieces = location.href.split('?');

	// The first part of the string will always be the base URL
	// We want the second part, the query.
	if( uriPieces != null && uriPieces[1] != null ) {
		var getElements = uriPieces[1].split('&');
	
		for(var i=0; i < getElements.length; i++) {
			if( getElements[i].match(/returnPath/) ) {
				return "&"+getElements[i];
			}
		}
	}

	return "";
}


