// Bookmark a page

function addToFavorites()
 {
  if (window.external)
  {
   window.external.AddFavorite(urlAddress,pageName)
  }
  else
  { 
   alert("Sorry! Your browser doesn't support this function.");
  }
 }

      function customImageLinks() {
              if (!document.getElementsByTagName) return;
              var anchors = document.getElementsByTagName('a');
              for (var i=0; i<anchors .length; i++) {
                   anchor = anchors[i];
                      var images = anchor.getElementsByTagName('img');
                      if (images[0] != null) {
                              anchor.className = "image";
                      }
              }
      }
       
      if (window.addEventListener)
              window.addEventListener("load", customImageLinks, false)
      else if (window.attachEvent)
              window.attachEvent("onload", customImageLinks)
      else if (document.getElementById)
              window.onload=customImageLinks
 
 // Email a friend
 
function e_friend()
{
var e_add= prompt('Enter your friend\'s email address:',' ');
var subj= prompt('Enter the subject of your message:',' ');
if ((subj==" ") || (subj==null))
 subj="W. W. Norton and Company: 21st Century Astronomy, 2e StudySpace Referral";
u = window.location;
window.location="mailto:"+e_add+"?subject="+subj+"&body=Check out this W. W. Norton and Company: 21st Century Astronomy, 2e StudySpace Page: "+u;
}

// pop-up function

var newWin = null;
function closeWin(){
	if (newWin != null){
		if(!newWin.closed)
			newWin.close();
	}
}

function popUp(strURL,strType,strHeight,strWidth) {
	closeWin();
	var strOptions="";
	if (strType=="console") strOptions="resizable,scrollbars,height="+strHeight+" + (browserVersion() == 7 ? -48 : 0),width="+strWidth+" + (browserVersion() == 7 ? -6 : 0)";
	if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
	if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
	newWin = window.open(strURL, 'newWin', strOptions);
	newWin.focus();
}