
var SM_V = new Object();

SM_V.slideMenu_vel = 3;
SM_V.px_initA = 20;
SM_V.px_init = SM_V.px_initA;
SM_V.txt_class = null;
SM_V.frame_color = '#ffffff';
SM_V.frame = true;
SM_V.frame_color = '#ffffff';
SM_V.frameClass = '';
SM_V.width = 150;
SM_V.sep = true;
SM_V.bullets = false;

//----------SLIDE MENU PROPERTIES-------------------------------


slideMenu = new Object();

slideMenu.setSlideSpeed = function (s) {
	SM_V.slideMenu_vel = s;
}

slideMenu.setWidth = function (w){
	SM_V.width = w;
} 

slideMenu.setSep = function setSep (v) {
	
	SM_V.px_init = SM_V.px_initA;
	SM_V.sep = v;

	if (SM_V.sep){
		SM_V.px_init -= 1;
	} else {SM_V.px_init += 3;}
}

slideMenu.setTxtClass = function (c) {

	SM_V.txt_class = c;
}

slideMenu.setTitleClass = function (c) {
	SM_V.title_class = c;
}

slideMenu.setBullets = function (b) {
	SM_V.bullets = b;
}

slideMenu.intitHeight = function (i) {
SM_V.px_initA = i;
if (SM_V.sep) SM_V.px_init = SM_V.px_initA-1;
}


slideMenu.setFrameClass= function (i) {
SM_V.frameClass	= i;
}

slideMenu.getFrameClass= function () {
return SM_V.frameClass;
}


//----------------------------------------------------------------


function setHeight (o,h) {
	if (is.ie || is.ns6 )
	{
		getObject(o).style.height = h;
	}

	if (is.ns4)
	{
		getObject(o).resizeTo(getObject(o).document.width,h);
	}
}

function slide (o,max,ac) {	
	var toh = max;
	ac+=(toh - ac)/SM_V.slideMenu_vel;
	setHeight(o,ac);
	if (Math.round(toh-ac)!=0)setTimeout ('slide("'+o+'","'+max+'",'+ac+')',0);
}

function hide (o) {
if (is.ns6 || is.ie)
		{
		var oS = o + 'C';
		slide(o,parseInt(SM_V.px_init),parseInt(getObject(o).offsetHeight+3));
		getObject(o).open = false; 
		}
if (is.ns4)
	{
	  clear();
	}
}

function show (o) {

if (is.ns6 || is.ie)
	{
	var oS = o + 'C';
	slide(o,getObject(oS).offsetHeight+3,SM_V.px_init);
	getObject(o).open = true;
	}
if (is.ns4)
	{
	  clear();
	}

/*if (SM_V.active) hide(SM_V.active);
SM_V.active = o;
*/


}

function showHide (o) {

if (is.ns4) update(o);

var i = o + '_img';	
	if (getObject(o).open) { 
		
		hide (o); 
		if (SM_V.bullets) document.images[i].src = 'images/slideMenu_plus.gif'
		} else { show (o); 
				if (SM_V.bullets) document.images[i].src = 'images/slideMenu_minus.gif'
				}



}



	


//--------------------------------------------------------------



function update (o){
	getObject('layer').document.write('');
	getObject('layer').document.close();

	draw_ns4(o);
}


function Menu (n) {
	this.items = new Array();
	this.name = n;
	this.setTitle = setTitle;
	this.addItem = addItem;
	this.addBullet = addBullet;
	this.draw = createMenu;
	this.frame_color = SM_V.frame_color;
	this.frame = SM_V.frame;
	}

function addItem (n,l,t,subm) {
	//n name | l link | t target | subm
	if (t==null) t = '_self';
	this.items[this.items.length] = new Object();
	this.items[this.items.length-1].name = '';
	if (SM_V.bullets) this.items[this.items.length-1].name = addBullet();
	this.items[this.items.length-1].name += n;
	this.items[this.items.length - 1].url = l;
	this.items[this.items.length - 1].target = t;
}

function addBullet () {
	return '<img src="images/icon_bullet.gif" width="4" height="9" border=0 alt="">';
}

function drawHTML (h) {
	document.write(h);
	return h;
}

function getSub (o) {
var sS='';
sS+='<table width="160" margin cellpadding=0 cellspacing=0 border=0>';

	for (var c=0;c<o.items.length;c++) {
			if (SM_V.sep) createSep();
			sS+='<tr><td width=10>';
		if (o.items[c].url)	{
			sS+='&nbsp;</td><td ><a href="'+o.items[c].url+'" class="'+SM_V.txt_class +'" target="'+o.items[c].target+'">'+o.items[c].name + '</a></td></tr>';
			/*drawHTML('<tr><td><a href="'+o.items[c].url+'" target="'+o.items[c].target+'" class="'+SM_V.txt_class +'">');
			drawHTML ('+ ' + o.items[c].name + '</a></td></tr>');*/
		} else {
			sS+='&nbsp;</td><td class="'+SM_V.txt_class +'">'+o.items[c].name + '</td></tr>';
		}
	}
	
	sS+='</table>';
	sS+=createSp(5);

return sS;
}


m_array = new Array();
var m_html = '';

function createMenu () {

if (!is.ns4) {
	var frame_attributes =	'class="'+SM_V.frameClass+'" style="position:relative; overflow:hidden; width:'+SM_V.width+' ;height:'+SM_V.px_init+'; ';
	drawHTML('<div id="'+this.name+'" '+frame_attributes+'">');
	drawHTML('<div id="'+this.name+'C">');
	drawHTML(getTitle(this.name,this.title,this.title_class));
	drawHTML (getSub (this));
	//getObject(this.name).absHeight = this.absHeight;
	drawHTML('</div>');
	drawHTML('</div>');
	this.open = false;
	drawHTML(createSp(5));
}

if (is.ns4) {
						  
	m_array[m_array.length] = this;

}
}

var ns4h ='';

function draw_ns4 (o) {
if (is.ns4) {

for (var c=0;c<m_array.length;c++ )
{
	var m = m_array[c];
	ns4h += getTitle(m.name,m.title,m.title_class);
	if (m.name == o) ns4h += getSub(m);

}

document.layers['layer'].document.write (ns4h);
document.layers['layer'].document.close();
ns4h='';

}
}

function setTitle (title,st,frame) {
	this.title = title;
	this.title_class = (st) ? st:SM_V.title_class;
	this.title_frame = frame;
}

function getTitle (bn,txt,stc) {
	//class[style] c

	var s='';
	s+='<table height="'+SM_V.px_initA+'" width="'+SM_V.width+'" cellpadding=0 cellspacing=0 border=0><tr><td   >';
	s+='&nbsp;'; s+='<a onmouseover="javascript:showHide(\''+bn+'\')" href="#"  class="'+stc+'">';
	
	if (SM_V.bullets) s+='&nbsp;<img id="'+bn+'_img" src="images/slideMenu_plus.gif" border="0" width="11" height="9">';
	s+=txt;
	s+='</a></td></tr></table>';
		return s;
	
}


function createSp (s) {
	return '<IMG SRC="images/spacer.gif" WIDTH="10" HEIGHT="'+s+'" BORDER=0 ALT=""><br>';
}

function createSep () {

	return '<tr><td colspan=2 width="'+SM_V.width+'" bgcolor="white" style="font-size=1px"><IMG SRC="images/spacer.gif" WIDTH="'+SM_V.width+'" HEIGHT="1" BORDER=0 ALT="sdssd&nbsp;"></td></tr>';
}
//<IMG SRC="images/spacer.gif" WIDTH="'+SM_V.width+'" HEIGHT="1" BORDER=0 ALT="">
//-------------------------------------