 /**
 *	Author : PERRAUDIN Steven <steven.perraudin@gmail.com>
 *	Author URI : http://unseen07.info
 *	FileName : comboBox.js
 *	Description : Drops down or up, the news, to gain space.
 *		The MySQL query is sent to dd.php, in the archives module file
 */

function comboBox(id, data, divname){

	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			new Effect.BlindDown(divname);
			var ajaxDisplay = document.getElementById(divname);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	

	var queryString = "?info=" + id +"&data=" + data;
	// Sending request to server with GET
	ajaxRequest.open("POST", "../modules/Search/auto.php" + queryString, true);
	ajaxRequest.send(null); 
}


function getInfoRoom(id){
	divid = "room_" + id;
	
	if(document.getElementById(divid).style.display == "none"){
		var ajaxRequest;  // The variable that makes Ajax possible!
		
		try{
			// Opera 8.0+, Firefox, Safari
			ajaxRequest = new XMLHttpRequest();
		} catch (e){
			// Internet Explorer Browsers
			try{
				ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try{
					ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e){
					// Something went wrong
					alert("Your browser broke!");
					return false;
				}
			}
		}
		// Create a function that will receive data sent from the server
		ajaxRequest.onreadystatechange = function(){
			if(ajaxRequest.readyState == 4){
				new Effect.BlindDown(divid);
				var ajaxDisplay = document.getElementById(divid);
				ajaxDisplay.innerHTML = ajaxRequest.responseText;
			}
		}
		

		var queryString = "?building=" + id;
		// Sending request to server with GET
		ajaxRequest.open("POST", "../modules/Search/auto.php" + queryString, true);
		ajaxRequest.send(null); 
	}
	else{
		new Effect.BlindUp(divid,{duration:0.3});
	}
}


function showConfInfo(id){
	alert(id);
}




