function enablePopups(){                                                                                                                                          
   if(!document.getElementsByTagName) return;                                                                                                                     
   var linkElements = document.getElementsByTagName("A");                                                                                                         
   for(var i = 0; i < linkElements.length; i++){                                                                                                                  
      var r = linkElements[i].rel;                                                                                                                                
      if(r.indexOf("gallery")!=-1){                                                                                                                               
         linkElements[i].onclick = function(){ return openGallery(this.href); }                                                                                   
      } else if(r.indexOf("external")!=-1){                                                                                                                       
         linkElements[i].onclick = function(){ return openPopup(this.href); }                                                                                     
      }                                                                                                                                                           
   }                                                                                                                                                              
}                                                                                                                                                                 
                                                                                                                                                                  
function openGallery(address){                                                                                                                                    
   var newWindow = window.open(address,'gallery','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=640,height=520');
   if(window.focus) newWindow.focus();                                                                                                                            
   return false;                                                                                                                                                  
}                                                                                                                                                                 
                                                                                                                                                                  
function openPopup(address){                                                                                                                                      
   var newWindow = window.open(address,'external');                                                                                                               
   if(window.focus) newWindow.focus();                                                                                                                            
   return false;                                                                                                                                                  
}                                                                                                                                                                 
                                                                                                                                                                  
window.onload = function(){                                                                                                                                       
   enablePopups();                                                                                                                                                
}                                                                                                                                                                 