function CheckAll() {
count = document.frm1.elements.length;
    for (i=0; i < count; i++) {
    if(document.frm1.elements[i].checked == 1){
	document.frm2.elements[i].checked = 1;
	document.frm3.elements[i].checked = 1;
	document.frm4.elements[i].checked = 1;
	document.frm5.elements[i].checked = 1;
	document.frm6.elements[i].checked = 1;
	document.frm7.elements[i].checked = 1;
	document.frm8.elements[i].checked = 1;
	}
    else {
	document.frm2.elements[i].checked = 0;
	document.frm3.elements[i].checked = 0;
	document.frm4.elements[i].checked = 0;
	document.frm5.elements[i].checked = 0;
	document.frm6.elements[i].checked = 0;
	document.frm7.elements[i].checked = 0;
	document.frm8.elements[i].checked = 0;
	}
	}
}

intImage = 2;
function swapImage() {
switch (intImage) {
 case 1:
   IMG0.src = "images_shared/_spotmap.gif"
   intImage = 2
   return(false);
 case 2:
   IMG0.src = "images_shared/_spotmap_fl.gif"
   intImage = 1
   return(false);
 }
}

function ProductPageChanger1() {
	var url = document.forms['drop2ListDET'].elements['Products'].value;
    document.location= url;
}

function ProductPageChanger2() {
	var url = document.forms['drop2ListSUM'].elements['Products'].value;
    document.location= url;
}

function expTable(type){
	var expPp = document.getElementById('expPrepack1');
	var exp1 = document.getElementById('exp1');
	if (type == "prepack1"){
		expPp.style.display = "block";
		exp1.style.background = "#ddd";
	}
}

function switchTable(type){
	var tblQu = document.getElementById('tblQuestion');
	var tblSt = document.getElementById('tblStandard');
	var tab1 = document.getElementById('tab1');
	var tab2 = document.getElementById('tab2');
	if (type == "question"){
		tblSt.style.display = "none";
		tblQu.style.display = "block";
		tab1.style.background = "#fff";
		tab2.style.background = "#ddd";
	}
	if (type == "standard"){
		tblSt.style.display = "block";
		tblQu.style.display = "none";
		tab1.style.background = "#ddd";
		tab2.style.background = "#fff";
	}
}

function switchTabler(type){
	var tblQu = document.getElementById('tblQuestion');
	var tblSt = document.getElementById('tblStandard');
	var tblOv = document.getElementById('tblOverall');
	var rad1 = document.getElementById('rad1');
	var rad2 = document.getElementById('rad2');
	var rad3 = document.getElementById('rad3');
	if (type == "question"){
		tblSt.style.display = "none";
		tblOv.style.display = "none";
		tblQu.style.display = "block";
		rad1.style.background = "#fff";
		rad2.style.background = "#ddd";
		rad3.style.background = "#fff";
	}
	if (type == "overall"){
		tblSt.style.display = "none";
		tblOv.style.display = "block";
		tblQu.style.display = "none";
		rad1.style.background = "#ddd";
		rad2.style.background = "#fff";
		rad3.style.background = "#fff";
	}
	if (type == "standard"){
		tblSt.style.display = "block";
		tblOv.style.display = "none";
		tblQu.style.display = "none";
		rad1.style.background = "#fff";
		rad2.style.background = "#fff";
		rad3.style.background = "#ddd";
	}
}

function switchTables(type){
	var tblQu = document.getElementById('tblQuestion');
	var tblSt = document.getElementById('tblStandard');
	var rad1 = document.getElementById('rad1');
	var rad2 = document.getElementById('rad2');
	if (type == "question"){
		tblSt.style.display = "none";
		tblQu.style.display = "block";
		rad1.style.background = "#ddd";
		rad2.style.background = "#fff";
	}
	if (type == "standard"){
		tblSt.style.display = "block";
		tblQu.style.display = "none";
		rad1.style.background = "#fff";
		rad2.style.background = "#ddd";
	}
}

function expand(thistag) {
   styleObj=document.getElementById(thistag).style;
   if (styleObj.display=='none') {
   		styleObj.display='';
	}
   else {
   		styleObj.display='none';
	}
}

function switchDropdown(type){
	var det = document.getElementById('dropdownDET');
	var sum = document.getElementById('dropdownSUM');
	if (type == "detail"){
		det.style.display = "block";
		sum.style.display = "none";
	}
	if (type == "summary"){
		det.style.display = "none";
		sum.style.display = "block";
	}
}

var largerView = "";
var winToggle = false;

function openFullSize(Pix,isDesc){

if (winToggle){largerView.close()}
document.getElementById('nullIMG').src = Pix;
var wStr = document.getElementById('nullIMG').width;
var offsetW = wStr;
wStr = wStr+20;
wStr = "width="+wStr;
var hStr = document.getElementById('nullIMG').height;
var offsetH = hStr;
hStr = hStr+20;
hStr = "height="+hStr;
var lStr = (screen.width-50-offsetW)/2;
lStr = "left="+lStr;
var tStr = (screen.availHeight-50-offsetH)/2;
tStr = "top="+tStr;
largerView = window.open(Pix,"FullSize","toolbar=0,status=0,"+tStr+","+lStr+","+wStr+","+hStr+"");
winToggle = true;
}

function buildSupport(){

var styleStr = "<style>.thumb{cursor:pointer;border:solid gray 1px}</style>"
var divStr = "<Div style='Position:Absolute;Top:-2000'><IMG ID='nullIMG'>&nbsp</Div>"
document.write(divStr);
document.write(styleStr);
}


window.onunload=function(){

if (winToggle && !largerView.closed){largerView.close()}
}

var gAutoPrint = false; // Tells whether to automatically call the print function
	function printSpecial() {
		if (document.getElementById != null) {
			var html = '<HTML>\n<HEAD>\n';
		if (document.getElementsByTagName != null) {
			var headTags = document.getElementsByTagName("head");
		if (headTags.length > 0)
			html += headTags[0].innerHTML;
}

html += '\n</HEAD>\n<BODY class="Print"><br /><span style="position:relative; left:560px;"><a href="javascript:print()">Print</a> | <a href="javascript:close()">Close</a></span><br /><br /><h3>Economics: Concepts and Choices</h3><br /><br />\n';

var printReadyElem = document.getElementById("printReady");

if (printReadyElem != null)
{
html += printReadyElem.innerHTML;
}
else
{
alert("Could not find the printReady function");
return;
}

html += '\n</BODY>\n</HTML>';

var printWin = window.open("","printSpecial","toolbar=0,status=0,scrollbars=1,resizable=1,left=100,top=100,width=700,height=600");
printWin.document.open();
printWin.document.write(html);
printWin.document.close();
if (gAutoPrint)
printWin.print();
}
else
{
alert("The print ready feature is only available if you are using an browser. Please update your browswer.");
}
}

var newWindow;
	function popA(url,info) {
		if (newWindow) {
			if (newWindow.closed == false) {
				newWindow.focus();
			}
		}
		newWindow = window.open(url,info,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=100,top=100,width=800,height=600');
	}
	
	function popB(url,info) {
		if (newWindow) {
			if (newWindow.closed == false) {
				newWindow.focus();
			}
		}
		newWindow = window.open(url,info,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,left=100,top=100,width=836,height=636');
	}
	
	function popC(url,info) {
		if (newWindow) {
			if (newWindow.closed == false) {
				newWindow.focus();
			}
		}
		newWindow = window.open(url,info,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,left=100,top=100,width=890,height=670');
	}
	
	function popD(url,info) {
		if (newWindow) {
			if (newWindow.closed == false) {
				newWindow.focus();
			}
		}
		newWindow = window.open(url,info,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=100,top=100,width=548,height=504');
	}
	
	function popBioA(url,info) {
		if (newWindow) {
			if (newWindow.closed == false) {
				newWindow.focus();
			}
		}
		newWindow = window.open(url,info,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=100,top=100,width=868,height=634');
	}
	
	function popBioB(url,info) {
		if (newWindow) {
			if (newWindow.closed == false) {
				newWindow.focus();
			}
		}
		newWindow = window.open(url,info,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,left=100,top=100,width=960,height=720');
	}
	
	function popMtutorial(url,info) {
		if (newWindow) {
			if (newWindow.closed == false) {
				newWindow.focus();
			}
		}
		newWindow = window.open(url,info,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,left=100,top=100,width=790,height=560');
	}
	
	function popWQ(url,info) {
		if (newWindow) {
			if (newWindow.closed == false) {
				newWindow.focus();
			}
		}
		newWindow = window.open(url,info,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,left=100,top=100,width=740,height=600');
	}
	
	function popActivity(url,info) {
		if (newWindow) {
			if (newWindow.closed == false) {
				newWindow.focus();
			}
		}
		newWindow = window.open(url,info,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,left=100,top=100,width=878,height=660');
	}
	
	function popSG(url,info) {
		if (newWindow) {
			if (newWindow.closed == false) {
				newWindow.focus();
			}
		}
		newWindow = window.open(url,info,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=100,top=100,width=920,height=640');
	}
	
	function popMaps(url,info) {
		if (newWindow) {
			if (newWindow.closed == false) {
				newWindow.focus();
			}
		}
		newWindow = window.open(url,info,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=100,top=100,width=888,height=664');
	}
	
	function popAudio(url,info) {
		if (newWindow) {
			if (newWindow.closed == false) {
				newWindow.focus();
			}
		}
		newWindow = window.open(url,info,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,left=300,top=300,width=260,height=40');
	}
	
	function ClosePopUp() {
		if (newWindow) {
			if (newWindow.closed == false) {
				newWindow.close();
			}
		}
	}

winautos = new Array();

function winauto (url, name, width, height, props, autoClose) {
	var winProps;
	
	// If the props argument isn't specified, make the window resizable and scrollable
	if (props == null)
		winProps = 'resizable=1,scrollbars=1';
	else
		winProps = props;
	
	if (width != null && width != '') {
		// Try not to open a window wider than the screen
		if (window.screen && width > window.screen.availWidth)
			winProps += ',outerWidth=' + window.screen.availWidth;
		else
			winProps += ',width=' + width;
	}
	
	if (height != null && height != '') {
		// Try not to open a window taller than the screen
		if (window.screen && width > window.screen.availHeight)
			winProps += ',outerHeight=' + window.screen.availHeight;
		else
			winProps += ',height=' + height;
	}
	
	if (winProps.charAt(0) == ',')
		winProps = winProps.substring(1);

	var winName;

	if (name == null || name == '')
		winName = '_blank';
	else
		winName = name;
	
	var win = window.open(url, winName, winProps);
	if (win.focus && winName != '_blank') {
		// Bug in AOL 5.0 causes javascript error when
		// window.focus() is called before the page loads.
		if (navigator.appVersion.indexOf('AOL') < 0) {
			win.focus();
		}
	}
	
	if (autoClose == true) {
		var addedToList = false;
		for (var i=0; i<winautos.length; i++) {
			if (winautos[i].closed) {
				winautos[i] = win;
			}
		}
		
		if (!addedToList) {
			winautos[winautos.length++] = win;
		}
	}
}


function closeWinautos () {
	for (var i=0; i<winautos.length; i++) {
		var win = winautos[i];
		if (!win.closed) {
			win.close();
		}
	}
}


function loadParent (url) {
	if (window.top.opener && !window.top.opener.closed) {
		var win = window.top.opener;
		win.location = url;
		if (win.focus) {
			win.focus();
		}
	} else {
		window.open(url, '_blank', '');	
	}
}


window.onunload = closeWinautos;
