window.onresize = windowBatch;
window.onload = function() {
	setTimeout(windowBatch,100);
}
function DropDown(thisId) {
	this.checkSubs = function() {
		var subs=document.getElementById('menu').getElementsByTagName('ul')[0].getElementsByTagName('ul');
		for (i=0;i<subs.length;i++) {
			var thisX=$('#'+subs[i].parentNode.id).offset().left;
			if (thisX==0) {
				thisX=subs[i].parentNode.style.marginLeft.replace("px","");
				if (thisX==0) {
					thisX=subs[i].parentNode.parentNode.getElementsByTagName('li')[0].style.marginLeft.replace("px","");
				}
			}
			subs[i].getElementsByTagName('li')[0].style.marginLeft=thisX+"px";
			subs[i].onmouseover = function() {
				this.parentNode.getElementsByTagName('a')[0].className+=' active';
			}
			subs[i].onmouseout = function() {
				if (this.parentNode.getElementsByTagName('a')[0].className=='active active') {
					this.parentNode.getElementsByTagName('a')[0].className='active';
				} else {
					this.parentNode.getElementsByTagName('a')[0].className='';
				}
			}
		}
	}
}
var myMenu=new DropDown('myMenu');
function windowBatch() {
	myMenu.checkSubs();
}