iv_header_isLoaded = true;
// s_prop3 changed to s_prop21. 
s_prop21 = '';
/* s_prop6 = ''; */
// s_prop7 changed to s_prop22. 
s_prop22 = '';
// s_prop12 changed to s_prop30.
s_prop30 = '';
// s_prop15 changed to s_eVar28.
s_eVar28 = '';

s_eVar5 = '';
s_eVar12 = '';
s_eVar13 = '';
s_eVar14 = '';
s_eVar15 = '';

/* s_prop11 = ''; */
// s_eVar7 changed to s_eVar25.
s_eVar25 = '';	

s_eVar22 = '';
s_eVar21 = '';

// === Scriptlets (none of these functions can be called inline within this include) ===
if (typeof iv_scriptletIncluded_utilities == "undefined") { document.write("<scr"+"ipt language=\"javascript\" type=\"text/javascript\" src=\"http://www.ivillage.com/shared/js/scriptlets/0,,utilities,00.js\"></scr" + "ipt>"); var iv_scriptletIncluded_utilities = 1; }
// === End Scriptlets ===

function iv_getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1) { endstr = document.cookie.length; }
  return unescape(document.cookie.substring(offset, endstr)); }

function iv_GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg) { return iv_getCookieVal (j); }
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

function iv_DeleteCookie (name,path,domain) {
  if (iv_GetCookie(name)) {
    document.cookie = name + "=" +
      "; path=" + ((path) ? path : "/") +
      ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-1970 00:00:01 GMT";
  }
}

function iv_SetCookie (name,value,expires,path,domain) {
  // expires represents a value in days
  var ckToday = new Date();
  if (expires != null) { var exp = new Date(ckToday.getTime() + expires * 24 * 60 * 60 * 1000); }
  document.cookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + exp.toGMTString() : "") +

    "; path=" + ((path) ? path : "/") +
    ((domain) ? "; domain=" + domain : ""); }

//this function makes sure that there isn't a duplicate "tag" in the "list"
function iv_inList (list, tag) {
	list = list.split(';');
	for (i=0;i<list.length;i++) { 
		if (tag == list[i]) { return true; } 
	} 
		
	return false; 
}

//append vars to omnitags
function iv_setevar5(tag) {	if (!iv_inList(s_eVar5,tag)) s_eVar5 = s_eVar5+tag+';'; }
function iv_setprop15(tag) {     if (!iv_inList(s_eVar28,tag)) s_eVar28 = s_eVar28+tag+';'; }
function setImp(tag) { iv_setprop15(tag); }

function iv_cookevar12() {
	skycook = iv_GetCookie("iv_skycook");
	if (skycook) s_eVar12 = skycook; 
}

function iv_cookevar13() {
	parcook = iv_GetCookie("iv_parcook");
	if (parcook) s_eVar13 = parcook; 
}

function iv_cookevar14() {
	magState = iv_GetCookie("iv_magStage");
	if (magState) s_eVar14 = magState; 
}

function addZero(vNumber){ 
    	return ((vNumber < 10) ? "0" : "") + vNumber 
  	} 

function iv_setevar12() {
	sky = iv_queryString('sky');
	var domainStr = document.location.href;
	
	var skyCookDate = new Date();
	var year = skyCookDate.getFullYear();
	var month = addZero(skyCookDate.getMonth()+ 1); 
	var skyApend = "|y:" + year +"|m:"+ month +"|d:|";
	
	
	if (sky != '') {
		sky = sky + skyApend;
		s_eVar12 = sky; 
		if(domainStr.indexOf("ivillage.com") > 0 )
		  iv_SetCookie("iv_skycook",sky,3600,"/",".ivillage.com");
		if(domainStr.indexOf("astrology.com") > 0 )
		  iv_SetCookie("iv_skycook",sky,3600,"/",".astrology.com");
	}
}

function iv_setevar13() {
	par = iv_queryString('par');
	
	var parCookDate = new Date();
	var year = parCookDate.getFullYear();
	var month = addZero(parCookDate.getMonth()+ 1);
	var parApend = "|y:" + year +"|m:"+ month +"|d:|";
	
	if (par != '') {
		par = par + parApend;
		s_eVar13 = par; 
		iv_SetCookie("iv_parcook",par,3600,"/", ".ivillage.com");
	}
}

function iv_setevar14() {
	if (typeof iv_magState == 'string' ) {
		if (iv_magState) {
			s_eVar14 = iv_magState;		
                        iv_SetCookie("iv_magState",iv_magState,3600,"/", ".ivillage.com");
		}
	}
}

function iv_cookevar20() {
	partSeg = iv_GetCookie("iv_partseg2");
	// changed to eVar22
	if (partSeg) s_eVar22 = partSeg; 
}

function iv_cookevar21() {
	toolEntry = iv_GetCookie("iv_toolentry");
	if (toolEntry) s_eVar21 = toolEntry; 
}


// Used for external tracking.
s_linkType="";

// trackStr - the unique tracking string for the link.
// url - redirects to the url after calling tracking functions.
// prop - which ominiture property to modify.
// linkType - usually defaulted, but can be overridden.
// gs - same as linkType
function iv_doTracking (trackStr, url, prop, linkType, gs ) {
   if (linkType == null || linkType == "") { linkType = "o"; }
   if (gs == null || gs == "") { gs = "nbcuglobal"; }
   // s_prop12 changed to s_prop30.
   if (prop == null || prop == "") { prop = "s_prop30"; }
   s_linkType=linkType;
   eval(prop+"='"+trackStr+"'");
   s_gs(gs);
   redirectUrl = url;
   if (url != null && url != "") {     
    setTimeout("document.location.replace(redirectUrl)", 1000 );
   }
 return true;
}

function iv_SetddcCookie (zip, age, gender, email) {
  if (zip == null) { zip = ""; }
  if (age == null) { age = ""; }
  if (gender == null) { gender = ""; }
  if (email == null) { email = ""; }
  iv_ddc= "Z:" + zip + "|A:"  + age + "|G:"  + gender;
  iv_SetCookie("iv_ddc", iv_ddc, 3600, "/", ".ivillage.com"); 
}

//get segment&eacute;&eacute;&eacute;
// s_prop7 changed to s_prop22.
s_prop22 = iv_GetCookie('iv_seg2');
s_eVar15 = s_prop22;

if (!s_prop22) s_prop22 = '';
if (!s_eVar15) s_eVar15 = '';

//Tacoda
if (typeof(iv_hideTacoda) == 'undefined') { iv_hideTacoda = false; } if (!iv_hideTacoda) {
	document.write('<s'+'cript src="http://a820.g.akamai.net/f/820/822/1d/i.ivillage.com/includes/Tacoda_AMS_DDC_Header.js" lang="Javascript"></s'+'cript>');
	document.write('<s'+'cript src="http://a820.g.akamai.net/f/820/822/1d/i.ivillage.com/includes/TacodaFTT.js" lang="Javascript"></s'+'cript>'); }

// if iv_dcc cookie exists populate the value after the p: value to s_prop11 and s_eVar7.

function iv_setPvalue () {
	var pStr = iv_GetCookie('iv_dcc');
    if (!pStr || pStr == "") { return ""; }
    pArray = pStr.split("|");
    for (var i = 0; i < pArray.length; i++) {
      	var paramArray = pArray[i].split(":");
       	var key = paramArray[0];
        var value = paramArray[1];
        if (key == "P") {
			// s_prop11 removed and s_eVar7 changed to s_eVar25.
          	s_eVar25 = value;
            return "";
		}
   	}
}
