// Javascript functions
function getFeature() {
	temp = 0
	newnumber = 0
	/*document.frmOne.taAll.value = ""
	TA = document.frmOne.taAll*/
	lottery = new Array(8)

	for (i = 0; i < 9; i++) {
		lottery[i] = i
	}

	featuredPointers = new createArray(9);
	featuredPointers[0] = '<tr><td colspan="2" width="280"><a href="parentese.html" onmouseout="imgrestore()" onmouseover="swapimage(\'image100\',\'\',\'images/parenting_parentese_on.gif\',1)" title="Speaking Parentese"><img src="images/parenting_parentese.gif" alt="Speaking Parentese" name="image100" width="250" height="20" border="0" /></a></td></tr><tr><td width="20">&nbsp;</td><td width="260">Discover a special way to talk to a baby.<br /><a href="parentese.html" title="read more" class="pc">&#187;&#187;</a></td></tr>\n';
	featuredPointers[1] = '<tr><td colspan="2" width="280"><a href="copycats.html" onmouseout="imgrestore()" onmouseover="swapimage(\'image101\',\'\',\'images/parenting_copycats_on.gif\',1)" title="Copycats"><img src="images/parenting_copycats.gif" alt="Copycats" name="image101" width="250" height="20" border="0" /></a></td></tr><tr><td>&nbsp;</td><td>Learn why your baby copies you.<br /><a href="copycats.html" title="read more" class="pc">&#187;&#187;</a></td></tr>\n';
	featuredPointers[2] = '<tr><td colspan="2" width="280"><a href="babycues.html" onMouseOut="imgrestore()" onMouseOver="swapimage(\'image102\',\'\',\'images/parenting_baby_cues_on.gif\',1)" title="Reading Your Baby\'s Cues"><img src="images/parenting_baby_cues.gif" alt="Reading Your Baby\'s Cues" name="image102" width="250" height="20" border="0" /></a></td></tr><tr><td>&nbsp;</td><td>Find out what your baby&#8217;s signals mean and how to respond to them.<br /><a href="babycues.html" title="read more" class="pc">&#187;&#187;</a></td></tr>';
	featuredPointers[3] = '<tr><td colspan="2" width="280"><a href="soothing.html" onMouseOut="imgrestore()" onMouseOver="swapimage(\'image103\',\'\',\'images/parenting_soothing_on.gif\',1)" title="Soothing the Stress"><img src="images/parenting_soothing.gif" alt="Soothing the Stress" name="image103" width="250" height="20" border="0" /></a></td></tr><tr><td>&nbsp;</td><td>How calming down helps both you and your baby!<br /><a href="soothing.html" title="read more" class="pc">&#187;&#187;</a></td></tr>';
	featuredPointers[4] = '<tr><td colspan="2" width="280"><a href="testing.html" onMouseOut="imgrestore()" onMouseOver="swapimage(\'image104\',\'\',\'images/parenting_testing_it_on.gif\',1)" title="Testing it Out"><img src="images/parenting_testing_it.gif" alt="Testing it Out" name="image104" width="250" height="20" border="0" /></a></td></tr><tr><td>&nbsp;</td><td>Babies explore the world by testing their surroundings.<br /><a href="testing.html" title="read more" class="pc">&#187;&#187;</a></td></tr>';
	featuredPointers[5] = '<tr><td colspan="2" width="280"><a href="expressive.html" onMouseOut="imgrestore()" onMouseOver="swapimage(\'image105\',\'\',\'images/parenting_be_expressive_on.gif\',1)" title="Be Expressive"><img src="images/parenting_be_expressive.gif" alt="Be Expressive" name="image105" width="250" height="20" border="0" /></a></td></tr><tr><td>&nbsp;</td><td>You are your baby\'s first teacher!<br /><a href="expressive.html" title="read more" class="pc">&#187;&#187;</a></td></tr>';
	featuredPointers[6] = '<tr><td colspan="2" width="280"><a href="tantrums.html" onMouseOut="imgrestore()" onMouseOver="swapimage(\'image106\',\'\',\'images/parenting_tantrums_on.gif\',1)" title="Tantrums"><img src="images/parenting_tantrums.gif" alt="Tantrums" name="image106" width="250" height="20" border="0" /></a></td></tr><tr><td>&nbsp;</td><td>Fits are a normal part of your child\'s emotional development.<br /><a href="tantrums.html" title="read more" class="pc">&#187;&#187;</a></td></tr>';
	featuredPointers[7] = '<tr><td colspan="2" width="280"><a href="communication.html" onMouseOut="imgrestore()" onMouseOver="swapimage(\'image107\',\'\',\'images/parenting_communication_on.gif\',1)" title="Good Communication"><img src="images/parenting_communication.gif" alt="Good Communication" name="image107" width="250" height="20" border="0" /></a></td></tr><tr><td>&nbsp;</td><td>Babies learn to speak by listening to you.<br /><a href="communication.html" title="read more" class="pc">&#187;&#187;</a></td></tr>';
	featuredPointers[8] = '<tr><td colspan="2" width="280"><a href="emotions.html" onMouseOut="imgrestore()" onMouseOver="swapimage(\'image108\',\'\',\'images/parenting_emotions_on.gif\',1)" title="Valuing Emotions"><img src="images/parenting_emotions.gif" alt="Valuing Emotions" name="image108" width="250" height="20" border="0" /></a></td></tr><tr><td>&nbsp;</td><td>Recognizing emotions teaches kids how to handle feelings.<br /><a href="emotions.html" title="read more" class="pc">&#187;&#187;</a></td></tr>';

	for (i = 0; i < 9; i++) {
		newnumber = (Math.random() * 8) + 1
		newnumber = parseInt(newnumber, 10)
		temp = lottery[i]
		lottery[i] = lottery[newnumber]
		lottery[newnumber] = temp
	}

	document.write("<table width=\"280\" border=\"0\">\n<tr>\n<td colspan=\"2\" width=\"280\"><img src=\"images/parenting_featured_pointer.gif\" alt=\"Featured Pointers\" width=\"175\" height=\"30\" /></td>\n</tr>\n");
	for (i = 0; i < 6; i++) {
		document.write(featuredPointers[lottery[i]]);
	}
	document.write("</table>\n");
}


function createArray(len) {
    for (var i = 0; i < len; i++){
		this[i] = null;
	}
	this.length = len;
}

randomTip = new createArray(10);
randomTip[0] = '<strong>Tests Ideas<br />(0 - 6 months)</strong><br />Infants are born active learners and like to test out ideas. Sticking out their tongues or grabbing and banging objects may actually be &#8220;tests&#8221; intended to provoke a response.<br />';
randomTip[1] = '<strong>Cries to Communicate<br />(0 - 4 months)</strong><br />Infants often communicate by crying. Some cries may sound different than others. A &#8220;pain cry&#8221; tends to start with a sudden loud wail, followed by a long pause, a large inhalation, and then another wail.<br />';
randomTip[2] = '<strong>Shows Feelings<br />(0 - 3 months)</strong><br />Infants begin to show basic emotional behaviors and expressions of contentment, interest, sadness and distress in their first days of life. And by three months, babies are able to perceive and respond to the emotional expressions they see in others. They may also react with feelings to the behavior of their parents and caregivers. For example, many three month-old babies will look sad and cry when their mothers stop interacting with them.<br />';
randomTip[3] = '<strong>Starts Crawling<br />(6 - 10 months)</strong><br />While learning to crawl, some babies rock on their hands and knees, and others push themselves backward instead of forward (because their arm muscles are better developed than their legs). Some crawl forward and others crawl backwards. Some never crawl at all, instead opting to scoot around on their bottoms or slither on their stomachs.<br />';
randomTip[4] = '<strong>Tests Their Parents<br />(8 - 15 months)</strong><br />Babies are curious about how parents react to their behavior. They begin to do things just to see what will happen. Testing parents and caregivers is one way babies learn about cause and effect and what to expect from people. These tests might include crying when their caregivers leave the room or grabbing, dropping and banging things.<br />';
randomTip[5] = '<strong>Shakes, Bangs and Drops<br />(8 - 16 months)</strong><br />As they approach their first birthday, babies begin to experiment by dropping, rolling, shaking, throwing, dunking and waving objects. Although their behavior may appear &#8220;random&#8221; when they dump out drawers and pour water on the floor, they are actually making important discoveries about how their world works.<br />';
randomTip[6] = '<strong>Understands Words<br />(8 - 11 months)</strong><br />Before they can speak, babies point to objects when they are named, and can often respond to simple directions or requests. For example, babies may look or point at a clock when they hear someone mention one.<br />';
randomTip[7] = '<strong>Makes Up Words<br />(12 - 19 months)</strong><br />Sometimes babies make up words to refer to things, and these are &#8220;real&#8221; words for them. They also might use a single word to represent many different types of things. For example, the word &#8220;dog&#8221; at first might refer to all animals with four legs.<br />';
randomTip[8] = '<strong>Shows Hand Preference<br />(16 - 33 months)</strong><br />Most infants show no clear hand preference (left or right handedness). Instead, many seem to alternate between favoring their right hand and left hand. By age two, some have established a clear hand preference, although many continue alternating for several more years. In general, about 10-13 percent will ultimately be left-handed.<br />';
randomTip[9] = '<strong>Develops Self-Awareness<br />(15 - 24 months)</strong><br />Toddlers now understand that the reflection in the mirror is more than a familiar face -- it is their own face. Toddlers are also learning that they are different from other people, and that others may have different beliefs, desires and feelings from their own. As a result, new emotions like embarrassment, envy and empathy emerge.<br />';

randomAwayTip = new createArray(9);
randomAwayTip[0] = '<strong>Talk With Your Baby</strong><br />Talk Parentese to your baby as much as you can. It&#8217;s one of the most important things you can do for your child &#8212; and for you!<br /><a href="parentese.html" title="Learn More" class="pctip">Learn More...</a><br />';
randomAwayTip[1] = '<strong>You&#8217;re The Role Model</strong><br />Babies are learning from everyone and everything they see. You are a role model for you baby&#8212;from day one!<br /><a href="copycats.html" title="Learn More" class="pctip">Learn More...</a><br />';
randomAwayTip[2] = '<strong>Keep Trying</strong><br />Don&#8217;t expect to understand every signal or be in sync all the time. You won&#8217;t always know what&#8217;s going on with your baby. If you&#8217;re trying to find out, you&#8217;re doing a great job!<br /><a href="babycues.html" title="Learn More" class="pctip">Learn More...</a><br />';
randomAwayTip[3] = '<strong>Super Stress Reducer</strong><br />Stop and take a breath and even laugh a little. If you burn the meatloaf, remember that cereal and carrots make a healthy meal too!<br /><a href="soothing.html" title="Learn More" class="pctip">Learn More...</a><br />';
randomAwayTip[4] = '<strong>Encourage Exploration</strong><br />Give your baby plenty of free time on the floor baby to explore, test, and learn about the world. And applaud his discoveries.<br /><a href="testing.html" title="Learn More" class="pctip">Learn More...</a><br />';
randomAwayTip[5] = '<strong>Mean What You Say</strong><br />The clearer you are, the clearer you baby will be. If you mean, &#8220;No,&#8221; make sure  your voice is firm (but gentle) and the look on your face means what you say. If you mean &#8220;Yes,&#8221; smile and nod in an encouraging way.<br /><a href="expressive.html" title="Learn More" class="pctip">Learn More...</a><br />';
randomAwayTip[6] = '<strong>You&#8217;re Not Alone</strong><br />It&#8217;s normal for you as a parent to feel frustrated and embarrassed when your child is having a tantrum, especially in public. Just remember that tantrums are a normal part of child development and most parents have gone through the same thing.<br /><a href="tantrums.html" title="Learn More" class="pctip">Learn More...</a><br />';
randomAwayTip[7] = '<strong>Feelings Matter</strong><br />If you value their emotions, they will too.<br /><a href="emotions.html" title="Learn More" class="pctip">Learn More...</a><br />';
randomAwayTip[8] = '<strong>Go For Quantity</strong><br />The best way to build a child&#8217;s vocabulary during the critical first five years of life is to talk with them &#8212; a lot.<br /><a href="communication.html" title="Learn More" class="pctip">Learn More...</a><br />';

function rand (num) {
    var now = new Date();                                 
    var rand = Math.round(num * Math.cos(now.getTime())); 
    if (rand < 0) rand = - rand; if (rand == 0) rand++;         
    return (rand % num);                                          
}

	// setup a controlled popup window
function popup(){
		// state the web address, window name, width and height of popup
		var myURL = 'http://www.pbs.org/parents/earlylearning/flash/index.html', popupName = 'Timeline', popupWidth = 760, popupHeight = 540, mypopup;
		// calculate the left edge (x position) of the popup window; if we can't get the screen width then make it 20 pixels (after the : )
		var popupX = (screen.availWidth)? ((screen.availWidth - popupWidth) / 2): 20;
		// calculate the top edge (y position) of the popup window; if we can't get the screen heigth then make it 20 pixels
		var popupY = (screen.availHeight)? ((screen.availHeight - popupHeight) / 3):20;
		// popup window chrome details: 0 is same as no, 1 is same as yes
		var details = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width='+popupWidth+',height='+popupHeight+',top='+popupY+',left='+popupX;
		// now create the popup and assign it to a variable
		mypopup = window.open(myURL,popupName,details);
		// give focus to our popup window, important if it's in the background
		mypopup.focus();
		//return false;
}