    window.addEvent('load', function() {  
		$('searchBtn').addEvent('click', function(){$('searchBox').setStyle('display', 'block');});
    	$$('.thumbnail').addEvent('mouseenter', function(){$$(this.getElement('span')).setStyles({visibility: 'visible', top: 0, left: '60px'}); });
		$$('.thumbnail img').addEvent('mouseenter', function(){$$(this.parentNode).setStyles({position:'absolute', left:'-1000px', visibility:'hidden'}); });
		$$('.thumbnail span').addEvent('mouseleave', function(){$$(this).setStyles({position:'absolute', left:'-1000px', visibility:'hidden'}); });
 });

function refreshAds(){
var h_ord2 = Math.floor(Math.random()*10000000000);

var findTracker=document.getElementById("photo-tracker");
	
if (!findTracker)
{
	//alert("Tracker not found.");
}
else
{
    //alert("Tracker found.");
    //$('photo-tracker').set('src','http://ad.doubleclick.net/ad/surfermag.primedia.com/;kw=adid_215684359;dcove=r;sz=1x1');
}

$('ad-160').set('src','http://ad.doubleclick.net/adi/surfermag.primedia.com/<tmpl_if cdir><tmpl_var cdir><tmpl_else>homepage</tmpl_if>;sect=<tmpl_if cdir><tmpl_var cdir><tmpl_else>homepage</tmpl_if>;subs=<tmpl_var scdir>;subss=<tmpl_var sscdir>;page=<tmpl_var slug>;sz=160x600;tile=2;ord='+h_ord2+'?');
$('ad-728').set('src','http://ad.doubleclick.net/adi/surfermag.primedia.com/<tmpl_if cdir><tmpl_var cdir><tmpl_else>homepage</tmpl_if>;sect=<tmpl_if cdir><tmpl_var cdir><tmpl_else>homepage</tmpl_if>;subs=<tmpl_var scdir>;subss=<tmpl_var sscdir>;page=<tmpl_var slug>;sz=728x90;tile=1;ord='+h_ord2+'?');
}

var h_ord=Math.floor(Math.random()*10000000000);
var h_tile=1;

function google_ad_request_done(google_ads) 
{
  var s = '<div '+titleclass+'>Sponsored Links</div>';
  var i;
  
  if (google_ads.length == 0)
    return;

  if (google_ads[0].type == "text") 
  {
    for (i = 0; i < google_ads.length; ++i) 
    {
      var description = google_ads[i].line2 + ' ' + google_ads[i].line3;
      var url_text = google_ads[i].visible_url;

      if (max_length_description > 0)
        description = description.substring (0, max_length_description);

      if (max_length_url > 0)
        url_text = url_text.substring(0, max_length_url);

      s += '<div '+holderclass+'><a href="' + google_ads[i].url + '" ' +
        'onmouseout="window.status=\'\'" ' +
        'onmouseover="window.status=\'go to ' +
        google_ads[i].visible_url + '\';return true;" '+ line1class +'>' +        
        google_ads[i].line1 + '</a><br /><span '+ line2class +'>'+
        description + '<br /></span><a href="' + google_ads[i].url + '" ' +
        'onmouseout="window.status=\'\'" ' +
        'onmouseover="window.status=\'go to ' +
        google_ads[i].visible_url + '\';return true;"' +line3class+ '>' +
        url_text + '</a></div>';
    }
  }
  document.write(s);
  return;
}

// START - sub-navigation drop down options
var DDSPEED = 2;
var DDTIMER = 1;

// main function to handle the mouse events //
function ddMenu(id,d){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearInterval(c.timer);
  if(d == 1){
    clearTimeout(h.timer);
    if(c.maxh && c.maxh <= c.offsetHeight){return}
    else if(!c.maxh){
      c.style.display = 'block';
      c.style.height = 'auto';
      c.maxh = c.offsetHeight;
      c.style.height = '0px';
    }
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }else{
    h.timer = setTimeout(function(){ddCollapse(c)},50);
  }
}

// collapse the menu //
function ddCollapse(c){
  c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER);
}

// cancel the collapse if a user rolls over the dropdown //
function cancelHide(id){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearTimeout(h.timer);
  clearInterval(c.timer);
  if(c.offsetHeight < c.maxh){
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }
}

// incrementally expand/contract the dropdown and change the opacity //
function ddSlide(c,d){
  var currh = c.offsetHeight;
  var dist;
  if(d == 1){
    dist = (Math.round((c.maxh - currh) / DDSPEED));
  }else{
    dist = (Math.round(currh / DDSPEED));
  }
  if(dist <= 1 && d == 1){
    dist = 1;
  }
  c.style.height = currh + (dist * d) + 'px';
  c.style.opacity = currh / c.maxh;
  c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
  if((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)){
    clearInterval(c.timer);
  }
}
// END - sub-navigation drop down options