

//pop-up window 
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



// Defines rollover images for prefetch
if (document.images)
{
	var Home0 = new Image();
	Home0.src = "/dotnetnuke/Portals/0/imgNavHomeOff.gif";
	var Home1 = new Image();
	Home1.src = "/dotnetnuke/Portals/0/imgNavHomeOn.gif";
	
	var WhatisHumanDevelopment0 = new Image();
	WhatisHumanDevelopment0.src = "/dotnetnuke/Portals/0/imgNavWhatOff.gif";
	var WhatisHumanDevelopment1 = new Image();
	WhatisHumanDevelopment1.src = "/dotnetnuke/Portals/0/imgNavWhatOn.gif";
	
	var HDFPrograms0 = new Image();
	HDFPrograms0.src = "/dotnetnuke/Portals/0/imgNavHDFProgramsOff.gif";
	var HDFPrograms1 = new Image();
	HDFPrograms1.src = "/dotnetnuke/Portals/0/imgNavHDFProgramsOn.gif";
	
	var HowYouCanHelp0 = new Image();
	HowYouCanHelp0.src = "/dotnetnuke/Portals/0/imgNavHelpOff.gif";
	var HowYouCanHelp1 = new Image();
	HowYouCanHelp1.src = "/dotnetnuke/Portals/0/imgNavHelpOn.gif";
	
	var AboutHDF0 = new Image();
	AboutHDF0.src = "/dotnetnuke/Portals/0/imgNavAboutHDFOff.gif";
	var AboutHDF1 = new Image();
	AboutHDF1.src = "/dotnetnuke/Portals/0/imgNavAboutHDFOn.gif";	
	
	var offoff = new Image();
	offoff.src = "/dotnetnuke/Portals/0/imgNavCornerOffOff.gif";
	
	var onoff = new Image();
	onoff.src = "/dotnetnuke/Portals/0/imgNavCornerOnOff.gif";
	
	var offon = new Image();
	offon.src = "/dotnetnuke/Portals/0/imgNavCornerOffOn.gif";
	
	var onon = new Image();
	onon.src = "/dotnetnuke/Portals/0/imgNavCornerOnOn.gif";
}

// Defines sections for rollovers and dropdowns
//var arrSections = new Array("home","what","programs","help","about")
var arrSections = new Array("Home","WhatisHumanDevelopment","HDFPrograms","HowYouCanHelp","AboutHDF")

// Simple rollover function
function rollOut(imgName) 
{
    if (document.images) 
    {
        document[imgName].src = eval(imgName+"0.src");
    }
}

// Simple rollout function
function rollIn(imgName)
{
    if (document.images)
    {
        document[imgName].src = eval(imgName+"1.src");
    }
}


// Gets page element by name
function returnElement(sContent)
{
	var objLocation;
	var sElement;
	
	if(document.getElementById)
	{
		sElement = "document.getElementById('" + sContent + "')";
	}
	else if(document.all)
	{
		sElement = "document.all['" + sContent + "']";
	}
	
	objLocation = eval(sElement);
	return objLocation;
}



// Hides form elements to prevent from showing through
function prepareForm(sVisibilityToggle) 
{
	/*for(var i=0; i < document.forms.length; i++)
	{
		for(var j=0; j < document.forms[i].elements.length; j++) 
		{
			if (document.forms[i].elements[j].type.indexOf("select") != -1)
			{
				document.forms[i].elements[j].style.visibility = sVisibilityToggle;
			}
		}
	}*/
}

// This function changes the overlapping corners
// sSubnav is the menu to be diplayed
// sCurrentSection is the default highlighted section
// sType is either display or hide
function changeCorners(sSubnav, sCurrentSection, sType)
{
	var nBefore = 0;
	var nAfter = 0;
	
	// Loop through the sections array and identify
	// the position of the corners of both the default highlight and the one to be changed
	for (var i in arrSections)
	{
		if (arrSections[i] == sSubnav)
		{
			nChangeBefore = parseInt(i);
			nChangeAfter = parseInt(i)+1;
		}
		
		if (arrSections[i] == sCurrentSection)
		{
			nDefaultBefore = parseInt(i);
			nDefaultAfter = parseInt(i)+1;
		}
	}
		
	// Determine if the corners match
	// If so, change the image
	var bBeforeCurrentlyOn = false;
	var bAfterCurrentlyOn = false;
	if (nChangeBefore == nDefaultAfter)
	{
		bBeforeCurrentlyOn = true;
	}
	
	if (nChangeAfter == nDefaultBefore)
	{
		bAfterCurrentlyOn = true;
	}
	
	// Show different images depending on mode
	if (sType == "display")
	{
		var sBeforeImage = offon.src;
		var sAfterImage = onoff.src;
		if (bBeforeCurrentlyOn)
		{
			sBeforeImage = onon.src;
		}
		
		if (bAfterCurrentlyOn)
		{
			sAfterImage = onon.src;
		}
	}
	else
	{
		var sBeforeImage = offoff.src;
		var sAfterImage = offoff.src;
		if (bBeforeCurrentlyOn)
		{
			sBeforeImage = onoff.src;
		}
		
		if (bAfterCurrentlyOn)
		{
			sAfterImage = offon.src;
		}
	}	

	if (nChangeBefore > 0 && nChangeBefore < arrSections.length)
	{
		var objBeforeImage = "sep"+nChangeBefore;
		document[objBeforeImage].src = sBeforeImage;
	}
	
	if (nChangeAfter > 0 && nChangeAfter < arrSections.length)
	{
		var objAfterImage = "sep"+nChangeAfter;
		document[objAfterImage].src = sAfterImage;
	}
}

// Displays the submenu 
// sSubnav is the menu to be diplayed
// sCurrentSection is the default highlighted section
function displaySubnav(sSubnav, sCurrentSection)
{
	changeCorners(sSubnav, sCurrentSection, 'display');
	
	rollIn(sSubnav);
	
	var sSubnavName = sSubnav + "Menu";
	var objLocation = returnElement(sSubnavName);	
	if (objLocation)
	{
		objLocation.style.visibility = 'visible';
	}
	
	prepareForm('hidden');
}



// Hides the submenu
// sSubnav is the menu to be hidden
function hideSubnav(sSubnav, bRemoveHighlight, sCurrentSection)
{
	
	if (bRemoveHighlight)
	{
		changeCorners(sSubnav, sCurrentSection, 'hide');
		
		rollOut(sSubnav);
	}
	
	var sNav = returnElement(sSubnav+"Menu");
	if (sNav)
	{
		sNav.style.visibility = 'hidden';
	}
	
	prepareForm('visible');
	
}

function displaySubnav1(sSubnav, sCurrentSection)
{
//	changeCorners(sSubnav, sCurrentSection, 'display');
	alert("display" + sCurrentSection);
//	rollIn(sSubnav);
	
	var sSubnavName = sSubnav + "Menu";
	var objLocation = returnElement(sSubnavName);	
	if (objLocation)
	{
		objLocation.style.visibility = 'visible';
	}
	
	prepareForm('hidden');
}


function hideSubnav1(sSubnav, bRemoveHighlight, sCurrentSection)
{
	alert("Hide" + sCurrentSection);
	if (bRemoveHighlight)
	{
		changeCorners(sSubnav, sCurrentSection, 'hide');
		
		rollOut(sSubnav);
	}
	
	var sNav = returnElement(sSubnav+"Menu");
	if (sNav)
	{
		sNav.style.visibility = 'hidden';
	}
	
	prepareForm('visible');
	
}








// arrSubNav defines the urls and names for the dropdown menus
var arrSubnav = new Array();

arrSubnav[0] = new Array("WhatisHumanDevelopment",
-381, // pixels from left
216 	// width of menu


                        ,"Introduction"
                        ,"/dotnetnuke/default.aspx?tabid=61" 

                        ,"HD Concept"
                        ,"/dotnetnuke/default.aspx?tabid=62" 

                        ,"Definitions"
                        ,"/dotnetnuke/default.aspx?tabid=63" 

                        ,"HD in Pakistan"
                        ,"/dotnetnuke/default.aspx?tabid=64" 

                        ,"HD in South Asia"
                        ,"/dotnetnuke/default.aspx?tabid=65" 

                        ,"HD in OIC Countries"
                        ,"/dotnetnuke/default.aspx?tabid=66" 


);

arrSubnav[1] = new Array("HDFPrograms",
-381, // pixels from left
216 	// width of menu

                        ,"Introduction"
                        ,"/dotnetnuke/default.aspx?tabid=67" 

                        ,"Success Stories"
                        ,"/dotnetnuke/default.aspx?tabid=149" 

                        ,"Development Organization"
                        ,"/dotnetnuke/default.aspx?tabid=68" 

                        ,"Health"
                        ,"/dotnetnuke/default.aspx?tabid=69" 

                        ,"Education"
                        ,"/dotnetnuke/default.aspx?tabid=70" 

                        ,"Micro Enterprises"
                        ,"/dotnetnuke/default.aspx?tabid=71" 

);

arrSubnav[2] = new Array("HowYouCanHelp",
-381, // pixels from left
216 	// width of menu


                        ,"Introduction"
                        ,"/dotnetnuke/default.aspx?tabid=72" 

                        ,"Volunteer"
                        ,"/dotnetnuke/default.aspx?tabid=54" 

                        ,"Donate"
                        ,"/dotnetnuke/default.aspx?tabid=73" 

);

arrSubnav[3] = new Array("AboutHDF",
-381, // pixels from left
133 	// width of menu


                        ,"Introduction"
                        ,"/dotnetnuke/default.aspx?tabid=74" 

                        ,"History"
                        ,"/dotnetnuke/default.aspx?tabid=75" 

                        ,"Organization"
                        ,"/dotnetnuke/default.aspx?tabid=76" 


);

// Initializes the dropdown menus
function loadSubnav(sHexBGColor, sHexOverColor, sHexFontColor, sHexFontOverColor, sHexLineColor, sThisSection)
{
	//alert(sThisSection);
	if((document.all) || (document.getElementById))
	{
		var this_arrSubnav = new Array();
		this_arrSubnav = arrSubnav;
		var sSubnav = "";
		
		for (j = 0; j < this_arrSubnav.length; j++)
		{			
			var sCurrent = this_arrSubnav[j][0];
			var arrCurrent = this_arrSubnav[j];
			var bInArray = false;
			
			for (var k = 0; k < arrCurrent.length; k++)
			{
				if (sThisSection == arrCurrent[k])
				{
					bInArray = true;
				}			
			}
			
			if (bInArray)
			{
				sSubnav += "<div id=\"" + sCurrent + "Menu\" style=\"z-index:999;position: absolute; left:50%; margin-left: " + this_arrSubnav[j][1] + "; width: 760;  visibility: hidden\" onmouseover=\"displaySubnav('" + sCurrent + "','" + sThisSection + "');\" onmouseout=\"hideSubnav('" + sCurrent + "', false);\">";
			}
			else
			{
				sSubnav += "<div id=\""  + sCurrent + "Menu\" style=\"z-index:999;position: absolute; left:50%; margin-left: " + this_arrSubnav[j][1] + "; width: 760;  visibility: hidden\" onmouseover=\"displaySubnav('" + sCurrent + "','" + sThisSection + "' );\" onmouseout=\"hideSubnav('" + sCurrent + "', true);\">";
			}
			
			sSubnav += "<ul >";	
			
			for (i=3; i < this_arrSubnav[j].length-1; i=i+2)
			{
				sSubnav += " <li ><a style=\"width: " + ((this_arrSubnav[j][i].length * 6) +10) + "px;\"  href='" + this_arrSubnav[j][i+1] + "' >" + this_arrSubnav[j][i] + "</a></li>";
			}
			
			sSubnav += "</ul>";
			sSubnav += "</div>";
		}
		//alert(sSubnav);
		document.write(sSubnav);
	}
}