// Puts the exit icon by all external links
function exitLink() {
	if (document.getElementById && document.all) {
		var browser="IE";
	} else {
		var browser="notIE";
	}
  var e = document.getElementById('content');
  if (e) {
    var a=e.getElementsByTagName('a');
    for (var i=0;i<a.length;i++) {
			if (browser == "IE") {
				if (a[i].getAttribute('href') != null && a[i].getAttribute('href').lastIndexOf(".pdf",a[i].length) == -1 && a[i].getAttribute('href',2).indexOf("://") >= 0 && a[i].getElementsByTagName('img').length == 0 && (a[i].getAttribute('href').indexOf("westernconference.org") == -1 || a[i].getAttribute('href').indexOf("offSite=y") >= 0)) {
					var icon = document.createElement('img');
					icon.src = 'http://www.westernconference.org/images/external.gif';
					icon.border = '0';
					icon.alt = 'This link takes you to an external website.';
					icon.width = '11';
					icon.height = '11';
					var iconLink = document.createElement('a');
					iconLink.href = a[i].href;
					var space = document.createTextNode(String.fromCharCode(160));
					iconLink.appendChild(icon);
					a[i].title = 'This link takes you to an external website.';
					a[i].appendChild(space);
				//	a[i].appendChild(space);
				//	a[i].appendChild(space);
				//	a[i].appendChild(space);
					a[i].appendChild(icon);
				}
			} else {
				if (a[i].getAttribute('href') != null && a[i].getAttribute('href').lastIndexOf(".pdf",a[i].length) == -1 && a[i].getAttribute('href').indexOf("://") >= 0 && a[i].getElementsByTagName('img').length == 0 && (a[i].getAttribute('href').indexOf("westernconference.org") == -1 || a[i].getAttribute('href').indexOf("offSite=y") >= 0)) {
					a[i].className+=a[i].className?' external':'external';
					a[i].title='This link takes you to an external website.';
				}			
			}
		}
	}
}

// Puts the pdf icon by all pdf links

function pdfLink() {
	if (document.getElementById && document.all) {
		var browser="IE";
	} else {
		var browser="notIE";
	}
  var e = document.getElementById('content');
  if (e) {
    var a=e.getElementsByTagName('a');
    for (var i=0;i<a.length;i++) {
			if (browser == "IE") {
				if (a[i].getAttribute('href') != null && a[i].getAttribute('href').lastIndexOf(".pdf",a[i].length) >= 0) {
					var icon = document.createElement('img');
					icon.src = 'http://www.westernconference.org/images/pdf.gif';
					icon.border = '0';
					icon.alt = 'This link opens a pdf document.';
					var iconLink = document.createElement('a');
					iconLink.href = a[i].href;					
				//	Uncomment for popup
				//	iconLink.onclick = function(){newWin=window.open(this.href,'pdf'+new Date().getTime(), 'toolbar=no, location=yes, resizable=yes, top=300, left=300, height=500, width=600');if(window.focus){newWin.focus()} return false;}
					var space = document.createTextNode(String.fromCharCode(160));
				//	a[i].appendChild(space);
				//	a[i].appendChild(space);	
					a[i].appendChild(icon);
					a[i].title += 'This link opens a pdf document.';
				//	Uncomment for popup
				//	a[i].onclick = function(){newWin=window.open(this.href,'pdf'+new Date().getTime(), 'toolbar=no, location=yes, resizable=yes, top=300, left=300, height=500, width=600');if(window.focus){newWin.focus()} return false;}
					if (a[i].innerHTML.toLowerCase().indexOf("<img ",0) == -1) {
						a[i].appendChild(icon);	
					}
				}
			} else {
				if (a[i].getAttribute('href') != null && a[i].getAttribute('href').lastIndexOf(".pdf",a[i].length) >= 0) {
				if (a[i].innerHTML.toLowerCase().indexOf("<img ",0) == -1) {					
					a[i].className +=a[i].className?' pdf':'pdf';
					}
					a[i].title += 'This link opens a pdf document.';
				//	Uncomment for popup
				//	a[i].onclick = function(){newWin=window.open(this.href,'pdf'+new Date().getTime(), 'toolbar=no, location=yes, resizable=yes, top=300, left=300, height=500, width=600');if(window.focus){newWin.focus()} return false;}
				}
			}
		}
	}
}

function docLink() {
	if (document.getElementById && document.all) {
		var browser="IE";
	} else {
		var browser="notIE";
	}
  var e = document.getElementById('content');
  if (e) {
    var a=e.getElementsByTagName('a');
    for (var i=0;i<a.length;i++) {
			if (browser == "IE") {
				if (a[i].getAttribute('href') != null && a[i].getAttribute('href').lastIndexOf(".doc",a[i].length) >= 0) {
					var icon = document.createElement('img');
					icon.src = 'http://www.westernconference.org/images/doc.gif';
					icon.border = '0';
					icon.alt = 'This link opens a Word document.';
					var iconLink = document.createElement('a');
					iconLink.href = a[i].href;					
				//	Uncomment for popup
				//	iconLink.onclick = function(){newWin=window.open(this.href,'pdf'+new Date().getTime(), 'toolbar=no, location=yes, resizable=yes, top=300, left=300, height=500, width=600');if(window.focus){newWin.focus()} return false;}
					var space = document.createTextNode(String.fromCharCode(160));
				//	a[i].appendChild(space);
					a[i].appendChild(space);	
					a[i].appendChild(icon);
					a[i].title += 'This link opens a Word document.';
				//	Uncomment for popup
				//	a[i].onclick = function(){newWin=window.open(this.href,'pdf'+new Date().getTime(), 'toolbar=no, location=yes, resizable=yes, top=300, left=300, height=500, width=600');if(window.focus){newWin.focus()} return false;}
					if (a[i].innerHTML.toLowerCase().indexOf("<img ",0) == -1) {
						a[i].appendChild(icon);	
					}
				}
			} else {
				if (a[i].getAttribute('href') != null && a[i].getAttribute('href').lastIndexOf(".doc",a[i].length) >= 0) {
                if (a[i].innerHTML.toLowerCase().indexOf("<img ",0) == -1) {					
					a[i].className +=a[i].className?' doc':'doc';
					}
					a[i].title += 'This link opens a Word document.';
				//	Uncomment for popup
				//	a[i].onclick = function(){newWin=window.open(this.href,'pdf'+new Date().getTime(), 'toolbar=no, location=yes, resizable=yes, top=300, left=300, height=500, width=600');if(window.focus){newWin.focus()} return false;}
				}
			}
		}
	}
}
function xlsLink() {
	if (document.getElementById && document.all) {
		var browser="IE";
	} else {
		var browser="notIE";
	}
  var e = document.getElementById('content');
  if (e) {
    var a=e.getElementsByTagName('a');
    for (var i=0;i<a.length;i++) {
			if (browser == "IE") {
				if (a[i].getAttribute('href') != null && a[i].getAttribute('href').lastIndexOf(".xls",a[i].length) >= 0) {
					var icon = document.createElement('img');
					icon.src = 'http://www.westernconference.org/images/xls.gif';
					icon.border = '0';
					icon.alt = 'This link opens a Excel document.';
					var iconLink = document.createElement('a');
					iconLink.href = a[i].href;					
				//	Uncomment for popup
				//	iconLink.onclick = function(){newWin=window.open(this.href,'xls'+new Date().getTime(), 'toolbar=no, location=yes, resizable=yes, top=300, left=300, height=500, width=600');if(window.focus){newWin.focus()} return false;}
					var space = document.createTextNode(String.fromCharCode(160));
				//	a[i].appendChild(space);
				//	a[i].appendChild(space);	
					a[i].appendChild(icon);
					a[i].title += 'This link opens a Excel document.';
				//	Uncomment for popup
				//	a[i].onclick = function(){newWin=window.open(this.href,'xls'+new Date().getTime(), 'toolbar=no, location=yes, resizable=yes, top=300, left=300, height=500, width=600');if(window.focus){newWin.focus()} return false;}
					if (a[i].innerHTML.toLowerCase().indexOf("<img ",0) == -1) {
						a[i].appendChild(icon);	
					}
				}
			} else {
				if (a[i].getAttribute('href') != null && a[i].getAttribute('href').lastIndexOf(".xls",a[i].length) >= 0) {
				if (a[i].innerHTML.toLowerCase().indexOf("<img ",0) == -1) {					
					a[i].className +=a[i].className?' xls':'xls';
					}
					a[i].title += 'This link opens a Excel document.';
				//	Uncomment for popup
				//	a[i].onclick = function(){newWin=window.open(this.href,'xls'+new Date().getTime(), 'toolbar=no, location=yes, resizable=yes, top=300, left=300, height=500, width=600');if(window.focus){newWin.focus()} return false;}
				}
			}
		}
	}
}
function pptLink() {
	if (document.getElementById && document.all) {
		var browser="IE";
	} else {
		var browser="notIE";
	}
  var e = document.getElementById('content');
  if (e) {
    var a=e.getElementsByTagName('a');
    for (var i=0;i<a.length;i++) {
			if (browser == "IE") {
				if (a[i].getAttribute('href') != null && a[i].getAttribute('href').lastIndexOf(".ppt",a[i].length) >= 0) {
					var icon = document.createElement('img');
					icon.src = 'http://www.westernconference.org/images/ppt.gif';
					icon.border = '0';
					icon.alt = 'This link opens a power point document.';
					var iconLink = document.createElement('a');
					iconLink.href = a[i].href;					
				//	Uncomment for popup
				//	iconLink.onclick = function(){newWin=window.open(this.href,'ppt'+new Date().getTime(), 'toolbar=no, location=yes, resizable=yes, top=300, left=300, height=500, width=600');if(window.focus){newWin.focus()} return false;}
					var space = document.createTextNode(String.fromCharCode(160));
				//	a[i].appendChild(space);
				//	a[i].appendChild(space);	
					a[i].appendChild(icon);
					a[i].title += 'This link opens a power point document.';
				//	Uncomment for popup
				//	a[i].onclick = function(){newWin=window.open(this.href,'ppt'+new Date().getTime(), 'toolbar=no, location=yes, resizable=yes, top=300, left=300, height=500, width=600');if(window.focus){newWin.focus()} return false;}
					if (a[i].innerHTML.toLowerCase().indexOf("<img ",0) == -1) {
						a[i].appendChild(icon);	
					}
				}
			} else {
				if (a[i].getAttribute('href') != null && a[i].getAttribute('href').lastIndexOf(".ppt",a[i].length) >= 0) {
				if (a[i].innerHTML.toLowerCase().indexOf("<img ",0) == -1) {					
					a[i].className +=a[i].className?' ppt':'ppt';
					}
					a[i].title += 'This link opens a power point document.';
				//	Uncomment for popup
				//	a[i].onclick = function(){newWin=window.open(this.href,'ppt'+new Date().getTime(), 'toolbar=no, location=yes, resizable=yes, top=300, left=300, height=500, width=600');if(window.focus){newWin.focus()} return false;}
				}
			}
		}
	}
}

window.onload = function() {
	if (document.getElementById) {
		exitLink();
		pdfLink();
		docLink()
		xlsLink()
		pptLink()
	}
}
