//Page Scroller (aka custom scrollbar)- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use
//Modified by MicroArts

var thespeed=3 //Enter scroll speed in integer (Advised: 1-3)

var ieNOTopera=document.all&&navigator.userAgent.indexOf("Opera")==-1
var myspeed=0

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function scrollwindow(mywindow){
bodymenu.window.scrollBy(0,myspeed)
}

function initializeIT(){
if (myspeed!=0){
scrollwindow()
}
}

if (document.all||document.getElementById||document.layers)
setInterval("initializeIT()",20)


// This is the implementation of SimpleSwap
// by Jehiah Czebotar
// Version 1.1 - June 10, 2005
// Distributed under Creative Commons
//
// Include this script on your page
// then make image rollovers simple like:
// <img src="/images/ss_img.gif" oversrc="/images/ss_img_over.gif">
//
// http://jehiah.com/archive/simple-swap
// 


function SimpleSwap(el,which){
  el.src=el.getAttribute(which || "origsrc");
}

function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
}

var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
//window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}

leftPos = 0

if (screen) { leftPos = screen.width-495

}

function contactpopup() {
  window.open('contact.php', '', 'status=no,toolbar=no,resizable=no,scrollbars=yes,width=295,height=450,left='+leftPos+',top=40')
}

function loginpopup() {
  window.open('login.php?area=Bigelow 400', '', 'status=no,toolbar=no,resizable=no,scrollbars=yes,width=295,height=350,left='+leftPos+',top=40')
}

function loginprojpopup() {
  window.open('project.php?area=the Project Center', '','status=no,toolbar=no,resizable=no,scrollbars=yes,width=295,height=350,left='+leftPos+',top=40')
}

function printpopup(whichpage) {
  window.open(whichpage, '', 'status=no,toolbar=no,resizable=no,scrollbars=yes,width=295,height=350,left='+leftPos+',top=40')
}

function pdfpopup(whichpdf) {
  window.open(whichpdf, '', 'status=yes,toolbar=yes,resizable=yes,scrollbars=yes,width=500,height=500,left=40,top=40')
}

function privacypopup() {
  window.open('privacy.php', '','status=no,toolbar=no,resizable=no,scrollbars=yes,width=295,height=450,left='+leftPos+',top=40')
}

function sitemappopup() {
 window.open('sitemap.php', '','status=no,toolbar=no,resizable=no,scrollbars=yes,width=295,height=450,left='+leftPos+',top=40')
}

function emailpopup(pagename) {
  window.open('emailpage.php?thispage='+pagename, '', 'status=no,toolbar=no,resizable=no,scrollbars=yes,width=295,height=400,left='+leftPos+',top=40')
}

function essPDF() {
  window.open('/_pdf/Entrepreneur-Strengths-Study.pdf', '','status=yes,toolbar=yes,resizable=yes,scrollbars=yes,width=500,height=450,left='+leftPos+',top=40')
}

function toggleDisplay(divId) {

  var div = document.getElementById(divId);

  div.style.display = (div.style.display=="block" ? "none" : "block");

}

 function Left(str, n)
        /***
                IN: str - the string we are LEFTing
                    n - the number of characters we want to return

                RETVAL: n characters from the left side of the string
        ***/
        {
                if (n <= 0)     // Invalid bound, return blank string
                        return "";
                else if (n > String(str).length)   // Invalid bound, return
                        return str;                // entire string
                else // Valid bound, return appropriate substring
                        return String(str).substring(0,n);
        }
        
function Mid(str, start, len)
        /***
                IN: str - the string we are LEFTing
                    start - our string's starting position (0 based!!)
                    len - how many characters from start we want to get

                RETVAL: The substring from start to start+len
        ***/
        {
                // Make sure start and len are within proper bounds
                if (start < 0 || len < 0) return "";

                var iEnd, iLen = String(str).length;
                if (start + len > iLen)
                        iEnd = iLen;
                else
                        iEnd = start + len;

                return String(str).substring(start,iEnd);
        }
        
 function Len(str)
        /***
                IN: str - the string whose length we are interested in

                RETVAL: The number of characters in the string
        ***/
        {  return String(str).length;  }
        
// InStr function written by: Steve Bamelis - steve.bamelis@pandora.be

function InStr(strSearch, charSearchFor)
/*
InStr(strSearch, charSearchFor) : Returns the first location a substring (SearchForStr)
                           was found in the string str.  (If the character is not
                           found, -1 is returned.)
                           
Requires use of:
	Mid function
	Len function
*/
{
	for (i=0; i < Len(strSearch); i++)
	{
	    if (charSearchFor == Mid(strSearch, i, 1))
	    {
			return i;
	    }
	}
	return -1;
}
