/*@cc_on
@if ( @_jscript )
	function hasClass(c,e) {
		var rx = new RegExp("(^|\\s)" + c + "(\\s|$)");
		return ( e.className && rx.test(e.className) );
		return false;
	}

	function findElements(c,e) {
		var rv = [];
		var rx = new RegExp("(^|\\s)" + c + "(\\s|$)");
		var ln = e.childNodes.length;
		for( var i = 0; i < ln; i++ ) {
			var cn = e.childNodes[i];
			if( cn.nodeType == 1 ) {
				if( cn.className && rx.test(cn.className) )
					rv[rv.length] = e.childNodes[i];
				rv = rv.concat(findElements(c,cn));
			}
		}
		return rv;
	}

	function showhide(e,show) { 
		if( e ) e.style.display = show?'block':'none'; 
	}

	function init() {
		var S = findElements('submenu',document.body);
		for( var s in S ) {
			var es = S[s];
			if( es.id.indexOf('_') < 0 ) continue;
			var id = es.id.substr(es.id.indexOf('_')+1,es.id.length);
			var em = document.getElementById('mainmenu_'+id);
			var emp= em.parentNode;

			var classes = em.className.split(' ');
			var level = 0;
			for( var i = 0; i < classes.length; i++ ) if(classes[i].indexOf('level')==0)
				level = classes[i].substr(6,classes[i].length);
 
			if( level > 0 )
				es.style.top = em.offsetTop+emp.offsetTop-15;
			else
				es.style.top = parseInt(em.offsetTop?em.offsetTop:0)+25;
		}
		for( s in S ) S[s].style.display = 'none';

		document.getElementById('divMenu').style.top = 100;
		
		var M = findElements('mainmenu',document.body);
		for( var m in M ) {
			var em = M[m];
			if( em.id.indexOf('_') >= 0 ) {
				em.onmouseover = function() {
					// show Submenu
					var id = this.id.substr(this.id.indexOf('_')+1,this.id.length);
					this.dohide = true;
					this.isover = true;
		
					var e = document.getElementById('submenu_'+id);
					showhide(e,true);
			
					var p = this.parentNode
					var pid = p.id.substr(p.id.indexOf('_')+1,p.id.length);
					if(pid) {
						var pm = document.getElementById('mainmenu_'+pid);
						if( pm ) { pm.isover = true; }
					}
	
					// keep submenu
					var self = this; 
					e.onmouseover = function() {
						self.dohide = false;
					}
					e.onmouseout = function() {
						var me = this;
						setTimeout(function() {
							var isover = self.isover;
							for( var i = 0; i < me.childNodes.length; i++ ) {
								if( me.childNodes[i].nodeType == 1 && me.childNodes[i].isover )
									isover = true;
							}
							if( !isover ) {
								self.dohide = true;
								self.onmouseout();
							}
						},100);
					}
				}
				em.onmouseout = function() {
					// hide Sbmenu
					var id = this.id.substr(this.id.indexOf('_')+1,this.id.length);
					this.isover = false;
	
					var p = this.parentNode
					var pid = p.id.substr(p.id.indexOf('_')+1,p.id.length);
					if(pid) {
						var pm = document.getElementById('mainmenu_'+pid);
						if( pm ) { pm.isover = false; }
					}
	
					var self = this;
					var e = document.getElementById('submenu_'+id);
					var p = this.parentNode;
					setTimeout(function() { 
						if(self.dohide)
							showhide(e,false);
						if( hasClass('submenu',p) )
							p.onmouseout();
					}, 100);
				}
			}
		}
	}

	document.write('<script id="__ie_onload" defer src="javascript:void(0)"></script>');
	var script = document.getElementById('__ie_onload');
	script.onreadystatechange = function() {
	    if (this.readyState == 'complete') {
	        init();
	    }
	};

@else */

	var mttg_adaptor = function() {
                this.height = 0;
                this.width = 0;

		this.adapt   = function (h,w) {
			divAll = document.getElementById('divAll');
			divScroll = document.getElementById('divScroll');
			divMenuTop = document.getElementById('divMenuTop');
			
			if( divAll && divScroll && divMenuTop && this.width != w ) {
				divAll.style.left = divScroll.style.left = Math.max((w-750)/2,0);
				divMenuTop.style.width = Math.min(w,750);
				this.width = w;
				}
			}
        	}

	mttg_adaptPositions = new mttg_adaptor()

        window.onresize = function() { mttg_adaptPositions.adapt(window.innerHeight,window.innerWidth); }

        tmp = function() {
                divAll = document.getElementById('divAll');
		divScroll = document.getElementById('divScroll');
		divMenuTop = document.getElementById('divMenuTop');

                mttg_adaptPositions.adapt(window.innerHeight,window.innerWidth);

                if( !(divAll && divScroll && divMenuTop) )
                        setTimeout(tmp,10);
        	}

        tmp();



	function setChildColor(c) {
		for( var i = 0; i < this.childNodes.length; i++ )
			if( this.childNodes[i].nodeType == 1 ) this.childNodes[i].style.backgroundColor = c;
	}
	function setParentTextColor(c) {
		var p = this.parentNode.parentNode;
		for( var i = 0; i < p.childNodes.length; i++ ) if( p.childNodes[i].nodeType == 1) {
			if( p.id.indexOf('Active') >= 0 ) p.childNodes[i].style.color = c;
			break;
		}
	}
/* @end
@*/

