isMozilla = (document.all) ? 0 : 1;



var xmlHttp;

function getXMLHTTP() {
	var A = null;
	try {
		A = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e) {
		try {
			A = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc) {
			A = null;
		}
	}
	if (!A && typeof XMLHttpRequest != "undefined") {
		A = new XMLHttpRequest();
	}
  return A;
}


function doQuery(e, queryString, senddata, suppressloading) {
	if (xmlHttp && xmlHttp.readyState != 0) {
		xmlHttp.abort()
	}	  
	xmlHttp=getXMLHTTP();
	if (xmlHttp) {
		xmlHttp.open("POST", queryString, true);
		xmlHttp.onreadystatechange = function() {
			if (xmlHttp.readyState == 4 && xmlHttp.responseText) {
	      		try {
	      			eval(xmlHttp.responseText);
	      		}
	      		catch(e) {
					alert(xmlHttp.responseText);
					errorWindow = window.open("", "", "height=500, width=600,toolbar=no,scrollbars=yes,menubar=no,resizable=yes");
	      			errorWindow.document.write(xmlHttp.responseText);
	      		}
			}
		}
		if (senddata) {
			senddata = senddata.split(' ')
			stub = '';
			for (var i=0;i < senddata.length;i++) {
				var fld = senddata[i];
				stub += fld + '=' + encodeURIComponent(document.getElementById(fld).value) + '&';
			}
			xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
			xmlHttp.send(stub);
		}
		else xmlHttp.send(null);
	}
}


function hover(obj) {
	UL = obj.getElementsByTagName('ul');
	if (UL.length > 0) {
		stubMenu = UL[0].style;
		if (stubMenu.display == 'none' || stubMenu.display == '') stubMenu.display = 'block';
		else stubMenu.display = 'none';
	}
}

function setHover() {
	obj = document.getElementById('menu');
	if (!obj) return ;
	LI = document.getElementById('menu').getElementsByTagName('li');
	for(i=0; i < LI.length; i++) {
		LI[i].onmouseover = function() { hover(this) };
		LI[i].onmouseout = function() { hover(this); }
	}
}



function ScrollToElement(el) {
	if (!document.getElementById(el)) return ;
	if (document.all) y = document.getElementById(el).offsetParent.offsetTop;
	else y = document.getElementById(el).offsetTop;
	window.scrollTo(0, y);
}

var lastmenu = 0;
var activesub = 0;
var tm;

function ShowSubmenu(id) {
	if (lastmenu && (lastmenu!=id)) HideSubmenu(lastmenu);
	if (activesub && (activesub!=id)) HideSubmenu(activesub);
	window.clearTimeout(tm);
	lastmenu = id;
	document.getElementById('submenu'+id).style.display = 'block';
}

function HideSubmenu(id) {
	document.getElementById('submenu'+id).style.display = 'none';
	if (activesub && (activesub!=id)) document.getElementById('submenu'+activesub).style.display = 'block';
}

function HideCurSubmenu() {
	HideSubmenu(lastmenu)
}

function TimeHide() {
	tm = setTimeout("HideCurSubmenu()", 1200);
}



var nextanim = 1;
var opval = 100;
var animcanceled = 0;

function FadeOut() {
	opval -= 10;
	document.getElementById('promocontent').className = 'opacity'+opval;
	if (opval > 0) setTimeout("FadeOut()", 30);
	else doQuery(0, 'index.php?s=ajax&a=showtop&id='+nextanim, '');
}


function FadeIn() {
	opval += 10;
	document.getElementById('promocontent').className = 'opacity'+opval;
	if (opval < 100) setTimeout("FadeIn()", 30);
}


function ShowTop(tid, ac) {
	animcanceled = ac;
	nextanim = tid;
	setTimeout("FadeOut()", 10);
}


function AnimTop() {
	if (animcanceled) return;
	nextanim++;
	if (nextanim > 6) nextanim = 1;
	ShowTop(nextanim, 0);
	setTimeout('AnimTop()', 5000);
}

