function getDimensions() {
var theheight = document.getElementById("pgbody").clientHeight;
var theleft = (document.getElementById("pgbody").clientWidth / 2) - 20 - (780 / 2);
document.getElementById("pagecontainer").style.height = theheight;
document.getElementById("popup").style.height = theheight - 50;
document.getElementById("popup").style.left = theleft + "px";
document.getElementById("closeoverlay").style.height = theheight - 2;
document.getElementById("closeoverlay").style.width = document.getElementById("pgbody").clientWidth - 2;

}



function popUp(theitem,offset) {
var theid = document.getElementById("pagecontainer");
var popid = document.getElementById("popup");
displayItem("closeoverlay");
theid.className = "effect-opaque";
document.getElementById("iframecontainer").innerHTML = '<iframe src="' + theitem + '" frameborder="0" style="width:100%; height:500px;"></iframe>';
document.getElementById("popup").style.paddingTop = offset + "px";
displayItem("popup");
}

function closePopConfirm() {
if(confirm('Would you like to close the overlay window?'))
closePop();
}

function closePop() {
var theid = document.getElementById("pagecontainer");
var popid = document.getElementById("popup");
theid.className = "";
popid.style.display = "none";
document.getElementById("iframecontainer").innerHTML = "";
hideItem("closeoverlay");
}

function popUpRC(theitem,headingText,offset) {
var theid = document.getElementById("pagecontainer");
var popid = document.getElementById("popup");
var popHeading = document.getElementById("overlay-heading");
popHeading.innerHTML = headingText;
displayItem("closeoverlay");
theid.className = "effect-opaque";
document.getElementById("iframecontainer").innerHTML = '<iframe src="' + theitem + '" frameborder="0" style="width:100%; height:500px;"></iframe>';
document.getElementById("popup").style.paddingTop = offset + "px";
displayItem("popup");
}

function performRSearch(pageName,popupHeading) {
document.getElementById("overlay-heading").innerHTML = "Search Resource Center";
popUpRC(pageName,popupHeading,50);
}

function privacyPolicy() {
document.getElementById("overlay-heading").innerHTML = "National Instruments Privacy Policy";
popUp("privacy.htm",50);
}

function otherResources() {
document.getElementById("overlay-heading").innerHTML = "All National Instruments Resources";
popUp("csearch.htm",50);
}

/* */
function updateFieldText(theitem,thetext) {
var theid = document.getElementById(theitem);
theid.innerHTML = thetext;
}


function manageDisplayToggle(theon) {
changeClass('magazine','');
changeClass('resourcecenter');
if (theon == 'all') {
displayItem('magazine-content');
displayItem('resourcecenter-content');
} else {
hideItem('magazine-content');
hideItem('resourcecenter-content');
displayItem(theon + '-content');
}
updateRDisplay();
changeClass(theon,'tabon');
}

function viewResource() {
alert("Would information form for resource.");
}




function updateRPage(thenum) {
if (thenum == 1) {
document.browsePage = document.browsePage + 1;
} else {
document.browsePage = document.browsePage -1;
}
updateRDisplay();
}

function updateRDisplay() 
{
	var displayCount = 0;
	var viewMax = 0;
	var beginDisplay = (document.pageResults * document.browsePage) - document.pageResults + 1;
	var endDisplay = beginDisplay + document.pageResults - 1;
	for (i = 1; i < document.resTotal; i++) 
	{
		var rtype = document.rType[i];
		if (document.getElementById("type-" + rtype).className == "rctr-r-on") 
		{
			displayCount++;
			if (displayCount >= beginDisplay && displayCount <= endDisplay) 
			{
				displayItem("rc" + i);
			} else  {
				hideItem("rc" + i);
			}
		} else {
			hideItem("rc" + i);
		}
	}
	if (displayCount < 1) {beginDisplay = 0;} 
	if (beginDisplay < document.pageResults) 
	{
		hideItem("backArrow");
		hideItem("backArrow2");
	} else {
		displayItem("backArrow");
		displayItem("backArrow2");
	}
	if (displayCount <= endDisplay) 
	{
		endDisplay = displayCount;
		hideItem("nextArrow");
		hideItem("nextArrow2");
	} else {
		displayItem("nextArrow");
		displayItem("nextArrow2");
	}
	viewMax = displayCount; 
	updateFieldText("viewing-start",beginDisplay);
	updateFieldText("viewing-end",endDisplay);
	updateFieldText("viewing-max",viewMax);
}



function manageRType(theon,theact) {
if (theon == "") {
for (i = 0; i < document.rTypeItems.length; i++) {
if (theact) {
changeClass("type-" + document.rTypeItems[i],"rctr-r-on");
} else {
changeClass("type-" + document.rTypeItems[i],"");
}
}
} else {
if (theact) {
changeClass("type-" + theon,"rctr-r-on");
} else {
changeClass("type-" + theon,"");
}
}
document.browsePage = 1;
updateRDisplay();
}

function manageROnlyType(theon) {
manageRType("",0);
manageRType(theon,1);
}


function technology(techAreaCd,techLbl)
{
	this.techCd=techAreaCd;
	this.techDescr=techLbl;
}
function pair(pairKey,pairValue)
{
	this.key=pairKey;
	this.value=pairValue;
}
function clearOptions(OptionList) 
{
   for (x = OptionList.length; x >= 0; x--) 
   {
	  OptionList[x] = null;
   }
}
function addToOptionList(OptionList, OptionValue, OptionText) 
{
   OptionList[OptionList.length] = new Option(OptionText, OptionValue);
}






