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_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_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 || (typeof(x)!="object")) && d.getElementById(n)) 
x=d.getElementById(n);
  return x;
}*/


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 topForm(research){
var URL = document.research.source.options[document.research.source.selectedIndex].value;
window.location.href = URL;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}




// email encryption new

// This script is (c) copyright 2006 Jim Tucek under the
// GNU General Public License (http://www.gnu.org/licenses/gpl.html)
// For more information, visit www.jracademy.com/~jtucek/email/ 
// Leave the above comments alone!
// 197 | 131

var decryption_cache = new Array();

function decrypt_string(crypted_string,n,decryption_key,just_email_address) {
	var cache_index = "'"+crypted_string+","+just_email_address+"'";

	if(decryption_cache[cache_index])					// If this string has already been decrypted, just
		return decryption_cache[cache_index];				// return the cached version.

	if(addresses[crypted_string])						// Is crypted_string an index into the addresses array
		var crypted_string = addresses[crypted_string];			// or an actual string of numbers?

	if(!crypted_string.length)						// Make sure the string is actually a string
		return "Error, not a valid index.";

	if(n == 0 || decryption_key == 0) {					// If the decryption key and n are not passed to the
		var numbers = crypted_string.split(' ');			// function, assume they are stored as the first two
		n = numbers[0];	decryption_key = numbers[1];			// numbers in crypted string.
		numbers[0] = ""; numbers[1] = "";				// Remove them from the crypted string and continue
		crypted_string = numbers.join(" ").substr(2);
	}

	var decrypted_string = '';
	var crypted_characters = crypted_string.split(' ');

	for(var i in crypted_characters) {
		var current_character = crypted_characters[i];
		var decrypted_character = exponentialModulo(current_character,n,decryption_key);
		if(just_email_address && i < 7)				// Skip 'mailto:' part
			continue;
		if(just_email_address && decrypted_character == 63)	// Stop at '?subject=....'
			break;
		decrypted_string += String.fromCharCode(decrypted_character);
	}
	
	decryption_cache[cache_index] = decrypted_string;			// Cache this string for any future calls

	return decrypted_string;
}

function decrypt_and_email(crypted_string,n,decryption_key) {
	if(!n || !decryption_key) { n = 0; decryption_key = 0; }
	if(!crypted_string) crypted_string = 0;

	var decrypted_string = decrypt_string(crypted_string,n,decryption_key,false);
	parent.location = decrypted_string;
}

function decrypt_and_echo(crypted_string,n,decryption_key) {
	if(!n || !decryption_key) { n = 0; decryption_key = 0; }
	if(!crypted_string) crypted_string = 0;

	var decrypted_string = decrypt_string(crypted_string,n,decryption_key,true);
	document.write(decrypted_string);
	return true;
}

// Finds base^exponent % y for large values of (base^exponent)
function exponentialModulo(base,exponent,y) {
	if (y % 2 == 0) {
		answer = 1;
		for(var i = 1; i <= y/2; i++) {
			temp = (base*base) % exponent;
			answer = (temp*answer) % exponent;
		}
	} else {
		answer = base;
		for(var i = 1; i <= y/2; i++) {
			temp = (base*base) % exponent;
			answer = (temp*answer) % exponent;
		}
	}
	return answer;
}
// -->



/* encryptions below - start with 0 */

if(!addresses) var addresses = new Array();
addresses.push("25807 16987 4679 9428 22117 20976 12476 25667 14463 14843 8833 10545 9428 14843 25667 24069 12114 22117 4074 9428 11350 10545 19915 15440 25667 4679");  // 0 ngranoski@ apr.com
addresses.push("6107 6101 1318 2608 2160 3332 3092 710 4150 4698 2428 5313 710 1679 710 3784 2608 2428 5313 4014 1080 710 1318");  // [0] sprovo - at - apr.com



/* Script Rotation File
    Copyright 2007 by Dan Appleman
    
    This script will rotate any text into a <div> tag or <span> tag. The rotation can be sequential or can be random.
    The text can include HTML tags, thus this script can be used for image rotation as well as text/html rotation.
    
    To use the script, do the following:
    1. Include this script file thus:    <script src="dwrotator.js" type="text/javascript" ></script>
    2. Add the code shown below. You can place it in a separate javascript file and include it, or place it
        in a script block in your page.
        
    Using the script.
    
    For each <div> or <span> tag that you want to substitute, do the following:
    1: Create a DivRotater object. The constructor for the object takes three parameters, the name of the associated
        <div> or <span> tag, the rotation time (in milliseconds), and a boolean value that is true for random selection
        or false for sequential.
       
        For example, to create a new DivRotater object for tag <div id="firstdiv"> and a 2 second random, you would use:
       
        var Div1Rotater = new DivRotater("firstdiv", 2000, true);


    2:  Next, add in all the substitution values using the add method. For example, to add four strings to be rotated
        you would use:

        Div1Rotater.add("text1");
        Div1Rotater.add("text2");
        Div1Rotater.add("text3");
        Div1Rotater.add("text4");

    You can create as many DivRotater objects as you wish.
    
    Remember, to include quotes within the text, use the escape character \. For example, to add an image link you might
    add:
    
    Div1Rotater.add("<img src=\"/someimage.gif\" />")

*/


var dwr_AllRotaters = new Array();
var dwr_Prevonload;
var dwr_Prevunload;

function DivRotater(divid, duration, random)
{
    this.add = AddToRotater;
    this.divid = divid;
    this.duration = duration;
    this.random = random;
    this.list = new Array();
    this.currentindex = 0;
	this.cancelid = 0;
    dwr_AllRotaters.push(this);
    if(dwr_AllRotaters.length== 1)
    {
        dwr_Prevonload = window.onload;
        window.onload =  HandleOnload;
		dwr_Prevunload = window.onunload;
		window.onunload = HandleOnunload;
    }
}

function AddToRotater(text) 
{
    this.list.push(text);
    if(this.random)
    {
        this.currentindex = getrandom(this.list.length);
    }
}

function getrandom(thelength)
{
    var total = Math.random() * thelength;
    return(Math.floor(total));
}


function DoRotation(index)
{
    var newindex;
    therotater = dwr_AllRotaters[index];
    if(therotater.random)
    {
        switch(therotater.list.length)
        {
            case 0:
            case 1: newindex = 0;
                    break;
            case 2: therotater.currentindex = (therotater.currentindex==0)? 1: 0;
                    break;
            default:
                    do newindex = getrandom(therotater.list.length); while(newindex==therotater.currentindex);
        }
        therotater.currentindex = newindex;
    }
    else
    {
        therotater.currentindex+=1;
        if(therotater.currentindex >= therotaterlist.list.length) therotater.currentindex = 0;
    }

    document.getElementById(therotater.divid).innerHTML = therotater.list[therotater.currentindex];
    StartTheTimer(index);
}

function HandleOnload()
{
    if(dwr_Prevonload) 
	try {
		dwr_Prevonload();
	}
	catch (ex) {}
    var index;
    for(index in dwr_AllRotaters)
    {
        therotator = dwr_AllRotaters[index];
		if(therotator && therotator.cancelid) clearTimeout(therotator.cancelid);
        if(document.getElementById(therotator.divid)) 
		{
			therotator.currentindex = -1;
			DoRotation(index);
		}
    }
}

function HandleOnunload()
{
    if(dwr_Prevunload) 
	try {
		dwr_Prevunload();
	}
	catch (ex) {}
    var index;
    for(index in dwr_AllRotaters)
    {
        therotater = dwr_AllRotaters[index];
        try
		{
			if(therotater.cancelid) clearTimeout(therotater.cancelid);
		}
		catch(ex){ }
    }
}

function StartTheTimer(index)
{
    therotator = dwr_AllRotaters[index];
    therotator.cancelid = setTimeout("DoRotation(" + index + ");", therotator.duration);
}   
