
//--------------- TARGET="_BLANK" JS and CHECK FOR EMAIL, DOC and PDF files to add icons --------------------- 

// Opens a link in a new window when class = externalLink
function doPopups() {
    if (!document.getElementsByTagName) return false;
        var links = document.getElementsByTagName("a");
        for (var i=0; i < links.length; i++) {
            if (links[i].className.match("externalLink")) {
        		links[i].className = links[i].className + " newWinStyle";
        		if (links[i].title == "") {
        		    links[i].title = "this link will open in a new window";
        		}
        		else {
        		    links[i].title = links[i].title + " (this link will open in a new window)";	
        		}
        	 	links[i].onclick = function(e) {
        			if(!e)e=window.event;
            			if(e.shiftKey || e.ctrlKey || e.altKey) return;
                			window.open(this.href);
                			return false;
            			}
                }
            //check email
            if (links[i].href.match("mailto")) {
                links[i].className = links[i].className + " emailStyle";
        		if (links[i].title == "") {
        		    links[i].title = "this link will open an email";
        		}
        		else {
        		    links[i].title = links[i].title + " (this link will open an email)";	
        		}
            }
            //check pdf
            if (links[i].href.match(".pdf")) {
                links[i].className = links[i].className + " pdfStyle";
        		if (links[i].title == "") {
        		    links[i].title = "this link will open a .PDF file";
        		}
        		else {
        		    links[i].title = links[i].title + " (this link will open a .PDF file)";	
        		}
            }
            //check doc
            if (links[i].href.match(".doc")) {
                links[i].className = links[i].className + " docStyle";
        		if (links[i].title == "") {
        		    links[i].title = "this link will open a .DOC file";
        		}
        		else {
        		    links[i].title = links[i].title + " (this link will open a .DOC file)";	
        		}
            }
            //check xls
            if (links[i].href.match(".xls")) {
                links[i].className = links[i].className + " xlsStyle";
        		if (links[i].title == "") {
        		    links[i].title = "this link will open a .XLS file";
        		}
        		else {
        		    links[i].title = links[i].title + " (this link will open a .XLS file)";	
        		}
            }
 
        }
}
//--------------- END ---------------------