// look for the brand in the cookie
var brandid = getCookieValue('brandid');

// if the brand is null (coming from signin)
// check the URL for the existence of the brand
if (brandid == '') {
	
	if (document.URL.indexOf('brandid=3') > 1) {
		brandid = '3'
	}
	else{
			if (document.URL.indexOf('brandid=2') > 1) {
			brandid = '2'
			}
			else {
				brandid = '1'
			}
		}
	
}
	
switch (brandid) {
	case '1':
		document.title = 'Safeway - Ingredients for life';
		break;
	
	case '2':
		document.title = 'Vons.com - Ingredients for life';
		break;
	
	case '3':
		document.title = 'Genuardis.com - Ingredients for life';
		break;
	
	default:
		document.title = 'Safeway - Ingredients for life';
}

function getCookieValue(cookieName) {

	var i = 0;
	var cookieEnd;
	while (i < document.cookie.length) {

		var j = i + cookieName.length;

		if (document.cookie.substring(i,j) == cookieName) {

			cookieEnd = document.cookie.indexOf(';', j);

			if (cookieEnd == -1) {

				cookieEnd = document.cookie.length;

			}
			return unescape(document.cookie.substring(j + 1, cookieEnd));
		}
		i++;
	}						
	return '';
}
