function daPopup() {
//object detection
//if UA (user agent: browser) does not understand the method, then end the function
if (!document.getElementsByTagName) return false;

//build array of all links on page
//getElementsByTagName method accesses all elements with the specified tagname
var links = document.getElementsByTagName("a");

  $len = links.length;
for (var i=0; i<$len; i++) {
  //looking in the HTML for class popup
  if (links[i].className.match("popup")) {
    links[i].onclick = function() {


//in case browser cannot handle the screen object
//so a null value is not passed to the window.open statement
var leftpos = 0;
var toppos = 0;
//check that the browser can recognize the screen object
if (screen) {
  var leftpos = (screen.width/2)-300;
  var toppos = (screen.height/2)-200;
  }
//end if screen 

//var features ='location=1,status=1,toolbar=0,menubar=0,resizable=0,scrollbars=0,width=600,height=400,left=150,top=100';
var features = 
'location=' + 0 +
',status=' + 1 +
',toolbar=' + 0 +
',menubar=' + 0 +
',resizable=' + 0 +
',scrollbars=' + 0 +
',width=' + 600 +
',height=' + 400 +
',left=' + leftpos +
',top=' + 100;
    
//getAttribute() method gets an attribute value by name
//window.open(url,winname,features);
  window.open(this.getAttribute("href"),'popupname',features);
  return false;

   }
  }
 }

}
//end daPopup

//Document Object Model must be complete (window must be loaded) so check for an onload event
//window.onload = daPopup;
//call the fn

//init() fix, remember u can only have 1 window.onload, see init.js




