// SJ Added this javaScripot function to switch to the Spanish page

function goToPage(locale) {
	var currentPageUrl = location.href;
	var currentPageIdStart = currentPageUrl.indexOf("/vgn-ext-templating/");
	if (currentPageIdStart < 0)	{
		currentPageIdStart = currentPageUrl.indexOf("/com_pub/");
	}
	
	var urlPage;
	
	currentPage = currentPageUrl.substring(currentPageIdStart);
	if (locale == 'Spanish') {
		// change here according to the CNAME
		urlPage = "http://espanol.comerica.com/enes" + currentPage;
	} else if (locale == 'English') {
		urlPage = "http://www.comerica.com" + currentPage;
	}
	
	//location.hostname = "http://escomerica.convertlanguage.com/enes";
	//alert(location.hostname);
	window.location.replace(urlPage);
}


