//Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/02)
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use
var ns6=document.getElementById&&!document.all
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1

function checkcontained(e){
	var iscontained=0
	cur=ns6? e.target : event.srcElement
	i=0
	//escape if the current element has no id
	if(!cur.id){ return; }
	
	if (cur.id.indexOf("foldheader") != -1)			
		iscontained=1	
	else
		while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){
			if (cur.id.indexOf("foldheader") != -1 || cur.id.indexOf("foldinglist")!= -1){
				iscontained=(cur.id.indexOf("foldheader")!=-1)? 1 : 0
				break
			}
			cur=ns6? cur.parentNode : cur.parentElement
		}	
		
	var arrFolder = cur.id.split("_");
	var intFolder = arrFolder[1];	
	
	if (iscontained && navigator.appName != "Netscape"){						
		if (eval("document.all.foldinglist_" + intFolder + ".style").display=="none"){			
			eval("document.all.foldinglist_" + intFolder + ".style").display=""
		}
		else{
			eval("document.all.foldinglist_" + intFolder + ".style").display=="none"
		}						
		for (var i=1; i<7;i++)
		{
			if (intFolder != i)
				eval("document.all.foldinglist_" + i + ".style").display = "none"
		}	
	}		
	else if (iscontained && navigator.appName == "Netscape"){						
		if (eval("document.getElementById('foldinglist_" + intFolder + "').style").display=="none"){			
			eval("document.getElementById('foldinglist_" + intFolder + "').style").display=""
		}
		else{
			eval("document.getElementById('foldinglist_" + intFolder + "').style").display=="none"
		}						
		for (var i=1; i<9;i++)
		{
			if (intFolder != i)
				eval("document.getElementById('foldinglist_" + i + "').style").display = "none"
		}	
	}
	
}

if (ie4||ns6)
document.onclick=checkcontained

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function validatePoll()
{
	var bCheckedFlag = true
	for (var i=0; i < document.frmPoll.choices.length; i++)
	{
		if(document.frmPoll.choices[i].checked)
			bCheckedFlag = false;
	}
	
	if(bCheckedFlag)
	{
		alert("You have not made a selection.");
		return false;
	}
	else
		return true;
}

function jumpToLink()
{
	//alert(document.jumpTo.selPartners.options[document.jumpTo.selPartners.selectedIndex].value);
	if (document.jumpTo.selPartners.options[document.jumpTo.selPartners.selectedIndex].value != "")
	{	
		window.open(document.jumpTo.selPartners.options[document.jumpTo.selPartners.selectedIndex].value, "USAFootballPartner", "scrollbars=yes, toolbar=yes, titlebar=yes, status=yes, resizble=yes, menubar=yes, location=yes, resizable=yes");
	}
}

function popupNewWindow(sURL)
{					
	var newWindow = window.open(sURL, "wndNew", "scrollbars=yes, menubar=no, width=500, height=300");		
}


// Search Engine
<!-- Hide from older browsers...

//Check the form before submitting
function CheckForm () {

	//Check for a word to search
	if (document.frmSiteSearch.search.value==""){
		alert("Please enter at least one keyword to search");
		document.frmSiteSearch.search.focus();
		return false;
	}
	
	return true
}
// -->

//Opens new Window <!--
	function openTitle(titleFile) {
		var winOpts = "width=520,height=320,resizable=yes,scrollbars=yes,menubar=no,status=no,toolbar=no,top=50,left=70";
		msgWin = window.open(titleFile,"winFinder",winOpts);
		if (navigator.userAgent != null)
			if ((navigator.userAgent.indexOf("4.") > 0) || (navigator.userAgent.indexOf("5.") > 0))
				msgWin.focus();
	}
//	-->


//Create Expanding/Collapsing Boxes for the FAQs
                                        
           function bind(obj, func){
             return function() { return func.apply(obj, arguments); };
           }
          
           function getElementsByClassName(className, obj){
                  var objs = new Array();
                  if(obj.className && obj.className.indexOf(className) > -1){
                          objs.push(obj);
                  }
                  if(obj.childNodes.length){
                          var children = obj.childNodes;
                          for(var i = 0; i < children.length; i++){
                                  objs = objs.concat(getElementsByClassName(className, children[i]));
                          }
                  }
                  return objs;
          }
                                        
                                /* Javascript file to create a class to register functions to run when the document is 'Ready' */
          function DocReady(func){
                  this.init();
                  if(func) this.add(func);
          }
          
          DocReady.prototype.readyFunctions = function() { };

          DocReady.prototype.init = function(){
                  //flag
                  this.ran = false;
          
                  this.addListeners();        
          }
          
          DocReady.prototype.addListeners = function()
          {
                  var runFunc = bind(this, this.readyFunctions);
                  //register event Readyrs
                  if(document.addEventListener){ //Moz or Opera
                          document.addEventListener('DOMContentLoaded', runFunc, false);
                          window.addEventListener('load', runFunc, false); //just in case
                  } else if(document.all && !window.opera && document.readyState) { //IE
                          var src = (window.location.protocol == 'https:') ? '://0' : 'javascript:void(0)';
                          document.write("<script id='DOMReady' defer=true src='" + src + "'><\/script>");  
                          document.getElementById("DOMReady").onreadystatechange=function(){
                              if (this.readyState=="complete"){ runFunc(); }
                          }
                  } else if(document.readyState && (navigator.userAgent.indexOf('AppleWebKit/') > -1)){ //safari
                          this.timer = setInterval(function() {
                                  if (document.readyState == 'loaded' || document.readyState == 'complete') { runFunc(); }
                          }, 50);
                  } else { //older browsers
                          var fn = window.onload;
                          window.onload = function() {
                                  runFunc();
                                  if (fn) fn();
                          }
                  }
          }
          
          DocReady.prototype.add = function(func){
                  if(typeof(func) != 'function'){ return false; }
                  if(this.ran){ return func(); }
                  var fn;
                  if(typeof(this.readyFunctions) == 'function'){
                          fn = bind(this, this.readyFunctions);
                  }else{
                          fn = function(){};
                  }
                  
                  this.readyFunctions = function () {
                          if(!this.ran){
                                  if(this.timer){ clearInterval(this.timer); }
                                  fn();
                                  func();
                          }
                          this.ran = true;
                  }
                  
                  this.addListeners();
          }
          
          var dR = new DocReady();          
          /**
           *  Trigger is the element on which you want to click to open/close the element
           *  Hide is the element you wish to open or close
           */
          function makeCollapsible(trigger, hide){
            trigger.style.cursor = "pointer";
            trigger.tabIndex = "30";
            trigger.onclick = function()
            {
              hide.slide();
            };
            
            trigger.onkeyup = function(e){
            	if(!e) var e = window.event;
            	if(e.keyCode == 13)
            	  hide.slide();
            };
            
            var tweenFast = [.01,.04,.12,.24,.40,.60,.76,.88,.96,1.00];
            
            hide.style.overflow = "hidden";
            hide.storeHeight = hide.clientHeight;
            hide.style.height = "1px";
            hide.isSlidClosed = true;
            hide.slide = function() {
              var store = trigger.onclick;
              trigger.onclick = null;
              
              if(this.isSlidClosed){
                this.isSlidClosed = false;
                close(this, tweenFast, this.storeHeight);
              } else {
                this.isSlidClosed = true;
                open(this, tweenFast, this.storeHeight);
              }
              trigger.onclick = store;
            };
          }
          
          var open = function(obj, tween, h){
                           var count = tween.length - 1;
                                                   
                          var intv = setInterval( function(){
                                  obj.style.height = (tween[count]*h)+'px';
                                  count--;
                                  if(count < 0){
                                          clearInterval(intv);
                                          obj.style.height = '1px';
                                  }
                          }, 50);
                          
          };
          
          var close = function (obj, tween, h){
                          var count = 0;
                                                 
                          var intv = setInterval( function(){
                                  obj.style.height = (tween[count]*h)+'px';
                                  count++;
                                  if(count == tween.length){
                                  	  
                                          clearInterval(intv);
                                          obj.style.height = h + 'px';
                                  }
                          }, 50);
                          
          };

          
          
          dR.add(function() {
		var headers = getElementsByClassName('cheader', document.body);
		var paragraphs = getElementsByClassName('ccontent', document.body);
		
		if(headers.length && paragraphs.length){
			var i = headers.length;
			while(i--){
			 makeCollapsible(headers[i], paragraphs[i]);
			}
		}
          });
