			var g_bUpdating = false;
			
			function loadXMLDoc(dname) 
        {
        var xmlDoc;
        if (window.XMLHttpRequest)
          {
          xmlDoc=new window.XMLHttpRequest();
          xmlDoc.open("GET",dname,false);
          xmlDoc.send("");
          return xmlDoc.responseXML;
          }
        // IE 5 and IE 6
        else if (ActiveXObject("Microsoft.XMLDOM"))
          {
          xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
          xmlDoc.async=false;
          xmlDoc.load(dname);
          return xmlDoc;
          }
        alert("Error loading document");
        return null;
        } 
			
        function setBoothColor(booth, sColor) {
				 	 document.getElementById(booth).style.backgroundColor = sColor;								
        }
			
			function setViewColors(iView) {
					
					x=xmlDoc.getElementsByTagName("Booth");				         							
					
					for (i=0;i<x.length;i++) { 	
							y = xmlDoc.getElementsByTagName("ID");
							sID = y[i].childNodes[0].nodeValue;

							if (iView == 2) {
                    y = xmlDoc.getElementsByTagName("ExhID");										
									if (y[i].childNodes[0].nodeValue == document.getElementById("exh").value)
										 setBoothColor(sID, "#66ff00");									
							}
							else if (iView == 3) {									 
  								  y = xmlDoc.getElementsByTagName("CatID1");																						
                    if (y[i].childNodes[0].nodeValue == document.getElementById("cat1").value)														 					 	
										 			setBoothColor(sID, "#9999ff");
										else {
												y = xmlDoc.getElementsByTagName("CatID2");													 													
                  			if (y[i].childNodes[0].nodeValue == document.getElementById("cat1").value)														 					 	
  						 					 		setBoothColor(sID, "#9999ff");
  										 	else {
  										 			y = xmlDoc.getElementsByTagName("CatID3");		  							 													
                  	 			 	if (y[i].childNodes[0].nodeValue == document.getElementById("cat1").value)														 					 	
  						 				 				 setBoothColor(sID, "#9999ff");  													
  										 	}												  														 
										}																			
							}
							else if (iView == 4) {
									y = xmlDoc.getElementsByTagName("CatID1");																						
                  if (y[i].childNodes[0].nodeValue == document.getElementById("cat2").value)														 					 	
									 		setBoothColor(sID, "#ff99cc");
									else {
										y = xmlDoc.getElementsByTagName("CatID2");													 													
                			if (y[i].childNodes[0].nodeValue == document.getElementById("cat2").value)														 					 	
						 					 		setBoothColor(sID, "#ff99cc");
										 	else {
										 			y = xmlDoc.getElementsByTagName("CatID3");		  							 													
                	 			 	if (y[i].childNodes[0].nodeValue == document.getElementById("cat2").value)														 					 	
						 				 				 setBoothColor(sID, "#ff99cc");  													
										 	}												  														 
									}												
							}
							else if (iView == 5) {
									 y = xmlDoc.getElementsByTagName("CatID1");																						
                    if (y[i].childNodes[0].nodeValue == document.getElementById("cat1").value)														 					 	
										 			setBoothColor(sID, "#9999ff");
										else {
												y = xmlDoc.getElementsByTagName("CatID2");													 													
                  			if (y[i].childNodes[0].nodeValue == document.getElementById("cat1").value)														 					 	
  						 					 		setBoothColor(sID, "#9999ff");
  										 	else {
  										 			y = xmlDoc.getElementsByTagName("CatID3");		  							 													
                  	 			 	if (y[i].childNodes[0].nodeValue == document.getElementById("cat1").value)														 					 	
  						 				 				 setBoothColor(sID, "#9999ff");  													
  										 	}												  														 
										}					
															
									y = xmlDoc.getElementsByTagName("CatID1");																						
                  if (y[i].childNodes[0].nodeValue == document.getElementById("cat2").value)														 					 	
									 		setBoothColor(sID, "#ff99cc");
									else {
										y = xmlDoc.getElementsByTagName("CatID2");													 													
                			if (y[i].childNodes[0].nodeValue == document.getElementById("cat2").value)														 					 	
						 					 		setBoothColor(sID, "#ff99cc");
										 	else {
										 			y = xmlDoc.getElementsByTagName("CatID3");		  							 													
                	 			 	if (y[i].childNodes[0].nodeValue == document.getElementById("cat2").value)														 					 	
						 				 				 setBoothColor(sID, "#ff99cc");  													
										 	}												  														 
									}																								
							}
					}
			}
			
        function toggleBooked(bLite) {
           	x=xmlDoc.getElementsByTagName("Booth");							
														
          		//document.write(x.length);
          		for (i=0;i<x.length;i++) { 			
							y = xmlDoc.getElementsByTagName("ID");
							sID = y[i].childNodes[0].nodeValue;
							y = xmlDoc.getElementsByTagName("Booked");								
          			if (y[i].childNodes[0].nodeValue == "0"){
									setBoothColor(sID, "");
								}
								else {
									 if (bLite) 
										 		setBoothColor(sID, "#ffff66"); 
									 else
									 		setBoothColor(sID, "#ffff00");
								}
						}					
        }
			
			function chkBooked(){
			  if (g_bUpdating)
					 return true;
					 
				g_bUpdating = true;
					 if (document.getElementById("exh").value > 0) {
					 		setView(2);
					 }
					 else {
					 		if ((document.getElementById("cat1").value > 0) && (document.getElementById("cat2").value >0)) {
								 setView(5);
							}
							else if (document.getElementById("cat1").value > 0) {
									 setView(3);
							}
							else if (document.getElementById("cat2").value > 0) {
									 setView(4);
							}
							else 
									setView(1); 
					 }
				g_bUpdating = false; 						
			}
			
			function cboCat1()  {
				g_bUpdating = true; 
				if (document.getElementById("cat1").value > 0) {					 
					 if (document.getElementById("exh").value > 0)
					 		  document.getElementById("exh").value = 0;
					 
					 if (document.getElementById("cat2").value > 0)
					 		setView(5);
					 else  //cat1 only
					 		 setView(3);
				}
				else {   //check cat2
					 if (document.getElementById("cat2").value > 0)
					 		setView(4);
					 else
							setView(1);
				}
				g_bUpdating = false; 											 
			}
			
			function cboCat2()  {
				g_bUpdating = true; 
				if (document.getElementById("cat2").value > 0) {
					 if (document.getElementById("exh").value > 0)
					 		document.getElementById("exh").value = 0;
					 
					 if (document.getElementById("cat1").value > 0)
					 		setView(5);
					 else  //cat2 only
					 		 setView(4);
				}
				else {   //check cat2
					 if (document.getElementById("cat1").value > 0)
					 		setView(3);
					 else  //booked
					 		setView(1);		
				}
				g_bUpdating = false; 											 
			}					
			
			function cboExh()  {
				g_bUpdating = true; 
				if (document.getElementById("exh").value > 0) {
					 document.getElementById("cat1").value = 0;
					 document.getElementById("cat2").value = 0;
					 setView(2);
				}
				else {  					 
			 		 setView(1);					
				}
				g_bUpdating = false; 											 
			}
			
			function setView(iView) {					 
				if (iView > 1) {
					 toggleBooked(true);	
					 setViewColors(iView);							 
				}
				else {   // booked only
							toggleBooked(false);																
				}
			}			
			
			function getCat(catid) {
			
				switch (catid) {
  				case "0": return "";
  				case "1": return "Adventure/Teambuilding Programs";
          case "2": return "Amusement Parks";
					case "3": return "Assembly Programs";
          case "4": return "Audio Visual/Audio Visual Equipment Rental";
          case "5": return "Awards/Trophies";
          case "6": return "Beverages";
          case "7": return "Buttons/Badges";
          case "8": return "Camps - Leadership/Spirit";
          case "9": return "Canopies/Tents";
					case "10": return "Cap/Gowns";
          case "11": return "Clothing/Uniforms/Imprinted Sportswear";
          case "12": return "Decorations/Balloons/Confetti/Streamers/Prom Supplies";
          case "13": return "DJs/Sound Systems/Dances";
          case "14": return "Educational Materials";
          case "15": return "Educators Financial Services";
          case "16": return "Event Planning/Entertainment/Reunions";
          case "17": return "Food Service";
          case "18": return "Fundraising";
          case "19": return "Grad Night/Amusements";
          case "20": return "Inflatable/Interactive Games and Rental";
					case "21": return "Leadership Training";
          case "22": return "Murals";
          case "23": return "Photography";
          case "24": return "Planners/Agendas/School Products";
          case "25": return "Scholastic Jewelry/Pins/Cloisonne";
          case "26": return "Screen Printing/Custom T-shirt Design";
          case "27": return "Signs/Sign Making";
          case "28": return "Software";
          case "29": return "Speakers/Presenters";
          case "30": return "Specialty Items";
          case "31": return "Spirit Supplies";
          case "32": return "Sports Equipment/Installation/Scoreboards";
          case "33": return "Travel/Educational Field Trips";
          case "34": return "Yearbooks/Printing";											
					default: return "Not found";
				}
								
			}
