

 

<!-- hide
// Begin Version Detection
isDOM  = (document.getElementById);
isNS4  = (document.layers);
isIE   = (document.all);
isIE4  = (isIE && !isDOM);
isMac  = (navigator.appVersion.indexOf("Mac") != -1);
isIE4M = (isIE4 && isMac);
isIE5M = isDOM && isIE && isMac;
isIE5W = isDOM && isIE && !isMac;
isNS6 =  isDOM && (navigator.vendor == ("Netscape6") || navigator.product == ("Gecko"));
// End Version Detection
iv_verticalID = "";

// Scriptlets
if (typeof iv_scriptletIncluded_cta == "undefined") { document.write("<scr"+"ipt language=\"javascript\" type=\"text/javascript\" src=\"http://www.ivillage.com/shared/js/scriptlets/0,,cta,00.js\"></scr" + "ipt>"); var iv_scriptletIncluded_cta = 1; }
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; }
if (typeof iv_scriptletIncluded_json == "undefined") { document.write("<scr"+"ipt language=\"javascript\" type=\"text/javascript\" src=\"http://www.ivillage.com/shared/js/scriptlets/0,,json,00.js\"></scr" + "ipt>"); var iv_scriptletIncluded_json = 1; }

// Reads a query string from the URL. Pass in the key name and get back the value. */ 
function 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); 
} 

// Verifies search input. To be deleted.
// @param Form to be checked.
// @return true/false depending on validation.
function processFindIt (box) {
    mt = box.qry.value;
    if (mt.length == 0) {
        alert ('Your search could not be completed because no search words were entered.');
        return false;
    }
}

// To be deleted
// Submit handler. Verifies search input. Alters action depending on button pushed.
// Script will check for optional global shadow tags (shadowTagAJ & shadowTagG)
// @param inputForm Form object to be checked.
// @return boolean value if form is valid or not.
function handleSearchSubmit(inputForm) {
    // Check for shadow tags
    var shadowAJ = typeof(shadowTagAJ) == 'undefined' ? "" : shadowTagAJ;
    var shadowG = typeof(shadowTagG) == 'undefined' ? "" : shadowTagG;

    mt = inputForm.qry.value;
    if (mt.length == 0) {
        alert ('Your search could not be completed because no search words were entered.');
        inputForm.qry.focus();
        inputForm.qry.select();
        return false;
    }

    for (var i = 0; i < inputForm.alias.length; i++) {
        if (inputForm.alias[i].checked) {
            var selectedValue = inputForm.alias[i].value;
        }
    }

    if (selectedValue == "google") {
        inputForm.action = shadowG + "http://search.ivillage.com/google/";
    } else {
        inputForm.action = shadowAJ + "http://findit.ivillage.com/find/";
    }

    return true;
}


// Submit handler. Verifies search input. Alters action depending on button pushed.
// @param inputForm Form object to be checked.
// @return boolean value if form is valid or not.
function handleGoogleSubmit(inputForm) {
    mt = inputForm.q.value;
    if (mt.length == 0) {
        alert ('Your search could not be completed because no search words were entered.');
        inputForm.q.focus();
        inputForm.q.select();
        return false;
    }

    for (var i = 0; i < inputForm.restrict.length; i++) {
        if (inputForm.restrict[i].checked) {
            var selectedValue = inputForm.restrict[i].value;
        }
    }
	var skin = inputForm.sk.value;

    if (selectedValue == "") {
		if (skin == "ivi") {
        	inputForm.action = "http://search.ivillage.com/search/web";
		} else if (skin == "gur") {
			inputForm.action = "http://search.ivillage.com/search/webgurl";
		} else if (skin == "wom") {
			inputForm.action = "http://search.ivillage.com/search/webwomen";
		} else if (skin == "ast") {
			inputForm.action = "http://search.ivillage.com/search/web";
		}
		return true;
    } else if (selectedValue == "Astrology") {
		inputForm.action = "http://search.ivillage.com/search/ivillage";
	} else if (selectedValue == "gURL") {
		inputForm.action = "http://search.ivillage.com/search/gurl";
	} else if (selectedValue == "Women") {
		inputForm.action = "http://search.ivillage.com/search/women";
	} else {
		inputForm.action = "http://search.ivillage.com/search/ivillage";	
    }
	myInput = document.createElement("INPUT");    
	myInput.name="filter";
	myInput.id="idFilter";
	myInput.value="p";
	myInput.type="hidden";
	inputForm.appendChild(myInput);
    return true;
}

// interstitial for tool front ends
function popAdTFE (subForm) {
  if (subForm.useCookie != null) {
    if (GetCookie('ivQuiz') == null) {
      SetCookie('ivQuiz', 'yes', '', '', '.ivillage.com');
    } else {
      return true;
    }
  }
  ivAD=window.open('/interquizzal/frame/0,,'+subForm.hidden_ID.value+',00.html' ,'ivAd',"WIDTH=480,HEIGHT=515");
  quizForm = subForm;
  setInterval("ivAD.close();",15000);
  if (navigator.platform == 'MacPPC') {
    timerID = setInterval("if (ivAD.closed || !ivAD) {quizForm.submit(); clearInterval(timerID);}",1000);
  } else {
    setInterval("quizForm.submit();",15100);
  }
  return false;
}

// Select box redirector (opens in same window)
function newpage(box) {
  if (box.options[box.selectedIndex].value == '') { return; }
  document.location.href = box.options[box.selectedIndex].value;
}

function pleasedontGo(box) {
  if (box.selectedIndex == -1) { alert('Please select a value first.'); return; }
  val = box.options[box.selectedIndex].value; window.open (val,'_top'); }

// Select box redirector (opens in new window)
function windowRedirect (selectBox) {
  if (selectBox.selectedIndex == -1) {
    alert("Please select a value first.");
    return;
  }
  
  val = selectBox.options[selectBox.selectedIndex].value;
  window.open (val,'_top');
}

// 4th Column redirector (opens in new window)
function pleasedoGo(box) {
  if (box.selectedIndex == -1) {
    alert('Please select a value first.');
    return;
  }
  
  if (box.options[box.selectedIndex].value == '') { return; }
  val = box.options[box.selectedIndex].value;
  window.open (val,'sponsor');
}

// Generic window opener (need to pass html)
function newWin(width, height, bgcolor, lcolor, name, title, content) {
  popupWin = window.open("", name, "scrollbars,width=" + width + ",height=" + height);
  if (popupWin == null) {window.open("", name, "width=" + width + ",height=" + height);}
  // the funkiness below is to prevent nesting of the scr*pt tags
  var m = "<html>\n<head><title>" + title + "</title>\n<scrip" + "t language=javascript>function t() {}</scrip" + "t></head>\n<body bgcolor=#" + bgcolor + " link=#" + lcolor + " alink=#" + lcolor + " vlink=#" + lcolor + ">\n";
  m += content;
  m += "</body>\n</html>";
  popupWin.document.write(m);
  popupWin.document.close();
  popupWin.focus();
}

// CIMS form handler.  
// Checks the email field, and sets cid and cid fields. All CIMS forms MUST have 
// these fields.
function processCIMS (theForm,popUp) {
   // See if we have any spaces.
	var space = theForm.email.value.indexOf(" ");
	if (space != -1) { 
	alert("Please check your email address");
	return false; 
	}
	
	var pos1 = theForm.email.value.indexOf("@");
    if (pos1 < 1) { 
	alert("Please check your email address");
	return false; 
	}
    var email = theForm.email.value.substr(pos1 + 1);
    var pos2 = theForm.email.value.indexOf(".");
    if (pos2 < 1 || theForm.email.value.substr(pos2 + 1) == "" || (pos2 - pos1) == 1) { 
	alert("Please check your email address");
	return false; 
	}
	

  if (typeof(cimsCid) != 'undefined') {
    theForm.cid.value=cimsCid;
  }
  
  if (typeof(cimsUid) != 'undefined') {
	theForm.uid.value=cimsUid;
  }
  
  // Append the email address to the rurl.
  //theForm.rurl.value += "?email=" + theForm.email.value;
  
  // If popUp is specified, open CIMS in a new window.
  if (popUp == 'y') {
    cimsWindow = window.open('','cimsWindow',"WIDTH=770,HEIGHT=600,scrollbars=yes,toolbar=yes,resizable=yes,location=yes,menubar=yes,statusbar=yes"); 
    theForm.target = 'cimsWindow';
    return true;
  } else {
    return true;
  }
}



function isValidEmail(email) {
    // See if we have any spaces.
	var space = email.indexOf(" ");
	if (space != -1) { return false; }
	
	var pos1 = email.indexOf("@",1);
    if (pos1 < 1) { return false; }
    var email = email.substr(pos1 + 1);
    var pos2 = email.indexOf(".",1);
    if (pos2 < 1 || email.substr(pos2 + 1) == "") { return false; }
    return true;
}
// @param thisForm Form object to be tested
// @param popUp checks for popUp window
// @return true/false
function doNewsletterSubmit(theForm,popUp) {
    theForm.ip.value = document.location.href;
    theForm.action="https://subscriber.ivillage.com/sagews"    //Get Server Environment
	if (!isValidEmail(theForm.email.value)) {
	  alert("Enter valid email address");
	  return false;
    }	

    if (theForm.r.value == "") { theForm.r.value = "http://www.ivillage.com/ivillage/thankyou/newsletters"; }
	if (popUp == 'y') {
	    sageWindow = window.open('','sageWindow',"WIDTH=500,HEIGHT=500,scrollbars=yes,toolbar=yes,resizable=yes,location=yes,menubar=yes,statusbar=yes"); 
    	theForm.target = 'sageWindow';
		theForm.submit();
    	return false;
  	} else {
		theForm.submit();
    	return false;
  	}

}

// @param thisForm Form object to be tested
// @param popUp checks for popUp window
// @return true/false
function doFunnel4Submit(theForm,popUp) {
    theForm.action="https://subscriber.ivillage.com/funnels/4/" 
	if (!isValidEmail(theForm.email.value)) {
	  alert("Enter valid email address");
	  return false;
    }	

    if (popUp == 'y') {
	    sageWindow = window.open('','sageWindow',"WIDTH=720,HEIGHT=500,scrollbars=yes,toolbar=yes,resizable=yes,location=yes,menubar=yes,statusbar=yes"); 
    	theForm.target = 'sageWindow';
		theForm.submit();
    	return false;
  	} else {
    	return true;
  	}
}


// ===== Cookie Code =====
var ckToday = new Date();

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

function 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 getCookieVal (j); }
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      "; path=" + ((path) ? path : "/") +
      ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-1970 00:00:01 GMT";
  }
}
 
function 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 : "");
}

function setIntervalCookie (name, value, interval, mode) {
  var now = new Date();
  var aDay = 86400000
  var aHour = 3600000
  var aMinute = 60000
  var aSec = 1000
  
  if (mode == 'days') {
    //this gets the precise seconds to set the cookie, calculating the days (not 24hours)
    now.setTime(now.getTime() + ((interval-1)*aDay)+(24-now.getHours())*aHour+aMinute)
  } else if (mode == 'hours') {
	now.setTime(now.getTime() + interval * aHour)
  }
 
  //now set the cookie
  document.cookie = name+"="+escape(value)+"; expires="+now.toGMTString()+"; path=/";
}
// ===== End Cookie Code =====




if(!window.saveInnerWidth) {
  window.onresize = resize;
  window.saveInnerWidth = window.innerWidth;
  window.saveInnerHeight = window.innerHeight;
}

function resize() {
    if (saveInnerWidth < window.innerWidth || 
        saveInnerWidth > window.innerWidth || 
        saveInnerHeight > window.innerHeight || 
        saveInnerHeight < window.innerHeight ) 
    {
        window.history.go(0);
    }
}

// Feedroom video popup
function iv_FRPop(url) {
    popupWindow = window.open(url,"videoPopup","width=800,height=500,location=yes,toolbar=yes,status=yes,resizable=yes,scrollbars=yes,menubar=yes,left=10,top=10");
    popupWindow.focus();
}

function challengeUser() {
	// Validate user
	if (GetCookie('temp_auth') != "logged" && (queryString("pp_user") == "" && queryString("pp_ticket") == "")) {
		document.location = "https://subscriber.ivillage.com/funnels/7?vrt=pp&prd=pregcl&dd="+escape(document.location);
	} else {
	  SetCookie('temp_auth','logged');
	}
}

// end hide -->



<!-- hide
	http_referrer = new String(document.referrer);
	
	if (http_referrer.indexOf("msn.co.uk") != -1) {
		document.write("<base target=_top>")
	}
// end hide -->
<!-- hide 
  var CookieName = "exciteuk"; var CookieString = document.cookie;
  var CookieSet = CookieString.split (';'); var SetSize = CookieSet.length;
  var CookiePieces; var ReturnValue = ""; var x = 0;
  for (x = 0; ((x < SetSize) && (ReturnValue == "")); x++) {
    CookiePieces = CookieSet[x].split ('=');
    if (CookiePieces[0].substring (0,1) == ' ') {
      CookiePieces[0] = CookiePieces[0].substring (1, CookiePieces[0].length);
    }
    if (CookiePieces[0] == CookieName) { ReturnValue = CookiePieces[1]; }
  }

if (ReturnValue != "") { document.write("<a href=http://www.excite.co.uk target=_top><img src=http://a820.g.akamai.net/f/820/822/1d/i.ivillage.com/uk_en/homepage/images/back_to_excite.gif border=0 alt=excite></a><br><br>");
		document.cookie = "exciteuk=yeah; domain=ivillage.co.uk";
} else {
	if (location.search.indexOf("excite") != -1) {
		document.cookie = "exciteuk=yeah; domain=ivillage.co.uk";
		document.write("<a href=http://www.excite.co.uk target=_top><img src=http://a820.g.akamai.net/f/820/822/1d/i.ivillage.com/uk_en/homepage/images/back_to_excite.gif border=0 alt=excite></a><br><br>");
	}
}

// AOL cookie
var aolquery = location.search.substr(1,1);
if (aolquery == '1') {
	document.cookie = "aoluk=done; domain=.ivillage.co.uk";
}

// New UK Google Search form edit.
function noEntry2(form) {
	//alert(form.qry.value);
	
	// Check for null value
	if ((form.q.value.length < 1)||(form.q.value.substring(0,6)=="******")) {
	   alert("Your search could not be completed because no search words were entered.");
       form.q.focus();
       form.q.select();
	   return false;
	}
	
	form.action = 'http://search.ivillage.co.uk/search/ivillageuk';
	return true;
}



// OLD - UK findit Search form edit.
function noEntry(form) {
	var popupWin;
	var alias;
	var dir;
	
	//alert(form.qry.value);
	
	// Check for null value
	if ((form.qry.value.length < 1)||(form.qry.value.substring(0,6)=="******")) {
	   alert("Your search could not be completed because no search words were entered.");
       form.qry.focus();
       form.qry.select();
	   return false;
	}
		
	// Find out which item is selected.
	for (i=0; i<form.findit_select.length; i++) {
		if (form.findit_select[i].selected) {
			//alert(form.findit_select.options[i].value);
			if (form.findit_select.options[i].value == "Infospace") {
				//alert("Infospace");
				popupWin = window.open("http://www.infospace.com/uk.iv2uk/dog/redir.htm?qkw=" + form.qry.value + "&alias=Infospace");
				return false;
			} else {
				//alert("ivillageuk");
				alias = "_uksearch"; 
 				dir = form.findit_select.options[i].value;
				location.href='http://findit.ivillage.co.uk/find?qry=' + form.qry.value + '&dir=' + dir + '&alias=' + alias;
				return false;
			} 
		} 
	}
}

// OLD - UK findit Search form edit (footer)
function chooseSearch(form) {
	var popupWin;
	var alias;
	var dir;

	searchOption = -1;
	for(i=0;i<form.findit_select.length;i++) {
		if (form.findit_select[i].checked) {
			searchOption = i;
		}
	}
	if (!(form.qry.value.length < 1)) {
		if (searchOption == 0) {
			alias = "_uksearch";
		 	dir = "ivillageuk";			
			location.href='http://findit.ivillage.co.uk/find?qry=' + form.qry.value + '&dir=' + dir + '&alias=' + alias;
			return false;
		} else {
			popupWin = window.open("http://www.infospace.com/uk.iv2uk/dog/redir.htm?qkw=" + form.qry.value + "&alias=Infospace");
			return false;
		}
	} else {
		alert("Your search could not be completed because no search words were entered.");
        form.qry.focus();
        form.qry.select();
		return false;
	}
}




function putout_link(the_html,repl_link) {
	var thecookies = document.cookie;
	var pos = thecookies.indexOf('aoluk=');
	//alert('aoluk position=' + pos);
	//alert(the_html + repl_link);
	if (pos != -1) {
		return(repl_link);
	} else {
		return(the_html);
	}
}

function uk_member_wall(saved_url, auth_channel)
{
	//alert(saved_url, auth_channel);
	
	// Determine if auth needs to be called. Users must be logged in to view and save the pregnancy calendar.	
	
	// Testing - Delete iv_id cookie.
	//DeleteCookie("iv_id","/","ivillage.co.uk");
	//alert("after deleting iv_id cookie...");
	
	var iv_id = GetCookie("iv_id");
	//alert("iv_id=" + GetCookie("iv_id"));
	if (iv_id != "undefined" && iv_id != "" && iv_id != null) 
	{
		//alert("logged in...");
		/* user is logged in; no need to go to auth. */
		location.href = saved_url;
	}
	else
	{
		//alert("not logged in...");
		/* user is either not logged in, or not a memeber. go to auth */
		/* Set the location of auth. */
		var url = "https://auth.ivillage.co.uk/login/login?s=uk&dt=rurl&dd=";
		
		/* Set the final url version. */
		url += "http://www.ivillage.co.uk";
		final_url = url + escape(saved_url);
		//alert(final_url);
		//return false;
		location.href = final_url;
	}
	return false;
}
// end hide -->

// UK Rollovers
// ##########
function display(id, str) {
  
	if (isNS4) { // if Navigator 4.0+
		with (document[id].document) {
			open(); // open document
			write(str); // write to document
			close(); // close document
		}
	} else if (isIE4) { // Internet Explorer 4.0
		document.all[id].innerHTML = str; // assign to element
	} else if (isIE5) { // Internet Explorer 5.0
		document.all[id].innerHTML = str; // assign to element
	} else if (isNS6) { // Netscape 6+
		var thing = document[id].document;
		document.open();
		document.write(str);
		document.close();
	}
}

function swapClass(text, spName, urlName, oldName, clName, over) {
	if (bVer < 4) { // old browser
		return; // terminate the function
	}  
	// create a new string for the link
	var str = "<a class=' + clName + ' href=' + urlName + '";
	if (over) {
		// replace onMouseOver with onMouseOut
		// replace true with false
		str += "onMouseOut = swapClass(' + text + ', ' + spName + ', ' + urlName + ', ' + clName + ', ' + oldName + ', false)>";
	} else {
		// replace onMouseOut with onMouseOver
		// replace false with true
		str += "onMouseOver = swapClass(' + text + ', ' + spName + ', ' + urlName + ', ' + clName + ', ' + oldName + ', true)>";
	}
	str += text + "</a>";
	display(spName, str); // update the code
}
// ##########
// End of UK Rollovers


