var undefined = undefined;
function Search(inputId, formId){
	this.inputId = inputId;
	this.formId = formId;

	this.displayState = false;
	this.closeDisplay = function(){ // EXIST TO PREVENT A RECURSION ERROR
		this.displayState = false;
		search.style.width = "103px";
		searchControllerClose.style.display = "none";
		searchControllerSearch.style.display = "block";
		searchBar.style.display = "none";
		if(menuCont != undefined) {
			menu.style.display = "block";
		}
	}
	this.toggleDisplay = function(){
		this.displayState = !this.displayState;
		search.style.width = (this.displayState ? (_HD ? "495px" : "386px") : "103px");
		searchControllerClose.style.display = (this.displayState ? "block" : "none");
		searchControllerSearch.style.display = (this.displayState ? "none" : "block");
		searchBar.style.display = (this.displayState ? "block" : "none");
		if(menuCont != undefined) {
			if(menuCont.displayState){
				menuCont.closeDisplay();
			}
			menu.style.display = (this.displayState && !_HD ? "none" : "block");
		}
	}

	this.submit = function(){
		if(this.inputId != undefined) {
			document.getElementById(this.inputId).value = document.getElementById("searchInput").value;
			document.getElementById(this.formId).submit();
		}
		this.toggleDisplay();
	}
}
