
iv_header_isLoaded = true;
s_prop3 = '';
s_prop6 = '';
s_prop7 = '';
s_prop12 = '';
s_prop15 = '';

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

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; 
}
	
// Reads a query string from the URL. Pass in the key name and get back the value. */
function iv_queryString(keyName) {
     var keyValue = ""; keyName = keyName.toUpperCase() + "=";

if (window.location.href.indexOf("?") != -1) {
     var queryString = window.location.href.substring(window.location.href.indexOf("?")+1);
     var searchString = queryString.toUpperCase();
     if (searchString.indexOf(keyName) != -1) {
      var keyValueStart = parseInt(searchString.indexOf(keyName)) + keyName.length;
      var keyValueEnd = searchString.indexOf("&", keyValueStart);
      var keyValueEnd = (keyValueEnd != -1) ? keyValueEnd : searchString.length;
      keyValue = queryString.substring(keyValueStart,keyValueEnd);
     }

     var plusPos = keyValue.indexOf('+');
     while (plusPos != -1) {
         keyValue = keyValue.substring(0, plusPos) + " " + keyValue.substring(plusPos + 1, keyValue.length);
         plusPos = keyValue.indexOf('+');
     }

}
return unescape(keyValue);
}

//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_prop15,tag)) s_prop15 = s_prop15+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 iv_setevar12() {
	sky = iv_queryString('sky');
	if (sky != '') {
		s_eVar12 = sky; 
		iv_SetCookie("iv_skycook",sky,3600,"/", ".ivillage.com");
	}
}

function iv_setevar13() {
	par = iv_queryString('par');
	if (par != '') {
		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");
		}
	}
}


// 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 = "ivillageinnet"; }
   if (prop == null || prop == "") { prop = "s_prop12"; }
   s_linkType=linkType;
   eval(prop+"='"+trackStr+"'");
   s_gs(gs);
   if (url != null && url != "") {
     document.location.href=url;
   }
 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 = iv_GetCookie('iv_seg');
s_eVar15 = s_prop7;

if (!s_prop7) s_prop7 = '';
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>'); }


