var aol_search1="http://parenting.aol.com/parenting/onlyonaol/search/1,20391,,00.html";
var aol_param1="search_string";
var aol_search2="http://aolsearch.aol.com/aol/search";
var aol_param2="query";
function chooseSearch(radio){
	radio.parentNode.action=eval("aol_search"+radio.value);
	radio.parentNode.getElementsByTagName("INPUT")[3].name=eval("aol_param"+radio.value);
}
function isInAolClient(){return false;}
function getHTTPObject() {
var xmlhttp;
/*@cc_on
@if (@_jscript_version >= 5)
try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
    xmlhttp = false;
  }
}
@else
xmlhttp = false;
@end @*/
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
  xmlhttp = new XMLHttpRequest();
} catch (e) {
  xmlhttp = false;
}
}
return xmlhttp;
}
var writelock=false;
function getFrame(targetId,url){
	setTimeout("requestFrame('"+targetId+"','"+url+"')",0);
}
function requestFrame(targetId,url){
	document.getElementById(targetId).innerHTML="<div id='"+targetId+"_shim'>&nbsp;</div>";
	try{
		var req = new getHTTPObject();
		req.open('GET', url, true); 
		req.onreadystatechange = function(aEvt) {
			if (req.readyState == 4){
				document.getElementById(targetId).innerHTML=req.responseText;
			}
		};	
		req.send(null);
	}catch(error){}
}
function ctaPopup(ctaUrl){
	if (ctaUrl)	window.open (ctaUrl,'CTA','scrollbars=no,location=no,directories=no,height=265,width=275,menubar=no,resizable=no,titlebar=no');
	else		window.open ("",'CTA','scrollbars=no,location=no,directories=no,height=265,width=275,menubar=no,resizable=no,titlebar=no');
}
/**hpp tout functions**/
function fieldTab(the_form, curr_fieldname, next_fieldname){ 
	var num = eval(the_form+'.'+curr_fieldname+'.value'); 
	if (num.length == eval(the_form+'.'+curr_fieldname+'.maxLength')) {
		eval(the_form+'.'+next_fieldname+'.focus()'); 
	}
}
function openWindow(URL, width, height, scroll, resize) {
        tb = "no"   //toolbars
        mb = "no"   //menubars
        st = "no"   //status

        var left = (screen.width - width)/2;
        var top = (screen.availHeight - height)/2;

        strBuff = "width="+width+",height="+height+",top="+top+",left="+left;
        strBuff = strBuff+",toolbar="+tb+",menubar="+mb+",scrollbars="+scroll;
        strBuff = strBuff+",status="+st+",resizable="+resize;

        window.open(URL,"newwindow",strBuff);
}
function forceTwoDigits(field) {
	if(field.value.length == 1) {
		field.value = '0' + field.value;
	}
}
var C_LOGIN_KEY = "SNAHSiteLogin";
var C_LOGIN_VALUE = "HPPProdParentAlt";
var cookie = document.cookie.split("; ");
var cookieDomain = "parenting.com";
function setCookie(){
	document.cookie="test=true; expires=never; path=/; domain="+location.hostname;
}
function getCookieValue(key) {
	for (var i=0; i < cookie.length; i++) {
  		var nextbite = cookie[i].split("=");
  		if (nextbite[0] == key)
  			return unescape(nextbite[1]);
	}
	return null;
}
function writeSaveButton(url, headline, publication) {
	var login = getCookieValue(C_LOGIN_KEY);
	 if (login == C_LOGIN_VALUE) {
		return "<a href='http://www.parenting.com/parenting/hpp.dyn?action=savedArticles&Article_Name=" + headline + "&Article_Url=" + url + "&sub_action=Add_Article&Publication_Name=" + publication + "'><img src='http://img.timeinc.net/parenting/web/images/article/article_buttons_02.gif' width='41' height='28' border='0'></a>";
	} else {
		return "";
	}
}  
function clearForm(which){
		which.value='';
	}

function createHyperlink(href, target, linkclass, linktext, channelpath) {
	if (channelpath != "" && channelpath != null) {
		
			href = href.replace("/parenting", channelpath);
		 }
	var link = "<a href='" + href + "?" + window.location.search.substring(1) + "' ";
	if (target != null) {
		link = link + "target='" + target + "' ";
	}
	if (linkclass != null) {
		link = link + "class='" + linkclass + "' ";
	}
	link = link + ">" + linktext + "</a>";
	return link;
}