var MenuDisplay = SZN.ClassMaker.makeClass({
	NAME: "MenuDisplay",
	VERSION: "1.0",
	CLASS: "class"
});

MenuDisplay.prototype.$constructor = function( linkElmId, menuElmId, status ) {
	this.linkElm = SZN.gEl(linkElmId);
	this.menuElmId = SZN.gEl(menuElmId);
	this.status = status;
	
	SZN.Events.addListener( this.linkElm, 'click', this, 'switchStatus');
	
	if ( !this.status ) {
		this.menuElmId.className = 'noDisplay';
		SZN.Dom.removeClass(this.linkElm, 'active');
	}
}

MenuDisplay.prototype.switchStatus = function( e, elm ) {
	SZN.Events.cancelDef(e);
	
	if ( this.status ) {
		SZN.Dom.removeClass(this.linkElm, 'active');
		this.menuElmId.className = 'noDisplay';
		this.status = false;
	} else { 
		SZN.Dom.addClass(this.linkElm, 'active');
		this.menuElmId.className = '';
		this.status = true;	
	}
}

function hide( elm ) {
	SZN.gEl(elm).style.display = 'none';
}

/*- IE Hack - no active ActiveX Component*/
function activateActiveX () {
	if(document.attachEvent && !window.opera) {
		var object = document.getElementsByTagName('object');
		for (i=0;i<object.length;i++) {
			object[i].outerHTML = object[i].outerHTML;
		}
		var embed = document.getElementsByTagName('embed');
		for (i=0;i<embed.length;i++) {
			embed[i].outerHTML = embed[i].outerHTML;
		}
	}
}

var SelectDevices = SZN.ClassMaker.makeClass({
	NAME : 'SelectDevices',
	VERSION : '1.0',
	CLASS : 'class'
});
SelectDevices.prototype.$constructor = function(){
	this.ec = [];
	this.dom = {};
	this.dom.select = SZN.gEl('devicesSelect');
	this._getDevices();
	this._link();
}
SelectDevices.prototype._getDevices = function(){
	var root = SZN.gEl('divDevices');
	var containers = SZN.Dom.getElementsByClass('tblDevicesContainer', root, 'table');
	this.containers = containers;
	for(var i=0;i<this.containers.length;i++){
		var th = this.containers[i].getElementsByTagName('th')[0];
		var option = SZN.cEl('option');
		option.value = i;
		option.innerHTML = th.innerHTML;
		this.dom.select.appendChild(option);
	}
}
SelectDevices.prototype._selDevice = function(e, elm){
	var value = this.dom.select.value;
	for(var i=0;i<this.containers.length;i++){
		if(value > -1){
			if(this.containers[i] != this.containers[value]){
				this.containers[i].style.display = 'none';
			} else {
				this.containers[i].style.display = 'block';
			}
		} else {
			if(value == -1){
				this.containers[i].style.display = 'block';
			}
			if(value == -2){
				this.containers[i].style.display = 'none';
			}
		}
	}
}
SelectDevices.prototype._link = function(){
	this.ec.push( SZN.Events.addListener( this.dom.select, 'change', this, '_selDevice' ) );
}


