// JavaScript Document - Sitepoint - Kevin Yank & Michael Rainey

//The job of this script, is to run once the document is loaded, will be to find all the hyperlinks in the document and modify those that have our special (but standards-compliant!) rel="external" attribute, so that they open in a new window.
//Contains a slight modification by yours truly

//example: <a href="http://www.somewhere.com/" rel="external">PerieraDesign</a>
function externalLinks() { 

 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
var windowAttributes='width=310,height=400,left=0,top=0,scrollbars=no,location=no';
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "newWindow") 
     anchor.target = "_blank"; 
 } 
} 
window.onload = externalLinks;

//example: <a href="http://www.somewhere.com/" rel="popup|600|400|0|1">PerieraDesign</a>
//function popupWindows() { 
//    if(!document.getElementsByTagName) { 
//         return; 
//    } 
//    var scrW = screen.availWidth; 
//    var scrH = screen.availHeight; 
//    var anchors = document.getElementsByTagName("a"); 
//    for (var i = 0; i < anchors.length; i++) { 
//         var anchor = anchors[i]; 
//         var linkDest = anchor.getAttribute("href"); 
//         var relIndex = anchor.getAttribute("rel"); 
//         var relSplit = relIndex.split("|"); 
//         var windowAttributes = ""; 
//		 
//         if(relSplit[0] == "popup") { 
//              if (relSplit[1] > scrW) { 
//                 pW = scrW - 10; 
//              } 
//              else { 
//                 pW = relSplit[1]; 
//              } 
//              if (relSplit[2] > scrH) { 
//                 pH = scrH - 40; 
//              } 
//              else { 
//                 pH = relSplit[2]; 
//              } 
//              scrX = (scrW - pW - 10) * .5; 
//              scrY = (scrH - pH - 30) * .5; 
//              var windowAttributes = "width=" + pW + ",height=" + pH + ",left=" + scrX + ",top=" + scrY + ",screenX=" + scrX",screenY=" + scrY; 
//              windowAttributes += ",location=" + relSplit[4] + ",resizable=" + relSplit[4] + ",scrollbars=" + relSplit[4]; 
//              anchor.setAttribute("href", "javascript:popupWin('" + linkDest + "','" + windowAttributes + "')"); 
//			  
//         } 
//    } 
//} 
//window.onload = popupWindows;



