// JavaScript Document


	//load style sheet, which will not load if js is unavailable. This will also prevent any flickering.
	document.write('<link rel="stylesheet" type="text/css" href="/css/projects/news/drop-downs.css" />');
	window.onload = function () {
		theBody = document.getElementsByTagName('body')[0]; 
		theBody.onclick = checkEvent;
		/*altRows();*/
	}
	
	
	function closePanels(){
		div = document.getElementsByTagName('div');
			//iterate through them
			for (var i=0; i < div.length; i++) {
				
				currentDiv = div[i];
				//see if the collapsible panel is open				
				if (currentDiv.className == "CollapsiblePanel CollapsiblePanelOpen") {
						//get its id, which gives is the name of the panel object
						divID = currentDiv.id;
						//get a reference of the panel object and run the Spry close function
						eval(divID).close();
						
				}//end if
			}//end for*/
	}//end function

	
	//this closes collapsible panels when the user clicks anywhere in the body
	function checkEvent () {

			  if (window.event) {
                  srcEl = null;
				  srcEl = window.event.srcElement; //msie
				 

				if (srcEl.className != "nr-sort CollapsiblePanelContent") {
				closePanels();
		
				//gather all divs so we can find collapsible panels
				}
			}//end if
			
          	else {
				closePanels();	
			}
			
			/*div = document.getElementsByTagName('div');
			//iterate through them
			for (var i=0; i < div.length; i++) {
				
				currentDiv = div[i];
				//see if the collapsible panel is open				
				if (currentDiv.className == "CollapsiblePanel CollapsiblePanelOpen") {
						//get its id, which gives is the name of the panel object
						divID = currentDiv.id;
						//get a reference of the panel object and run the Spry close function
						eval(divID).close();
						
				}//end if
			}//end for*/

			
	}// end function

	
	
	
