/****************************************************************************************************
** JS Cobrand Redirect(cobrand_redirect.js)
** Choon Chong (cchong) 8/3/01
** Description: This script will cobrand the URL provided and redirect the page to the related cobranded 
** url. This script is an extention of cobrand.js, hence it will not work without the presence of 
** cobran.js file.  
** set replace to "yes" to avoid "back button keep redirect back to this page" issue. Only set replace to "no" 
** when this functionis being initiated by client. eg. click on a link or button. 
*****************************************************************************************************/
var siteID;
var cobrandID;
function ebayRedirect(targetURL, replace)
{	
	if(replace=="yes"){		
		if(siteID > 0 || cobrandID >0){
			fullCB();
		}		
		document.write("<a href=\""+targetURL+"\"></a>")
		for (var i = document.links.length-1; i < document.links.length; i++){
		document.location.replace(document.links[i].href);
		}
	}
	else{	
		if(siteID > 0){
			//cobrand redirect only work for core. 
			document.location.href=cobrandURL(targetURL);
		}	
		else{
			//intl cobrand not ready until it move to new cobrand code.
			document.location.href=targetURL;
		}
	}
}

