	var projectsOpened = 1;
	var useragent = navigator.userAgent.toLowerCase();
	var isIE = useragent.indexOf("msie")!=-1;

	function AddProjects(webroot) {
		var s = document.write("<div id='submenu'><table border='0' cellspacing='0' cellpadding='0' width='83'><tr><td height='8' id='td_up'></td></tr><tr><td width='83'><a href='" + webroot + "webprojects.html'><img src='" + webroot + "img/web_projects.gif' width='77' height='13' border='0' id='im_web' alt='Web projects'/></a></td></tr><tr><td height='8' id='td_middle'></td></tr><tr><td width='83'><a href='" + webroot + "printprojects.html'><img src='" + webroot + "img/print_projects.gif' width='78' height='13' border='0' id='im_print' alt='Print projects'/></a></td></tr></table></div>");
		CloseProjects();
		if (!isIE) {
			var i = findObj("faketd");
			i.style.height = "0";
			i.style.visibility = 'hidden';
		}
	}

	function ExpandProjects() {
		if (projectsOpened == 0) {
			var d = findObj('submenu');
			d.style.visibility = 'visible';
			d.style.height = "56";
			var i = findObj('im_web');
			i.style.height = "13";
			var i = findObj('im_print');
			i.style.height = "13";
			projectsOpened = 1;
			if (isIE) {
				var i = findObj('td_up');
				i.style.height = "8";
				var i = findObj('td_middle');
				i.style.height = "8";
			}
		}
	}
	
	function CloseProjects() {
		if (projectsOpened == 1) {
			var d = findObj('submenu');
			d.style.visibility = 'hidden';
			d.style.height = "0";
			var i = findObj('im_web');
			i.style.height = "0";
			var i = findObj('im_print');
			i.style.height = "0";
			projectsOpened = 0;
			if (isIE) {
				var i = findObj('td_up');
				i.style.height = "0";
				var i = findObj('td_middle');
				i.style.height = "0";
			}
		}
	}
	
	function ToggleProjects() {
		if (projectsOpened == 0) {
			ExpandProjects();
		} else {
			CloseProjects();
		}
	}
	
	function findObj(n, d) { 
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findDiv(n,d.layers[i].document);
    if(!x && document.getElementById) x=document.getElementById(n); return x;
	}

	var zoomWin = '';
	function Zoom(file, width, height) {
		width += 16;
		height += 20;
		zoomWin = window.open( file, "zoom",
		'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=' + width + ',height=' + height);
		zoomWin.focus();
	}

	function GetReferer() {
         	return document.referrer;
	}
	
	function TickCounter(alias) {
		referer = GetReferer();
		counter = '<iframe src="/counter.php?pa=' + alias + '&r=' + referer + '" width="1" height="1" frameborder="0" scrolling="no" />';
		document.write(counter);
	}

