// Pop Up Script
var popupWindow = null;

function popupWin(link,attribs, pW, pH) { 
	if (popupWindow && !popupWindow.closed) {
		popupWindow.close();
	}
    popupWindow = window.open(link,'winPopup',attribs);  
	if(navigator.appVersion.substring(0,1)!="2") popupWindow.focus();
	if(popupWindow.opener == null) popupWindow.opener = self;
	//popupWindow.resizeTo(pW, pH);
	
}
function closePopupWin() { 
	if (popupWindow && !popupWindow.closed) {
		popupWindow.close();
	}
}
function MakePopUpWindows() { 
    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; 
				 width = pW;
              } 
              else { 
                 pW = relSplit[1]; 
				 width = pW;
              } 
              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[3] + ",scrollbars=" + relSplit[3] + ",status=" + relSplit[3]; 
              anchor.setAttribute("href", "javascript:popupWin('" + linkDest + "','" + windowAttributes + "', " + pW + ", " + pH + ")"); 
         } 
    } 
} 