// JavaScript Document afs version 0.1
var t_opt = new Array();  //timer optmenu var
var t_blk; //timer blinker var
var t_scrl;


function blinker(t) {
	O = document.getElementById('opt_menu_btn').style;
if (t == '1') {
	t_blk = setInterval("blinker(0)",500);
	setTimeout('clearInterval(t_blk); O.backgroundPosition = "0px 0px";',5000);
}
else {
	if ( O.backgroundPosition.substr(1,1) > 0 ) { O.backgroundPosition = "0px 0px" }
	else { O.backgroundPosition = "23px 0px" }
	}
}

function do_pnl_scroll(d,x) {

if ( d == 'u' ) {

	scrl_div = document.getElementById('style_test');
	scrl_height = scrl_div.offsetHeight;
	scrl_div.style.height = (scrl_height - x) +'px';


	if ( scrl_height <= 7 ) { 
	
		//alert('?'); 
		clearInterval(t_scrl); 
		scrl_div.style.visibility = 'hidden'; 
		//scrl_div.parentNode.style.visibility = 'hidden';
		//scrl_div.parentNode.style.height = '0px';
		if (btns = document.getElementById('btn_table') ) { btns.style.visibility = 'visible'; }
	
		}

	}
	
if ( d == 'd' ) {

	scrl_div = document.getElementById('style_test');
	scrl_height = scrl_div.offsetHeight;
	scrl_div.style.height = (scrl_height + x) +'px';

	if ( scrl_height >= 31 ) { 
	
		//alert('?'); 
		clearInterval(t_scrl); 
		scrl_div.style.height = '31px';
		oe = document.getElementById('sphidersearch');
		oe.style.visibility = 'visible'
		oe.style.height = '16px';
		oe.focus();

		ob = document.getElementById('sphiderbtn');
		ob.style.visibility = 'visible';
		ob.style.height = '19px';
		
		document.getElementById('search_x').style.visibility = 'visible';
		
		
	
		}

	}	
	
	
	
	
	
}


function pnl_scroll(d) {

if ( d == 'u' ) {
	oe = document.getElementById('sphidersearch');
	oe.style.visibility = 'hidden'
	oe.style.height = '0px';

	ob = document.getElementById('sphiderbtn');
	ob.style.visibility = 'hidden';
	ob.style.height = '0px';
	document.getElementById('search_x').style.visibility = 'hidden';
	t_scrl = setInterval("do_pnl_scroll('u',2)",10);
	
}

if ( d == 'd' ) {

	t_scrl = setInterval("do_pnl_scroll('d',2)",10);

	scrl_div = document.getElementById('style_test');
	scrl_div.style.visibility = 'visible';
	//scrl_div.parentNode.style.visibility = 'visible';
	//scrl_div.parentNode.style.height = '31px';
	if (btns = document.getElementById('btn_table') ) { btns.style.visibility = 'hidden'; }

	
}

	
}

function extSidebar() {
e = document.getElementById('footer');
x = document.getElementById('sidebar1')
h = (e.offsetTop-x.offsetTop)+'px';
x.style.height = h;
x = document.getElementById('sidebar2');
x.style.height = h;
	
}

function LMI(O) {
	O.className = "LM_CntO";
	O.parentNode.children[0].className = "LM_SideO";
	O.parentNode.children[0].innerHTML = '>';
}

function LMO(O) {
	O.className = "LM_Cnt";
	O.parentNode.children[0].className = "LM_Side";
	O.parentNode.children[0].innerHTML = '&nbsp;';
}

function blinker(t) {
	O = document.getElementById('opt_menu_btn').style;
if (t == '1') {
	t_blk = setInterval("blinker(0)",500);
	setTimeout('clearInterval(t_blk); O.backgroundPosition = "0px 0px";',5000);
}
else {
	if ( O.backgroundPosition.substr(1,1) > 0 ) { O.backgroundPosition = "0px 0px" }
	else { O.backgroundPosition = "23px 0px" }
	}
}

function opt_hi(O) {
	O.className = "opt_menu_itemO"
	O.children[0].innerHTML = '>';
	O.style.background = '#666';
	O.children[0].className = "opt_menu_point";
}
 
function opt_ho(O) {
	O.className = "opt_menu_item"
	O.children[0].className = "opt_menu_pointD";
	O.children[0].innerHTML = '&nbsp;';
	O.style.background = '#969796'
}

function changeClass(O,c) {
	O.className = c;
}

function changeBgpos(O,x,y) {
	O.style.backgroundPosition = x +'px '+ y +'px' ;
}

function h_btn(x,h) {

if (!h) { 
	if (t_opt[x]) { clearTimeout(t_opt[x]);}
	opt_btn = document.getElementById('opt_menu_btn'+x);
	opt_btn.style.backgroundPosition = " 0px -265px";
	o = findPos(opt_btn);  //Get offsets
	
	//var d = document.getElementById('app_cnt_div'+x);
	//o_x = d.offsetLeft+d.offsetWidth;
	//o_y = d.offsetTop;
	//alert(o_x);
	
	opt = document.getElementById('opt_menu'+x);
	opt.style.left = (o[0] - opt.offsetWidth +23  )+'px';
	opt.style.top = (o[1] +25 )+'px';
	opt.style.visibility = 'visible';
}


if (h == 1) { 
	document.getElementById('opt_menu_btn'+x).style.backgroundPosition = " 0px -244px"; document.getElementById('opt_menu'+x).style.visibility = 'hidden'
}

if (h == 2) { 
	if (t_opt[x]) { clearTimeout(t_opt[x]);}
}


if (h == 0){ t_opt[x] = setTimeout('h_btn('+x+',1);',2000) }

}

function hm_btn(x,h) {

	if (!h) { 
		//	if (t_opt[x]) { clearTimeout(t_opt[x]);}
		document.getElementById('mag_btn'+x).style.backgroundPosition = " 0px -223px";
	}

	if (h == 1) { 
		document.getElementById('mag_btn'+x).style.backgroundPosition = " 0px -202px"; 
	}

	if (h == 2) { 
		//if (t_opt[x]) { clearTimeout(t_opt[x]);}
	}
//if (h == 0){ t_opt[x] = setTimeout('h_btn('+x+',1);',2000) }
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
	do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
	} while (obj = obj.offsetParent);
}
return [curleft,curtop];
}

