
//function blockError(){return true;}

//window.onerror = blockError;


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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.0
  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 && document.getElementById) x=document.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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');

}

function check_range_change()
{
	var selected_value = document.searchform.period.options[document.searchform.period.selectedIndex].value;


	if (selected_value == "daily")
	{
		// it's the daily range, set it to today
		set_range_popups(new Date(), new Date());
	}
	if (selected_value == "weekly")
	{
		// it's the weekly range set it to last week through today

		// get a new date object to start
		var start = new Date();
		start.setDate(start.getDate() - 6);

		// set the popups
		set_range_popups(start, new Date());
	}
	if (selected_value == "30days")
	{
		// it's the 30 day range

		// get a new date object to start
		var start = new Date();
		start.setDate(start.getDate() - 29);

		// set the popups
		set_range_popups(start, new Date());
	}
	if (selected_value == "90days")
	{
		// it's the 90 day range

		// get a new date object to start
		var start = new Date();
		start.setDate(start.getDate() - 89);

		// set the popups
		set_range_popups(start, new Date());
	}
	if (selected_value == "year")
	{
		// it's the yearly range

		// get a new date object to start
		var start = new Date();
		start.setDate(start.getDate() - 364);

		// set the popups
		set_range_popups(start, new Date());
	}
	if (selected_value == "archive")
	{
		// it's the archive range

		// get a new date object to start
		var start = new Date(1997, 1, 1);

		// set the popups
		set_range_popups(start, new Date());
	}

}	// end check_range_change


function reset_range_popup()
{
	document.searchform.period.selectedIndex = 6;

}	// end reset_range


function set_range_popups(start, end)
{
	var form_handle = document.searchform;

	// set the months
	form_handle.start_month.selectedIndex = start.getMonth() + 1;
	form_handle.end_month.selectedIndex = end.getMonth() + 1;

	// set the days
	form_handle.start_day.selectedIndex = start.getDate();
	form_handle.end_day.selectedIndex = end.getDate();

	// set the years
	form_handle.start_year.selectedIndex = year_format(start) - 1996;
	form_handle.end_year.selectedIndex = year_format(end) - 1996;
}	// end set_range_popups


// year_format works around a variety of compatibility problems with browsers and the way they handle dates
function year_format(date_handle)
{
	var y = date_handle.getYear();

	if (y < 1000)
	{
		y += 1900;
	}
	return y;
}	// end year_format

function valid_date()
{
	var form_handle = document.searchform;
}

		function SubmitAction1(action)
		{
			var form = document.frmMailing;
			form.ACTION.value = action;
			
			if( action == "SUBMIT" )
			{
				//form.submit();
				return DataValidation1();
			}
			
			if( action == "CANCEL" )
			{
				window.navigate( "" );
			}
			
			return false;
		}
		
		function DataValidation1()
		{
			var form = document.frmMailing;						
			
			if( form.email.value == "" )
			{
				alert( "Please supply a valid email before proceeding.");
				return false;
			}
			
			if( form.email.value.length > 50 )
			{
				alert( "Please fill out an email with a length < 50.");
				return false;	
			}
			
			if ( form.email.value != "" )
			{		
				if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.email.value))
				{
				}
				else
				{				
					alert("Please supply a valid email before proceeding.");
					return false;
				}
			}
								
			return true;
		}
			

function GoSearch(searchpage) 
{
var form = document.simplesearch;
//alert (searchpage);
if (searchpage == "Author") {
	location.href = "/results2.asp?criteria=author&simplequery=" + form.simplequery.value;
	}
if (searchpage == "Date"){
	location.href = "/results2.asp?criteria=date&simplequery=" + form.simplequery.value;
	}
if (searchpage == "Keyword"){
	location.href = "/results.asp?simplequery=" + form.simplequery.value;
	}
if (searchpage == "0"){
	alert("Please select a criteria") 
	}
}


// Pop-up Window functions
var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety+"px"
}
}

function initializedrag(e){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
document.getElementById("dwindowcontent").style.display="none" //extra
tempx=parseInt(document.getElementById("dwindow").style.left)
tempy=parseInt(document.getElementById("dwindow").style.top)

dragapproved=true
document.getElementById("dwindow").onmousemove=drag_drop
}

function loadwindow(url,width,height){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width+"px"
document.getElementById("dwindow").style.height=initialheight=height+"px"
document.getElementById("dwindow").style.left="30px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
document.getElementById("cframe").src=url
}
}

function maximize(){
if (minrestore==0){
minrestore=1 //maximize window
document.getElementById("maxname").setAttribute("src","images/restore.gif")
document.getElementById("dwindow").style.width=ns6? window.innerWidth-20+"px" : iecompattest().clientWidth+"px"
document.getElementById("dwindow").style.height=ns6? window.innerHeight-20+"px" : iecompattest().clientHeight+"px"
}
else{
minrestore=0 //restore window
document.getElementById("maxname").setAttribute("src","images/max.gif")
document.getElementById("dwindow").style.width=initialwidth
document.getElementById("dwindow").style.height=initialheight
}
document.getElementById("dwindow").style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"
}

function closeit(){
document.getElementById("dwindow").style.display="none"
}

function stopdrag(){
dragapproved=false;
document.getElementById("dwindow").onmousemove=null;
document.getElementById("dwindowcontent").style.display="" //extra
}


// Copyright 2001 William Bontrager - Floater
var Type = 'Z';
function StartFloat() {
if(document.all) {
	document.all.AdFloater.style.pixelLeft = document.body.clientWidth - document.all.AdFloater.offsetWidth;
	document.all.AdFloater.style.visibility = 'visible';
	Type = 'A';
	}
else if(document.layers) {
	document.AdFloater.left = window.innerWidth - document.AdFloater.clip.width - 16;
	document.AdFloater.visibility = 'show';
	Type = 'B';
	}
else if(document.getElementById) {
	document.getElementById('AdFloater').style.left = (window.innerWidth - 35) + 'px';
	document.getElementById('AdFloater').style.visibility = 'visible';
	Type = 'C';
	}
if (document.all) { window.onscroll = Float; }
else { setInterval('Float()', 100); }
}
function Float() {
if (Type == 'A') { document.all.AdFloater.style.pixelTop = document.body.scrollTop; }
else if (Type == 'B') { document.AdFloater.top = window.pageYOffset; }
else if (Type == 'C') { document.getElementById('AdFloater').style.top = window.pageYOffset + 'px'; }
} 