// Flash detection
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if (plugin) 
{
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i)
	{
	  if (isNaN(parseInt(words[i]))) continue;
	  var MM_PluginVersion = words[i]; 
	}
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) 
{
	
	document.write('<scr' + 'ipt language=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</scr' + 'ipt\> \n');
	
}

// Preload menu group background image 
var menuGroupBg = new Image(); 
menuGroupBg.src = '../images/menuItemBgOver.gif'; 
var menuItemBg = new Image(); 
menuItemBg.src = '../images/menuItemBg.gif'; 
var x = new Image();
x.src = '../images/right_achieve_on.gif';
var a = new Image();
a.src = '../images/right_philanthropy_on.gif';
var b = new Image();
b.src = '../images/right_connecting_on.gif';
var c = new Image();
c.src = '../images/right_eitc_on.gif';
var d = new Image();
d.src = '../images/right_fema_on.gif';
var e = new Image();
e.src = '../images/right_va_on.gif';
var f = new Image();
f.src = '../images/right_building_on.gif';
var g = new Image();
g.src = '../images/right_latino_on.gif';
var h = new Image();
h.src = '../images/right_rural_on.gif';
var i = new Image();
i.src = '../images/right_leadership_on.gif';



// Pop up a new window
function popup(url,width,height,scrollbars) 
{
	var popwidth = width;
	var popheight = height;
	var leftoffset = (screen.width - popwidth - 10)/2;
	var topoffset = (screen.height - popheight - 40)/2;
	window.open(url,'_blank','titlebar=no,resizable=no,scrollbars=' + scrollbars + ',width=' + popwidth + ',height=' + popheight + ',left=' + leftoffset + ',top=' + topoffset);
}

//Gets the relative path of from the URL and writes ../ as many times needed based on directory depth
var baseSlashes = 5; //this may be different depending upon directory structure 
var slashes = window.location.href.split('/');

//alert(getRelativePath()); //testing only

function getRelativePath()
{
	var path = '';

	for (var i = 0; i < slashes.length - baseSlashes; i++)
	{
		path += '../';
	}

	return path;
}

//right navigation
var achieve_on = new Image();
var achieve_off = new Image();
var cpreas_on = new Image();
var cpreas_off = new Image();
var connecting_on = new Image();
var connecting_off = new Image();
var eitc_on = new Image();
var eitc_off = new Image();
var fema_on = new Image();
var fema_off = new Image();
var va_on = new Image();
var va_off = new Image();
var building_on = new Image();
var building_off = new Image();
var latino_on = new Image();
var latino_off = new Image();
var rural_on = new Image();
var rural_off = new Image();
var leadership_on = new Image();
var leadership_off = new Image();

var root = getRelativePath()

achieve_on.src = root + "images/right_achieve_on.gif";
achieve_off.src = root + "images/right_achieve_off.gif";
cpreas_on.src = root + "images/right_cpreas_on.gif";
cpreas_off.src = root + "images/right_cpreas_off.gif";
connecting_on.src = root + "images/right_connecting_on.gif";
connecting_off.src = root + "images/right_connecting_off.gif";
eitc_on.src = root + "images/right_eitc_on.gif";
eitc_off.src = root + "images/right_eitc_off.gif";
fema_on.src = root + "images/right_fema_on.gif";
fema_off.src = root + "images/right_fema_off.gif";
va_on.src = root + "images/right_va_on.gif";
va_off.src = root + "images/right_va_off.gif";
building_on.src = root + "images/right_building_on.gif";
building_off.src = root + "images/right_building_off.gif";
latino_on.src = root + "images/right_latino_on.gif";
latino_off.src = root + "images/right_latino_off.gif";
rural_on.src = root + "images/right_rural_on.gif";
rural_off.src = root + "images/right_rural_off.gif";
leadership_on.src = root + "images/right_leadership_on.gif";
leadership_off.src = root + "images/right_leadership_off.gif";

function over(type){
	var str = type + "_on";
	document[type].src = window[str].src;
}

function out(type){
	var str = type + "_off";
	document[type].src = window[str].src;
}

//Itenerary Hovering div
var info = null;
function showInfo(which,e)
{
	info = document.getElementById('info');
	if( info && info.style.visibility == 'hidden' ){
		info.style.left       = e.pageX ? pageXOffset + e.clientX + 20 : document.body.scrollLeft + e.x + 20;
     	info.style.top        = e.pageY ? pageYOffset + e.clientY : document.body.scrollTop  + e.y;
		info.style.visibility = 'visible';
		info.innerHTML        = which;
	}
}
function closeInfo()
{
	if( info ) info.style.visibility = 'hidden';
}

