/* on window load, make corners on specified boxes curved */
  window.onload = function()
  {
  /*
     The new 'validTags' setting is optional and allows
     you to specify other HTML elements that curvyCorners
     can attempt to round.

     The value is comma separated list of html elements
     in lowercase.

     validTags: ["div", "form"]

     The above example would enable curvyCorners on FORM elements.
  */
  
  settings = { 
               tl: { radius: 10 },
               tr: { radius: 10 },
               bl: { radius: 10 },
               br: { radius: 10 },
               antiAlias: true,
               autoPad: true,
               validTags: ["div"]
              };

  settingsFeaturedSites = {
                           tl: false,
                           tr: false,
                           bl: { radius: 10 },
                           br: { radius: 10 },
                           antiAlias: true,
                           autoPad: false,
                           validTags: ["div"]
                          };

  /*
     Usage:

     newCornersObj = new curvyCorners(settingsObj, classNameStr);
     newCornersObj = new curvyCorners(settingsObj, divObj1[, divObj2[, divObj3[, . . . [, divObjN]]]]);
  */
  
  var myMenuObject = new curvyCorners(settings, "border_menu");
  var myAdsObject = new curvyCorners(settings, "border_ads");
  var myFeaturedSitesObject = new curvyCorners(settingsFeaturedSites, "featured_sites");
  myMenuObject.applyCornersToAll();
  myAdsObject.applyCornersToAll();
  myFeaturedSitesObject.applyCornersToAll();
}



/* Bookmark page */
function BookmarkIt(){
  window.external.AddFavorite(location.href, document.title)

  if (window.sidebar) { // Mozilla Firefox Bookmark
    window.sidebar.addPanel(document.title, location.href,"");
  } 
  else if( window.external ) { // IE Favorite
    window.external.AddFavorite( location.href, document.title); 
  }

}


/* Print Page */
function PrintPage() {
  if (window.print)
    window.print()        
}


/* Page Last Updated */
function LastUpdated() {
  var date_updated = "Page Last Updated " + document.lastModified
  var date_length = date_updated.length-8

  document.write(date_updated.substring(date_length, 0))
}


/* Validate email address */
function validate_email() {
  var at = document.frmSubscribe.email.value.indexOf("@")
  var len = document.frmSubscribe.email.value.length
	  
  if ( at == -1  ||  len < 9 ) {
	alert("Not a valid email address...")
	return false
  }
  else {
	return true
  }
}


/* Randomly pick a header graphic and display it */
function showImage(theImages) {
  var j = 0
  var p = theImages.length
  var preBuffer = new Array()

  for ( i = 0; i < p; i++ ) {
    preBuffer[i] = new Image()
    preBuffer[i].src = theImages[i]
  }

  var whichImage = Math.round(Math.random()*(p-1))
  document.write('<img src="'+theImages[whichImage]+'">')
}