/**
 *	History:	1.1.0	Tom Polchowski	July 14, 2003
 * 			1.2.0	Tom Polchowski	November 2, 2007
 * 			1.3.0	Tom Polchowski	December 30, 2008
*/

function ObjectHandler(objectId, clientInformation, defaultDisplay){
	var clientInformation = clientInformation;
	var objectId = objectId;
	var defaultDisplay = defaultDisplay;

	this.getReference = function (){
		if(clientInformation.isInternetExplorer()){
			return document.all[objectId];
		}
		else if(clientInformation.isNetscape(5)){
			return document.getElementById(objectId);
		}
		else if(clientInformation.isNetscape()){
			return document.layers[objectId];
		}
		else{
			return null;
		}
	};

	this.show = function (){
		var reference = this.getReference();

		/*	With no reference, return. */
		if(reference == null) return;

		/*	First set the displayable attribute. */
		this.display();

		if(clientInformation.isInternetExplorer()){
			reference.style.visibility = "visible";
		}
		else if(clientInformation.isNetscape(5)){
			reference.style.visibility = "visible";
		}
		else if(clientInformation.isNetscape(4)){
			reference.visibility = "visible";
		}
	};

	this.hide = function (){
		var reference = this.getReference();
	
		/*	With no reference, return. */
		if(reference == null) return;
	
		if(clientInformation.isInternetExplorer()){
			reference.style.visibility = "hidden";
		}
		else if(clientInformation.isNetscape(5)){
			reference.style.visibility = "hidden";
		}
		else if(clientInformation.isNetscape(4)){
			reference.visibility = "hidden";
		}
	};

	this.display = function (){
		var reference = this.getReference();

		/*	With no reference, return. */
		if(reference == null) return;


		if(clientInformation.isInternetExplorer() || clientInformation.isFirefox()){
			reference.style.display = this.getDefaultDisplay();
		}
		else if(clientInformation.isNetscape(5)){
			reference.style.display = this.getDefaultDisplay();
		}
		else if(clientInformation.isNetscape(4)){
			reference.display = this.getDefaultDisplay();
		}
	};

	this.noDisplay = function (){
		var reference = this.getReference();
	
		/*	With no reference, return. */
		if(reference == null) return;
	
		if(clientInformation.isInternetExplorer() || clientInformation.isFirefox()){
			reference.style.display = "none";
		}
		else if(clientInformation.isNetscape(5)){
			reference.style.display = "none";
		}
		else if(clientInformation.isNetscape(4)){
			reference.display = "none";
		}
	};

	this.moveTo = function (x, y){
		var reference = this.getReference();

		/*	With no reference, return. */
		if(reference == null) return;

		if(clientInformation.isInternetExplorer()){
			reference.style.left = x;
			reference.style.top = y;
		}
		else if(clientInformation.isNetscape(5)){
			reference.style.left = x;
			reference.style.top = y;
		}
		else if(clientInformation.isNetscape(4)){
			reference.left = x;
			reference.top = y;
		}
	};

	this.setPositionAbsolute = function (){
		var reference = this.getReference();

		/*	With no reference, return. */
		if(reference == null) return;

		if(clientInformation.isInternetExplorer()){
			reference.style.position = 'absolute';
		}
		else if(clientInformation.isNetscape(5)){
			reference.style.position = 'absolute';
		}
		else if(clientInformation.isNetscape(4)){
			return;
		}
	};

	this.setPositionRelative = function (){
		var reference = this.getReference();
	
		/*	With no reference, return. */
		if(reference == null) return;
	
		if(clientInformation.isInternetExplorer()){
			reference.style.position = 'relative';
		}
		else if(clientInformation.isNetscape(5)){
			reference.style.position = 'relative';
		}
		else if(clientInformation.isNetscape(4)){
			return;
		}
	};

	this.setPositionStatic = function (){
		var reference = this.getReference();
	
		/*	With no reference, return. */
		if(reference == null) return;
	
		if(clientInformation.isInternetExplorer()){
			reference.style.position = 'static';
		}
		else if(clientInformation.isNetscape(5)){
			reference.style.position = 'static';
		}
		else if(clientInformation.isNetscape(4)){
			return;
		}
	};
	
	this.valid = function (){
		var reference = this.getReference();
		
		if(reference == null) return false;
		
		return true;
	};

	this.getDefaultDisplay = function (){
		if(defaultDisplay == null) return 'inline';
		else return defaultDisplay;
	};

	this.getId = function (){
		return objectId;
	};
	
	this.isDisplayed = function (){
		var reference = this.getReference();
		
		if(reference == null) return false;
		
		if(clientInformation.isInternetExplorer){
			if(reference.style.display == "none") return false;
			return true;
		}
		else if(clientInformation.isNetscape(5)){
			if(reference.style.display == "none") return false;
			return true;
		}
		else if(clientInformation.isNetscape(4)){
			if(reference.display == "none") return false;
			return true;
		}
	
		return false;
	};
	
	this.isVisible = function (){
		var reference = this.getReference();
		
		if(reference == null) return false;
	
		if(clientInformation.isInternetExplorer){
			if(reference.style.visibility == "hidden") return false;
			return true;
		}
		else if(clientInformation.isNetscape(5)){
			if(reference.style.visibility == "hidden") return false;
			return true;
		}
		else if(clientInformation.isNetscape(4)){
			if(reference.visibility == "hidden") return false;
			return true;
		}
	
		return false;
	};

	this.getStyle = function (){
		var reference = this.getReference();

		/*	With no reference, return. */
		if(reference == null) return;

		if(clientInformation.isInternetExplorer()){
			return reference.style;
		}
		else if(clientInformation.isNetscape(5)){
			return reference.style;
		}
		else if(clientInformation.isNetscape(4)){
			return reference.style;
		}
	};
};

function dispnone(a){
	var element = document.getElementById(a);
	if(element != null) element.style.display = 'none';
}

function dispblock(a){
	var element = document.getElementById(a);
	if(element != null) element.style.display = 'block';
}

function dispinline(a){
	var element = document.getElementById(a);
	if(element != null) element.style.display = 'inline';
}


