// function to register events on page load
function addLoadEvent(func) {
 var oldonload = window.onload;
 if (typeof window.onload != 'function') window.onload = func;
 else {
  window.onload = function() {
   oldonload();
   func();
  }
 }
}
// fire detailsEvent once DOM has loaded
addLoadEvent(detailsEvent);
// set event handler on the offerDetails div for expansion/contraction
function detailsEvent() {
 jQuery("#offersContainer div.offerDetails a.show").click(showOfferDetails);
}
// expansion/contraction function for offer details
function showOfferDetails (e) {
 var el = e.target.parentNode.parentNode.getElementsByTagName('div')[0];
 el.style.display = el.style.display != 'block' ? 'block' : 'none';
}
// rollover function
function setOverSrc(elem){
 elem.overStatePreload=new Image();
 elem.overStatePreload.src=elem.src.replace(/(_on)*(\.\w+)$/,'_on$2');
 elem.onmouseover=function(){this.src=this.src.replace(/(_on)*(\.\w+)$/,'_on$2')}
 elem.onmouseout=function(){this.src=this.src.replace(/(_on)+(\.\w+)$/,'$2')}
 elem.onload='';
}