﻿var onloadfunctions = new Array();

window.onload = function() {
    onloadfunctions.push(initRollovers());
}

var browser = navigator.appName;
var IE = "Microsoft Internet Explorer";
var vendor = navigator.vendor;
var safari = "Apple Computer, Inc.";
var imagePath = "images/";
var classAttribute = classAttr();   //Get the appropriate class attribute to set. IE and Firefox use different attributes for class in the DOM.

/**** Begin image rollover funtion ****/
/* Function to initalize rollover */
function initRollovers(){	
	var rollovers = getElementsByClass("rollover",null,null);	//Get elements with a class of "rollover"
	
	if (rollovers.length > 0){		//If there is at least one element with a class "rollover"
		for(var i=0;i<rollovers.length;i++){	//Loop through all elements with class "rollover"
			addEvent(rollovers[i],"mouseover",rollover);	//Attach mouseover event
			addEvent(rollovers[i],"mouseout",rollover);	//Attach mouseout event
		}		
	}
}

// This can be used for rollovers that are NOT transparent PNGs. In IE, transparent PNGs are replaced in the DOM with clearpixel.gif, so grabbing the src attribute
// in IE will only return clearpixel.gif, not the actual image src that we want to swap with its on/off state.
// This function grabs the src attribute and replaces "off" with "on" (for mouseover) or "on" with "off (for mouseout) in the attribute string. KM
function rollover(event) {
	var etype = event.type;
	var imgSrc = getImgSrc(this);
	var newImgSrc;
	
	if (etype == "mouseover"){
	    newImgSrc = imgSrc.replace("off.","on.","gi");
		this.setAttribute("src",newImgSrc);
	}
	
	else if (etype == "mouseout") {
	    newImgSrc = imgSrc.replace("on.","off.","gi");
		this.setAttribute("src",newImgSrc);
	}
}

function rolloverInline(imgId,type) {
	var imgObj = $(imgId);
	var imgSrc = getImgSrc(imgObj);
	var newImgSrc;	

	if (type == 'over'){
	    newImgSrc = imgSrc.replace('off.','on.','gi');
		imgObj.setAttribute('src',newImgSrc);
	}

	

	else if (type == 'out') {
	    newImgSrc = imgSrc.replace('on.','off.','gi');
		imgObj.setAttribute('src',newImgSrc);
	}
}
/***** End image rollover funtion *****/

/**** Begin popup div funtion ****/
function divPop(id,mevent){
    if (id == "ava-papers"){
        var el1 = "ava-papers";
        var el2 = "ava-pov"
    }
    
    else {
        var el1 = "ava-pov";
        var el2 = "ava-papers"    
    }
    
    if (mevent == "out"){
        $(id).style.display = "none";
    }
    else {
        $(el1).style.display = "block";
        $(el2).style.display = "none";
    }
}
/**** Begin popup div funtion ****/

