var img_cache = new Object();
var this_page = ""; //current menu item (mN)

function parse_images() {

	function on_mouseout() {
		this.src = this.rootsrc;
	}

	function return_false() {
		return false;
	}

	function on_mouseover() {
		this.src = this.hoversrc;
	}

	if (document.getElementById) {
		var ar = document.getElementsByTagName('img');
		for( var x = 0; ar[x]; x++ ) {
			var im = ar[x];
			if(im.getAttribute) im.hoversrc = im.getAttribute('hoversrc');
			if(im.hoversrc) {

				im.rootsrc = im.src;
				im.onmouseout = on_mouseout;

				if(!img_cache[im.hoversrc]) {
					img_cache[im.hoversrc] = new Image();
					img_cache[im.hoversrc].src = im.hoversrc;
				}

				im.onmouseover = on_mouseover;

			}
		}
	}
}



function show_menu(current) {

		if(document.getElementById) {

			var obj = current.parentNode.getElementsByTagName('ul')[0];

			if(obj.style.display == 'none') {
				obj.style.display = 'block';
				current.className = 'selected';
			}
			else if(obj.style.display == 'block') {
				obj.style.display = 'none';
				current.className = '';
			}

			return false;
		}
		else {
			return truel
		}

}

function colore_menu() {
	var myMenuList = document.getElementById('menu');
	var ar = myMenuList.getElementsByTagName('li');
	// alert("ar.length " + ar.length + " ar[" + (ar.length-1) + "]" + ar[(ar.length-1)].style.color);
	var item = ar[4];
	var ahref = item.getElementsByTagName('a');
	var loc = location.href;
	loc2 = loc.substring(0, 27);
	var loc3 = "http://www.fxteam.ru/fxpro/";
	var _m = '/'; // needle
	var _c = 0;
	for (var i=0;i<loc.length;i++) {		if (_m == loc.substr(i,_m.length))
		_c++;
	}
	// alert(_c);

	if ( (ahref != null) && ( (loc2 != loc3) || (_c !=5) ) ) {		ahref[0].style.color = 'red';
		// ahref[0].onmouseover = "javascript: this.style.backgroundColor='#C00000'; this.style.color='white'";
		// ahref[0].onmouseout = "javascript: this.style.backgroundColor='transparent'; this.style.color='red'";

		ahref[0].onmouseover = function() {			ahref[0].style.backgroundColor='#C00000';
			ahref[0].style.color='white';
		}
		ahref[0].onmouseout = function() {			ahref[0].style.backgroundColor='transparent';
			ahref[0].style.color='red';
		}
	}
}

function expand_current_menu() {
	var myActiveItem = document.getElementById('active_item');
	if (myActiveItem) {		var myActiveParent = myActiveItem.parentNode;
		if (myActiveParent) {			myActiveParent.style.display = 'block';
		}
	}

}

var tmout;
var timer_is_on=0;

function timedCount()
{
	var req = new JsHttpRequest();
	req.onreadystatechange = function() {
		if (req.readyState == 4) {
            document.getElementById('fxteam_quotes').innerHTML = req.responseJS.quotes;
        }
    }
    req.open(null, 'http://www.fxteam.ru/quotes.html', true);
    req.send();
	tmout=setTimeout("timedCount()", 30000);
}
