myVar = "stop";

function getName() {
	if(document.cookie) {
		index = document.cookie.indexOf(cookie_name);
		if (index != -1) {
			namestart = (document.cookie.indexOf("=", index) + 1);
			nameend = document.cookie.indexOf(";", index);
			if (nameend == -1) {nameend = document.cookie.length;}
			myVar = document.cookie.substring(namestart, nameend);
			return myVar;
		} else {
			return myVar;
		}
	}
	else {
		return myVar;
	}
}

function checkCookie(cookie_name, value) {
	if(document.cookie) {
		index = document.cookie.indexOf(cookie_name);
		if (index != -1) {
			namestart = (document.cookie.indexOf("=", index) + 1);
			nameend = document.cookie.indexOf(";", index);
			if (nameend == -1) {
				nameend = document.cookie.length;
			}
			myVar = document.cookie.substring(namestart, nameend);
			if (myVar != value) {
				var exp = new Date()
				var nowPlusOneYear = exp.getTime() + (1000 * 60 * 60 * 24 * 365)
				exp.setTime(nowPlusOneYear)
				document.cookie= cookie_name+"="+ value +"; expires=" + exp.toGMTString() + "; path=/; domain=central-market.com";
			}
		}
		else {
			var exp = new Date()
			var nowPlusOneYear = exp.getTime() + (1000 * 60 * 60 * 24 * 365)
			exp.setTime(nowPlusOneYear)
			document.cookie= cookie_name+"="+ value +"; expires=" + exp.toGMTString() + "; path=/; domain=central-market.com";
		}
	}
	else {
		var exp = new Date()
		var nowPlusOneYear = exp.getTime() + (1000 * 60 * 60 * 24 * 365)
		exp.setTime(nowPlusOneYear)
		document.cookie= cookie_name+"="+ value +"; expires=" + exp.toGMTString() + "; path=/; domain=central-market.com";
	}
	
}
storeIs = getName('store');
//alert(document.location.indexOf('newSite'));
if (storeIs=="millcreek"){
			//window.location.replace('/newSite/millcreek/home.php');

		}

function setCookie(cookie_name, value) {
	index = document.cookie.indexOf(cookie_name);
	if(index != -1){
		fromCookieToEnd = document.cookie.substring(index);
		nextCookieStart = fromCookieToEnd.indexOf(";");
		if(nextCookieStart == -1){
			nextCookieStart = fromCookieToEnd.length;
		}
		cookieStart = fromCookieToEnd.indexOf("=");
		cookieString = fromCookieToEnd.substring(cookieStart+1,nextCookieStart);
	}else{
		cookieString = "";
	}
	//
	var exp = new Date()
	var nowPlusOneYear = exp.getTime() + (1000 * 60 * 60 * 24 * 365)
	exp.setTime(nowPlusOneYear)
	document.cookie= cookie_name+"="+ value + "|" + cookieString + "; expires=" + exp.toGMTString() + "; path=/; domain=central-market.com";
	alert("This recipe has been added to your favorites section");
}




//recipe print page function, called from flash recipeNav, printable Version button
function openPrint() {
	 myleft=(screen.width)?(screen.width-700)/2:100;
     myNewWin = window.open("http://www.central-market.com/newSite/recipes/recPrintable.html", "printRecipe", "scrollbars=1, width=700, height=700, left="+myleft+", top=10");
	 myNewWin.focus();
}

//recipe print page function for php recipes, called from flash event page printable version button
function openPHPprint(recID, loc) {
	 myleft=(screen.width)?(screen.width-700)/2:100;
     myNewWin = window.open("http://www.central-market.com/newSite/recipes/recPrintable.php?location="+loc+"&recID="+recID, "printRecipe", "scrollbars=1, width=700, height=700, left="+myleft+", top=10");
	 myNewWin.focus();
}

//recipe send to friend function, called from flash recipeNav
function launchRecipeMail() {
	myleft=(screen.width)?(screen.width-400)/2:100;
     myNewWin2 = window.open("http://www.central-market.com/newSite/recipes/recipeMailForm.html", "recipeMail", "width=400, height=350, left="+myleft+", top=40");
	 myNewWin2.focus();
}

//recipe send to friend function for php recipes, called from flash event pages
function launchPHPRecipeMail(recID, loc) {
	myleft=(screen.width)?(screen.width-700)/2:100;
     myNewWin2 = window.open("http://www.central-market.com/newSite/recipes/recipeMailForm.php?location="+loc+"&recID="+recID, "recipeMail", "width=700, height=750, left="+myleft+", top=40");
	 myNewWin2.focus();
}
