// Detect Client Browser type
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
jsVersion = 1.1;

function edu_search()
{
		if (document.edu.subType.value != 'heading')
			{
				document.edu.submit();
			}
}



function createMainContent()	{
	
		document.write("<link href='/style/mainContent1024.css' rel='stylesheet' type='text/css' />");
	
}
createMainContent();

/* window opener */
				

function newWindow(mypage,myname,w,h) {
	var win = null;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable';
	win = window.open(mypage,myname,settings);
}

/* Start Fly-Over Functions */

/* initialize browser versions */
var gecko = (navigator.product == ('Gecko'))
var ie = (document.all);
var mac = (navigator.userAgent.indexOf("Mac") != -1)
var ff = (navigator.userAgent.indexOf("Firefox") != -1)
var ns = (navigator.userAgent.indexOf("Netscape") != -1)

var imageOver, imageOverSrc;
var activeID, activeMenu, activeLink, imgToSwap;
var siteAlign = "left"
//var siteAlign = "center"

var menuLeft, menuTop, position, menuName, activeLink, activeID, origClass;
if(screen.width>=1024){
	var containerWidth = 1004;
	}
else{
	var containerWidth = 780;
	}

//var menuHideDelay = 360;
var menuHideDelay = 0;
//var mozScrollBars = (ff || ns) ? (mac) ? 16 : 20 : 0;
var mozScrollBars = (ff || ns) ? (mac) ? 0 : 0 : 0;
//set this if you are turning on permanent scrollbars in FF via css, if you arent, use zero instead of (MacFF:16)/(WinFF:20)

function getElementPosition(elemID,menuWidth) {
	var offsetTrail = document.getElementById(elemID.id);
    var offsetLeft = 0;
    var offsetTop = 0;
	var elementHeight = offsetTrail.offsetHeight;
	var elementWidth = offsetTrail.offsetWidth;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
		offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined") {
		offsetLeft += document.body.leftMargin;
		offsetTop += document.body.topMargin;
    }
	var leftBuffer = (siteAlign == "left") ? 0 : (gecko) ? (Math.ceil((window.innerWidth - containerWidth - mozScrollBars)/2)) : (Math.ceil((document.body.clientWidth-containerWidth)/2));
	var rightExtreme = (siteAlign == "left") ? (containerWidth-menuWidth) : (gecko) ? (Math.ceil(window.innerWidth-((window.innerWidth - containerWidth)/2))-menuWidth) : (document.body.clientWidth - (leftBuffer+menuWidth));

	var rightGap = (containerWidth+leftBuffer)-(offsetLeft+elementWidth); // space between last menu item and the right edge of the container
	if (offsetLeft > rightExtreme)  {
		offsetLeft = rightExtreme - rightGap; 
	}

	//menu debugger
	//alert("leftBuffer: " + leftBuffer + "\nrightExtreme: " + rightExtreme + "\noffsetLeft: " + offsetLeft + "\nrightGap: " + rightGap);
	
	position = {left:offsetLeft, top:offsetTop};
	menuLeft = (ie) ? position["left"] - leftBuffer : position["left"];
	menuTop = position["top"] + elementHeight;
}

function showMenu(theImg, menuName) {
	var menuObj = document.getElementById(menuName);
	if (!menuObj) return;
	var menuWidth = 147; // ideally, this would be set automatically
	imgToSwap = theImg;
	getElementPosition(theImg, menuWidth);
	
	menuObj.style.top = menuTop+'px';
	menuObj.style.left = menuLeft+'px';

	menuObj.style.display = "block";
}

function menuOver(activeID) {
	clearTimeout(activeID);
	//swapImage(imgToSwap);
}

function menuOut(activeMenu) {
	startHide(activeMenu);
	//restoreImage(imageOver);
}

function startHide(menuName) {
	activeMenu = menuName;
	activeID = setTimeout("hideMenu('" + menuName + "')", menuHideDelay);
}

function hideMenu(menuName) {
	var menuObj = document.getElementById(menuName);
  	if (!menuObj) return;
	menuObj.style.display = "none";
}
/*

function toggleMenu(objID) {
	if (!document.getElementById)
	return;
	var ob = document.getElementById(objID).style;
	ob.display = (ob.display == 'block')? 'none': 'block';
	}
*/
/* END FLY-OVER MENU FUNCTIONS */




// Detect Flash, return 0 or 1
function hasFlashPlugin(obj) {

    (isEmpty(obj) ? brs=navigator.userAgent.toLowerCase() : brs=obj);

    var f=new Array("0", "0");
    var brwEng=getBrowser(obj)[2];
    var opSys=getOS(obj)[0];

    //if (getBrowser(obj)[2]!="msie") {
    if ( (brwEng=="gecko") || (brwEng=="opera") || (brwEng=="khtml") || (brwEng=="mozold") || (opSys=="macosx") || (opSys=="macclassic") ) {
        // Non-IE Flash plug-in detection

        if (navigator.plugins && navigator.plugins.length) {
            x = navigator.plugins["Shockwave Flash"];
            if (x) {
                f[0] = 2;
                if (x.description) {
                    y = x.description;
                    f[1] = y.charAt(y.indexOf('.')-1);
                }
            } else {
                f[0] = 1;
            }
            if (navigator.plugins["Shockwave Flash 2.0"]) {
                f[0] = 2;
                f[0] = 2;
            }
        } else if (navigator.mimeTypes && navigator.mimeTypes.length) {
            x = navigator.mimeTypes['application/x-shockwave-flash'];
            if (x && x.enabledPlugin) {
                f[0] = 2;
            } else {
                f[0] = 1;
            }
        }

   return f[0];

  } else if (brwEng=="msie") {
      // IE flash detection.
       for(var i=15; i>0; i--) {
           try {
               var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
               f[1] = i;
               break;
               //return;
           } catch(e) { }
       }

       if (f[1]>0) {
           f[0]=2
       } else {
           f[0]=1
       }
   return f[0];
   } else {
       f[0]=0;
       f[1]=0;
       return f[0];
   }
}

// end detectFalsh
