function avPlayer(mediaURL,mediaCaption,audPic,wid,hei,av,mediaType,logoURL,sqAd,bnrAd){/* generic broadband player */
	//mediaURL - url of media(REQUIRED) - all others are optional
	if(!mediaCaption){mediaCaption='';}//optional text to show below the clip,limited to 50 characters
	//in mediaCaption must use \" to show a " [double quote] and \' to show a ' [single quote] - character escaping
	if(!audPic){audPic='http://images.beliefnet.com/imgs/v4/broadband/bbSwirl.swf';}
	//url of placeholder image(gif or jpeg) or animation(swf) for audio streams only	//(default: http://images.beliefnet.com/imgs/v4/broadband/bbSwirl.swf')
	if(!wid){wid='320';}//video width - default to '320'
	if(!hei){hei='240';}//video height - default to '240'
	if(!av){av='aud';}//(for audio - default) or 'vid' - default is 'aud'
	if(!mediaType){mediaType='rm';}//'rm' or 'flash' - default to 'rm'
	if(!logoURL){logoURL='none';}//no logo by default
	if(!sqAd){sqAd='00/13/21/79';}//square ad tag code - default to '00/13/21/79'
	if(!bnrAd){bnrAd='00/13/21/78';}//bottom banner ad tag code - default to '00/13/21/78'
	if(!mediaURL||mediaURL==''){}
	else {var tmpLoc='http://www.beliefnet.com/broadband/bnetPlayer.aspx?mediaType='+mediaType+'&mediaURL='+escape(mediaURL);tmpLoc=tmpLoc+'&mediaCaption='+escape(mediaCaption)+'&av='+av+'&audPic='+escape(audPic);
		tmpLoc=tmpLoc+'&wid='+wid+'&hei='+hei+'&logoURL='+escape(logoURL)+'&sqAd='+sqAd+'&bnrAd='+bnrAd;avWin=window.open(tmpLoc,'avPlayerWin','height=570,width=770,resizable=yes');
	}
}
//*STEP ONE: COPY JAVASCRIPT INTO YOUR WEB PAGE(S)*
function randomSurvey(scale){var expdate=new Date();
	//var surveyCookieName="BnetInstExprSurvey";//named by Anthony
	var surveyCookieName="BnetOpLdrs";//opinion leaders survey
	//var percentOfferedSurvey=25;//CHANGE THIS PARAMETER TO CONTROL SAMPLING RATE
	var percentOfferedSurvey=15;//CHANGE THIS PARAMETER TO CONTROL SAMPLING RATE
	//var surveyLocation="http://www.insightexpress.com/s/Cons80951?uid=4&onfinish=close";//given from Erin to Anthony
	var surveyLocation="/includes/v3/opinionLdrs.html";//opinion leaders survey
	var popupNewWindow=true;//or show the survey in the same window.
	expdate.setTime(expdate.getTime() +(365 * 24 * 60 * 60 * 1000));//1 year from now
    var stored_value=GetCookie2(surveyCookieName);var dd=new Date();cn=Math.round(dd.getTime() / 100) % 100;
	if((cn <=percentOfferedSurvey)&&(stored_value==null)){SetCookie2(surveyCookieName,"alreadyOffered",expdate);
		window.open(surveyLocation,'new_window','width=320,height=450,resizable=yes,scrollbars=no');
	}
}
function SetCookie2(name,value,expires,path,domain,secure){document.cookie=name+"="+escape(value) +
	((expires) ? ";expires="+expires.toGMTString() : "") +
	((path) ? ";path="+path : "") +
	((domain) ? ";domain="+domain : "") +
	((secure) ? ";secure" : "");
}
function getCookieVal2(offset){var endstr=document.cookie.indexOf(";",offset);
	if(endstr==-1){endstr=document.cookie.length;}
	return unescape(document.cookie.substring(offset,endstr));
}
function GetCookie2(name){var arg=name+"=";var alen=arg.length;var clen=document.cookie.length;
	if((document.cookie==null)||(document.cookie.length==null)){return null;}
	var i=0;
	while(i < clen){var j=i+alen;
		if(document.cookie.substring(i,j)==arg){return getCookieVal2(j);}
		i=document.cookie.indexOf(" ",i)+1;
		if(i==0) break;
	}
	return null;
}
function GetCookieKey(name,key){var result="";var tcookie=GetCookie2(name);
	if(tcookie!=null){temp=tcookie.split("&");
		for(var i=0;i<temp.length;i++){if(temp[i].indexOf(key,0)>=0){args=temp[i].split("=");result=args[1];break;}}
	}
	return result;
}
//* END OF STEP 1 - STEP TWO: COPY INTO BODY OF HTML DOCUMENT *
//<BODY LINK onload="randomSurvey()">
//comment and uncomment to take away or add the survey
//randomSurvey();
//* END OF STEP TWO *
//editorial popunder
var expdate=new Date();
expdate.setTime(expdate.getTime() +(7 * 24 * 60 * 60 * 1000));//cookie expires 7 days from now
function editPop(){SetCookie2('BNetEditPop','alreadyOffered',expdate);window.open('/includes/v3/edPop.html','edWin','width=711,height=312');}
//if(GetCookie2('BNetEditPop')==null){setTimeout("editPop()",5000);}
//pjp2r popunder
function pjp2rPop(){page=window.location.href;
	if(page.indexOf('beliefnet.com/index.html')==-1&&page!='http://www.beliefnet.com/'&&page!='http://beliefstaging.beliefnet.com/'){
		SetCookie2('BNetPJP2RPop','alreadyOffered',expdate,'/');
		window.open('http://www.surveymonkey.com/s.asp?u=117581252522','pjp2rWin','width=640,height=600,scrollbars=yes');
	}
}
/* call the pope popunder and if they have the cookie then callthe other popup so user will never see 3 pops at one time */
//if(GetCookie2('BNetPJP2RPop')==null){setTimeout("pjp2rPop()",3000);}
//if(GetCookie2('BNetEditPop')==null){setTimeout("editPop()",5000);}
//else {randomSurvey();}
var dontshow=false;
var popwin=null;
var bnum=new Number(Math.floor(99999999 * Math.random())+1);sniff=navigator.userAgent.toLowerCase();
if(sniff.indexOf('aol')!=-1){}
else{
var qsParm=new Array();
function qs(){
	var query=window.location.search.substring(1);
	var parms=query.split('&');
	for(var i=0;i<parms.length;i++){
		var pos=parms[i].indexOf('=');
		if(pos > 0){
			var key=parms[i].substring(0,pos);
			var val=parms[i].substring(pos+1);
			qsParm[key]=val;
		}
	}
}
qs();
if(qsParm['source']==''||qsParm['source']==null){source='';}
else {source=qsParm['source'];}
if(qsParm['medium']==''||qsParm['medium']==null){medium='';}
else {medium=qsParm['medium'];}
if(qsParm['campaign']==''||qsParm['campaign']==null){campaign='';}
else {campaign=qsParm['campaign'];}
if(qsParm['nopop']==''||qsParm['nopop']==null){nopop='';}
else {nopop=qsParm['nopop'];}
var nopopDate=new Date();
/* cookie expires in ~17 seconds or ~0.0002 days from now */
nopopDate.setTime(nopopDate.getTime() +(0.0002 * 24 * 60 * 60 * 1000));
/* if nopop is true set a cookie,they won't see the popup */
if(nopop==1){SetCookie2('BNetFromNoPop','alreadyOffered',nopopDate,'/');}
	function setCookie(NameOfCookie,value,expirehours){
	var ExpireDate=new Date();ExpireDate.setTime(ExpireDate.getTime() +(expirehours * 3600 * 1000));document.cookie=NameOfCookie+"="+escape(value) +	((expirehours==null) ? "" : ";expires="+ExpireDate.toGMTString()) +	";path=/;" ;}	//if(document.cookie.indexOf('AdComPop689197')==-1)	//{
	//setCookie('AdComPop689197','yes');
	if(GetCookie2('BNetFromNoPop')==null){
		/* remove falk ad tag */
		/* <!-- BEGIN: AdSolution-Website-Tag 4.2 : BeliefNet / Site-Default_720x300 --> */
		/*
		document.write('<scr'+'ipt language="javascript" type="text/javascript">');
		document.write('Ads_kid=0;Ads_bid=0;Ads_xl=0;Ads_yl=0;Ads_xp="";Ads_yp="";Ads_xp1="";Ads_yp1="";Ads_opt=0;Ads_wrd="";Ads_prf="";Ads_par="";Ads_cnturl="";Ads_sec=0;Ads_channels="";');
		document.write('</scr'+'ipt>');
		document.write('<scr'+'ipt type="text/javascript" language="javascript" src="http://a.as-us.falkag.net/dat/cjf/00/08/99/79.js"></scr'+'ipt>');
		*/
		/* <!-- END:AdSolution-Tag 4.2 --> */
	} else {SetCookie2('BNetFromNoPop','',-1,'/');}
}
function setcookie(cstr){cookie_str=cstr;cookie_str +=";PATH=/";document.cookie=cookie_str;}
this.window.name='windowMain';
function submitPoll(pollID,randpollID,voteType){var f='poll'+pollID+"_"+randpollID;var url="/polls/poll_vote.asp";
	var qstr="?pollID="+document.forms[f].pollID.value+"&voteType="+voteType;var numberOfPollResponses=document.forms[f].numberOfPollResponses.value;
	for(i=0;i < numberOfPollResponses;i++){
		if(document.forms[f].responseID[i].checked=="1"){qstr +="&responseID="+document.forms[f].responseID[i].value;break;}
	}
	openNewWin( url+qstr,'pollResults',350,400,true);
}
//opens a web page in a popup window
function openNewWin(page,win_name,width,height,scrollbars)
{
  var remote;
  
  //spicificly to support video popups under brightcove
  if (page.toLowerCase().indexOf("/av/popupplayer.aspx") > -1)
  {
    page = page.replace("/av/popupplayer.aspx","/video/popupplayer.aspx")
    width=845;
    height=455;
  }
  
  if(win_name=="login_popup")
  {
	startIndex=page.indexOf("?");
	parent.document.location.href="/login.asp\?"+page.substring(startIndex+1,page.length);
  }
  else
  {
    var xMax=screen.width;xMax=xMax-(width+15);
	if(scrollbars)
    {
      remote=window.open(page,win_name,"width="+width+",height="+height+",scrollbars,dependent=yes,left="+xMax+",screenX="+xMax+",top=0,screenY=0");
    }
    else 
    {remote=window.open(page,win_name,"width="+width+",height="+height+",scrollbars=auto,resize=no,dependent=yes,left=" +xMax+ ",screenX=" +xMax+ ",top=0,screenY=0");}
	remote.focus();
	}
}
//a wrapper for openNewWin() that is spicific to brightcove video
function videoPopup(videoID,loadPage)
{
  AdStr = "";
  if(document.body)
  {
    adCdBase=document.body.innerHTML;
    adStrt=adCdBase.search("src=\"http://ad.doubleclick.net");
    if(adStrt>-1)
    {
      adCdBase=adCdBase.substr(adStrt+30);
      adCdBase=adCdBase.substr(0,adCdBase.search("pos"));
      if(adCdBase.charAt(0)=="/")
        AdStr="&AdCode="+adCdBase;
    }
  }
 
  openNewWin('http://www.beliefnet.com/video/popupplayer.aspx?videoId='+videoID+AdStr,'popupplayer',845,455);
  
  if (loadPage)
    return true;
  else
    return false;
}

//code to embed a video in a page, still requires the brightcove javascript include in the page
function embedVideo(vid,pid)
{
  var config = new Array();
  config["videoId"] = vid;
  config["videoRef"] = null;
  config["lineupId"] = null;
  config["playerTag"] = null;
  config["autoStart"] = false;
  config["preloadBackColor"] = "#FFFFFF";

  //controls the size if in a story page
  if (window.location.href.indexOf("/story_") > -1)
  {
    config["width"] = 430;
    config["height"] = 365;
  }
  if (window.location.href.indexOf("/christianmusic") > -1)
  {
    config["width"] = 400;
    config["height"] = 339;
  }
  else //normal size
  {
    config["width"] = 486;
    config["height"] = 412;
  }

  config["wmode"] = "transparent";
  config["transparentBackground"] = true; 
 
  if (typeof(pid) == "undefined")
    config["playerId"] = 1460867924;
  else
    config["playerId"] = pid;
  
  //if the brightcove coad is loaded
  if (typeof(createExperience) != "undefined")
    createExperience(config, 8);
  else //write a place holder
    document.write ("<!-- brightcove functions not found -->");
}

function closedown(){if(remote&&remote.open)remote.closeThis();}
function closeThis(){var MotherWin=this.window.opener;
	if(MotherWin.closed==1){window.close();}
}
//open a location and break out of frameset
function breakFrame(url){if(!window.opener.closed)opener.parent.location=url;
	else{var newParent=window.open(url);window.opener=newParent;
	}
	window.focus();
}
//Draws variable-size input box for navbar Search tool. For cross-browser compatibility
function drawdictionary(name){sniff=navigator.userAgent;var fsize;
		if((sniff.indexOf('Windows')!=-1)&&(sniff.indexOf('MSIE')!=-1)){fsize=12;}
		else if((sniff.indexOf('Mac')!=-1)&&(sniff.indexOf('MSIE')!=-1)){fsize=17;}
		else if((sniff.indexOf('Win')!=-1)&&(sniff.indexOf('en')!=-1)){fsize=6;}
		else if((sniff.indexOf('Mac')!=-1)&&(sniff.indexOf('PPC')!=-1)){fsize=11;}
		else{fsize=10;}
		document.write('<input type=text name='+name+' size='+fsize+' onchange=gloss(document.searchform.entry.value,1);void(0)>')
	}
//Draws variable-size input box for navbar Search tool. For cross-browser compatibility.
function drawSearch(name){sniff=navigator.userAgent;var fsize;
		if((sniff.indexOf('Windows')!=-1)&&(sniff.indexOf('MSIE')!=-1)){fsize=10;}
		else if((sniff.indexOf('Mac')!=-1)&&(sniff.indexOf('MSIE')!=-1)){fsize=17;}
		else if((sniff.indexOf('Win')!=-1)&&(sniff.indexOf('en')!=-1)){fsize=6;}
		else if((sniff.indexOf('Mac')!=-1)&&(sniff.indexOf('PPC')!=-1)){fsize=11;}
		else{fsize=10;}
		document.write('<input type=text name='+name+' size='+fsize+'>')
	}
var jumpURL;
//Explorer dropdown function
		function setJump(idx){jumpURL=idx[idx.selectedIndex].value;type=typeof jumpURL;
			if((jumpURL=="nothing")||(type=="undefined")){}
			else if((jumpURL=="http://servedby.advertising.com/click/site=690299/mnum=183474")){window.open(jumpURL),'smWin','';}
			else{top.location.href=jumpURL;}
		}
//End of Explorer dropdown functions
function validateCheck(){var validEntry;var validEmail;
	for(x=0;x<document.newsLetter.nlChoice.length;x++){
		if(document.newsLetter.nlChoice[x].checked){validEntry=true;break;}
	}
	if(validEntry !=true){alert("Please select a newsletter");return false;}
	f=document.newsLetter;email=f.emailID;validEmail=checkEmail(email);
	if(validEmail==false){alert("Please fill out a valid email address.");email.focus();}
	if(validEntry==true&&validEmail==true){return true;}
	else {return false};
}
function checkEmail(em){var objRegExp=/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
	if(objRegExp.test(em.value)){isEmail=true;}
	else {isEmail=false;}
	if(!(em.value.indexOf("dodgeit.com",0)==-1)||!(em.value.indexOf("mailinator.com",0)==-1)){isEmail=false;}
	return isEmail;
}
function validateCheck2(){var validEntry=false;var validEmail=false;f=document.newsLetter;email=f.emailID;
	zip=f.zipcode;validEmail=checkEmail(email);
	if(validEmail==false){alert("Please fill out a valid email address.");email.focus();email.select();}
	if(validEmail){/* if email is good checks zip for blank and not 5 or 6 in length */
		if(zip.value !=''&&zip.value.length !=5&&zip.value.length !=6){
			alert('Please enter a valid zip code.');zip.focus();zip.select();validEntry=false;	}
		else {validEntry=true;}
	}
	if(validEntry==true&&validEmail==true){return true;}
	else {return false;}
}
function removeText(){if(document.newsLetter.emailID.value=="enter email"){document.newsLetter.emailID.value="";}}
var thepath=location.pathname+location.search;issearch=0;
function gloss(entry,issearch){var url="/glossary/entry.asp?entry="+escape(entry);var winnme="glosswin";var wdt=400;
var hgt=400;var centered="yes";var resizeable="no";var scrollbar="yes";var tool="no";var statbar="no";var men="no";var loc="no";
if(issearch){url="/glossary/search.asp?step=search&term="+escape(entry);}
	sfeatures="width="+wdt+","+"height="+hgt+","+"resizable="+resizeable+","+"scrollbars="+scrollbar+",";
	sfeatures +="toolbar="+tool+","+"statusbar="+statbar+","+"menubar="+men+","+"location="+loc+",";
	if(centered=="yes"){ctrX=(screen.width / 2);ctrY=(screen.height / 2);winX=(wdt / 2);winY=(hgt / 2);
		if(document.layers){xpos=",screenX=" +(ctrX - winX);ypos=",screenY=" +(ctrY - winY);}
		if(document.all){xpos=",left=" +(ctrX - winX);ypos=",top=" +(ctrY - winY);}
		sfeatures +=xpos+ypos;
	}
	t=window.open(url,winnme,sfeatures);t.window.focus();
}
function popupLaunch(url,winnme,wdt,hgt,centered,resizeable,scroll,tool,statbar,men,loc){
	sfeatures="width="+wdt+","+"height="+hgt+","+"resizable="+resizeable+","+"scrollbars="+scroll+","
	sfeatures+="toolbar="+tool+","+"statusbar="+statbar+","+"menubar="+men+","+"location="+loc+","
	if(centered=='yes'){ctrX=(screen.width/2);ctrY=(screen.height/2);winX=(wdt/2);winY=(hgt/2);
		if(document.layers){xpos=",screenX="+(ctrX-winX);ypos=",screenY="+(ctrY-winY);}
		if(document.all){xpos=",left="+(ctrX-winX);ypos=",top="+(ctrY-winY);}
		sfeatures+=xpos+ypos;
	}
	t=window.open(url,winnme,sfeatures);t.window.focus();
}
function popunder(url,winnme,wdt,hgt,centered,resizeable,scroll,tool,statbar,men,loc){
	try{sfeatures="width="+wdt+","+"height="+hgt+","+"resizable="+resizeable+","+"scrollbars="+scroll+",";
		sfeatures+="toolbar="+tool+","+"statusbar="+statbar+","+"menubar="+men+","+"location="+loc+",";
		if(centered=='yes'){ctrX=(screen.width/2);ctrY=(screen.height/2);winX=(wdt/2);winY=(hgt/2);
			if(document.layers){xpos=",screenX="+(ctrX-winX);ypos=",screenY="+(ctrY-winY);}
			if(document.all){xpos=",left="+(ctrX-winX);ypos=",top="+(ctrY-winY);}
			sfeatures+=xpos+ypos;
		}
		if((popwin!=null&&popwin.open)){popwin.close();}
		popwin=window.open(url,winnme,sfeatures);window.top.focus();
	}
	catch(e){}
}
//This very simple function changes the image in the top nav bar so that it does not cachs
function change_image(){var day=new Date();var real_day=day.getDay();
	document.write("<a href='/shared/indexpage"+real_day+".asp?pageloc=2065'><img src=/imgs/v3/Top_"+real_day+".gif border='0' width='120' height='60'></a>")
}
function change_flower(){var a=document.getElementById('pc_flower').innerHTML;
	if(!(document.getElementById('pc_flower').innerHTML.indexOf('<img')!=-1)){var day=new Date();var flower='<img src="/imgs/v4/flower_'+day.getDay();
        flower=flower+'.jpg" align="left" valign="middle">';document.getElementById('pc_flower').innerHTML=flower;
   }
}
function whichSrch(){if(document.searchFrm.searchFld.value==''){return false;}}

function nlSignupOpen(nlFolder)
{
  switch (nlFolder)
  {
    case "weightlosswithnorris":
      nlFile = "dweightloss.aspx";
    break;

    case "yourhealthandhappiness":
      nlFile = "dhealthhappiness.aspx";
    break;
    
    case "yourpeaceofmind":
      nlFile = "dpeacemind.aspx";
    break;
    
    default:
      nlFile = "d"+nlFolder+".aspx";
    break;
  }
  
  url = "/newsletter/"+nlFolder+"/"+ nlFile;
  newWindow = window.open(url,nlFolder+"Signup","height=1000,width=791,top=0,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no" );
  return false;
}

function nlSignupOpen_sem(nlFolder)
{
  switch (nlFolder)
  {
    case "weightlosswithnorris":
      nlFile = "dweightloss.aspx";
    break;

    case "yourhealthandhappiness":
      nlFile = "dhealthhappiness.aspx";
    break;
    
    case "yourpeaceofmind":
      nlFile = "dpeacemind.aspx";
    break;
    
    default:
      nlFile = "d"+nlFolder+".aspx";
    break;
  }
  
  url = "/sem/newsletter/"+nlFolder+"/"+ nlFile;
  newWindow = window.open(url,nlFolder+"Signup","height=1000,width=791,top=0,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no" );
  return false;
}