// JavaScript Document
/**************************************************************
	
		Checks if the browaser is IE. If so, sets up 1ms interval,
		checks the size of the window (IE style, but it is only
		used for IE so it doesn't matter), and resizes the content
		holder accordigly.
		
		All other browsers will respect "min-width" css
		
	**************************************************************/
	var intervalHandler=0;
	var counterIfLive=0
	window.onload=function() {
		if (navigator.userAgent.indexOf("MSIE") != -1){
	//		alert("IE: "+navigator.userAgent);
			window.setInterval(setTheSize,1);
			
		}
	}		
	function setTheSize (){
		if (document.body.clientWidth <= 770) {
			//document.getElementById("scaleHolder").style.width="779px";		
			document.getElementById("container").style.width="770px";		
			} else { 
			document.getElementById("container").style.width="100%";			
			
		}
	}
	
	//adds a PDF icon to the link
function addLoadEvent(func)
   {
	  var oldonload = window.onload;
	  
	  if (typeof window.onload != 'function') 
	  {
	   window.onload = func; 
	  } else {
	   window.onload = function() 
		  {
		   oldonload(); func(); 
		  } 
	  } 
	}

// PDF Link Handler

function fPDFHandler ()
{
 if (!document.getElementsByTagName) return false;
 var links = document.getElementsByTagName("a");
 for (var i=0; i < links.length; i++) {
  if (links[i].href.indexOf('.pdf') !== -1) {
   links[i].onclick =
    function() {
     window.open(this.href,'popper','resizable,scrollbars');
     return false;
    }
    links[i].title += "Portable Document Format (PDF) Document. This link will open in a new window/tab.";
	//links[i].class += "pdfdoc";
	//links[i].setAttribute("class", "test");
	//links[i].className+=links[i].className?' pdfdoc':'pdfdoc';
	var img1 = document.createElement("img");
    img1.setAttribute("src", "icon_new_window.gif");
    img1.setAttribute("border", "0");
    img1.setAttribute("alt", "This link will open in a new window/tab.");
    var img2 = document.createElement("img");
    img2.setAttribute("src", "icon_pdf.gif");
    img2.setAttribute("border", "0");
    img2.setAttribute("alt", "Portable Document Format (PDF) Document. This link will open in a new window/tab.");
    links[i].appendChild(img1);
	links[i].appendChild(img2);
	}
 }
}
addLoadEvent(fPDFHandler);

function fWordHandler ()
{
 if (!document.getElementsByTagName) return false;
 var links = document.getElementsByTagName("a");
 for (var i=0; i < links.length; i++) {
  if (links[i].href.indexOf('.doc') !== -1) {
   links[i].onclick =
    function() {
     window.open(this.href,'popper','resizable,scrollbars');
     return false;
    }
    links[i].title += "Word Format Document. This link will open in a new window/tab.";
	var img1 = document.createElement("img");
    img1.setAttribute("src", "icon_new_window.gif");
    img1.setAttribute("border", "0");
    img1.setAttribute("alt", "This link will open in a new window/tab.");
    var img2 = document.createElement("img");
    img2.setAttribute("src", "icon_word.gif");
    img2.setAttribute("border", "0");
    img2.setAttribute("alt", "Word Format Document. This link will open in a new window/tab.");
    links[i].appendChild(img1);
	links[i].appendChild(img2);
	}
 }
}
addLoadEvent(fWordHandler);

function fExcelHandler ()
{
 if (!document.getElementsByTagName) return false;
 var links = document.getElementsByTagName("a");
 for (var i=0; i < links.length; i++) {
  if (links[i].href.indexOf('.xls') !== -1) {
   links[i].onclick =
    function() {
     window.open(this.href,'popper','resizable,scrollbars');
     return false;
    }
    links[i].title += "Excel Format Document. This link will open in a new window/tab.";
	var img1 = document.createElement("img");
    img1.setAttribute("src", "icon_new_window.gif");
    img1.setAttribute("border", "0");
    img1.setAttribute("alt", "This link will open in a new window/tab.");
    var img2 = document.createElement("img");
    img2.setAttribute("src", "icon_excel.gif");
    img2.setAttribute("border", "0");
    img2.setAttribute("alt", "Excel Format Document. This link will open in a new window/tab.");
    links[i].appendChild(img1);
	links[i].appendChild(img2);
	}
 }
}
addLoadEvent(fExcelHandler);
