

function OpenCloseByType(thisValue){
//this function returns only the name of the value (ir). 
//that name must be mapped to a number in the array, in order to poll whether it is checked or unchecked.
//then you have to iterate through all regions and open or close the DIVs
	for (i=0; i<typesValueList.length;i++){
		if(thisValue==typesValueList[i]){
		var isChecked = document.calForm.eventType[i].checked
		}
	}

	if(isChecked==true){
	//the user Checked a box, so some DIVs *may* need to be opened (if there are any checked DIVs in the Type list)
	//Iterate through all regions
	for (i=0; i<regionsValueList.length-1;i++){

		//check to see if this region should be opened (by iterating through the region checkboxes and seeing which ones are checked  )
		if(document.calForm.regionType[i].checked){ //If this region should be opened
		
			//concatenate the name of this type w/the name of this region
			var thisTypeRegion = thisValue + regionsValueList[i];
				
			// open this type/region pair based on checking a region
			OpenSuperClam(thisTypeRegion);
			
		}
		//concatenate the name of this type w/"global" so region agnostic items will be shown
		var thisTypeRegion = thisValue + "Global";

		// open this type/"global" pair based on checking a region
		//alert(thisTypeRegion);
		OpenSuperClam(thisTypeRegion);

	}
		}else{
	//the user UNchecked a box, so some DIVs *may* need to be hidden (if there are any checked DIVs in the Region list)
	//Iterate through all Regions, 
	for (i=0; i<regionsValueList.length-1;i++){
		//check to see if this region should be closed
			if(document.calForm.regionType[i].checked){ //If this region is opened
				//alert("a region is opened");
				//concatenate the name of this type w/the name of this region
				var thisTypeRegion = thisValue + regionsValueList[i];

				// close this type/region pair based on unchecking a region
				CloseSuperClam(thisTypeRegion);
			}
		//concatenate the name of this type w/"global" so region agnostic items will be shown
		var thisTypeRegion = thisValue + "Global";

		// close this type/"global" pair based on checking a region
		CloseSuperClam(thisTypeRegion);
		}
	}
}




function OpenCloseByRegion(thisValue){
//this function returns only the name of the value (newyork). 
//that name must be mapped to a number in the array, in order to poll whether it is checked or unchecked.
//then you have to iterate through all types and open or close the DIVs

	for (i=0; i<regionsValueList.length;i++){
		if(thisValue==regionsValueList[i]){
		var isChecked = document.calForm.regionType[i].checked
		}
	}

	if(isChecked==true){
	
	//they checked this item (thisValue), so some DIVs will need to be open.
	//Iterate through all types, and see which ones are checked. Those are the ones to open
	
	for (i=0; i<typesValueList.length;i++){


		//check to see if this Type pair should be opened 
			if(document.calForm.eventType[i].checked){ //If this Type is checked, then it should be opened

				//concatenate the name of this type w/the name of this region
				var thisTypeRegion = typesValueList[i] + thisValue;
				
				// open this type/region pair based on checking a region
				OpenSuperClam(thisTypeRegion)//
			}

		}

	}else{
	//any items that are checked in the types but now unchecked in the regions need to be closed
	//Iterate through all regions, 
	for (i=0; i<typesValueList.length;i++){

		//check to see if this region should be closed
			if(document.calForm.eventType[i].checked){ //If this region is opened
		
				//concatenate the name of this type w/the name of this region
				var thisTypeRegion = typesValueList[i] + thisValue;				
				
				// close this type/region pair based on unchecking a region
				CloseSuperClam(thisTypeRegion)

			}
		}
	}
}




function openClamShellMenu(objectID) {
	if (isAll || isID) {
		if(findDOM(objectID,0)){
			domStyle = findDOM(objectID,1);
			domStyle.display='block';
		}
	}
	return;
}
function closeClamShellMenu(objectID) {
	if (isAll || isID) {
		if(findDOM(objectID,0)){
			domStyle = findDOM(objectID,1);
			domStyle.display='none';
		}
	}
	return;
}
function getDisplay(objectID) {
if (isAll || isID) {
	var domStyle = findDOM(objectID,1);
	return	domStyle.display;
	}
}
function OpenSuperClam(thisSection){
	for (var i=1;i<32;i++) {
		for (var jj=1;jj<7;jj++) {
			var thisDiv = thisSection+parseInt(i)+parseInt(jj);
			
			openClamShellMenu(thisDiv);
		}
	}
}
function CloseSuperClam(thisSection){
	for (var i=1;i<32;i++) {
		for (var jj=1;jj<7;jj++) {
			var thisDiv = thisSection+parseInt(i)+parseInt(jj);
			closeClamShellMenu(thisDiv);
		}
	}
}

