/**
 * Copyright (C) 2005 Brightcove, Inc.  All Rights Reserved.  No
 * use, copying or distribution of this work may be made except in
 * accordance with a valid license agreement from Brightcove, Inc.
 * This notice must be included on all copies, modifications and
 * derivatives of this work.
 *
 * Brightcove, Inc MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT
 * THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. BRIGHTCOVE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED
 * BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS
 * SOFTWARE OR ITS DERIVATIVES.
 *
 * "Brightcove" is a trademark of Brightcove, Inc.
 **/

/**
 * Utility script for syndication redirection.  This allows for the old references to the
 * syndication flow which used to be 
 * 
 * @author amanning
 */

var enableSyndicationRedirect = true;
var searchString = URLEncode( self.location.search );

function isSyndicationRedirect( pSearchString ){
	
	var result = false;

	if (pSearchString.indexOf("offer",2) != -1 || 
		pSearchString.indexOf("offersignin",2) != -1||
		pSearchString.indexOf("syndicationrequest",2) != -1){
		result = true;
	}

	return result;
			
}

function checkForRedirect(){
	
	if (!enableSyndicationRedirect) return;
	if (isSyndicationRedirect(searchString) == true){
		document.location = '/syndication/' + self.location.search;
	}

}

checkForRedirect();

