//SWAP IMAGE
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 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 swapImage() {
	strImage = (arguments[1]=='on')?'style/images/leftmenu_r.gif':'style/images/leftmenu.gif';
	MM_swapImage(arguments[0],'',strImage,1)
}

function MM_homeMenu(targ,selObj,restore){ //v3.0
	if (selObj.selectedIndex == 4 || selObj.selectedIndex == 0 ) {
			eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
		}
		else {
			window.open(selObj.options[selObj.selectedIndex].value,'new')
		}
  if (restore) selObj.selectedIndex=0;
	return false;
}



/*/ preload images
if (document.images){
  preload_image_object = new Image();
  // set image url
  image_url = new Array();
  image_url[0] = location.protocol+"//"+location.host+"/images/text/clock/small_00.gif";
  image_url[1] = location.protocol+"//"+location.host+"/images/text/clock/small_01.gif";
  image_url[2] = location.protocol+"//"+location.host+"/images/text/clock/small_02.gif";
  image_url[3] = location.protocol+"//"+location.host+"/images/text/clock/small_03.gif";
  image_url[4] = location.protocol+"//"+location.host+"/images/text/clock/small_04.gif";
  image_url[5] = location.protocol+"//"+location.host+"/images/text/clock/small_05.gif";
  image_url[6] = location.protocol+"//"+location.host+"/images/text/clock/small_06.gif";
  image_url[7] = location.protocol+"//"+location.host+"/images/text/clock/small_07.gif";
  image_url[8] = location.protocol+"//"+location.host+"/images/text/clock/small_08.gif";
  image_url[9] = location.protocol+"//"+location.host+"/images/text/clock/small_09.gif";
  var i = 0;
  for(i=0; i<=9; i++){
	 preload_image_object.src = image_url[i];
  }
}*/



// Exit disclaimer
var popupWidth;
var popupHeight;

// check type size
function textSizeDetect() {
	var intTextSize = (document.layers)?document.layers["textsizedetect"]:(document.all)?document.all["textsizedetect"]:(document.getElementById)?document.getElementById("textsizedetect"):"";

	if (intTextSize) {
		 intTextSize = intTextSize.offsetHeight
	}
	if (intTextSize>14){
		//set the height and width of the popup
		popupWidth=220;
		popupHeight=240;
	} else if (intTextSize>12){
		//set the height and width of the popup
		popupWidth=220;
		popupHeight=220;
	} else{
		popupWidth=220;
		popupHeight=200;
	
	}
}


// --- KEYPRESS VALIDATION
function verifyKey(oElement,oEvent){
	if(oEvent.keyCode==13 && oElement.onclick){
		oEvent();
	}
}



// --- SET EXTERNAL LINKS
function externalLinks() {
  if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName("a");
  for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
    if(anchor.getAttribute("href")&&anchor.getAttribute("rel") == "external"){
       anchor.target = "_blank";
       var strTitle = anchor.getAttribute("title");
       if((strTitle=="")||(strTitle==null)){
          anchor.title = "Opens in a new browser window.";
       }else{
          if(strTitle.indexOf("browser window")<0){
             anchor.title = strTitle+". Opens in a new browser window";
          }
       }
       var strTitle = "";
    }
  }
  menuLinkActive();
}
window.onload=externalLinks;



// --- MEDIA BOX SELECTOR (SWAP LAYER VISIBILITY FOR DIFFERENT SECTIONS

var mediasections=new Array("images","videos","podcasts");
function selectmediabox(mediatype){
	for(x in mediasections){
		if(mediasections[x]==mediatype){
			document.getElementById('mmbutton_'+mediasections[x]).className="lit";
			document.getElementById('mm'+mediasections[x]).className="";
		}else{
			document.getElementById('mmbutton_'+mediasections[x]).className="";
			document.getElementById('mm'+mediasections[x]).className="hidden";
		}
	}
}
function setdisplaytext(position){
	x=0;
	if (!document.getElementsByTagName) return;
	var getmedia = document.getElementById("mmimages");
	var links = getmedia.getElementsByTagName("a");
	for (var i=0; i<links.length; i++) {
		var linkselect = links[i];
		if(position==i){
			x++;
			linkselect.className="lit";
		}else{
			linkselect.className="";
		}
	}
}


// set rolloverstate on Featured Supporters Menu 
function menuLinkActive(){
	
  if (!document.getElementsByTagName) return;
  var divs = document.getElementsByTagName("div");
  for(var i=0;i<divs.length;i++){
    var div = divs[i];
    if(div.className.match("supporter_content")){
	  var anchors=div.getElementsByTagName("a");
      for(var j=0;j<anchors.length;j++){
        var anchor = anchors[j];
        if(anchor.getAttribute("href")){
          anchor.onmouseover=new Function('divRollover(this.parentNode);')
          anchor.onmouseout=new Function('divRollout(this.parentNode);')
          anchor.onfocus=new Function('divRollover(this.parentNode);')
          anchor.onblur=new Function('divRollout(this.parentNode);')
	}
      }
    }
  }
}

// Row rollovers for tables
function divRollover(theparent){
	theparent.parentNode.style.backgroundColor='#F4F4F4';
	//theparent.parentNode.childNodes[0].style.backgroundColor='#F8F6F3';
}
function divRollout(theparent){
	theparent.parentNode.style.backgroundColor='#FFFFFF';
	//theparent.parentNode.childNodes[0].style.backgroundColor='#FFFFFF';
}
//window.onload=menuLinkActive;


