// Flash bandwidth var
var iv_bandwidth = iv_getCookie("iv_pbpBandwidth");

// === Send To A Friend OR "Email this page" functionality===
// iv_openS2F - Opens S2F window. Use iv_S2FOverride to override standard page location.
function iv_openS2F() {
 
    iv_S2FUrl = typeof iv_S2FOverride == "undefined" ? window.document.location.href : iv_S2FOverride;
	    

    var w = 540;
    var h = 520;
    var cw = 252;
    var ch = 203;

    if (window.screen) {
        cw = Math.floor((screen.availWidth - w) / 2);
        ch = Math.floor((screen.availHeight - h) / 3);
    }

    var mywin = window.open ('http://www.ivillage.com/pbp/s2f/form', 's2f', 'width=540,height=520,top=' + ch + ',left=' + cw + ',scrollbars=yes');
} 

// Flash bandwidth detection.
// If this is called then set the cookie. 
function iv_setBandwidth(kbps) {
  kbps = parseInt(kbps);
  var speed = "100";
  if (kbps > 500 && kbps < 2000) {
    speed = "200";
  } else if (kbps >2000 || isNaN(kbps)) {
    speed = "300";
  }
  iv_setCookie ("iv_pbpBandwidth", speed);
  iv_bandwidth = speed;
}

function iv_drawBandwidthDetect() {
  if (iv_isDOM && (typeof iv_flashObj_detect != "undefined")) {
	  if (document.getElementById("flashcontent_detect") != null) {
	    document.getElementById("flashcontent_detect").innerHTML = iv_flashObj_detect.getHTML();
		
	  }
  }
}

function iv_checkBandwidth() {

  if (iv_bandwidth == "" || iv_bandwidth == null) {
	iv_drawBandwidthDetect(); 
  }
}


function iv_handlePBPSearch(inputForm, frmIDBase) {
    var skin = inputForm.sk;
    var restrictValue = inputForm.restrict;
    var 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;
    }
    var r1 = inputForm.restrict[0].checked;
    if (r1) {
      inputForm.action = "http://search.ivillage.com/search/pbp";
      restrictValue.value = "pbp";
	  inputForm.target="";
    } else {
      inputForm.action = "http://search.ivillage.com/search/ivillage";
      restrictValue.value = "ivillage";
	  inputForm.target="_new";
    }
    return true;
    
}


  var iv_arrBoardLink = new Array();
   iv_arrBoardLink["baby|aug05"] = "http://messageboards.ivillage.com/iv-prplayaug05n";
   iv_arrBoardLink["baby|jul05"] = "http://messageboards.ivillage.com/iv-prplayjul05n";
   iv_arrBoardLink["baby|jun05"] = "http://messageboards.ivillage.com/iv-prplayjun05n";
   iv_arrBoardLink["baby|may05"] = "http://messageboards.ivillage.com/iv-prplaymay05n";
   iv_arrBoardLink["baby|apr05"] = "http://messageboards.ivillage.com/iv-prplayapr05n";
   iv_arrBoardLink["baby|mar05"] = "http://messageboards.ivillage.com/iv-ppplaymar05n";
   iv_arrBoardLink["pregnant|oct05"] = "http://messageboards.ivillage.com/iv-ppoct05n";
   iv_arrBoardLink["pregnant|nov05"] = "http://messageboards.ivillage.com/iv-ppnov05n";
   iv_arrBoardLink["pregnant|dec05"] = "http://messageboards.ivillage.com/iv-ppdec05n";
   iv_arrBoardLink["pregnant|jan06"] = "http://messageboards.ivillage.com/iv-ppjan06n";
   iv_arrBoardLink["pregnant|feb06"] = "http://messageboards.ivillage.com/iv-ppfeb06n";
   iv_arrBoardLink["pregnant|mar06"] = "http://messageboards.ivillage.com/iv-prmar06n";
   iv_arrBoardLink["pregnant|apr06"] = "http://messageboards.ivillage.com/iv-prapr06n";
   iv_arrBoardLink["pregnant|may06"] = "http://messageboards.ivillage.com/iv-prmay06n";
   iv_arrBoardLink["pregnant|jun06"] = "http://messageboards.ivillage.com/iv-prjun06n";
  
  
  function iv_drawMomGroup(iceTag) {
    var groupURL = "";
	var groupURL = iv_arrBoardLink[iv_duedate];
   
	if (typeof(groupURL) == "undefined") { 
	  var temp = iv_duedate.split("|");
      var modifier = "";
      if (temp[0] == "baby") { modifier = "play"; }
      groupURL = "http://messageboards.ivillage.com/iv-pr" + modifier + temp[1] + "n?" + iceTag;
	}
    var mywin = window.open (groupURL);
  }