// JavaScript Document
ie = false;
ns = false;
op = false;

if (window.navigator.userAgent.indexOf('Opera') != -1) {
	op = true;
}
else {
	if (window.navigator.appName.indexOf('Microsoft') != -1) {
		ie = true;
	}
}

if (window.navigator.appName.indexOf('Netscape') != -1) {
	ns = true;
}

sm_check_timeout = 50;
smIndex = new Array();

function sm_get_element(id) {
	if (ie) {
		return document.all[id];
	}
	else {
		return document.getElementById(id);
	}
}

function sm_calc_xpos(sm_pos) {
	if (ns) {
		win_w = window.innerWidth;
	}
	else {
		win_w = window.document.body.clientWidth;
	}
	return Math.round(win_w / 2) - 470 + sm_pos;
}

function sm_init() {
	setTimeout('sm_check()', sm_check_timeout);
}

function sm_check() {
	for (i = 0; i < smIndex.length; i++) {
		if (smIndex[i].state == false) {
			sm_get_element('sm_' + smIndex[i].id).style.visibility = 'hidden';
		}
	}
	setTimeout('sm_check()', sm_check_timeout);
}

function sm_switch(id, state) {
	for (i = 0; i < smIndex.length; i++) {
		if (state == true) {
			if (id == smIndex[i].id) {
				smIndex[i].state = true;
				sm_get_element('sm_' + smIndex[i].id).style.left = sm_calc_xpos(smIndex[i].x) + 5 + 'px';
				sm_get_element('sm_' + smIndex[i].id).style.visibility  = 'visible';
			}
			else {
				smIndex[i].state = false;
				sm_get_element('sm_' + smIndex[i].id).style.visibility  = 'hidden';
			}
		}
		else {
			smIndex[i].state = false;
		}
	}
}

function sm_item(id, x)
{
	this.id = id;
	this.x = x;
	this.state = false;
}
