function isEmailAddr(email)
{
  var result = false;
  var theStr = new String(email);
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function validRequiredSelect(formField,fieldLabel)
{
	var result = true;
	   
	   
	if (formField.options[formField.selectedIndex].value == "none")
	{
		alert('Please select a value for the "' + fieldLabel +'" field.');
		formField.focus();
		result = false;
	}
	
	return result;
}

function validRequired(formField,fieldLabel)
{
	var result = true;
	
	if (formField.value == "") 
	{
		alert('Please enter a value for the "' + fieldLabel +'" field.');
		formField.focus();
		result = false;
	}
	
	return result;
}

function allDigits(str)
{
	return inValidCharSet(str,"0123456789");
}

function inValidCharSet(str,charset)
{
	var result = true;

	// Note: doesn't use regular expressions to avoid early Mac browser bugs	
	for (var i=0;i<str.length;i++)
		if (charset.indexOf(str.substr(i,1))<0)
		{
			result = false;
			break;
		}
	
	return result;
}

function validEmail(formField,fieldLabel,required)
{
	var result = true;
	
	if (required && !validRequired(formField,fieldLabel))
		result = false;

	if (result && ((formField.value.length < 3) || !isEmailAddr(formField.value)) )
	{
		alert("Please enter a complete email address in the form: yourname@yourdomain.com");
		formField.focus();
		result = false;
	}
   
  return result;

}

function validNum(formField,fieldLabel,required)
{
	var result = true;

	if (required && !validRequired(formField,fieldLabel))
		result = false;
  
 	if (result)
 	{
 		if (!allDigits(formField.value))
 		{
 			alert('Please enter a number for the "' + fieldLabel +'" field.');
			formField.focus();		
			result = false;
		}
	} 
	
	return result;
}


function validInt(formField,fieldLabel,required)
{
	var result = true;

	if (required && !validRequired(formField,fieldLabel))
		result = false;
  
 	if (result)
 	{
 		var num = parseInt(formField.value);
 		if (isNaN(num))
 		{
 			alert('Please enter a number for the "' + fieldLabel +'" field.');
			formField.focus();		
			result = false;
		}
	} 
	
	return result;
}


function validDate(formField,fieldLabel,required)
{
	var result = true;

	if (required && !validRequired(formField,fieldLabel))
		result = false;
  
 	if (result)
 	{
 		var elems = formField.value.split("/");
 		
 		result = (elems.length == 3); // should be three components
 		
 		if (result)
 		{
 			var month = parseInt(elems[0]);
  			var day = parseInt(elems[1]);
 			var year = parseInt(elems[2]);
			result = allDigits(elems[0]) && (month >= 01) && (month < 13) && 
					 //allDigits(elems[1]) && (day >= 01) && (day < 32) &&
					 allDigits(elems[2]) && (elems[2].length == 4);
					 
					 
 		}
 		
  		if (!result)
 		{
 			alert('Please enter a date in the format MM/DD/YYYY for the "' + fieldLabel +'" field.');
			formField.focus();		
		}
	} 
	
	return result;
}
function checkinteger(object_value)
    {
    //Returns true if value is a number or is NULL
    //otherwise returns false   

    if (object_value.length == 0)
        return true;

    //Returns true if value is an integer defined as
    //   having an optional leading + or -.
    //   otherwise containing only the characters 0-9.
        var decimal_format = ".";
        var check_char;

    //The first character can be + -  blank or a digit.
        check_char = object_value.indexOf(decimal_format)
    //Was it a decimal?
    if (check_char < 1)
        return checknumber(object_value);
    else
        return false;
    }
	
function checknumber(object_value)
    {
    //Returns true if value is a number or is NULL
    //otherwise returns false   

    if (object_value.length == 0)
        return true;

    //Returns true if value is a number defined as
    //   having an optional leading + or -.
    //   having at most 1 decimal point.
    //   otherwise containing only the characters 0-9.
        var start_format = " .+-0123456789";
        var number_format = " .0123456789";
        var check_char;
        var decimal = false;
        var trailing_blank = false;
        var digits = false;

    //The first character can be + - .  blank or a digit.
        check_char = start_format.indexOf(object_value.charAt(0))
    //Was it a decimal?
        if (check_char == 1)
            decimal = true;
        else if (check_char < 1)
                return false;
        
        //Remaining characters can be only . or a digit, but only one decimal.
        for (var i = 1; i < object_value.length; i++)
        {
                check_char = number_format.indexOf(object_value.charAt(i))
                if (check_char < 0)
                        return false;
                else if (check_char == 1)
                {
                        if (decimal)            // Second decimal.
                                return false;
                        else
                                decimal = true;
                }
                else if (check_char == 0)
                {
                        if (decimal || digits)  
                                trailing_blank = true;
        // ignore leading blanks

                }
                else if (trailing_blank)
                        return false;
                else
                        digits = true;
        }       
    //All tests passed, so...
    return true
    }


function isEmpty(inputStr) {
	if (inputStr == null || inputStr == "") {
		return true
		}
		return false	
}
	
function B() {
var text = prompt("Enter text to bold","");
document.forms[0].Text.value += ('<b>' + text + '</b>');
}


function I() {
var text = prompt("Enter text to italic","");
document.forms[0].Text.value += ('<i>' + text + '</i>');
}



<!--
function P() {
alert("To create a paragraph break, just enter a double carriage return.");
document.forms[0].Text.value += ('\n\n');
}
//-->

<!--
function BR() {
document.forms[0].Text.value += ('<br>\n');
}
//-->

<!--
function HR() {
document.forms[0].Text.value += ('<hr>\n');
}
//-->

<!--
function OL() {
document.forms[0].Text.value += ('<ol></ol>');
}
//-->

<!--
function UL() {
document.forms[0].Text.value += ('<ul></ul>');
}
//-->

<!--
function LI() {
document.forms[0].Text.value += ('<li>');
}
//-->

<!--
function A() {
var text = prompt("Enter text to display for this link","");
var link = prompt("Enter page to link to","");
document.forms[0].Text.value += ('<a href="' + link + '">' + text + '</a>');
}
//-->

<!--
function IM() {
var text = prompt("Enter the filename for the image","");
document.forms[0].Text.value += ('<img src="' + text + '">');
}
//-->

<!--
function preview() { 
alert('Please be aware that paragraph breaks and images may not always show up correctly in the preview!');
var textpreview = document.forms[0].Text.value;
var creturn = "\r";
textpreview = textpreview.replace(creturn, '<p>');
var previewwin = window.open('','previewwin','width=500,height=400,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1');
previewwin.document.open();
previewwin.document.write(textpreview);
previewwin.document.close();
}
//-->

<!--
function validateanswfrm(theForm){
    if (theForm.answer_text1.value == "" && theForm.answer_text2.value == "" && theForm.answer_text3.value == "" &&	theForm.answer_text4.value == "" &&	theForm.answer_text5.value == "" &&	theForm.answer_text6.value == "" &&	theForm.answer_text7.value == "" &&	theForm.answer_text8.value == "" &&	theForm.answer_text9.value == "" &&	theForm.answer_text10.value == "" && theForm.answer_text11.value == "" && theForm.answer_text12.value == "" && theForm.answer_text13.value == "" &&	theForm.answer_text14.value == "" && theForm.answer_text15.value == "" && theForm.answer_text16.value == "" && theForm.answer_text17.value == "" &&	theForm.answer_text18.value == "" && theForm.answer_text19.value == "" && theForm.answer_text20.value == "" ){
	 alert("You must enter at least one answer.");
	 theForm.answer_text1.focus();
     return false;
	 }
	 else{
     if (theForm.answer_text1.value != "") {
 	   if (!validRequired(theForm.answer1,"Answer Value 1",true))
	   return false;
	 }
     if (theForm.answer_text2.value != "") {
 	   if (!validRequired(theForm.answer2,"Answer Value 2",true))
	   return false;
	 }
    if (theForm.answer_text3.value != "") {
 	   if (!validRequired(theForm.answer3,"Answer Value 3",true))
	   return false;
	 }
    if (theForm.answer_text4.value != "") {
 	   if (!validRequired(theForm.answer4,"Answer Value 4",true))
	   return false;
	 }
    if (theForm.answer_text5.value != "") {
 	   if (!validRequired(theForm.answer5,"Answer Value 5",true))
	   return false;
	 }
    if (theForm.answer_text6.value != "") {
 	   if (!validRequired(theForm.answer6,"Answer Value 6",true))
	   return false;
	 }
    if (theForm.answer_text7.value != "") {
 	   if (!validRequired(theForm.answer7,"Answer Value 7",true))
	   return false;
	 }
    if (theForm.answer_text8.value != "") {
 	   if (!validRequired(theForm.answer8,"Answer Value 8",true))
	   return false;
	 }
    if (theForm.answer_text9.value != "") {
 	   if (!validRequired(theForm.answer9,"Answer Value 9",true))
	   return false;
	 }
    if (theForm.answer_text10.value != "") {
 	   if (!validRequired(theForm.answer10,"Answer Value 10",true))
	   return false;
	 } 	 
   	}
   return true;
    }

 function openWin( windowURL, windowName, windowFeatures ) { 
	win = window.open( windowURL, windowName, windowFeatures ) ; 
	win.focus();
	}
	
 function storeWin(){ 
    var swin
    var windowURL ="http://store.aetv.com/html/referer_entry.jhtml?vid=BIO_Exhibit_BioClub&dest=/html/subject/index.jhtml?id=1105";
	var windowName = "Store";
 	var windowFeatures = "width=640,height=480,toolbar=1,location=1,directories=1,status=1,menuBar=1,scrollBars=1,resizable=1";
    swin = window.open( windowURL, windowName, windowFeatures ) ; 
	swin.focus();
	}

 function forumWin(){ 
    var forumwin
    var windowURL ="http://boards.biography.com/forum.jsp?forum=30005";
	var windowName = "Store";
 	var windowFeatures = "width=640,height=480,toolbar=1,location=1,directories=1,status=1,menuBar=1,scrollBars=1,resizable=1";
    forumwin = window.open( windowURL, windowName, windowFeatures ) ; 
	forumwin.focus();
	}	
	
 function pdfWin(){ 
    var pdfwin
    var windowURL ="celebrity_lookalike_mail-in_release_aeclub.pdf";
	var windowName = "pdf";
 	var windowFeatures = "width=800,height=600,toolbar=1,location=1,directories=1,status=1,menuBar=1,scrollBars=1,resizable=1";
    forumwin = window.open( windowURL, windowName, windowFeatures ) ; 
	forumwin.focus();
	}		
	
	
	function videoWin(){ 
    var videowin
    var windowURL ="http://www.biography.com/broadband/bioclub/index.jsp";
	var windowName = "video";
 	var windowFeatures = "width=710,height=460,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0";
    videowin = window.open( windowURL, windowName, windowFeatures ) ; 
	videowin.focus();
	}		
	
	function openPoster(){ 
    var openPoster
    var windowURL ="http://club.aetv.com/family_jewels_ad_campaign.html";
	var windowName = "video";
 	var windowFeatures = "width=464,height=600,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0";
    openPoster = window.open( windowURL, windowName, windowFeatures ) ; 
	openPoster.focus();
	}		
	
	function openCrissAngelPoster(){ 
    var openPoster
    var windowURL ="http://club.aetv.com/CrissAngelflyer.html";
	var windowName = "video";
 	var windowFeatures = "width=600,height=776,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0";
    openPoster = window.open( windowURL, windowName, windowFeatures ) ; 
	openPoster.focus();
	}		
	
	

	
	function hideIt(xName) {
	var hideMe = xName;
	
	if (document.layers) {
	// Netscape 4
		document.layers[hideMe].visibility = "hide";
       	}
    else if (!document.all && document.getElementById) {
    // W3C netscape 6+ explorer 5+
    	document.getElementById(hideMe).style.visibility = "hidden";
    }
	else {
	// Explorer 4
		document.all[hideMe].style.visibility = "hidden";
		}
	}
function showIt(xName) {
	var showMe = xName;
	
	if (document.layers) {
	// Netscape 4
		document.layers[showMe].visibility = "show";
       }
    else if (!document.all && document.getElementById) {
    // W3C netscape 6+ explorer 5+
    	document.getElementById(showMe).style.visibility = "visible";
    }
	else {
	// Explorer 4
		document.all[showMe].style.visibility = "visible";
		}
	}

function hideShow(xName,yName) {
	hideIt(xName);
	showIt(yName);
	}

function popUp(url, winName, width, height,scr,res)
{
    var features;
  
    (scr) ? scr=1:scr=0;
    (res) ? res=1:res=0; 

    features = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=' + scr + ',resizable=' + res + ',width=' + width + ',height=' + height;
    window.open(url, winName, features);
}

 function jump(form){
	   if (form.value!="")
	    window.location.href=form.value;
		}	
		
function topjumpfunc(){
 selInd = document.topjump.selectmenu.selectedIndex; 
 goURL = document.topjump.selectmenu.options[selInd].value;
 if (goURL!="")
    window.location.href=goURL;
		}	
	
	function botjumpfunc(){
	  selInd = document.botjump.selectmenu.selectedIndex; 
      goURL = document.botjump.selectmenu.options[selInd].value;
     if (goURL!="")
        window.location.href=goURL;
	   }	
		
//-->  

function valButton(btn) {
 var cnt = -1;
 for (var i=btn.length-1; i > -1; i--) {
    if (btn[i].checked) {cnt = i; i = -1;}
     }
   if (cnt > -1) return btn[cnt].value; 
    else return null;
   }
   
   
   function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	return false;
    }
} // changeObjectVisibility

function moveObject(objectId, newXCoordinate, newYCoordinate) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.left = newXCoordinate;
	styleObject.top = newYCoordinate;
	return true;
    } else {
	// we couldn't find the object, so we can't very well move it
	return false;
    }
} // moveObject

var xOffset = 0;
var yOffset = -390;

function showPopup (targetObjectId, eventObj) {
    if(eventObj) {
	// hide any currently-visible popups
	hideCurrentPopup();
	// stop event from bubbling up any farther
	eventObj.cancelBubble = true;
	// move popup div to current cursor position 
	// (add scrollTop to account for scrolling for IE)
	var newXCoordinate = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x + xOffset + ((document.body.scrollLeft)?document.body.scrollLeft:0);
	var newYCoordinate = (eventObj.pageY)?eventObj.pageY + yOffset:eventObj.y + yOffset + ((document.body.scrollTop)?document.body.scrollTop:0);
	//moveObject(targetObjectId, newXCoordinate, newYCoordinate);
	// and make it visible
	if( changeObjectVisibility(targetObjectId, 'visible') ) {
	    // if we successfully showed the popup
	    // store its Id on a globally-accessible object
	    window.currentlyVisiblePopup = targetObjectId;
	    return true;
	} else {
	    // we couldn't show the popup, boo hoo!
	    return false;
	}
    } else {
	// there was no event object, so we won't be able to position anything, so give up
	return false;
    }
} // showPopup

function hideCurrentPopup() {
    // note: we've stored the currently-visible popup on the global object window.currentlyVisiblePopup
    if(window.currentlyVisiblePopup) {
	changeObjectVisibility(window.currentlyVisiblePopup, 'hidden');
	window.currentlyVisiblePopup = false;
    }
} // hideCurrentPopup



// ***********************
// hacks and workarounds *
// ***********************

// initialize hacks whenever the page loads
window.onload = initializeHacks;

// setup an event handler to hide popups for generic clicks on the document
document.onclick = hideCurrentPopup;

function initializeHacks() {
    // this ugly little hack resizes a blank div to make sure you can click
    // anywhere in the window for Mac MSIE 5
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	window.onresize = explorerMacResizeFix;
    }
    resizeBlankDiv();
    // this next function creates a placeholder object for older browsers
    createFakeEventObj();
}

function createFakeEventObj() {
    // create a fake event object for older browsers to avoid errors in function call
    // when we need to pass the event object to functions
    if (!window.event) {
	window.event = false;
    }
} // createFakeEventObj

function resizeBlankDiv() {
    // resize blank placeholder div so IE 5 on mac will get all clicks in window
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	getStyleObject('blankDiv').width = document.body.clientWidth - 20;
	getStyleObject('blankDiv').height = document.body.clientHeight - 20;
    }
}

function explorerMacResizeFix () {
    location.reload(false);
}




/// MENU ///
var menuwidth='100px;' //default menu width
var menubgcolor='#CF1640'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-20 : window.pageXOffset+window.innerWidth-20
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-20 : window.pageYOffset+window.innerHeight-20
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)



if (ie4||ns6){

if ((navigator.userAgent.indexOf('Firefox') != -1) || (navigator.userAgent.indexOf('Safari') != -1)){
  //alert(navigator.userAgent);
  showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
  dropmenuobj.x=getposOffset(obj, "left")+1
  dropmenuobj.y=getposOffset(obj, "top")+6 
  dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")-16+"px"
  dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")-6+obj.offsetHeight+"px"
 }

else{
  //alert(navigator.userAgent);
  showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
  dropmenuobj.x=getposOffset(obj, "left")
  dropmenuobj.y=getposOffset(obj, "top")+6
  dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")-15+"px"
  dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")-10+obj.offsetHeight+"px"
}


}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

/// END MENU ///
